Skip to content

Commit 14b661a

Browse files
committed
Added notebooks for several additional cancer types outside of AML, including CRC, BRCA, and SKCM
1 parent 1adb363 commit 14b661a

8 files changed

Lines changed: 1401 additions & 86 deletions

models/SKCM/SKCM_bulk_pipeline.pkl

6.3 MB
Binary file not shown.

models/SKCM/SKCM_heatmap.pdf

5.2 KB
Binary file not shown.
2.66 MB
Binary file not shown.

models/SKCM/SKCM_scree.pdf

730 Bytes
Binary file not shown.

models/SKCM/SKCM_umap_BRAF.pdf

443 Bytes
Binary file not shown.

notebooks/02_CRC_TCGA_COAD_READ.ipynb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@
829829
},
830830
{
831831
"cell_type": "code",
832-
"execution_count": null,
832+
"execution_count": 16,
833833
"id": "7bece2e0",
834834
"metadata": {},
835835
"outputs": [
@@ -839,6 +839,15 @@
839839
"text": [
840840
"Loading count matrix ... (this may take 2-5 min)\n"
841841
]
842+
},
843+
{
844+
"name": "stderr",
845+
"output_type": "stream",
846+
"text": [
847+
"\n",
848+
"KeyboardInterrupt\n",
849+
"\n"
850+
]
842851
}
843852
],
844853
"source": [

notebooks/03_BRCA_TCGA.ipynb

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,7 +1744,7 @@
17441744
},
17451745
{
17461746
"cell_type": "code",
1747-
"execution_count": null,
1747+
"execution_count": 23,
17481748
"id": "90126937",
17491749
"metadata": {},
17501750
"outputs": [
@@ -1753,7 +1753,21 @@
17531753
"output_type": "stream",
17541754
"text": [
17551755
"13:50:06 | INFO | scope.pipeline.sc_pipeline — === SingleCellPipeline.fit ===\n",
1756-
"13:50:06 | INFO | scope.preprocessing.single_cell — SingleCellPreprocessor fitted.\n"
1756+
"13:50:06 | INFO | scope.preprocessing.single_cell — SingleCellPreprocessor fitted.\n",
1757+
"13:52:16 | INFO | scope.utils.gene_utils — Gene universe: 16214 shared, 4316 bulk-only, 10470 sc-only\n",
1758+
"13:54:18 | INFO | scope.preprocessing.alignment — BulkSCAligner fitted (method=moment_matching, n_genes=16214).\n",
1759+
"13:54:18 | INFO | scope.pipeline.sc_pipeline — SingleCellPipeline.fit complete.\n",
1760+
"13:54:18 | INFO | scope.pipeline.sc_pipeline — === SingleCellPipeline.transform ===\n",
1761+
"13:56:48 | WARNING | scope.pipeline.sc_pipeline — 4316 / 20530 bulk genes absent from sc data (will be zero-padded).\n",
1762+
"14:10:27 | INFO | scope.pipeline.sc_pipeline — Projected 200128 cells into 200-D latent space.\n",
1763+
"14:10:31 | INFO | scope.pipeline.sc_pipeline — Inferred probabilities for 22 mutations.\n"
1764+
]
1765+
},
1766+
{
1767+
"name": "stdout",
1768+
"output_type": "stream",
1769+
"text": [
1770+
"Inferred mutation probability columns: ['mutation_prob_PIK3CA', 'mutation_prob_PIK3R1', 'mutation_prob_PTEN', 'mutation_prob_AKT1', 'mutation_prob_TP53', 'mutation_prob_CDH1', 'mutation_prob_ERBB2', 'mutation_prob_ERBB3', 'mutation_prob_KRAS', 'mutation_prob_BRAF', 'mutation_prob_GATA3', 'mutation_prob_RUNX1', 'mutation_prob_FOXA1', 'mutation_prob_BRCA1', 'mutation_prob_BRCA2', 'mutation_prob_PALB2', 'mutation_prob_ATM', 'mutation_prob_KMT2C', 'mutation_prob_ARID1A', 'mutation_prob_MAP3K1', 'mutation_prob_RB1', 'mutation_prob_CCND1']\n"
17571771
]
17581772
}
17591773
],
@@ -1784,21 +1798,58 @@
17841798
"execution_count": null,
17851799
"id": "dc506e05",
17861800
"metadata": {},
1801+
"outputs": [
1802+
{
1803+
"name": "stderr",
1804+
"output_type": "stream",
1805+
"text": [
1806+
"/opt/homebrew/Cellar/micromamba/2.5.0_1/envs/scope-dev/lib/python3.10/site-packages/umap/umap_.py:1952: UserWarning: n_jobs value 1 overridden to 1 by setting random_state. Use no seed for parallelism.\n",
1807+
" warn(\n"
1808+
]
1809+
}
1810+
],
1811+
"source": [
1812+
"adata_sc = compute_umap(adata_sc, obsm_key=\"X_svd\")\n"
1813+
]
1814+
},
1815+
{
1816+
"cell_type": "code",
1817+
"execution_count": null,
1818+
"id": "0de7b082-a42d-47b2-9e72-99144c24d937",
1819+
"metadata": {},
17871820
"outputs": [],
17881821
"source": [
1789-
"adata_sc = compute_umap(adata_sc, obsm_key=\"X_svd\")\n",
1790-
"\n",
17911822
"ct_col = next((c for c in adata_sc.obs.columns\n",
17921823
" if \"celltype\" in c.lower() or \"cell_type\" in c.lower()), \"sample_id\")\n",
17931824
"\n",
1794-
"fig, axes = plt.subplots(1, 2, figsize=(14, 5))\n",
1825+
"fig, axes = plt.subplots(2, 1, figsize=(14, 12))\n",
17951826
"sc.pl.umap(adata_sc, color=ct_col, ax=axes[0], show=False, title=\"Cell type\")\n",
17961827
"sc.pl.umap(adata_sc, color=\"sample_id\", ax=axes[1], show=False, title=\"Patient\")\n",
17971828
"plt.tight_layout()\n",
17981829
"fig.savefig(os.path.join(MODELS_DIR, \"BRCA_umap_celltype.pdf\"), bbox_inches=\"tight\")\n",
17991830
"plt.show()\n"
18001831
]
18011832
},
1833+
{
1834+
"cell_type": "code",
1835+
"execution_count": null,
1836+
"id": "c4b4b183-853a-49a1-9058-9580382ce2a3",
1837+
"metadata": {},
1838+
"outputs": [],
1839+
"source": [
1840+
"print(adata_sc)\n"
1841+
]
1842+
},
1843+
{
1844+
"cell_type": "code",
1845+
"execution_count": null,
1846+
"id": "54269169-a965-4389-b2b9-eec4f674f07a",
1847+
"metadata": {},
1848+
"outputs": [],
1849+
"source": [
1850+
"sc.pl.umap(adata_sc, color=\"sample_id\", ax=axes[1], show=False, title=\"Patient\")\n"
1851+
]
1852+
},
18021853
{
18031854
"cell_type": "code",
18041855
"execution_count": null,
@@ -1807,7 +1858,7 @@
18071858
"outputs": [],
18081859
"source": [
18091860
"top_muts = (\n",
1810-
" mutation_labels.sum().sort_values(ascending=False).head(6).index.tolist()\n",
1861+
" mutation_labels.sum().sort_values(ascending=False).index.tolist()\n",
18111862
")\n",
18121863
"fig = plot_mutation_probabilities(adata_sc, mutations=top_muts)\n",
18131864
"fig.savefig(os.path.join(MODELS_DIR, \"BRCA_mutation_probs.pdf\"), bbox_inches=\"tight\")\n",
@@ -1822,6 +1873,7 @@
18221873
"outputs": [],
18231874
"source": [
18241875
"fig, ax = plot_mutation_heatmap(adata_sc, cluster_key=ct_col, mutations=top_muts)\n",
1876+
"fig.set_size_inches(20, 8) # width, height in inches\n",
18251877
"fig.savefig(os.path.join(MODELS_DIR, \"BRCA_heatmap.pdf\"), bbox_inches=\"tight\")\n",
18261878
"plt.show()\n"
18271879
]

0 commit comments

Comments
 (0)