Skip to content

redo map without death labels #169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
596 changes: 239 additions & 357 deletions 9.mAP/notebooks/0.generate_map_scores_morphology.ipynb

Large diffs are not rendered by default.

520 changes: 215 additions & 305 deletions 9.mAP/notebooks/1.generate_map_scores_secretome.ipynb

Large diffs are not rendered by default.

60 changes: 30 additions & 30 deletions 9.mAP/notebooks/2.visualize_map_scores.ipynb

Large diffs are not rendered by default.

30 changes: 28 additions & 2 deletions 9.mAP/scripts/0.generate_map_scores_morphology.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
# In[8]:


pos_sameby = ["Metadata_Treatment", "Metadata_labels", reference_col]
pos_sameby = ["Metadata_Treatment", reference_col]
pos_diffby = []
neg_sameby = []
neg_diffby = ["Metadata_Treatment", reference_col]
Expand All @@ -148,7 +148,33 @@
activity_map["-log10(p-value)"] = -activity_map["corrected_p_value"].apply(np.log10)
# flatten the multi-index columns to make it easier to work with
activity_map.reset_index(inplace=True)
activity_map.head()
# add apoptosis, pyroptosis and healthy columns to dataframe
activity_map["Apoptosis"] = activity_map.apply(
lambda row: row["Metadata_Treatment"] in apoptosis_ground_truth,
axis=1,
)
activity_map["Pyroptosis"] = activity_map.apply(
lambda row: row["Metadata_Treatment"] in pyroptosis_ground_truth,
axis=1,
)
activity_map["Control"] = activity_map.apply(
lambda row: row["Metadata_Treatment"] in control_ground_truth,
axis=1,
)

# merge apoptosis, pyroptosis, and healthy columns into one column
activity_map["Metadata_labels"] = activity_map.apply(
lambda row: "Apoptosis"
if row["Apoptosis"]
else "Pyroptosis"
if row["Pyroptosis"]
else "Control",
axis=1,
)
metadata_labels = activity_map.pop("Metadata_labels")
activity_map.insert(1, "Metadata_labels", metadata_labels)
# # drop apoptosis, pyroptosis, and healthy columns
activity_map.drop(columns=["Apoptosis", "Pyroptosis", "Control"], inplace=True)


# In[10]:
Expand Down
28 changes: 27 additions & 1 deletion 9.mAP/scripts/1.generate_map_scores_secretome.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,33 @@
activity_map["-log10(p-value)"] = -activity_map["corrected_p_value"].apply(np.log10)
# flatten the multi-index columns to make it easier to work with
activity_map.reset_index(inplace=True)
activity_map.head()
# add apoptosis, pyroptosis and healthy columns to dataframe
activity_map["Apoptosis"] = activity_map.apply(
lambda row: row["Metadata_Treatment"] in apoptosis_ground_truth,
axis=1,
)
activity_map["Pyroptosis"] = activity_map.apply(
lambda row: row["Metadata_Treatment"] in pyroptosis_ground_truth,
axis=1,
)
activity_map["Control"] = activity_map.apply(
lambda row: row["Metadata_Treatment"] in control_ground_truth,
axis=1,
)

# merge apoptosis, pyroptosis, and healthy columns into one column
activity_map["Metadata_labels"] = activity_map.apply(
lambda row: "Apoptosis"
if row["Apoptosis"]
else "Pyroptosis"
if row["Pyroptosis"]
else "Control",
axis=1,
)
metadata_labels = activity_map.pop("Metadata_labels")
activity_map.insert(1, "Metadata_labels", metadata_labels)
# # drop apoptosis, pyroptosis, and healthy columns
activity_map.drop(columns=["Apoptosis", "Pyroptosis", "Control"], inplace=True)


# In[10]:
Expand Down
2 changes: 1 addition & 1 deletion 9.mAP/scripts/2.visualize_map_scores.r
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ scatter_by_treatment <- (
'Topotecan 10.0 nM',
'Topotecan 20.0 nM'
),
values = colors)
values = colors_5)
+ scale_shape_manual(
name = "Inhibitor",
labels = c(
Expand Down
Binary file modified figures/4.figure4/figures/figure4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
4 changes: 2 additions & 2 deletions figures/4.figure4/notebooks/figure4.ipynb

Large diffs are not rendered by default.

Binary file modified figures/S7/figures/PBMCS7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
651 changes: 563 additions & 88 deletions figures/S7/notebooks/S7.ipynb

Large diffs are not rendered by default.

29 changes: 14 additions & 15 deletions figures/S7/scripts/S7.r
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ df <- merge(morphology_data, secretome_data,by = c("Metadata_Treatment", "Metada


df$Metadata_labels <- factor(df$Metadata_labels, levels = c("Control", "Apoptosis", "Pyroptosis"))
df$Metadata_Treatment <- factor(df$Metadata_Treatment, levels =levels_list)
# df$Metadata_Treatment <- factor(df$Metadata_Treatment, levels =levels_list)

length(unique(df$Metadata_Treatment))
unique(df$Metadata_Treatment)
df <- df %>%
mutate(Metadata_Treatment = case_when(
Metadata_Treatment =='DMSO_0.100_%_DMSO_0.025_%' ~ "DMSO 0.1% - DMSO 0.025%",
Expand All @@ -125,7 +127,7 @@ df <- df %>%
Metadata_Treatment =='Flagellin_1.000_ug_per_ml_Disulfiram_1.000_uM' ~ "Flagellin 1.0 ug/ml - Disulfiram 1.0 uM",
Metadata_Treatment =='LPS_0.010_ug_per_ml_DMSO_0.025_%' ~ "LPS 0.01 ug/ml - DMSO 0.025%",
Metadata_Treatment =='LPS_0.100_ug_per_ml_DMSO_0.025_%' ~ "LPS 0.1 ug/ml - DMSO 0.025%",
Metadata_Treatment =='Flagellin_0.100_ug_per_ml_DMSO_0.0_%' ~ "Flagellin 0.1 ug/ml - DMSO 0.0%",
# Metadata_Treatment =='Flagellin_0.100_ug_per_ml_DMSO_0.0_%' ~ "Flagellin 0.1 ug/ml - DMSO 0.0%",
Metadata_Treatment =='Flagellin_0.100_ug_per_ml_DMSO_0.025_%' ~ "Flagellin 0.1 ug/ml - DMSO 0.025%",
Metadata_Treatment =='Disulfiram_0.100_uM_DMSO_0.025_%' ~ "Disulfiram 0.1 uM - DMSO 0.025%",
Metadata_Treatment =='LPS_Nigericin_1.000_ug_per_ml_1.000_uM_DMSO_0.025_%' ~ "LPS 1.0 ug/ml + Nigericin 1.0 uM - DMSO 0.025%",
Expand All @@ -134,7 +136,7 @@ df <- df %>%
Metadata_Treatment =='LPS_Nigericin_1.000_ug_per_ml_10.000_uM_Z-VAD-FMK_100.000_uM' ~ "LPS 1.0 ug/ml + Nigericin 10.0 uM - Z-VAD-FMK 100.0 uM",
Metadata_Treatment =='LPS_Nigericin_1.000_ug_per_ml_3.000_uM_DMSO_0.025_%' ~ "LPS 1.0 ug/ml + Nigericin 3.0 uM - DMSO 0.025%",
Metadata_Treatment =='LPS_1.000_ug_per_ml_DMSO_0.025_%' ~ "LPS 1.0 ug/ml - DMSO 0.025%",
Metadata_Treatment =='Flagellin_1.000_ug_per_ml_DMSO_0.0_%' ~ "Flagellin 1.0 ug/ml - DMSO 0.025%",
# Metadata_Treatment =='Flagellin_1.000_ug_per_ml_DMSO_0.0_%' ~ "Flagellin 1.0 ug/ml - DMSO 0.025%",
Metadata_Treatment =='Disulfiram_1.000_uM_DMSO_0.025_%' ~ "Disulfiram 1.0 uM - DMSO 0.025%",
Metadata_Treatment =='Thapsigargin_1.000_uM_DMSO_0.025_%' ~ "Thapsigargin 1.0 uM - DMSO 0.025%",
Metadata_Treatment =='Topotecan_10.000_nM_DMSO_0.025_%' ~ "Topotecan 10.0 nM - DMSO 0.025%",
Expand All @@ -155,11 +157,15 @@ df <- df %>%
Metadata_Treatment =='Disulfiram_2.500_uM_DMSO_0.025_%' ~ "Disulfiram 2.5 uM - DMSO 0.025%",
Metadata_Treatment =='Topotecan_20.000_nM_DMSO_0.025_%' ~ "Topotecan 20.0 nM - DMSO 0.025%",
Metadata_Treatment =='Topotecan_5.000_nM_DMSO_0.025_%' ~ "Topotecan 5.0 nM - DMSO 0.025%",
Metadata_Treatment =='media_ctr_0.0_0_Media_ctr_0.0_0' ~ "Media ctr 0.0 0",
Metadata_Treatment =='media_ctr_0.0_0_Media_0.0_0' ~ "Media ctr 0.0 0"
Metadata_Treatment =='Media' ~ "Media",
# Metadata_Treatment =='media_ctr_0.0_0_Media_ctr_0.0_0' ~ "Media",
# Metadata_Treatment =='media_ctr_0.0_0_Media_0.0_0' ~ "Media"
))
# replace Media ctr 0.0 0 with Media
df$Metadata_Treatment <- gsub("Media ctr 0.0 0", "Media", df$Metadata_Treatment)
length(unique(df$Metadata_Treatment))

unique(df$Metadata_Treatment)


# split the Metadata_Treatment into two columns by the " - " delimiter
df <- df %>%
Expand All @@ -176,34 +182,26 @@ df$inducer <- factor(
levels = c(
'Media',
'DMSO 0.1%',

'Flagellin 0.1 ug/ml',
'Flagellin 1.0 ug/ml',

'LPS 0.01 ug/ml',
'LPS 0.1 ug/ml',
'LPS 1.0 ug/ml',
'LPS 10.0 ug/ml',
'LPS 100.0 ug/ml',

'LPS 1.0 ug/ml + Nigericin 1.0 uM',
'LPS 1.0 ug/ml + Nigericin 3.0 uM',
'LPS 1.0 ug/ml + Nigericin 10.0 uM',

'LPS 100.0 ug/ml + Nigericin 1.0 uM',
'LPS 100.0 ug/ml + Nigericin 3.0 uM',
'LPS 100.0 ug/ml + Nigericin 10.0 uM',

'H2O2 100.0 nM',
'H2O2 100.0 uM',

'Disulfiram 0.1 uM',
'Disulfiram 1.0 uM',
'Disulfiram 2.5 uM',

'Thapsigargin 1.0 uM',
'Thapsigargin 10.0 uM',

'Topotecan 5.0 nM',
'Topotecan 10.0 nM',
'Topotecan 20.0 nM'
Expand All @@ -227,6 +225,7 @@ df$inhibitor <- factor(
)
)
head(df)
unique(df$inducer)

width <- 15
height <- 15
Expand Down Expand Up @@ -279,7 +278,7 @@ scatter_by_treatment <- (
'Topotecan 10.0 nM',
'Topotecan 20.0 nM'
),
values = colors)
values = colors_5)
+ scale_shape_manual(
name = "Inhibitor",
labels = c(
Expand Down
33 changes: 33 additions & 0 deletions figures/utils/figure_themes.r
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,36 @@ colors_4 <- c(
)


colors_5 <- c(
'Media' = colorgrad1[1],
'DMSO 0.1%' = colorgrad1[2],

'Flagellin 0.1 ug/ml'= colorgrad5[1],
'Flagellin 1.0 ug/ml' = colorgrad5[2],

'LPS 0.01 ug/ml' = colorgrad2[1],
'LPS 0.1 ug/ml' = colorgrad2[2],
'LPS 1.0 ug/ml' = colorgrad2[3],
'LPS 10.0 ug/ml' = colorgrad2[4],
'LPS 100.0 ug/ml' = colorgrad2[5],
'LPS 1.0 ug/ml + Nigericin 1.0 uM' = colorgrad2[6],
'LPS 1.0 ug/ml + Nigericin 3.0 uM' = colorgrad2[7],
'LPS 1.0 ug/ml + Nigericin 10.0 uM' = colorgrad2[8],
'LPS 100.0 ug/ml + Nigericin 1.0 uM' = colorgrad2[9],
'LPS 100.0 ug/ml + Nigericin 3.0 uM' = colorgrad2[10],
'LPS 100.0 ug/ml + Nigericin 10.0 uM' = colorgrad2[11],

'H2O2 100.0 nM' = colorgrad7[1],
'H2O2 100.0 uM' = colorgrad7[2],

'Disulfiram 0.1 uM' = colorgrad4[3],
'Disulfiram 1.0 uM' = colorgrad4[4],
'Disulfiram 2.5 uM' = colorgrad4[5],

'Thapsigargin 1.0 uM' = colorgrad8[1],
'Thapsigargin 10.0 uM' = colorgrad8[2],

'Topotecan 5.0 nM' = colorgrad9[1],
'Topotecan 10.0 nM' = colorgrad9[2],
'Topotecan 20.0 nM' = colorgrad9[3]
)