Skip to content

Commit

Permalink
Save changes to fix labeling
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Ramirez committed Nov 5, 2024
1 parent 527409e commit 73801ef
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pf2/figures/commonFuncs/plotGeneral.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions pf2/figures/figureA11.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 9 additions & 2 deletions pf2/figures/figureA14.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand All @@ -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)


Expand Down
6 changes: 3 additions & 3 deletions pf2/figures/figureA2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions pf2/figures/figureA7.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand Down

0 comments on commit 73801ef

Please sign in to comment.