Oncodrive3D 1.0.8__tar.gz → 1.0.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. oncodrive3d-1.0.9/.dockerignore +1 -0
  2. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/.gitignore +4 -1
  3. oncodrive3d-1.0.9/Dockerfile +106 -0
  4. oncodrive3d-1.0.9/PKG-INFO +262 -0
  5. oncodrive3d-1.0.9/README.md +227 -0
  6. oncodrive3d-1.0.9/docs/annotations_plotting.md +187 -0
  7. oncodrive3d-1.0.9/docs/build_output.md +26 -0
  8. oncodrive3d-1.0.9/docs/run_input_output.md +245 -0
  9. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/oncodrive3d_pipeline/README.md +15 -41
  10. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/oncodrive3d_pipeline/conf/test.config +11 -21
  11. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/oncodrive3d_pipeline/modules/o3d_chimerax_plot.nf +7 -1
  12. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/oncodrive3d_pipeline/modules/o3d_plot.nf +1 -1
  13. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/oncodrive3d_pipeline/modules/o3d_run.nf +1 -1
  14. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/oncodrive3d_pipeline/nextflow.config +16 -9
  15. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/oncodrive3d_pipeline/validation.nf +37 -0
  16. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/__init__.py +1 -1
  17. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/datasets/seq_for_mut_prob.py +12 -8
  18. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/globals.py +0 -24
  19. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/main.py +36 -9
  20. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/plotting/build_annotations.py +38 -23
  21. oncodrive3d-1.0.9/scripts/plotting/chimerax_plot.py +416 -0
  22. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/plotting/pdb_tool.py +41 -11
  23. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/plotting/plot.py +17 -6
  24. oncodrive3d-1.0.9/scripts/plotting/stability_change.py +374 -0
  25. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/plotting/uniprot_feat.py +2 -2
  26. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/plotting/utils.py +111 -0
  27. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/run/clustering.py +19 -5
  28. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/run/score_and_simulations.py +2 -0
  29. oncodrive3d-1.0.9/tools/mut_profile/README.md +19 -0
  30. oncodrive3d-1.0.9/tools/mut_profile/get_regions_file.py +34 -0
  31. oncodrive3d-1.0.9/tools/release/docker.sh +85 -0
  32. oncodrive3d-1.0.8/.github/workflows/release-publish.yml +0 -225
  33. oncodrive3d-1.0.8/Dockerfile +0 -73
  34. oncodrive3d-1.0.8/PKG-INFO +0 -359
  35. oncodrive3d-1.0.8/README.md +0 -324
  36. oncodrive3d-1.0.8/docs/annotations_plotting.md +0 -170
  37. oncodrive3d-1.0.8/docs/build_output.md +0 -19
  38. oncodrive3d-1.0.8/docs/run_input_output.md +0 -246
  39. oncodrive3d-1.0.8/scripts/plotting/chimerax_plot.py +0 -257
  40. oncodrive3d-1.0.8/scripts/plotting/stability_change.py +0 -183
  41. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/.python-version +0 -0
  42. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/LICENSE +0 -0
  43. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/docs/images/graphical_abstract.png +0 -0
  44. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/docs/mutability.md +0 -0
  45. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/oncodrive3d_pipeline/main.nf +0 -0
  46. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/oncodrive3d_pipeline/workflows/oncodrive3d.nf +0 -0
  47. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/pyproject.toml +0 -0
  48. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/clustering_3d.code-workspace +0 -0
  49. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/datasets/__init__.py +0 -0
  50. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/datasets/af_merge.py +0 -0
  51. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/datasets/build_datasets.py +0 -0
  52. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/datasets/custom_pdb.py +0 -0
  53. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/datasets/get_pae.py +0 -0
  54. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/datasets/get_structures.py +0 -0
  55. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/datasets/model_confidence.py +0 -0
  56. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/datasets/parse_pae.py +0 -0
  57. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/datasets/prob_contact_maps.py +0 -0
  58. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/datasets/utils.py +0 -0
  59. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/plotting/__init__.py +0 -0
  60. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/plotting/pfam.py +0 -0
  61. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/run/__init__.py +0 -0
  62. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/run/communities.py +0 -0
  63. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/run/miss_mut_prob.py +0 -0
  64. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/run/mutability.py +0 -0
  65. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/run/pvalues.py +0 -0
  66. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/scripts/run/utils.py +0 -0
  67. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/test/input/maf/TCGA_WXS_ACC.in.maf +0 -0
  68. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/test/input/maf/TCGA_WXS_PAAD.in.maf +0 -0
  69. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/test/input/mut_profile/TCGA_WXS_ACC.sig.json +0 -0
  70. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/test/input/mut_profile/TCGA_WXS_PAAD.sig.json +0 -0
  71. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/test/input/vep/TCGA_WXS_ACC.vep.tsv.gz +0 -0
  72. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/test/input/vep/TCGA_WXS_PAAD.vep.tsv.gz +0 -0
  73. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/tools/preprocessing/README.md +0 -0
  74. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/tools/preprocessing/config.yaml +0 -0
  75. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/tools/preprocessing/parse_alphafold_predictions.py +0 -0
  76. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/tools/preprocessing/prepare_samplesheet.py +0 -0
  77. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/tools/preprocessing/pyproject.toml +0 -0
  78. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/tools/preprocessing/sitecustomize.py +0 -0
  79. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/tools/preprocessing/update_samplesheet_and_structures.py +0 -0
  80. {oncodrive3d-1.0.8 → oncodrive3d-1.0.9}/uv.lock +0 -0
@@ -0,0 +1 @@
1
+ .env
@@ -192,4 +192,7 @@ run_*
192
192
 
193
193
  # VSC
194
194
  launch.json
195
- .vscode
195
+ .vscode
196
+
197
+ # Docker build artifacts (ChimeraX installer staged into context)
198
+ chimerax*.deb
@@ -0,0 +1,106 @@
1
+ # Multi-target Dockerfile for Oncodrive3D.
2
+ #
3
+ # Targets (each builds on the previous; pick with `--target`):
4
+ # light (default) - oncodrive3d only.
5
+ # Covers `run` and `plot` (including normal-tissue
6
+ # mutability runs). No external prerequisites to build.
7
+ # chimerax - light + ChimeraX. Adds `chimerax-plot`. Requires the
8
+ # ChimeraX installer staged in the build context as
9
+ # `chimerax.deb` (override via --build-arg CHIMERAX_DEB=).
10
+ # full - chimerax + bgdata caches (hg38, mm39) + PDB_Tool.
11
+ # Adds `build-datasets` and `build-annotations`.
12
+ #
13
+ # Examples:
14
+ # docker build --target light -t oncodrive3d:1.0.9 -t oncodrive3d:latest .
15
+ # docker build --target chimerax -t oncodrive3d:1.0.9-chimerax -t oncodrive3d:chimerax .
16
+ # docker build --target full -t oncodrive3d:1.0.9-full -t oncodrive3d:full .
17
+
18
+ # Stage 1: build the oncodrive3d wheel
19
+ FROM ghcr.io/astral-sh/uv:0.5-python3.10-bookworm AS build-stage
20
+
21
+ ENV UV_COMPILE_BYTECODE=1
22
+
23
+ WORKDIR /oncodrive3d
24
+
25
+ COPY uv.lock uv.lock
26
+ COPY pyproject.toml pyproject.toml
27
+ COPY scripts scripts
28
+ COPY README.md README.md
29
+
30
+ RUN mkdir -p /root/.cache/uv \
31
+ && uv sync --frozen --no-dev \
32
+ && uv build
33
+
34
+ # Stage 2: compile PDB_Tool from source (only consumed by the `full` target)
35
+ FROM python:3.10-bullseye AS pdb-tool-stage
36
+ RUN apt-get update && apt-get install -y --no-install-recommends \
37
+ build-essential ca-certificates git \
38
+ && git clone --depth 1 https://github.com/realbigws/PDB_Tool.git /pdb-tool \
39
+ && make -C /pdb-tool/source_code \
40
+ && rm -rf /var/lib/apt/lists/*
41
+
42
+ # Stage 3 (target=light): just oncodrive3d. No ChimeraX, no PDB_Tool, no bgdata.
43
+ # Debian 11 base keeps layers shareable with the downstream targets that need
44
+ # libssl1.1 + libffi7 for the Ubuntu 20.04 ChimeraX .deb.
45
+ FROM python:3.10-bullseye AS light
46
+
47
+ COPY --from=build-stage /oncodrive3d/dist /oncodrive3d/dist
48
+ WORKDIR /oncodrive3d
49
+ RUN pip install --no-cache-dir dist/*.tar.gz
50
+
51
+ LABEL Author="stefano.pellegrini@irbbarcelona.org"
52
+
53
+ CMD ["oncodrive3D"]
54
+
55
+ # Stage 4 (target=chimerax): light + ChimeraX
56
+ FROM light AS chimerax
57
+
58
+ ENV DEBIAN_FRONTEND=noninteractive
59
+
60
+ ARG CHIMERAX_DEB=chimerax.deb
61
+ COPY ${CHIMERAX_DEB} /tmp/chimerax.deb
62
+
63
+ RUN apt-get update \
64
+ && apt-get install -y --no-install-recommends /tmp/chimerax.deb \
65
+ && rm /tmp/chimerax.deb \
66
+ && apt-get clean \
67
+ && rm -rf /var/lib/apt/lists/*
68
+
69
+ # Stage 5 (target=full): chimerax + bgdata caches (hg38, mm39) + PDB_Tool
70
+ FROM chimerax AS full
71
+
72
+ ENV BGDATA_LOCAL="/bgdatacache" \
73
+ BBGLAB_HOME="/home/user/.config/bbglab/"
74
+
75
+ # PDB_Tool binary (for `build-annotations`)
76
+ COPY --from=pdb-tool-stage /pdb-tool/PDB_Tool /usr/local/bin/PDB_Tool
77
+
78
+ RUN install -d -m 0755 "$BGDATA_LOCAL" "$BBGLAB_HOME"
79
+
80
+ # Write bgdata configuration
81
+ RUN echo "# Version of the bgdata config file\n\
82
+ version = 2\n\
83
+ \n\
84
+ # The default local folder to store the data packages\n\
85
+ local_repository = \"$BGDATA_LOCAL\"\n\
86
+ \n\
87
+ # The remote URL to download the data packages\n\
88
+ remote_repository = \"https://bbglab.irbbarcelona.org/bgdata\"\n\
89
+ \n\
90
+ # If you want to force bgdata to work only locally\n\
91
+ # offline = True\n\
92
+ \n\
93
+ # Cache repositories\n\
94
+ [cache_repositories]" > "$BBGLAB_HOME/bgdatav2.conf"
95
+
96
+ # Pre-fetch and prepare genome data (needed by `build-datasets`)
97
+ RUN apt-get update && apt-get install -y --no-install-recommends curl \
98
+ && pip install --no-cache-dir bgdata bgreference \
99
+ && bgdata get datasets/genomereference/hg38 \
100
+ && bgdata get datasets/genomereference/mm39 \
101
+ && python3 -c "from bgreference import hg38; hg38(1, 1300000, 3000)" \
102
+ && python3 -c "from bgreference import mm39; mm39(1, 1300000, 3000)" \
103
+ && apt-get clean \
104
+ && rm -rf /var/lib/apt/lists/*
105
+
106
+ RUN chmod -R 0755 "$BGDATA_LOCAL"
@@ -0,0 +1,262 @@
1
+ Metadata-Version: 2.4
2
+ Name: Oncodrive3D
3
+ Version: 1.0.9
4
+ Summary: Oncodrive3D is a method designed to analyse patterns of somatic mutations across tumors to identify three-dimensional (3D) clusters of missense mutations and detect genes that are under positive selection.
5
+ Project-URL: Homepage, https://github.com/bbglab/clustering_3d
6
+ Project-URL: Repository, https://github.com/bbglab/clustering_3d
7
+ Project-URL: Issues, https://github.com/bbglab/clustering_3d/issues
8
+ Author-email: "BBGLab (Barcelona Biomedical Genomics Lab)" <bbglab@irbbarcelona.org>, Stefano Pellegrini <stefano.pellegrini@irbbarcelona.org>
9
+ License: GNU Affero General Public License v3 or later (AGPLv3+)
10
+ License-File: LICENSE
11
+ Keywords: bbglab,bioinformatics,driversprediction,positiveselection
12
+ Requires-Python: >=3.10
13
+ Requires-Dist: adjusttext==1.1.1
14
+ Requires-Dist: aiohttp>=3.11.10
15
+ Requires-Dist: bgreference==0.7
16
+ Requires-Dist: bio==1.7.1
17
+ Requires-Dist: colorcet==3.0.1
18
+ Requires-Dist: daiquiri>=3.3.0
19
+ Requires-Dist: matplotlib>=3.6.2
20
+ Requires-Dist: networkx==2.7.1
21
+ Requires-Dist: numpy==1.26.4
22
+ Requires-Dist: pandas==1.4.2
23
+ Requires-Dist: progressbar2==4.0.0
24
+ Requires-Dist: pypdl==1.4.5
25
+ Requires-Dist: pytabix==0.0.2
26
+ Requires-Dist: scikit-learn>=1.3.0
27
+ Requires-Dist: scipy>=1.7.3
28
+ Requires-Dist: seaborn>=0.12.2
29
+ Requires-Dist: setuptools==61.2.0
30
+ Requires-Dist: statsmodels>=0.13.2
31
+ Requires-Dist: tqdm>=4.67.1
32
+ Provides-Extra: linting
33
+ Requires-Dist: ruff>=0.8.3; extra == 'linting'
34
+ Description-Content-Type: text/markdown
35
+
36
+ # Oncodrive3D
37
+
38
+ **Oncodrive3D** is a fast and accurate computational method designed to analyze patterns of somatic mutation across tumors, with the goal of identifying **three-dimensional (3D) clusters** of missense mutations and detecting genes under **positive selection**.
39
+
40
+ The method leverages **AlphaFold 2-predicted protein structures** and Predicted Aligned Error (PAE) to define residue contacts within the protein's 3D space. When available, it integrates **mutational profiles** to build an accurate background model of neutral mutagenesis. By applying a novel **rank-based statistical approach**, Oncodrive3D scores potential 3D clusters and computes empirical p-values.
41
+
42
+ [![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)
43
+ [![docker](https://img.shields.io/docker/v/bbglab/oncodrive3d?logo=docker)](https://hub.docker.com/r/bbglab/oncodrive3d)
44
+ [![PyPI - Version](https://img.shields.io/pypi/v/oncodrive3d?logo=pypi)](https://pypi.org/project/Oncodrive3D/)
45
+
46
+ ![Graphical abstract of Oncodrive3D](docs/images/graphical_abstract.png "Oncodrive3D")
47
+
48
+ ## Requirements
49
+
50
+ Python 3.10+ is required. Some systems also need a C/C++ toolchain:
51
+
52
+ - With sudo privileges:
53
+
54
+ ```bash
55
+ sudo apt install build-essential
56
+ ```
57
+
58
+ - On HPC clusters, [Conda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html) (or [Mamba](https://mamba.readthedocs.io/en/latest/)) is recommended:
59
+
60
+ ```bash
61
+ conda create -n o3d python=3.10.0
62
+ conda activate o3d
63
+ conda install -c conda-forge gxx gcc libxcrypt clang zlib
64
+ ```
65
+
66
+ ## Installation
67
+
68
+ - Install via PyPI:
69
+
70
+ ```bash
71
+ pip install oncodrive3d
72
+ ```
73
+
74
+ - Alternatively, you can obtain the latest code from the repository and install it for development with pip:
75
+
76
+ ```bash
77
+ git clone https://github.com/bbglab/oncodrive3d.git
78
+ cd oncodrive3d
79
+ pip install -e .
80
+ oncodrive3d --help
81
+ ```
82
+
83
+ - Or you can use a modern build tool like [uv](https://github.com/astral-sh/uv):
84
+
85
+ ```bash
86
+ git clone https://github.com/bbglab/oncodrive3d.git
87
+ cd oncodrive3d
88
+ uv run oncodrive3d --help
89
+ ```
90
+
91
+ ## Building Datasets
92
+
93
+ This step builds the datasets necessary for Oncodrive3D to run the 3D clustering analysis. It is required once after installation or whenever you need to generate datasets for a different organism or apply a specific threshold to define amino acid contacts.
94
+
95
+ > [!WARNING]
96
+ > This step is time- and resource-intensive: it downloads and processes large amounts of structural data. Ensure adequate disk space, CPU, and a reliable internet connection (AlphaFold, Ensembl, Pfam, and other resources are fetched on demand).
97
+
98
+ <!-- -->
99
+
100
+ > [!WARNING]
101
+ > MANE builds force AlphaFold DB v4 structures (non-MANE builds default to v6). PAE files for v4 are no longer hosted after 2025, so MANE builds without `--custom_pae_dir` fall back to binary contact maps. To keep PAE-weighted probability maps, supply precomputed v4 PAE files via `--custom_pae_dir`.
102
+
103
+ <!-- -->
104
+
105
+ > [!NOTE]
106
+ > The first time that you run Oncodrive3D building dataset step with a given reference genome, it will download it from our servers. By default the downloaded datasets go to `~/.bgdata`. If you want to move these datasets to another folder you have to define the system environment variable `BGDATA_LOCAL` with an export command.
107
+
108
+ ```text
109
+ Usage: oncodrive3d build-datasets [OPTIONS]
110
+
111
+ Examples:
112
+ Basic build (human):
113
+ oncodrive3d build-datasets -o <build_folder>
114
+
115
+ Build with MANE Select transcripts:
116
+ oncodrive3d build-datasets -o <build_folder> --mane
117
+
118
+ Build mouse datasets:
119
+ oncodrive3d build-datasets -o <build_folder> -s mouse
120
+ ```
121
+
122
+ See `oncodrive3d build-datasets --help` for all options.
123
+
124
+ For more information on the output of this step, please refer to the [Building Datasets Output Documentation](docs/build_output.md).
125
+
126
+ > [!TIP]
127
+ > To extend MANE Select structural coverage beyond the AlphaFold MANE bundle, see the [MANE Preprocessing Toolkit](tools/preprocessing/README.md).
128
+
129
+ ## Running 3D Clustering Analysis
130
+
131
+ See the [Input and Output Documentation](docs/run_input_output.md) for details on inputs and outputs.
132
+
133
+ ### Input
134
+
135
+ - **Mutations file** (`required`): It can be either:
136
+ - **<input_maf>**: A Mutation Annotation Format (MAF) file annotated with consequences (e.g., by using [Ensembl Variant Effect Predictor (VEP)](https://www.ensembl.org/info/docs/tools/vep/index.html)).
137
+ - **<input_vep>**: The unfiltered output of VEP including annotations for all possible transcripts.
138
+
139
+ - **<mut_profile>** (`optional`): Dictionary including the normalized frequencies of mutations (*values*) in every possible trinucleotide context (*keys*), such as 'ACA>A', 'ACC>A', and so on.
140
+
141
+ > [!NOTE]
142
+ > Examples of the input files are available in the [Test Input Folder](test/input).
143
+ Please refer to these examples to understand the expected format and structure of the input files.
144
+
145
+ <!-- -->
146
+
147
+ > [!NOTE]
148
+ > Oncodrive3D uses the mutational profile of the cohort to build an accurate background model. However, it’s not strictly required. If the mutational profile is not provided, the tool will use a simple uniform distribution as the background model for simulating mutations and scoring potential 3D clusters.
149
+
150
+ ### Main Output
151
+
152
+ - **Gene-level output**: CSV file (`<cohort>.3d_clustering_genes.csv`) containing the results of the analysis at the gene level. Each row represents a gene, sorted from the most significant to the least significant based on the 3D clustering analysis. The table also includes genes that were not analyzed, with the reason for exclusion provided in the `status` column.
153
+
154
+ - **Residue-level output**: CSV file (`<cohort>.3d_clustering_pos.csv`) containing the results of the analysis at the level of mutated residues. Each row corresponds to a mutated position within a gene and includes detailed information for each potential mutational cluster.
155
+
156
+ ### Usage
157
+
158
+ ```text
159
+ Usage: oncodrive3d run [OPTIONS]
160
+
161
+ Examples:
162
+ Basic run:
163
+ oncodrive3d run -i <input_maf> -p <mut_profile> -d <build_folder> -C <cohort_name>
164
+
165
+ Run using VEP output as input and MANE Select transcripts:
166
+ oncodrive3d run -i <input_vep> -p <mut_profile> -d <build_folder> -C <cohort_name> \
167
+ --o3d_transcripts --use_input_symbols --mane
168
+ ```
169
+
170
+ See `oncodrive3d run --help` for all options.
171
+
172
+ > [!WARNING]
173
+ > Human datasets built with the default settings pin canonical transcript metadata to the January 2024 Ensembl archive (release 111 / GENCODE v45). Annotate input variants with the same Ensembl/GENCODE release to avoid transcript-ID mismatches.
174
+
175
+ <!-- -->
176
+
177
+ > [!TIP]
178
+ > To maximize the number of matching transcripts between your input mutations and Oncodrive3D's structures, supply the unfiltered VEP output as input along with `--o3d_transcripts --use_input_symbols`.
179
+
180
+ ### Handling Heterogeneous Sequencing Depth
181
+
182
+ Oncodrive3D can ingest **site-specific mutability tables** when a single mutational profile is not representative of the cohort (e.g., mutation calling performed on highly heterogeneous-depth datasets such as ultra depth **Duplex sequencing** panels commonly used in normal tissue analysis). Provide an indexed TSV describing per-site mutability together with a JSON config via `--mutability_config_path`. The run automatically switches from trinucleotide rates to per-position probabilities and tracks additional diagnostics (`Mut_zero_mut_prob`, `Pos_zero_mut_prob`, status `Mut_with_zero_prob/No_mutability`).
183
+
184
+ Please see the [Mutability-aware runs guide](docs/mutability.md) for the expected file formats, config schema, and troubleshooting tips.
185
+
186
+ ### Container Images
187
+
188
+ Oncodrive3D ships three image variants, each layered on top of the previous so you can pick the smallest one that covers your workflow:
189
+
190
+ | Variant | Tags | Approx size | Supported commands |
191
+ | --- | --- | --- | --- |
192
+ | Light | `bbglab/oncodrive3d:latest`, `:light`, `:<version>`, `:<version>-light` | ~490 MB | `run`, `plot` |
193
+ | ChimeraX | `bbglab/oncodrive3d:chimerax`, `:<version>-chimerax` | ~1.6 GB | `run`, `plot`, `chimerax-plot` |
194
+ | Full | `bbglab/oncodrive3d:full`, `:<version>-full` | ~4.7 GB | `run`, `plot`, `chimerax-plot`, `build-datasets`, `build-annotations` |
195
+
196
+ #### Docker
197
+
198
+ ```bash
199
+ docker pull bbglab/oncodrive3d:latest
200
+ docker run --rm -v "$PWD":/data bbglab/oncodrive3d:latest \
201
+ oncodrive3d run -i /data/<input_maf> -p /data/<mut_profile> \
202
+ -d /data/<build_folder> -C <cohort_name> -o /data/<output_dir>
203
+ ```
204
+
205
+ #### Singularity
206
+
207
+ ```bash
208
+ singularity pull oncodrive3d.sif docker://bbglab/oncodrive3d:latest
209
+ singularity exec oncodrive3d.sif oncodrive3d run \
210
+ -i <input_maf> -p <mut_profile> -d <build_folder> -C <cohort_name>
211
+ ```
212
+
213
+ > [!NOTE]
214
+ > Singularity only auto-binds `$HOME` and `$PWD`. If any input or output path lives outside those (e.g. `/data/...` on a cluster), bind that host path explicitly with `-B /path:/path` (e.g. `singularity exec -B /data:/data oncodrive3d.sif ...`).
215
+
216
+ ### Testing
217
+
218
+ To verify that Oncodrive3D is installed and configured correctly, you can perform a test run using the provided test input files:
219
+
220
+ ```bash
221
+ oncodrive3d run -d <build_folder> \
222
+ -i ./test/input/maf/TCGA_WXS_ACC.in.maf \
223
+ -p ./test/input/mut_profile/TCGA_WXS_ACC.sig.json \
224
+ -o ./test/output/ -C TCGA_WXS_ACC
225
+ ```
226
+
227
+ Check the output in the `test/output/` directory to ensure the analysis completes successfully.
228
+
229
+ ## Building Annotations & Plotting
230
+
231
+ Oncodrive3D ships with an optional plotting pipeline: run `oncodrive3d build-annotations` once to cache structural/functional tracks, then use `oncodrive3d plot` and/or `chimerax-plot` to generate plots and tables that help interpret the clustering signal and distinguish real biology from artifacts.
232
+
233
+ See the [Annotation & plotting workflow](docs/annotations_plotting.md) for prerequisites, usage examples, and output descriptions.
234
+
235
+ ## Parallel Processing on Multiple Cohorts
236
+
237
+ Oncodrive3D ships with a [Nextflow](https://www.nextflow.io/) pipeline for running multiple cohorts in parallel. See the [Oncodrive3D Pipeline documentation](oncodrive3d_pipeline/README.md) for setup, input layout, and options.
238
+
239
+ ## License
240
+
241
+ Oncodrive3D is available to the general public subject to certain conditions described in its [LICENSE](LICENSE).
242
+
243
+ ## Credits
244
+
245
+ Oncodrive3D was originally written by Stefano Pellegrini.
246
+
247
+ We thank the following people for their assistance in the development of this tool:
248
+
249
+ - [@koszulordie](https://github.com/koszulordie)
250
+ - [@FedericaBrando](https://github.com/FedericaBrando)
251
+ - [@FerriolCalvet](https://github.com/FerriolCalvet)
252
+ - [@odove](https://github.com/odove)
253
+
254
+ ## Citation
255
+
256
+ If you use Oncodrive3D in your research, please cite:
257
+
258
+ > **Oncodrive3D: fast and accurate detection of structural clusters of somatic mutations under positive selection**
259
+ >
260
+ > Stefano Pellegrini, Olivia Dove-Estrella, Ferran Muiños, Nuria Lopez-Bigas, Abel Gonzalez-Perez
261
+ >
262
+ > *Nucleic Acids Research* 53(15) (2025) doi:[10.1093/nar/gkaf776](https://doi.org/10.1093/nar/gkaf776)
@@ -0,0 +1,227 @@
1
+ # Oncodrive3D
2
+
3
+ **Oncodrive3D** is a fast and accurate computational method designed to analyze patterns of somatic mutation across tumors, with the goal of identifying **three-dimensional (3D) clusters** of missense mutations and detecting genes under **positive selection**.
4
+
5
+ The method leverages **AlphaFold 2-predicted protein structures** and Predicted Aligned Error (PAE) to define residue contacts within the protein's 3D space. When available, it integrates **mutational profiles** to build an accurate background model of neutral mutagenesis. By applying a novel **rank-based statistical approach**, Oncodrive3D scores potential 3D clusters and computes empirical p-values.
6
+
7
+ [![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)
8
+ [![docker](https://img.shields.io/docker/v/bbglab/oncodrive3d?logo=docker)](https://hub.docker.com/r/bbglab/oncodrive3d)
9
+ [![PyPI - Version](https://img.shields.io/pypi/v/oncodrive3d?logo=pypi)](https://pypi.org/project/Oncodrive3D/)
10
+
11
+ ![Graphical abstract of Oncodrive3D](docs/images/graphical_abstract.png "Oncodrive3D")
12
+
13
+ ## Requirements
14
+
15
+ Python 3.10+ is required. Some systems also need a C/C++ toolchain:
16
+
17
+ - With sudo privileges:
18
+
19
+ ```bash
20
+ sudo apt install build-essential
21
+ ```
22
+
23
+ - On HPC clusters, [Conda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html) (or [Mamba](https://mamba.readthedocs.io/en/latest/)) is recommended:
24
+
25
+ ```bash
26
+ conda create -n o3d python=3.10.0
27
+ conda activate o3d
28
+ conda install -c conda-forge gxx gcc libxcrypt clang zlib
29
+ ```
30
+
31
+ ## Installation
32
+
33
+ - Install via PyPI:
34
+
35
+ ```bash
36
+ pip install oncodrive3d
37
+ ```
38
+
39
+ - Alternatively, you can obtain the latest code from the repository and install it for development with pip:
40
+
41
+ ```bash
42
+ git clone https://github.com/bbglab/oncodrive3d.git
43
+ cd oncodrive3d
44
+ pip install -e .
45
+ oncodrive3d --help
46
+ ```
47
+
48
+ - Or you can use a modern build tool like [uv](https://github.com/astral-sh/uv):
49
+
50
+ ```bash
51
+ git clone https://github.com/bbglab/oncodrive3d.git
52
+ cd oncodrive3d
53
+ uv run oncodrive3d --help
54
+ ```
55
+
56
+ ## Building Datasets
57
+
58
+ This step builds the datasets necessary for Oncodrive3D to run the 3D clustering analysis. It is required once after installation or whenever you need to generate datasets for a different organism or apply a specific threshold to define amino acid contacts.
59
+
60
+ > [!WARNING]
61
+ > This step is time- and resource-intensive: it downloads and processes large amounts of structural data. Ensure adequate disk space, CPU, and a reliable internet connection (AlphaFold, Ensembl, Pfam, and other resources are fetched on demand).
62
+
63
+ <!-- -->
64
+
65
+ > [!WARNING]
66
+ > MANE builds force AlphaFold DB v4 structures (non-MANE builds default to v6). PAE files for v4 are no longer hosted after 2025, so MANE builds without `--custom_pae_dir` fall back to binary contact maps. To keep PAE-weighted probability maps, supply precomputed v4 PAE files via `--custom_pae_dir`.
67
+
68
+ <!-- -->
69
+
70
+ > [!NOTE]
71
+ > The first time that you run Oncodrive3D building dataset step with a given reference genome, it will download it from our servers. By default the downloaded datasets go to `~/.bgdata`. If you want to move these datasets to another folder you have to define the system environment variable `BGDATA_LOCAL` with an export command.
72
+
73
+ ```text
74
+ Usage: oncodrive3d build-datasets [OPTIONS]
75
+
76
+ Examples:
77
+ Basic build (human):
78
+ oncodrive3d build-datasets -o <build_folder>
79
+
80
+ Build with MANE Select transcripts:
81
+ oncodrive3d build-datasets -o <build_folder> --mane
82
+
83
+ Build mouse datasets:
84
+ oncodrive3d build-datasets -o <build_folder> -s mouse
85
+ ```
86
+
87
+ See `oncodrive3d build-datasets --help` for all options.
88
+
89
+ For more information on the output of this step, please refer to the [Building Datasets Output Documentation](docs/build_output.md).
90
+
91
+ > [!TIP]
92
+ > To extend MANE Select structural coverage beyond the AlphaFold MANE bundle, see the [MANE Preprocessing Toolkit](tools/preprocessing/README.md).
93
+
94
+ ## Running 3D Clustering Analysis
95
+
96
+ See the [Input and Output Documentation](docs/run_input_output.md) for details on inputs and outputs.
97
+
98
+ ### Input
99
+
100
+ - **Mutations file** (`required`): It can be either:
101
+ - **<input_maf>**: A Mutation Annotation Format (MAF) file annotated with consequences (e.g., by using [Ensembl Variant Effect Predictor (VEP)](https://www.ensembl.org/info/docs/tools/vep/index.html)).
102
+ - **<input_vep>**: The unfiltered output of VEP including annotations for all possible transcripts.
103
+
104
+ - **<mut_profile>** (`optional`): Dictionary including the normalized frequencies of mutations (*values*) in every possible trinucleotide context (*keys*), such as 'ACA>A', 'ACC>A', and so on.
105
+
106
+ > [!NOTE]
107
+ > Examples of the input files are available in the [Test Input Folder](test/input).
108
+ Please refer to these examples to understand the expected format and structure of the input files.
109
+
110
+ <!-- -->
111
+
112
+ > [!NOTE]
113
+ > Oncodrive3D uses the mutational profile of the cohort to build an accurate background model. However, it’s not strictly required. If the mutational profile is not provided, the tool will use a simple uniform distribution as the background model for simulating mutations and scoring potential 3D clusters.
114
+
115
+ ### Main Output
116
+
117
+ - **Gene-level output**: CSV file (`<cohort>.3d_clustering_genes.csv`) containing the results of the analysis at the gene level. Each row represents a gene, sorted from the most significant to the least significant based on the 3D clustering analysis. The table also includes genes that were not analyzed, with the reason for exclusion provided in the `status` column.
118
+
119
+ - **Residue-level output**: CSV file (`<cohort>.3d_clustering_pos.csv`) containing the results of the analysis at the level of mutated residues. Each row corresponds to a mutated position within a gene and includes detailed information for each potential mutational cluster.
120
+
121
+ ### Usage
122
+
123
+ ```text
124
+ Usage: oncodrive3d run [OPTIONS]
125
+
126
+ Examples:
127
+ Basic run:
128
+ oncodrive3d run -i <input_maf> -p <mut_profile> -d <build_folder> -C <cohort_name>
129
+
130
+ Run using VEP output as input and MANE Select transcripts:
131
+ oncodrive3d run -i <input_vep> -p <mut_profile> -d <build_folder> -C <cohort_name> \
132
+ --o3d_transcripts --use_input_symbols --mane
133
+ ```
134
+
135
+ See `oncodrive3d run --help` for all options.
136
+
137
+ > [!WARNING]
138
+ > Human datasets built with the default settings pin canonical transcript metadata to the January 2024 Ensembl archive (release 111 / GENCODE v45). Annotate input variants with the same Ensembl/GENCODE release to avoid transcript-ID mismatches.
139
+
140
+ <!-- -->
141
+
142
+ > [!TIP]
143
+ > To maximize the number of matching transcripts between your input mutations and Oncodrive3D's structures, supply the unfiltered VEP output as input along with `--o3d_transcripts --use_input_symbols`.
144
+
145
+ ### Handling Heterogeneous Sequencing Depth
146
+
147
+ Oncodrive3D can ingest **site-specific mutability tables** when a single mutational profile is not representative of the cohort (e.g., mutation calling performed on highly heterogeneous-depth datasets such as ultra depth **Duplex sequencing** panels commonly used in normal tissue analysis). Provide an indexed TSV describing per-site mutability together with a JSON config via `--mutability_config_path`. The run automatically switches from trinucleotide rates to per-position probabilities and tracks additional diagnostics (`Mut_zero_mut_prob`, `Pos_zero_mut_prob`, status `Mut_with_zero_prob/No_mutability`).
148
+
149
+ Please see the [Mutability-aware runs guide](docs/mutability.md) for the expected file formats, config schema, and troubleshooting tips.
150
+
151
+ ### Container Images
152
+
153
+ Oncodrive3D ships three image variants, each layered on top of the previous so you can pick the smallest one that covers your workflow:
154
+
155
+ | Variant | Tags | Approx size | Supported commands |
156
+ | --- | --- | --- | --- |
157
+ | Light | `bbglab/oncodrive3d:latest`, `:light`, `:<version>`, `:<version>-light` | ~490 MB | `run`, `plot` |
158
+ | ChimeraX | `bbglab/oncodrive3d:chimerax`, `:<version>-chimerax` | ~1.6 GB | `run`, `plot`, `chimerax-plot` |
159
+ | Full | `bbglab/oncodrive3d:full`, `:<version>-full` | ~4.7 GB | `run`, `plot`, `chimerax-plot`, `build-datasets`, `build-annotations` |
160
+
161
+ #### Docker
162
+
163
+ ```bash
164
+ docker pull bbglab/oncodrive3d:latest
165
+ docker run --rm -v "$PWD":/data bbglab/oncodrive3d:latest \
166
+ oncodrive3d run -i /data/<input_maf> -p /data/<mut_profile> \
167
+ -d /data/<build_folder> -C <cohort_name> -o /data/<output_dir>
168
+ ```
169
+
170
+ #### Singularity
171
+
172
+ ```bash
173
+ singularity pull oncodrive3d.sif docker://bbglab/oncodrive3d:latest
174
+ singularity exec oncodrive3d.sif oncodrive3d run \
175
+ -i <input_maf> -p <mut_profile> -d <build_folder> -C <cohort_name>
176
+ ```
177
+
178
+ > [!NOTE]
179
+ > Singularity only auto-binds `$HOME` and `$PWD`. If any input or output path lives outside those (e.g. `/data/...` on a cluster), bind that host path explicitly with `-B /path:/path` (e.g. `singularity exec -B /data:/data oncodrive3d.sif ...`).
180
+
181
+ ### Testing
182
+
183
+ To verify that Oncodrive3D is installed and configured correctly, you can perform a test run using the provided test input files:
184
+
185
+ ```bash
186
+ oncodrive3d run -d <build_folder> \
187
+ -i ./test/input/maf/TCGA_WXS_ACC.in.maf \
188
+ -p ./test/input/mut_profile/TCGA_WXS_ACC.sig.json \
189
+ -o ./test/output/ -C TCGA_WXS_ACC
190
+ ```
191
+
192
+ Check the output in the `test/output/` directory to ensure the analysis completes successfully.
193
+
194
+ ## Building Annotations & Plotting
195
+
196
+ Oncodrive3D ships with an optional plotting pipeline: run `oncodrive3d build-annotations` once to cache structural/functional tracks, then use `oncodrive3d plot` and/or `chimerax-plot` to generate plots and tables that help interpret the clustering signal and distinguish real biology from artifacts.
197
+
198
+ See the [Annotation & plotting workflow](docs/annotations_plotting.md) for prerequisites, usage examples, and output descriptions.
199
+
200
+ ## Parallel Processing on Multiple Cohorts
201
+
202
+ Oncodrive3D ships with a [Nextflow](https://www.nextflow.io/) pipeline for running multiple cohorts in parallel. See the [Oncodrive3D Pipeline documentation](oncodrive3d_pipeline/README.md) for setup, input layout, and options.
203
+
204
+ ## License
205
+
206
+ Oncodrive3D is available to the general public subject to certain conditions described in its [LICENSE](LICENSE).
207
+
208
+ ## Credits
209
+
210
+ Oncodrive3D was originally written by Stefano Pellegrini.
211
+
212
+ We thank the following people for their assistance in the development of this tool:
213
+
214
+ - [@koszulordie](https://github.com/koszulordie)
215
+ - [@FedericaBrando](https://github.com/FedericaBrando)
216
+ - [@FerriolCalvet](https://github.com/FerriolCalvet)
217
+ - [@odove](https://github.com/odove)
218
+
219
+ ## Citation
220
+
221
+ If you use Oncodrive3D in your research, please cite:
222
+
223
+ > **Oncodrive3D: fast and accurate detection of structural clusters of somatic mutations under positive selection**
224
+ >
225
+ > Stefano Pellegrini, Olivia Dove-Estrella, Ferran Muiños, Nuria Lopez-Bigas, Abel Gonzalez-Perez
226
+ >
227
+ > *Nucleic Acids Research* 53(15) (2025) doi:[10.1093/nar/gkaf776](https://doi.org/10.1093/nar/gkaf776)