broadinstitute / lincs-cell-painting

Processed Cell Painting Data for the LINCS Drug Repurposing Project
BSD 3-Clause "New" or "Revised" License
25 stars 13 forks source link

Adding whole-plate normalization consensus signatures #41

Closed gwaybio closed 4 years ago

gwaybio commented 4 years ago

In #36, we added DMSO normalized consensus signatures. Here, I add whole-plate normalized consensus signatures.

The file suffixes are as follows:

Plate Normalization Consensus Normalization Consensus Suffix
DMSO Median <BATCH>_consensus_median_dmso.csv.gz
DMSO MODZ <BATCH>_consensus_modz_dmso.csv.gz
Whole Plate Median <BATCH>_consensus_median.csv.gz
Whole Plate MODZ <BATCH>_consensus_modz.csv.gz
gwaybio commented 4 years ago

Note that we will update #33 once this is merged

shntnu commented 4 years ago

Just one more thing https://github.com/broadinstitute/lincs-cell-painting/blob/cd8b0f7c79611178e430972c2a036645d727f299/consensus/scripts/nbconverted/build-consensus-signatures.py#L140-L154

I'd recommend making compound_replicate_cols identical to dmso_replicate_cols by including Metadata_pert_well. Replicates are only across plates for all but 2 compounds + DMSOs. For DMSO, we do want position information. It would be great to also have this for the two compounds as well.

image

platemaps <- list.files("../../metadata/2016_04_01_a549_48hr_batch1/platemap/", pattern = "*.txt", full.names = T) %>% map_df(read_tsv)

platemaps %>% mutate(plate_map_name = str_sub(plate_map_name, 15, 17)) %>% mutate(broad_sample = replace_na(broad_sample, "DMSO"), mmoles_per_liter = replace_na(mmoles_per_liter, 0)) %>% rowwise() %>% mutate(broad_sample = ifelse(broad_sample == "DMSO", "DMSO", str_match(broad_sample, "(BRD)-([A-Z]+[0-9]{8})")[[3]])) %>% ungroup() %>% group_by(plate_map_name, broad_sample, mmoles_per_liter) %>% tally() %>% filter(n > 1) %>% ggplot(aes(interaction(broad_sample, round(mmoles_per_liter)), n)) + geom_col() + facet_wrap(~plate_map_name, nrow = 4) + theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5))
gwaybio commented 4 years ago

I'd recommend making compound_replicate_cols identical to dmso_replicate_cols by including Metadata_pert_well.

💯 will add next commit

gwaybio commented 4 years ago

done in 33b8df111414cb0d063db4e746020b4c9e735b95 (plus some added documentation) @shntnu thanks for these suggestions! Ready for another look