From f6c7c4ae77bf73d9462bd07ac0183dbbe432f476 Mon Sep 17 00:00:00 2001 From: Andrew Ramirez Date: Wed, 4 Sep 2024 15:55:38 -0700 Subject: [PATCH] Make direct comparisons for DEG --- pf2/figures/figureA11.py | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/pf2/figures/figureA11.py b/pf2/figures/figureA11.py index 40346c8..7b7e3f6 100644 --- a/pf2/figures/figureA11.py +++ b/pf2/figures/figureA11.py @@ -35,17 +35,30 @@ def makeFigure(): df = add_label(X, "KIF20A", ax[0], cmp1, cmp2) X.obs["Label"] = df["Cell Type"].astype(str) + df["Label"].astype(str) + print(np.unique(X.obs["Label"])) + + XX = X[(X.obs["Label"] == "MacrophagesCmp3")] + XXXX = X[(X.obs["Label"] == "MacrophagesCmp26")] + XXX = X[(X.obs["Label"] == "MacrophagesNoLabel")] + newX = sc.pp.subsample(XXX, fraction=.1, copy=True) + + print(np.unique(XX.obs["Label"])) + print(np.unique(newX.obs["Label"])) + + finalX = anndata.concat([newX, XX, XXXX]) + + + print(np.unique(finalX.obs["Label"])) - print(X) - XX = X[(X.obs["Label"] == "MacrophagesCmp3") & (X.obs["Label"] == "MacrophagesCmp26") & (X.obs["Label"] == "MacrophagesNoLabel")] - sc.tl.rank_genes_groups(X, "Label", method="wilcoxon", groups="MacrophagesCmp3", reference="MacrophagesCmp26") - sc.pl.rank_genes_groups(X, n_genes=30, save="Cmp_3_26_wilcoxon.png") + # print(X) + # sc.tl.rank_genes_groups(X, "Label", method="wilcoxon", groups="MacrophagesCmp3", reference="MacrophagesCmp26") + # sc.pl.rank_genes_groups(X, n_genes=30, save="Cmp_3_26_wilcoxon.png") - # sc.tl.rank_genes_groups(X, "Label", method="'t-test", groups=["MacrophagesCmp3", "MacrophagesCmp26"], reference="MacrophagesNoLabel") - # sc.pl.rank_genes_groups(X, n_genes=30, save="Cmp_3_26_test.png") + sc.tl.rank_genes_groups(finalX, "Label", method="wilcoxon", groups=["MacrophagesCmp3", "MacrophagesCmp26"], reference="MacrophagesNoLabel") + sc.pl.rank_genes_groups(finalX, n_genes=30, save="Cmp_3_26_test.png") return f