diff --git a/pf2/figures/commonFuncs/plotGeneral.py b/pf2/figures/commonFuncs/plotGeneral.py index 0bdeb02..81c67b3 100644 --- a/pf2/figures/commonFuncs/plotGeneral.py +++ b/pf2/figures/commonFuncs/plotGeneral.py @@ -93,7 +93,7 @@ def add_obs_cmp_both_label( else: thres_value = top_perc threshold2 = np.percentile(wprojs, thres_value, axis=0) - idx = wprojs[:, cmp - 1] < threshold1[cmp - 1] + idx = wprojs[:, cmp - 1] < threshold2[cmp - 1] X.obs[f"Cmp{cmp}"] = idx diff --git a/pf2/figures/figureA11.py b/pf2/figures/figureA11.py index 6bec013..8fa879a 100644 --- a/pf2/figures/figureA11.py +++ b/pf2/figures/figureA11.py @@ -24,8 +24,8 @@ def makeFigure(): add_obs(X, "patient_category") combine_cell_types(X) - cmp1 = 27; cmp2 = 46 - pos1 = True; pos2 = True + cmp1 = 2; cmp2 = 25 + pos1 = True; pos2 = False threshold = 0.5 X = add_obs_cmp_both_label(X, cmp1, cmp2, pos1, pos2, top_perc=threshold) X = add_obs_label(X, cmp1, cmp2) diff --git a/pf2/figures/figureA14.py b/pf2/figures/figureA14.py index 120ea05..810a692 100644 --- a/pf2/figures/figureA14.py +++ b/pf2/figures/figureA14.py @@ -8,6 +8,7 @@ from ..figures.commonFuncs.plotGeneral import add_obs_cmp_both_label, add_obs_label import seaborn as sns import matplotlib.colors as mcolors +import numpy as np def makeFigure(): """Get a list of the axis objects and create a figure.""" @@ -20,17 +21,23 @@ def makeFigure(): add_obs(X, "patient_category") combine_cell_types(X) - cmp1 = 27; cmp2 = 46 - pos1 = True; pos2 = True + cmp1 = 2; cmp2 = 25 + pos1 = True; pos2 = False threshold = 0.5 X = add_obs_cmp_both_label(X, cmp1, cmp2, pos1, pos2, top_perc=threshold) + print(np.count_nonzero(X.obs["Cmp2"])) + print(np.count_nonzero(X.obs["Cmp25"])) + print(np.count_nonzero(X.obs["Both"])) + X = add_obs_label(X, cmp1, cmp2) + print(np.unique(X.obs["Label"], return_counts=True)) colors = ["black", "fuchsia", "turquoise", "gainsboro"] pal = [] for i in colors: pal.append(mcolors.CSS4_COLORS[i]) + print(np.unique(X.obs["Label"], return_counts=True)) plot_labels_pacmap(X, "Label", ax[0], color_key=pal) diff --git a/pf2/figures/figureA2.py b/pf2/figures/figureA2.py index 870b91a..4dad1dd 100644 --- a/pf2/figures/figureA2.py +++ b/pf2/figures/figureA2.py @@ -11,8 +11,8 @@ def makeFigure(): X = read_h5ad("/opt/northwest_bal/full_fitted.h5ad", backed="r") - for i in [24, 25, 49]: - plot_wp_pacmap(X, i, ax[i - 1], cbarMax=0.4) - # plot_wp_per_celltype(X, i, ax[i-1]) + for i, cmp in enumerate([2, 25, 19, 26, 34, 27, 37, 44, 8, 31]): + plot_wp_pacmap(X, cmp, ax[2*i], cbarMax=0.4) + plot_wp_per_celltype(X, cmp, ax[2*i + 1]) return f diff --git a/pf2/figures/figureA7.py b/pf2/figures/figureA7.py index 7439010..004b536 100644 --- a/pf2/figures/figureA7.py +++ b/pf2/figures/figureA7.py @@ -17,7 +17,7 @@ def makeFigure(): """Get a list of the axis objects and create a figure.""" - ax, f = getSetup((10, 10), (2, 2)) + ax, f = getSetup((15, 15), (4, 4)) X = anndata.read_h5ad("/opt/northwest_bal/full_fitted.h5ad") X = add_obs(X, "binary_outcome") @@ -26,9 +26,9 @@ def makeFigure(): celltype_count_perc_df = cell_count_perc_df(X, celltype="cell_type") - for i in range(4): + for i, cmp in enumerate([2, 25, 19, 26, 34, 27, 37, 44, 8, 31]): plot_correlation_cmp_cell_count_perc( - X, i + 1, celltype_count_perc_df, ax[i], cellPerc=True + X, cmp, celltype_count_perc_df, ax[i], cellPerc=True ) return f