bioneuralnet.metrics.correlation

Functions

cluster_correlation(cluster_df, pheno)

Compute the Pearson correlation coefficient between PC1 of a cluster and phenotype.

get_logger(name)

Retrieves a global logger configured to write to 'bioneuralnet.log' at the project root.

louvain_to_adjacency(louvain_cluster)

Convert a Louvain cluster to an adjacency matrix.

omics_correlation(omics, pheno)

Compute the Pearson correlation between a group of omics data (reduced to one principal component) and a phenotype.

pearsonr(x, y, *[, alternative, method])

Pearson correlation coefficient and p-value for testing non-correlation.

bioneuralnet.metrics.correlation.cluster_correlation(cluster_df: DataFrame, pheno: DataFrame) tuple[source]

Compute the Pearson correlation coefficient between PC1 of a cluster and phenotype.

Parameters:
  • cluster_df – DataFrame representing a cluster of samples.

  • pheno – DataFrame representing the phenotype.

Returns:

(cluster_size, correlation) or (size, None) if correlation fails.

bioneuralnet.metrics.correlation.louvain_to_adjacency(louvain_cluster: DataFrame) DataFrame[source]

Convert a Louvain cluster to an adjacency matrix.

Parameters:

louvain_cluster – represents an induced subnetwork (from Louvain).

Returns:

Adjacency matrix

Return type:

pd.DataFrame

bioneuralnet.metrics.correlation.omics_correlation(omics: DataFrame, pheno: DataFrame) Tuple[float, float][source]

Compute the Pearson correlation between a group of omics data (reduced to one principal component) and a phenotype.

Parameters:
  • omics (pd.DataFrame) – Omics data with rows as samples and columns as features.

  • pheno (pd.DataFrame) – Phenotype data. Expected to have a single column.

Returns:

Pearson correlation coefficient and p-value.

Return type:

Tuple[float, float]