From 319dce44f9f8ee8e14a045cfd38bcc291dc37be3 Mon Sep 17 00:00:00 2001 From: Kartavya Vashishtha Date: Wed, 31 Jan 2024 10:08:45 -0500 Subject: [PATCH] remove sample prefix from sample number removes discrepancies in "sample_" prefix removal --- server/scripts/Librarian/.Rhistory | 18 +++++++++--------- .../Librarian/Librarian_offline_analysis.Rmd | 6 +++--- .../Librarian/librarian_offline_analysis.R | 6 +++--- server/scripts/Librarian_analysis.Rmd | 6 +++--- ...arian_plotting_test_samples_server_220623.R | 6 +++--- server/src/lib.rs | 2 +- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/server/scripts/Librarian/.Rhistory b/server/scripts/Librarian/.Rhistory index 3d58f00..ff8b13c 100644 --- a/server/scripts/Librarian/.Rhistory +++ b/server/scripts/Librarian/.Rhistory @@ -85,7 +85,7 @@ mutate(lib_type = gsub("DNase-Hypersensitivity", "DNase-HS", lib_type)) %>% ggplot(aes(UMAP1,UMAP2)) + geom_point(size = 1.5, aes(colour = lib_type, group = SRR)) + geom_point(data = test_coordinates, aes(UMAP1, UMAP2), colour = "black", shape = 1, size = 5, stroke = 3) + -geom_text(data = test_coordinates, aes(UMAP1, UMAP2, label = gsub("sample_","", sample)), size = 6, nudge_x = 1, nudge_y = 1) + +geom_text(data = test_coordinates, aes(UMAP1, UMAP2, label = sample), size = 6, nudge_x = 1, nudge_y = 1) + theme_bw(base_size = 14) + theme(legend.title = element_text(size = 12)) + #ylim(-10, 10) + @@ -149,7 +149,7 @@ theme(legend.title = element_blank(), axis.title = element_blank(), panel.backgr geom_tile(aes(fill = percentage)) + scale_fill_viridis_c(option = "inferno", direction = -1) + geom_point(data = test_coordinates, aes(UMAP1, UMAP2), fill = "black", colour = "#609CE1", shape = 1, size = 3, stroke = 1 ) + -geom_text(data = test_coordinates, aes(x=UMAP1, y=UMAP2, label = gsub("sample_","", sample)), size = 3, nudge_x = 2, nudge_y = 1) + +geom_text(data = test_coordinates, aes(x=UMAP1, y=UMAP2, label = sample), size = 3, nudge_x = 2, nudge_y = 1) + ggtitle("percent of library per tile") + facet_wrap(facets = "library_type", ncol = 5) + theme(text = element_text(family = "sans"), aspect.ratio = 0.8, panel.background = element_rect(fill = "#feffe9"), panel.grid = element_blank(), plot.title = element_text(size = 14, hjust = 0.5)) -> umap_grid_tile_long_plot @@ -169,7 +169,7 @@ pivot_longer(5:last_col(), names_to = "library_type", values_to = "percent") -> ## Plotting grid stats as heatmap test_percentage %>% mutate(library_type = factor(library_type, levels = sort(unique(library_type), decreasing = TRUE))) %>% -mutate(sample = gsub("sample_", "", sample)) %>% +mutate(sample = sample) %>% ggplot(aes(sample, library_type, fill = percent)) + geom_tile() + scale_fill_gradient(low = "white", high = "red") + @@ -251,7 +251,7 @@ mutate(lib_type = gsub("DNase-Hypersensitivity", "DNase-HS", lib_type)) %>% ggplot(aes(UMAP1,UMAP2)) + geom_point(size = 1.5, aes(colour = lib_type, group = SRR)) + geom_point(data = test_coordinates, aes(UMAP1, UMAP2), colour = "black", shape = 1, size = 5, stroke = 3) + -geom_text(data = test_coordinates, aes(UMAP1, UMAP2, label = gsub("sample_","", sample)), size = 6, nudge_x = 1, nudge_y = 1) + +geom_text(data = test_coordinates, aes(UMAP1, UMAP2, label = sample), size = 6, nudge_x = 1, nudge_y = 1) + theme_bw(base_size = 14) + theme(legend.title = element_text(size = 12)) + #ylim(-10, 10) + @@ -307,7 +307,7 @@ theme(legend.title = element_blank(), axis.title = element_blank(), panel.backgr geom_tile(aes(fill = percentage)) + scale_fill_viridis_c(option = "inferno", direction = -1) + geom_point(data = test_coordinates, aes(UMAP1, UMAP2), fill = "black", colour = "#609CE1", shape = 1, size = 3, stroke = 1 ) + -geom_text(data = test_coordinates, aes(x=UMAP1, y=UMAP2, label = gsub("sample_","", sample)), size = 3, nudge_x = 2, nudge_y = 1) + +geom_text(data = test_coordinates, aes(x=UMAP1, y=UMAP2, label = sample), size = 3, nudge_x = 2, nudge_y = 1) + ggtitle("percent of library per tile") + facet_wrap(facets = "library_type", ncol = 5) + theme(text = element_text(family = "sans"), aspect.ratio = 0.8, panel.background = element_rect(fill = "#feffe9"), panel.grid = element_blank(), plot.title = element_text(size = 14, hjust = 0.5)) -> umap_grid_tile_long_plot @@ -321,7 +321,7 @@ left_join(grid_tile_corr_percentages) %>% pivot_longer(5:last_col(), names_to = "library_type", values_to = "percent") -> test_percentage test_percentage %>% mutate(library_type = factor(library_type, levels = sort(unique(library_type), decreasing = TRUE))) %>% -mutate(sample = gsub("sample_", "", sample)) %>% +mutate(sample = sample) %>% ggplot(aes(sample, library_type, fill = percent)) + geom_tile() + scale_fill_gradient(low = "white", high = "red") + @@ -398,7 +398,7 @@ mutate(lib_type = gsub("DNase-Hypersensitivity", "DNase-HS", lib_type)) %>% ggplot(aes(UMAP1,UMAP2)) + geom_point(size = 1.5, aes(colour = lib_type, group = SRR)) + geom_point(data = test_coordinates, aes(UMAP1, UMAP2), colour = "black", shape = 1, size = 5, stroke = 3) + -geom_text(data = test_coordinates, aes(UMAP1, UMAP2, label = gsub("sample_","", sample)), size = 6, nudge_x = 1, nudge_y = 1) + +geom_text(data = test_coordinates, aes(UMAP1, UMAP2, label = sample), size = 6, nudge_x = 1, nudge_y = 1) + theme_bw(base_size = 14) + theme(legend.title = element_text(size = 12)) + #ylim(-10, 10) + @@ -462,7 +462,7 @@ theme(legend.title = element_blank(), axis.title = element_blank(), panel.backgr geom_tile(aes(fill = percentage)) + scale_fill_viridis_c(option = "inferno", direction = -1) + geom_point(data = test_coordinates, aes(UMAP1, UMAP2), fill = "black", colour = "#609CE1", shape = 1, size = 3, stroke = 1 ) + -geom_text(data = test_coordinates, aes(x=UMAP1, y=UMAP2, label = gsub("sample_","", sample)), size = 3, nudge_x = 2, nudge_y = 1) + +geom_text(data = test_coordinates, aes(x=UMAP1, y=UMAP2, label = sample), size = 3, nudge_x = 2, nudge_y = 1) + ggtitle("percent of library per tile") + facet_wrap(facets = "library_type", ncol = 5) + theme(text = element_text(family = "sans"), aspect.ratio = 0.8, panel.background = element_rect(fill = "#feffe9"), panel.grid = element_blank(), plot.title = element_text(size = 14, hjust = 0.5)) -> umap_grid_tile_long_plot @@ -482,7 +482,7 @@ pivot_longer(5:last_col(), names_to = "library_type", values_to = "percent") -> ## Plotting grid stats as heatmap test_percentage %>% mutate(library_type = factor(library_type, levels = sort(unique(library_type), decreasing = TRUE))) %>% -mutate(sample = gsub("sample_", "", sample)) %>% +mutate(sample = sample) %>% ggplot(aes(sample, library_type, fill = percent)) + geom_tile() + scale_fill_gradient(low = "white", high = "red") + diff --git a/server/scripts/Librarian/Librarian_offline_analysis.Rmd b/server/scripts/Librarian/Librarian_offline_analysis.Rmd index ecf5640..2f819de 100644 --- a/server/scripts/Librarian/Librarian_offline_analysis.Rmd +++ b/server/scripts/Librarian/Librarian_offline_analysis.Rmd @@ -120,7 +120,7 @@ compositions_umap_results %>% ggplot(aes(UMAP1,UMAP2)) + geom_point(size = 1.5, aes(colour = lib_type, group = SRR)) + geom_point(data = test_coordinates, aes(UMAP1, UMAP2), colour = "black", shape = 1, size = 5, stroke = 3) + - geom_text(data = test_coordinates, aes(UMAP1, UMAP2, label = gsub("sample_","", sample)), size = 6, nudge_x = 1, nudge_y = 1) + + geom_text(data = test_coordinates, aes(UMAP1, UMAP2, label = sample), size = 6, nudge_x = 1, nudge_y = 1) + theme_bw(base_size = 14) + theme(legend.title = element_text(size = 12)) + #ylim(-10, 10) + @@ -204,7 +204,7 @@ umap_grid_tile_long %>% geom_tile(aes(fill = percentage)) + scale_fill_viridis_c(option = "inferno", direction = -1) + geom_point(data = test_coordinates, aes(UMAP1, UMAP2), fill = "black", colour = "#609CE1", shape = 1, size = 3, stroke = 1 ) + - geom_text(data = test_coordinates, aes(x=UMAP1, y=UMAP2, label = gsub("sample_","", sample)), size = 3, nudge_x = 2, nudge_y = 1) + + geom_text(data = test_coordinates, aes(x=UMAP1, y=UMAP2, label = sample), size = 3, nudge_x = 2, nudge_y = 1) + ggtitle("percent of library per tile") + facet_wrap(facets = "library_type", ncol = 5) + theme(text = element_text(family = "sans"), aspect.ratio = 0.8, panel.background = element_rect(fill = "#feffe9"), panel.grid = element_blank(), plot.title = element_text(size = 14, hjust = 0.5)) -> umap_grid_tile_long_plot @@ -236,7 +236,7 @@ test_grid %>% test_percentage %>% mutate(library_type = factor(library_type, levels = sort(unique(library_type), decreasing = TRUE))) %>% - mutate(sample = gsub("sample_", "", sample)) %>% + mutate(sample = sample) %>% ggplot(aes(sample, library_type, fill = percent)) + geom_tile() + scale_fill_gradient(low = "white", high = "red") + diff --git a/server/scripts/Librarian/librarian_offline_analysis.R b/server/scripts/Librarian/librarian_offline_analysis.R index ac17190..eecac71 100644 --- a/server/scripts/Librarian/librarian_offline_analysis.R +++ b/server/scripts/Librarian/librarian_offline_analysis.R @@ -111,7 +111,7 @@ compositions_umap_results %>% ggplot(aes(UMAP1,UMAP2)) + geom_point(size = 1.5, aes(colour = lib_type, group = SRR)) + geom_point(data = test_coordinates, aes(UMAP1, UMAP2), colour = "black", shape = 1, size = 5, stroke = 3) + - geom_text(data = test_coordinates, aes(UMAP1, UMAP2, label = gsub("sample_","", sample)), size = 6, nudge_x = 1, nudge_y = 1) + + geom_text(data = test_coordinates, aes(UMAP1, UMAP2, label = sample), size = 6, nudge_x = 1, nudge_y = 1) + theme_bw(base_size = 14) + theme(legend.title = element_text(size = 12)) + #ylim(-10, 10) + @@ -195,7 +195,7 @@ umap_grid_tile_long %>% geom_tile(aes(fill = percentage)) + scale_fill_viridis_c(option = "inferno", direction = -1) + geom_point(data = test_coordinates, aes(UMAP1, UMAP2), fill = "black", colour = "#609CE1", shape = 1, size = 3, stroke = 1 ) + - geom_text(data = test_coordinates, aes(x=UMAP1, y=UMAP2, label = gsub("sample_","", sample)), size = 3, nudge_x = 2, nudge_y = 1) + + geom_text(data = test_coordinates, aes(x=UMAP1, y=UMAP2, label = sample), size = 3, nudge_x = 2, nudge_y = 1) + ggtitle("percent of library per tile") + facet_wrap(facets = "library_type", ncol = 5) + theme(text = element_text(family = "sans"), aspect.ratio = 0.8, panel.background = element_rect(fill = "#feffe9"), panel.grid = element_blank(), plot.title = element_text(size = 14, hjust = 0.5)) -> umap_grid_tile_long_plot @@ -227,7 +227,7 @@ test_grid %>% test_percentage %>% mutate(library_type = factor(library_type, levels = sort(unique(library_type), decreasing = TRUE))) %>% - mutate(sample = gsub("sample_", "", sample)) %>% + mutate(sample = sample) %>% ggplot(aes(sample, library_type, fill = percent)) + geom_tile() + scale_fill_gradient(low = "white", high = "red") + diff --git a/server/scripts/Librarian_analysis.Rmd b/server/scripts/Librarian_analysis.Rmd index 82f1b36..5dd02a5 100644 --- a/server/scripts/Librarian_analysis.Rmd +++ b/server/scripts/Librarian_analysis.Rmd @@ -117,7 +117,7 @@ compositions_umap_results %>% ggplot(aes(UMAP1,UMAP2)) + geom_point(size = 1.5, aes(colour = lib_type, group = SRR)) + geom_point(data = test_coordinates, aes(UMAP1, UMAP2), colour = "black", shape = 1, size = 5, stroke = 3) + - geom_text(data = test_coordinates, aes(UMAP1, UMAP2, label = gsub("sample_","", sample)), size = 6, nudge_x = 1, nudge_y = 1) + + geom_text(data = test_coordinates, aes(UMAP1, UMAP2, label = sample), size = 6, nudge_x = 1, nudge_y = 1) + theme_bw(base_size = 14) + theme(legend.title = element_text(size = 12)) + #ylim(-10, 10) + @@ -199,7 +199,7 @@ umap_grid_tile_long %>% geom_tile(aes(fill = percentage)) + scale_fill_viridis_c(option = "inferno", direction = -1) + geom_point(data = test_coordinates, aes(UMAP1, UMAP2), fill = "black", colour = "#609CE1", shape = 1, size = 3, stroke = 1 ) + - geom_text(data = test_coordinates, aes(x=UMAP1, y=UMAP2, label = gsub("sample_","", sample)), size = 3, nudge_x = 2, nudge_y = 1) + + geom_text(data = test_coordinates, aes(x=UMAP1, y=UMAP2, label = sample), size = 3, nudge_x = 2, nudge_y = 1) + ggtitle("percent of library per tile") + facet_wrap(facets = "library_type", ncol = 5) + theme(text = element_text(family = "sans"), aspect.ratio = 0.8, panel.background = element_rect(fill = "#feffe9"), panel.grid = element_blank(), plot.title = element_text(size = 14, hjust = 0.5)) -> umap_grid_tile_long_plot @@ -226,7 +226,7 @@ test_grid %>% test_percentage %>% mutate(library_type = factor(library_type, levels = sort(unique(library_type), decreasing = TRUE))) %>% - mutate(sample = gsub("sample_", "", sample)) %>% + mutate(sample = sample) %>% ggplot(aes(sample, library_type, fill = percent)) + geom_tile() + scale_fill_gradient(low = "white", high = "red") + diff --git a/server/scripts/librarian_plotting_test_samples_server_220623.R b/server/scripts/librarian_plotting_test_samples_server_220623.R index 7e7377a..9137f95 100644 --- a/server/scripts/librarian_plotting_test_samples_server_220623.R +++ b/server/scripts/librarian_plotting_test_samples_server_220623.R @@ -99,7 +99,7 @@ compositions_umap_results %>% ggplot(aes(UMAP1,UMAP2)) + geom_point(size = 1.5, aes(colour = lib_type, group = SRR)) + geom_point(data = test_coordinates, aes(UMAP1, UMAP2), colour = "black", shape = 1, size = 5, stroke = 3) + - geom_text(data = test_coordinates, aes(UMAP1, UMAP2, label = gsub("sample_","", sample)), size = 6, nudge_x = 1, nudge_y = 1) + + geom_text(data = test_coordinates, aes(UMAP1, UMAP2, label = sample), size = 6, nudge_x = 1, nudge_y = 1) + theme_bw(base_size = 14) + theme(legend.title = element_text(size = 12)) + #ylim(-10, 10) + @@ -180,7 +180,7 @@ umap_grid_tile_long %>% geom_tile(aes(fill = percentage)) + scale_fill_viridis_c(option = "inferno", direction = -1) + geom_point(data = test_coordinates, aes(UMAP1, UMAP2), fill = "black", colour = "#609CE1", shape = 1, size = 3, stroke = 1 ) + - geom_text(data = test_coordinates, aes(x=UMAP1, y=UMAP2, label = gsub("sample_","", sample)), size = 3, nudge_x = 2, nudge_y = 1) + + geom_text(data = test_coordinates, aes(x=UMAP1, y=UMAP2, label = sample), size = 3, nudge_x = 2, nudge_y = 1) + ggtitle("percent of library per tile") + facet_wrap(facets = "library_type", ncol = 5) + theme(text = element_text(family = "sans"), aspect.ratio = 0.8, panel.background = element_rect(fill = "#feffe9"), panel.grid = element_blank(), plot.title = element_text(size = 14, hjust = 0.5)) -> umap_grid_tile_long_plot @@ -207,7 +207,7 @@ test_grid %>% test_percentage %>% mutate(library_type = factor(library_type, levels = sort(unique(library_type), decreasing = TRUE))) %>% - mutate(sample = gsub("sample_", "", sample)) %>% + mutate(sample = sample) %>% ggplot(aes(sample, library_type, fill = percent)) + geom_tile() + scale_fill_gradient(low = "white", high = "red") + diff --git a/server/src/lib.rs b/server/src/lib.rs index 2d4e709..12b6ce4 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -135,7 +135,7 @@ pub fn serialize_comps_for_script(comp: Vec) -> String { // substitute tabs in sample names with spaces c.name = c.name.replace('\t', " "); - write!(&mut ser, "sample_{:02}\t{}\t", i + 1, c.name).unwrap(); // this unwrap never fails + write!(&mut ser, "{:02}\t{}\t", i + 1, c.name).unwrap(); // this unwrap never fails c.comp .lib .into_iter()