Skip to content

Commit

Permalink
Merge pull request #75 from gwaygenomics/rearrange-fig-names
Browse files Browse the repository at this point in the history
[Response to Reviewers] Update all figure names
  • Loading branch information
gwaybio authored May 5, 2022
2 parents 659face + 6b5d769 commit 3d7ed0f
Show file tree
Hide file tree
Showing 115 changed files with 3,807 additions and 20,022 deletions.
18 changes: 16 additions & 2 deletions 1.Data-exploration/gene_target_median_correlation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,21 @@
"execution_count": 3,
"id": "4861408c-f0cd-4d9e-8b54-d52734e96f9d",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Number of unique targets: 720\n"
]
}
],
"source": [
"# Match compounds that target the same genes\n",
"# Note the compound can also target _other_ genes as well\n",
"all_targets = {x: list(set(x.split(\"|\"))) for x in cp_df.Metadata_target.unique().tolist()}\n",
"\n",
"all_unique_targets = []\n",
"cp_target_comparisons = {}\n",
"for target in all_targets:\n",
" target_set = set(all_targets[target])\n",
Expand All @@ -216,7 +225,12 @@
" if target in cp_target_comparisons:\n",
" cp_target_comparisons[target].append(compare_target)\n",
" else:\n",
" cp_target_comparisons[target] = [compare_target]"
" cp_target_comparisons[target] = [compare_target]\n",
" \n",
" all_unique_targets += list(target_set)\n",
"\n",
"all_unique_targets = set(all_unique_targets)\n",
"print(f\"Number of unique targets: {len(all_unique_targets)}\")"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
# Note the compound can also target _other_ genes as well
all_targets = {x: list(set(x.split("|"))) for x in cp_df.Metadata_target.unique().tolist()}

all_unique_targets = []
cp_target_comparisons = {}
for target in all_targets:
target_set = set(all_targets[target])
Expand All @@ -54,6 +55,11 @@
cp_target_comparisons[target].append(compare_target)
else:
cp_target_comparisons[target] = [compare_target]

all_unique_targets += list(target_set)

all_unique_targets = set(all_unique_targets)
print(f"Number of unique targets: {len(all_unique_targets)}")


# In[4]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"metadata": {},
"outputs": [],
"source": [
"output_figure_base <- file.path(\"figures\", \"figure1\")\n",
"output_figure_base <- file.path(\"figures\", \"figure1_percentreplicating\")\n",
"extensions <- c(\".png\", \".pdf\")"
]
},
Expand All @@ -42,7 +42,9 @@
"id": "013de854-d981-42c6-85d3-5f19edc32aef",
"metadata": {},
"source": [
"### Panel A - Within assay percent replicating non-parametric p values"
"### Panel B - Within assay percent replicating non-parametric p values\n",
"\n",
"Note, Panel A is a single cell example Cell Painting image"
]
},
{
Expand Down Expand Up @@ -367,7 +369,7 @@
}
],
"source": [
"panel_a_gg <- (\n",
"panel_b_gg <- (\n",
" ggplot(pr_pval_df, aes(x = median_score, y = neg_log_10_p_val))\n",
" + geom_point(aes(color = no_of_compounds), alpha = 0.05)\n",
" + geom_text(data = percent_replicating_df, aes(label = percent_replicating, x = 0.65, y = 2.5))\n",
Expand All @@ -384,15 +386,15 @@
" + guides(color = guide_legend(override.aes = list(alpha = 1, size = 2)))\n",
")\n",
"\n",
"panel_a_gg"
"panel_b_gg"
]
},
{
"cell_type": "markdown",
"id": "699ddb14-3066-4399-a329-3204eb40e614",
"metadata": {},
"source": [
"## Panel B - Comparing percent replicating scores\n",
"## Panel C - Comparing percent replicating scores\n",
"\n",
"At the perturbation level between the two assays."
]
Expand Down Expand Up @@ -556,7 +558,7 @@
}
],
"source": [
"panel_b_gg <- (\n",
"panel_c_gg <- (\n",
" ggplot(\n",
" pr_summary_df %>%\n",
" # Remove compounds measured in different wells inconsistently\n",
Expand All @@ -571,15 +573,15 @@
" + ylab(\"L1000: Median pairwise\\nreplicate Spearman correlation\")\n",
")\n",
"\n",
"panel_b_gg"
"panel_c_gg"
]
},
{
"cell_type": "markdown",
"id": "6e667e14-c5eb-4985-b586-7a687cb27792",
"metadata": {},
"source": [
"## Panel C - Percent replicating summary\n",
"## Panel D - Percent replicating summary\n",
"\n",
"Which compounds pass the null distribution threshold?"
]
Expand Down Expand Up @@ -869,7 +871,7 @@
"source": [
"updated_assay_colors <- c(assay_colors, \"Both\" = \"#DF74F0\")\n",
"\n",
"panel_c_gg <- (\n",
"panel_d_gg <- (\n",
" ggplot(full_rect)\n",
" + geom_rect(\n",
" aes(\n",
Expand Down Expand Up @@ -899,7 +901,7 @@
"\n",
")\n",
"\n",
"panel_c_gg"
"panel_d_gg"
]
},
{
Expand All @@ -917,9 +919,9 @@
"metadata": {},
"outputs": [],
"source": [
"panel_a_gg <- panel_a_gg + labs(tag = \"b\")\n",
"panel_b_gg <- panel_b_gg + labs(tag = \"c\")\n",
"panel_c_gg <- panel_c_gg + labs(tag = \"d\")"
"panel_b_gg <- panel_b_gg + labs(tag = \"b\")\n",
"panel_c_gg <- panel_c_gg + labs(tag = \"c\")\n",
"panel_d_gg <- panel_d_gg + labs(tag = \"d\")"
]
},
{
Expand Down Expand Up @@ -962,10 +964,10 @@
],
"source": [
"# We add an updated panel a in the resubmission, update tags here\n",
"left_panel <- (panel_a_gg / panel_b_gg) + plot_layout(heights = c(2, 1))\n",
"left_panel <- (panel_b_gg / panel_c_gg) + plot_layout(heights = c(2, 1))\n",
"\n",
"figure_1_gg <- (\n",
" ( left_panel | panel_c_gg)\n",
" ( left_panel | panel_d_gg)\n",
" + plot_layout(widths = c(2, 1))\n",
")\n",
"\n",
Expand All @@ -980,7 +982,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "R [conda env:lincs-complimentarity-figures]",
"display_name": "R [conda env:lincs-complimentarity-figures] *",
"language": "R",
"name": "conda-env-lincs-complimentarity-figures-r"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "09a930c5-017c-4bc8-9bb6-eb6b31deba02",
"metadata": {},
"source": [
"## Figure 3\n",
"## Figure 2\n",
"\n",
"Perturbation sample diversity"
]
Expand Down Expand Up @@ -34,7 +34,7 @@
"metadata": {},
"outputs": [],
"source": [
"output_figure_base <- file.path(\"figures\", \"figure3\")\n",
"output_figure_base <- file.path(\"figures\", \"figure2_sampleanalysis\")\n",
"extensions <- c(\".png\", \".pdf\")"
]
},
Expand Down Expand Up @@ -443,7 +443,7 @@
" labels = c(\"\", \"\")\n",
")\n",
"\n",
"figure3_gg <- cowplot::plot_grid(\n",
"figure2_gg <- cowplot::plot_grid(\n",
" cowplot::plot_grid(\n",
" cp_umap_gg,\n",
" l1000_umap_gg,\n",
Expand All @@ -456,20 +456,12 @@
" labels = c(\"\", \"b\")\n",
")\n",
"\n",
"figure3_gg"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "b1044714-10fb-4a5b-ba16-49c44885e943",
"metadata": {},
"outputs": [],
"source": [
"for (extension in extensions) {\n",
" output_file <- paste0(output_figure_base, extension)\n",
" cowplot::save_plot(output_file, figure3_gg, base_width = 12, base_height = 11, dpi = 500)\n",
"}"
" cowplot::save_plot(output_file, figure2_gg, base_width = 12, base_height = 11, dpi = 500)\n",
"}\n",
"\n",
"figure2_gg"
]
}
],
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit 3d7ed0f

Please sign in to comment.