Skip to content
Snippets Groups Projects
Commit b453db9e authored by Thomas Schwarzl's avatar Thomas Schwarzl
Browse files

added replicate visualisations

#1
parent 4e935a62
Branches patch-1
No related tags found
No related merge requests found
Pipeline #48462 passed with stages
in 1 minute and 52 seconds
......@@ -89,7 +89,10 @@ out_dir_between_methods <- file.path(out_dir, "Plots_pae_vs_se")
out_dir_between_methods_by_type <- file.path(out_dir_between_methods, "by_type")
out_dir_comparisons <- file.path(out_dir, "Plots_comparisons")
out_dir_comparisons_by_type <- file.path(out_dir_comparisons, "by_type")
out_dir_comparisons_replicates <- file.path(out_dir, "Plots_replicates")
out_dir_comparisons_replicates_t <- file.path(out_dir_comparisons_replicates,
"by_type")
# directory for temporary file
tmp_dir <- "tmp"
......@@ -111,8 +114,12 @@ dir.create(out_dir_between_methods, recursive = T, showWarnings = F)
dir.create(out_dir_between_methods_by_type, recursive = T, showWarnings = F)
dir.create(out_dir_comparisons, recursive = T, showWarnings = F)
dir.create(out_dir_comparisons_by_type, recursive = T, showWarnings = F)
dir.create(out_dir_comparisons_replicates, recursive = T, showWarnings = F)
dir.create(out_dir_comparisons_replicates_t, recursive = T, showWarnings = F)
dir.create(tmp_dir, showWarnings = F)
```
### Files
......@@ -611,8 +618,106 @@ with_progress({
})
})
```
p
### Comparisons between replicates
Creating a list of comparisons between replicates
```{r}
#| label: select groups with multiple replicates
groups_with_multiple_replicates <- sampleInfo %>% group_by(group) %>%
summarize(n = n()) %>% dplyr::filter(n > 1) %>%
pull(group)
names(groups_with_multiple_replicates) <- groups_with_multiple_replicates
groups_with_multiple_replicates <- lapply(groups_with_multiple_replicates, function(x) {
getSampleNamesForGroup(sampleInfo, x)
})
```
```{r}
#| label: plots for replicate comparisons
with_progress({
prog <- progressor(along = names(groups_with_multiple_replicates))
tmp_plots_facet <- do_lapply(names(groups_with_multiple_replicates), function(i) {
prog()
xx = groups_with_multiple_replicates[[i]]
comp2_samples <- xx[[2]]
comp1_samples <- xx[[1]]
for(x1 in comp2_samples) {
for(y1 in comp1_samples) {
x1_file <- getFileSuffixForSampleName(sampleInfo, x1)
y1_file <- getFileSuffixForSampleName(sampleInfo, y1)
file_p <- file.path(out_dir_comparisons_replicates,
str_c(i,
"_",
x1_file,
"_",
y1_file,
".png"))
if(!file.exists(file_p)) {
p <- create_comparison_plot(vsd_anno, x1, y1)
save_plot(filename = file_p, p, base_asp = 2)
}
}
}
})
})
```
```{r}
#| label: "create_comparison_plots_by_type"
with_progress({
prog <- progressor(along = names(groups_with_multiple_replicates))
tmp_plots_facet <- do_lapply(names(groups_with_multiple_replicates), function(i) {
prog()
xx = groups_with_multiple_replicates[[i]]
comp2_samples <- xx[[2]]
comp1_samples <- xx[[1]]
for(x1 in comp2_samples) {
for(y1 in comp1_samples) {
x1_file <- getFileSuffixForSampleName(sampleInfo, x1)
y1_file <- getFileSuffixForSampleName(sampleInfo, y1)
file_p <- file.path(out_dir_comparisons_replicates_t,
str_c(i,
"_",
x1_file,
"_",
y1_file,
".png"))
p <- create_facet_plot(vsd_anno, x1, y1)
if(!file.exists(file_p)) {
save_plot(filename = file_p,
p,
base_height = 6,
base_asp = 1.8)
}
}
}
})
})
```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment