Skip to content

Commit 1cb9bdd

Browse files
committed
updates to the package synced with notebooks
1 parent 7b4bf3e commit 1cb9bdd

12 files changed

Lines changed: 2742 additions & 3222 deletions

File tree

bioneuralnet/datasets/kipan/clinical.csv

Lines changed: 634 additions & 634 deletions
Large diffs are not rendered by default.

bioneuralnet/datasets/lgg/clinical.csv

Lines changed: 512 additions & 512 deletions
Large diffs are not rendered by default.

bioneuralnet/datasets/lgg/meth.csv

Lines changed: 0 additions & 512 deletions
This file was deleted.

bioneuralnet/datasets/lgg/methylation.csv

Lines changed: 512 additions & 512 deletions
Large diffs are not rendered by default.

bioneuralnet/datasets/lgg/mirna.csv

Lines changed: 512 additions & 512 deletions
Large diffs are not rendered by default.

bioneuralnet/datasets/lgg/rna.csv

Lines changed: 512 additions & 512 deletions
Large diffs are not rendered by default.

bioneuralnet/datasets/lgg/target.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Patient_ID,vital_status
1+
Patient_ID,target
22
TCGA-CS-4938,0
33
TCGA-CS-4941,1
44
TCGA-CS-4942,1

bioneuralnet/metrics/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from .correlation import (
77
omics_correlation,
88
cluster_correlation,
9-
louvain_to_adjacency,
9+
cluster_pca_correlation,
1010
)
1111

1212
from .plot import (
@@ -23,7 +23,7 @@
2323
__all__ = [
2424
"omics_correlation",
2525
"cluster_correlation",
26-
"louvain_to_adjacency",
26+
"cluster_pca_correlation",
2727
"plot_variance_distribution",
2828
"plot_variance_by_feature",
2929
"plot_performance_three",

bioneuralnet/metrics/correlation.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def omics_correlation(omics: pd.DataFrame, pheno: pd.DataFrame) -> Tuple[float,
4444
return corr, pvalue
4545

4646

47-
def cluster_correlation(cluster_df: pd.DataFrame, pheno: pd.DataFrame) -> tuple:
47+
def cluster_pca_correlation(cluster_df: pd.DataFrame, pheno: pd.DataFrame) -> tuple:
4848
"""Computes the Pearson correlation coefficient between PC1 of a cluster and phenotype.
4949
5050
Args:
@@ -88,12 +88,15 @@ def cluster_correlation(cluster_df: pd.DataFrame, pheno: pd.DataFrame) -> tuple:
8888

8989
return (cluster_size, corr)
9090

91-
def louvain_to_adjacency(louvain_cluster: pd.DataFrame) -> pd.DataFrame:
92-
"""Converts a Louvain cluster to an adjacency matrix.
91+
def cluster_correlation(louvain_cluster: pd.DataFrame) -> pd.DataFrame:
92+
"""Builds a new correlation network from an extracted cluster/subnetwork.
93+
94+
This function is often used as an intermediate step between HybridLouvain and plotting.
95+
It allows the subnetwork to reveal its internal topological structure by computing the Pearson correlation of node connectivity profiles.
9396
9497
Args:
9598
96-
louvain_cluster (pd.DataFrame): Represents an induced subnetwork (from Louvain).
99+
louvain_cluster (pd.DataFrame): Represents an induced subnetwork.
97100
98101
Returns:
99102
@@ -103,4 +106,4 @@ def louvain_to_adjacency(louvain_cluster: pd.DataFrame) -> pd.DataFrame:
103106
np.fill_diagonal(adjacency_matrix.values, 0)
104107
adjacency_matrix = adjacency_matrix.fillna(0)
105108

106-
return adjacency_matrix
109+
return adjacency_matrix

bioneuralnet/metrics/plot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import matplotlib.cm as cm
88
from sklearn.manifold import TSNE
99

10-
from .correlation import cluster_correlation
10+
from .correlation import cluster_pca_correlation
1111
from ..utils import get_logger
1212

1313
logger = get_logger(__name__)
@@ -458,8 +458,8 @@ def get_size(pair):
458458
results = []
459459

460460
for i, (df1, df2) in enumerate(zip(clusters1, clusters2), start=1):
461-
size1, corr1 = cluster_correlation(df1, pheno)
462-
size2, corr2 = cluster_correlation(df2, pheno)
461+
size1, corr1 = cluster_pca_correlation(df1, pheno)
462+
size2, corr2 = cluster_pca_correlation(df2, pheno)
463463

464464
if corr1 is not None and corr2 is not None:
465465
results.append((f"Cluster_{i}", size1, corr1, size2, corr2))

0 commit comments

Comments
 (0)