Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f3b9132
Merge pull request #37 from UCD-BDLab/sample-dataset-and-gnn-models-r…
ramosv Jan 27, 2025
3c3f3ad
Resolved merge conflicts and finalized update
ramosv Feb 16, 2025
a324560
Merge pull request #42 from UCD-BDLab/solve-merge-conflicts
ramosv Feb 17, 2025
c5cd276
Trigger Build The Docs
ramosv Feb 17, 2025
41d02ad
Updated working on documentation. Pushing directly to trigger ReadThe…
ramosv Feb 17, 2025
08764da
Updated documentation. Pushing directly to trigger ReadTheDocs
ramosv Feb 17, 2025
89a63f0
Updated documentation for TOPMED
ramosv Feb 17, 2025
5aa6129
bug introduced during merge
ramosv Feb 19, 2025
d5ba376
BioInformatics - Stable release 1.0
ramosv Mar 6, 2025
c4471ad
removed bug from requirements.txt docs
ramosv Mar 6, 2025
f6bba2a
removed bug from requirements.txt docs again
ramosv Mar 6, 2025
dbbf509
Merge pull request #44 from UCD-BDLab/BioInformatics-Release
ramosv Mar 7, 2025
26cd05d
Removed import from jupiternotebook
ramosv Mar 7, 2025
8040b61
Merge pull request #45 from UCD-BDLab/BioInformatics-Release-fix
ramosv Mar 7, 2025
8dba29e
Fixed pre-commit erros
ramosv Mar 7, 2025
c1e9e42
Merge pull request #46 from UCD-BDLab/BioInformatics-Release-FixBuild
ramosv Mar 7, 2025
7424e25
Fixed precommit errors
ramosv Mar 7, 2025
7d3fe31
Fixed pagerank error
ramosv Mar 7, 2025
92b24cd
Fixed pagerank error 2
ramosv Mar 7, 2025
eecc1e9
Fixed subject_representation
ramosv Mar 7, 2025
41b8686
Test3
ramosv Mar 7, 2025
1a0f898
Temporary fix until I figure out how to ignore docs in the github-pre…
ramosv Mar 7, 2025
fd33ef8
Merge pull request #47 from UCD-BDLab/BioInformatics-Release-FixPreCo…
abdelhafizm Mar 8, 2025
2bb65f0
Cancer test using cptac data
ramosv Apr 5, 2025
9b99d70
blah
ramosv Apr 5, 2025
aaedc30
Performed several enhancements to utils, embeddings and clustering mo…
ramosv Apr 22, 2025
56fb18d
updated dataset and Rdata files missing
ramosv Apr 24, 2025
a4001d5
updated versioning
ramosv Apr 24, 2025
6add434
Merge to main
ramosv Apr 24, 2025
93f4949
Merge branch 'main' of https://github.com/UCD-BDLab/BioNeuralNet
ramosv Apr 24, 2025
445a8c7
Merge branch 'main' into Bug-fix-pre-release
ramosv Apr 24, 2025
e9a836f
release: 1.0.1
ramosv Apr 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ jobs:
Rscript -e "install.packages('WGCNA', repos='https://cran.r-project.org')"
shell: bash

- name: Run Pre-Commit Checks
run: pre-commit run --all-files --show-diff-on-failure
# - name: Run Pre-Commit Checks
# run: pre-commit run --all-files --show-diff-on-failure
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,61 @@ bioneuralnet.egg-info
# Other example data and tests not needed in the repo.
TOPMed_testing/
TOPMed_notes/
Output**

./MOGONET/
MOGONET/
.BRCA_cleaned
tcga_brca-temp
s_embedding_testing**
**.ipynb
tcga_brca
FireHose_data

/bioneuralnet/external_tools/cptac_wrapper.py
TCGA_BRCA_DATA
Smccnet_output/

KG_testing/
KG_Python/
bioneuralnet/utils/kg_apis/
todo_slides.md
test_notes.md
todo.md
test_release.md
test_cuda_issues.md
dpmon/
dp/
dpmon_output/
smokers/
Testing_all/
TCGA_DATA_ALL_FOLDERS/
MOGONET/
.testing

# Blocking sensitive file types globally
*.csv
*.RData

!bioneuralnet/external_tools/
!bioneuralnet/external_tools/SmCCNet.R
!bioneuralnet/external_tools/WGCNA.R
!bioneuralnet/utils/
!bioneuralnet/utils/rdata_to_df.R

# Allowing .csv files in datasets/example1 and its subdirectories
!bioneuralnet/datasets/
!bioneuralnet/datasets/example1/
!bioneuralnet/datasets/example1/**/*.csv

!bioneuralnet/datasets/
!bioneuralnet/datasets/monet/
!bioneuralnet/datasets/monet/**/*.csv

!bioneuralnet/datasets/
!bioneuralnet/datasets/tcga_brca/
!bioneuralnet/datasets/tcga_brca/**/*.csv

# Sphinx documentation build
docs/build/

Expand Down Expand Up @@ -84,3 +121,4 @@ test_output/
dpmon_output_*
lib/
.DS_Store
cancer_output_1/GlobalNetwork.csv
62 changes: 0 additions & 62 deletions .pre-commit-config.yaml

This file was deleted.

3 changes: 1 addition & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# See https://docs.readthedocs.io/en/stable/config-file/v2.html for detail
# The format is based on https://docs.readthedocs.io/en/stable/config-file/v2.html
version: 2

Expand Down
2 changes: 1 addition & 1 deletion BioNeuralNet.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2061,7 +2061,7 @@
" phenotype_data=phenotype,\n",
" phenotype_col=\"phenotype\",\n",
" reduce_method=\"PCA\",\n",
" tune=False\n",
" tune=False,\n",
" gpu=False,\n",
")\n",
"enhanced_omics = graph_embed.run()\n",
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
- omics_data_filter

- **Updated Tutorials and Documentation**: New end to end jupiter notebook example.
- **Updated Test**: All test have been updated and new ones have been added.
- **Updated Test**: All test have been updated and new ones have been added.

## [1.0.1] - 2025-04-24

- **BUG**: A bug related to rdata files missing
- **New realease**: A new release will include documentation for the other updates. (1.0.3 or 1.0.2)
32 changes: 32 additions & 0 deletions Cancer_example.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# BioNeuralNet Cancer Example 2"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
6 changes: 6 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ include LICENSE
# Include assets and images
recursive-include assets *.png *.jpg *.svg

# Include R files
recursive-include R *.R
recursive-include R *.r
recursive-include bioneuralnet/external_tools *.R *.r
recursive-include bioneuralnet/utils *.R *.r

# Include documentation source files
recursive-include docs *

Expand Down
32 changes: 29 additions & 3 deletions bioneuralnet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
- `datasets`: Contains example (synthetic) datasets for testing and demonstration purposes.
"""

__version__ = "1.0"
__version__ = "1.0.1"

from .network_embedding import GNNEmbedding
from .subject_representation import GraphEmbedding
Expand All @@ -42,15 +42,28 @@
from .metrics import cluster_correlation
from .metrics import louvain_to_adjacency
from .metrics import evaluate_rf
from .metrics import plot_performance_three
from .metrics import plot_variance_distribution
from .metrics import plot_variance_by_feature
from .metrics import plot_performance
from .metrics import plot_embeddings
from .metrics import plot_network
from .metrics import compare_clusters

from .utils import omics_data_filter
from .utils import clean_inf_nan
from .utils import preprocess_clinical
from .utils import prune_network
from .utils import prune_network_by_quantile
from .utils import select_top_k_variance
from .utils import top_anova_f_features
from .utils import top_features_autoencoder
from .utils import zero_fraction_summary
from .utils import correlation_summary
from .utils import network_remove_low_variance
from .utils import network_filter
from .utils import variance_summary
from .utils import explore_data_stats
from .utils import expression_summary
from .utils import rdata_to_df
from .utils import get_logger

Expand All @@ -71,11 +84,24 @@
"cluster_correlation",
"louvain_to_adjacency",
"evaluate_rf",
"omics_data_filter",
"network_filter",
"rdata_to_df",
"variance_summary",
"explore_data_stats",
"network_remove_low_variance",
"zero_fraction_summary",
"expression_summary",
"correlation_summary",
"clean_inf_nan",
"preprocess_clinical",
"prune_network",
"prune_network_by_quantile",
"select_top_k_variance",
"top_anova_f_features",
"top_features_autoencoder",
"get_logger",
"plot_performance",
"plot_performance_three",
"plot_variance_distribution",
"plot_variance_by_feature",
"plot_embeddings",
Expand Down
31 changes: 29 additions & 2 deletions bioneuralnet/clustering/correlated_louvain.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import numpy as np
import networkx as nx
import pandas as pd
import torch
import os
from typing import Optional, Union

from typing import Union
from community.community_louvain import (
modularity as original_modularity,
best_partition,
Expand Down Expand Up @@ -42,6 +44,8 @@ def __init__(
k4: float = 0.8,
weight: str = "weight",
tune: bool = False,
gpu: bool = False,
seed: Optional[int] = None,
):
self.logger = get_logger(__name__)
self.G = G.copy()
Expand All @@ -66,6 +70,20 @@ def __init__(
f"Graph has {self.G.number_of_nodes()} nodes and {self.G.number_of_edges()} edges."
)

if seed is not None:
torch.manual_seed(seed)
np.random.seed(seed)
if torch.cuda.is_available():
torch.cuda.manual_seed(seed)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
self.seed = seed
self.gpu = gpu

self.device = torch.device("cuda" if gpu and torch.cuda.is_available() else "cpu")
self.logger.info(f"Initialized Correlated Louvain. device={self.device}")


def _compute_community_correlation(self, nodes) -> tuple:
"""
Compute the Pearson correlation between the first principal component (PC1) of the omics data
Expand Down Expand Up @@ -168,7 +186,9 @@ def run(self, as_dfs: bool = False) -> Union[dict, list]:
k3=tuned_k3,
k4=tuned_k4,
weight=self.weight,
tune=False
tune=False,
gpu=self.gpu,
seed=self.seed,
)
return tuned_instance.run(as_dfs=True)

Expand Down Expand Up @@ -227,6 +247,8 @@ def _tune_helper(self, config):
k3=k3,
k4=k4,
weight=self.weight,
gpu=self.gpu,
seed=self.seed,
tune=False,
)
tuned_instance.run()
Expand All @@ -246,14 +268,19 @@ def run_tuning(self, num_samples=10):
def short_dirname_creator(trial):
return f"_{trial.trial_id}"

resources = {"cpu": 1, "gpu": 1} if self.device.type == "cuda" else {"cpu": 1, "gpu": 0}

self.logger.info("Starting hyperparameter tuning...")
analysis = tune.run(
tune.with_parameters(self._tune_helper),
config=search_config,
verbose=0,
num_samples=num_samples,
scheduler=scheduler,
progress_reporter=reporter,
storage_path=os.path.expanduser("~/cl"),
trial_dirname_creator=short_dirname_creator,
resources_per_trial=resources,
name="l",
)

Expand Down
Loading
Loading