From 5fe4a5d7825baa6c2c62951f88d30e1d74c955e9 Mon Sep 17 00:00:00 2001 From: jolinahor Date: Wed, 6 Nov 2024 12:37:51 -0800 Subject: [PATCH] Added Figure 4 --- pf2barcode/figures/figure2.py | 11 +++++++++++ pf2barcode/figures/figure4.py | 36 +++++++++++++++++++++++++++++++++++ requirements-dev.lock | 5 +++++ requirements.lock | 6 ++++++ 4 files changed, 58 insertions(+) create mode 100644 pf2barcode/figures/figure2.py create mode 100644 pf2barcode/figures/figure4.py diff --git a/pf2barcode/figures/figure2.py b/pf2barcode/figures/figure2.py new file mode 100644 index 0000000..6799da0 --- /dev/null +++ b/pf2barcode/figures/figure2.py @@ -0,0 +1,11 @@ +import scanpy as sc +from pf2barcode.imports import import_CCLE +import seaborn as sns + +def makeFigure(): + X = import_CCLE() + + Xsel = X[:, X.var.index.str.contains('AXL')] + Xsel.uns + + sc.pl.pca(X, color="SW", components=['1,2', '3,4'], size=10) \ No newline at end of file diff --git a/pf2barcode/figures/figure4.py b/pf2barcode/figures/figure4.py new file mode 100644 index 0000000..5739951 --- /dev/null +++ b/pf2barcode/figures/figure4.py @@ -0,0 +1,36 @@ +import seaborn as sns +import numpy as np +from scipy.stats import kruskal +import matplotlib.pyplot as plt + +from pf2barcode.imports import import_CCLE + +from .common import ( + getSetup, + subplotLabel, +) + +def makeFigure(): + + X = import_CCLE() + + """Get a list of the axis objects and create a figure.""" + ax, f = getSetup((10, 6), (1, 1)) + subplotLabel(ax) + + idx_selected = 0 + cells = [] + pvalues = np.zeros(X.obsm["X_pca"].shape[1]) + + for jj in range(X.obsm["X_pca"].shape[1]): + for barcodes in X.obs["SW"].unique(): + cells_selected = X.obsm["X_pca"][X.obs["SW"] == barcodes, idx_selected] + cells.append(cells_selected.flatten()) + + pvalues[jj] = kruskal(*cells).pvalue + + sns.barplot(x=np.arange(pvalues.shape[0]), y=-np.log10(pvalues)) + plt.xlabel("PC") + plt.ylabel("-log10(p-value)") + + return f \ No newline at end of file diff --git a/requirements-dev.lock b/requirements-dev.lock index 60af87a..9cd960b 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -61,6 +61,8 @@ idna==3.8 # via requests igraph==0.11.6 # via pf2barcode +importlib-metadata==8.5.0 + # via dask iniconfig==2.0.0 # via pytest ipykernel==6.29.5 @@ -252,6 +254,7 @@ traitlets==5.14.3 # via jupyter-core # via matplotlib-inline typing-extensions==4.12.2 + # via ipython # via pyright tzdata==2024.1 # via pandas @@ -263,3 +266,5 @@ wcwidth==0.2.13 # via prompt-toolkit widgetsnbextension==4.0.13 # via ipywidgets +zipp==3.20.2 + # via importlib-metadata diff --git a/requirements.lock b/requirements.lock index 8fa27f2..fe13efb 100644 --- a/requirements.lock +++ b/requirements.lock @@ -59,6 +59,8 @@ idna==3.8 # via requests igraph==0.11.6 # via pf2barcode +importlib-metadata==8.5.0 + # via dask ipykernel==6.29.5 # via pf2barcode ipython==8.27.0 @@ -238,6 +240,8 @@ traitlets==5.14.3 # via jupyter-client # via jupyter-core # via matplotlib-inline +typing-extensions==4.12.2 + # via ipython tzdata==2024.1 # via pandas umap-learn==0.5.6 @@ -248,3 +252,5 @@ wcwidth==0.2.13 # via prompt-toolkit widgetsnbextension==4.0.13 # via ipywidgets +zipp==3.20.2 + # via importlib-metadata