Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/updt_markdowns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Install docs dependencies
run: |
python -m pip install --upgrade pip
pip install ".[docs]" sphinx-markdown-builder==0.6.9
pip install ".[docs,all]" sphinx-markdown-builder==0.6.9

- name: Build markdown docs
working-directory: docs
Expand Down
1 change: 1 addition & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ python:
path: .
extra_requirements:
- docs
- all
2 changes: 1 addition & 1 deletion docs/api_examples/batch_correction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"outputs": [],
"source": [
"%pip install acore"
"%pip install acore vuecore"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions docs/api_examples/batch_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.19.1
# jupytext_version: 1.19.3
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
Expand All @@ -24,7 +24,7 @@


# %% tags=["hide-output"]
# %pip install acore
# %pip install acore vuecore

# %% tags=["hide-input"]
from typing import Optional
Expand Down
2 changes: 1 addition & 1 deletion docs/api_examples/diff_regulation_ancova.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"outputs": [],
"source": [
"%pip install acore"
"%pip install acore vuecore"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions docs/api_examples/diff_regulation_ancova.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.19.1
# jupytext_version: 1.19.3
# ---

# %% [markdown]
Expand All @@ -27,7 +27,7 @@
#

# %% tags=["hide-output"]
# %pip install acore
# %pip install acore vuecore

# %% tags=["hide-input"]
import dsp_pandas
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"outputs": [],
"source": [
"%pip install acore"
"%pip install acore vuecore"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions docs/api_examples/diff_regulation_anova_ttest_two_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.19.1
# jupytext_version: 1.19.3
# kernelspec:
# display_name: .venv
# language: python
Expand All @@ -29,7 +29,7 @@
#

# %% tags=["hide-output"]
# %pip install acore
# %pip install acore vuecore

# %% tags=["hide-input"]
import dsp_pandas
Expand Down
3 changes: 2 additions & 1 deletion docs/api_examples/enrichment_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
},
"outputs": [],
"source": [
"%pip install acore vuecore"
"# ToDo: Improve VueCore dependencies\n",
"%pip install acore vuecore python-louvain snfpy"
]
},
{
Expand Down
3 changes: 2 additions & 1 deletion docs/api_examples/enrichment_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@


# %% tags=["hide-output"]
# %pip install acore vuecore
# ToDo: Improve VueCore dependencies
# %pip install acore vuecore python-louvain snfpy

# %%
from pathlib import Path
Expand Down
2 changes: 1 addition & 1 deletion docs/api_examples/imputation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"outputs": [],
"source": [
"%pip install acore"
"%pip install acore vuecore"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/api_examples/imputation.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@


# %% tags=["hide-output"]
# %pip install acore
# %pip install acore vuecore

# %% tags=["hide-input"]
from typing import Optional
Expand Down
2 changes: 1 addition & 1 deletion docs/api_examples/normalization_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"outputs": [],
"source": [
"%pip install acore"
"%pip install acore vuecore"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions docs/api_examples/normalization_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.18.1
# jupytext_version: 1.19.3
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
Expand All @@ -23,7 +23,7 @@
# Refers to the [`acore.normalization`](acore.normalization) module.

# %% tags=["hide-output"]
# %pip install acore
# %pip install acore vuecore

# %% tags=["hide-input"]
from typing import Optional
Expand Down
39 changes: 27 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,24 @@ classifiers = [

dependencies = [
"numpy",
# pandas stuff
"pandas",
"dsp-pandas", # has only pandas related dependencies
"vuecore",
"dsp-pandas", # https://github.com/biosustain/dsp_pandas (import dsp_pandas)
# scientific computing
"scipy",
"scikit-learn>=1.5",
"networkx",
"biopython",
"combat",
# enrichment analysis dependencies
"gseapy!=1.1.5",
"kmapper",
"lifelines",
"pingouin<0.6.0", # ToDo: update column name changes, https://pingouin-stats.org/changelog.html#v0-6-0-february-2026
"python-louvain",
"PyWGCNA!=2.2.0", # to fix.
"snfpy",
"pingouin<0.6.0", # ToDo: update column name changes, https://pingouin-stats.org/changelog.html#v0-6-0-february-2026
"umap-learn",
"statsmodels",
"inmoose", # combat batch correction
# batch correction dependencies
"combat",
"inmoose", # combat batch correction
# io dependencies
"requests",
"rarfile",
# types
"pandera",
]

Expand All @@ -56,6 +54,8 @@ docs = [
"jupytext",
"sphinx-copybutton",
"sphinx-llms-txt",
# Multi-Omics-Analysis group package for visualisation of results in the documentation
"vuecore",
]
dev = [
"black[jupyter]",
Expand All @@ -70,6 +70,21 @@ dev = [
"ipykernel",
]

all = [ # Optional dependencies for all non-core analysis modules
# Publication analysis dependencies
"biopython",
# Topological Data Analysis
# network analysis dependencies
"python-louvain", # community detection for network analysis (import community)
"networkx",
# "PyWGCNA!=2.2.0", # not used?
# Kaplan-Meier-analysis dependencies
"lifelines",
"kmapper",
# network_analysis dependencies
"snfpy",
]

[project.urls]
Homepage = "https://github.com/Multiomics-Analytics-Group/acore"
Issues = "https://github.com/Multiomics-Analytics-Group/acore/issues"
Expand Down
29 changes: 28 additions & 1 deletion src/acore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,32 @@

import dsp_pandas # sets up pandas formatting options

__all__ = ["dsp_pandas"]
from . import (
batch_correction,
decomposition,
enrichment_analysis,
exploratory_analysis,
filter_metabolomics,
imputation_analysis,
io,
multiple_testing,
normalization,
types,
utils,
)

__all__ = [
"dsp_pandas",
"decomposition",
"imputation_analysis",
"io",
"enrichment_analysis",
"filter_metabolomics",
"batch_correction",
"exploratory_analysis",
"multiple_testing",
"normalization",
"types",
"utils",
]
__version__ = version("acore")
12 changes: 10 additions & 2 deletions src/acore/kaplan_meier_analysis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import pandas as pd
from lifelines import KaplanMeierFitter, NelsonAalenFitter
from lifelines.statistics import multivariate_logrank_test

try:
from lifelines import KaplanMeierFitter, NelsonAalenFitter
from lifelines.statistics import multivariate_logrank_test
except ImportError as e:
raise ImportError(
"Error importing lifelines module. Make sure lifelines is installed. "
"Install it with: pip install 'acore[all]'"
f"\n\nError: {e}"
) from e


def get_data_ready_for_km(dfs_dict, args):
Expand Down
14 changes: 11 additions & 3 deletions src/acore/network_analysis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import community
import networkx as nx
try:
import community
import networkx as nx
import snf
except ImportError as e:
raise ImportError(
"Error importing network analysis dependencies (community/python-louvain, networkx, snf/snfpy). "
"Install them with: pip install 'acore[all]'"
f"\n\nError: {e}"
) from e

import pandas as pd
import snf
from sklearn import cluster
from sklearn.cluster import AffinityPropagation

Expand Down
11 changes: 10 additions & 1 deletion src/acore/publications_analysis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
from urllib import error

import pandas as pd
from Bio import Entrez, Medline

try:
from Bio import Entrez, Medline
except ImportError as e:
raise ImportError(
"Error importing Bio modules. Make sure biopython is installed. "
"Install it with: pip install biopython"
f"\n\nError: {e}"
) from e


# TODO: This should probably be changed to the email of the person installing ckg?
Entrez.email = "kg@dtu.dk"
Expand Down
9 changes: 8 additions & 1 deletion src/acore/tda_analysis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import kmapper as km
try:
import kmapper as km
except ImportError as e:
raise ImportError(
"Error importing kmapper module. Make sure kmapper is installed. "
"Install it with: pip install 'acore[all]'"
f"\n\nError: {e}"
) from e
import numpy as np
from sklearn import cluster, ensemble

Expand Down
1 change: 1 addition & 0 deletions src/acore/wgcna_analysis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# TODO: only here for vuecore compatibility
Loading