Mercurial > repos > bgruening > music_inspect_eset
annotate scripts/compare.R @ 3:8c64a2da3869 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
author | bgruening |
---|---|
date | Thu, 10 Feb 2022 12:52:56 +0000 |
parents | |
children | 7705cc75ac18 |
rev | line source |
---|---|
3
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
1 suppressWarnings(suppressPackageStartupMessages(library(xbioc))) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
2 suppressWarnings(suppressPackageStartupMessages(library(MuSiC))) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
3 suppressWarnings(suppressPackageStartupMessages(library(reshape2))) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
4 suppressWarnings(suppressPackageStartupMessages(library(cowplot))) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
5 ## We use this script to estimate the effectiveness of proportion methods |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
6 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
7 ## Load Conf |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
8 args <- commandArgs(trailingOnly = TRUE) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
9 source(args[1]) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
10 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
11 method_key <- list("MuSiC" = "est_music", |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
12 "NNLS" = "est_nnls")[[est_method]] |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
13 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
14 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
15 scale_yaxes <- function(gplot, value) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
16 if (is.na(value)) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
17 gplot |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
18 } else { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
19 gplot + scale_y_continuous(lim = c(0, value)) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
20 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
21 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
22 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
23 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
24 set_factor_data <- function(bulk_data, factor_name = NULL) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
25 if (is.null(factor_name)) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
26 factor_name <- "None" ## change to something plottable |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
27 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
28 pdat <- pData(bulk_data) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
29 sam_fact <- NULL |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
30 if (factor_name %in% colnames(pdat)) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
31 sam_fact <- cbind(rownames(pdat), |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
32 as.character(pdat[[factor_name]])) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
33 cat(paste0(" - factor: ", factor_name, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
34 " found in phenotypes\n")) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
35 } else { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
36 ## We assign this as the factor for the entire dataset |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
37 sam_fact <- cbind(rownames(pdat), |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
38 factor_name) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
39 cat(paste0(" - factor: assigning \"", factor_name, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
40 "\" to whole dataset\n")) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
41 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
42 colnames(sam_fact) <- c("Samples", "Factors") |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
43 return(as.data.frame(sam_fact)) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
44 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
45 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
46 ## Due to limiting sizes, we need to load and unload |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
47 ## possibly very large datasets. |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
48 process_pair <- function(sc_data, bulk_data, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
49 ctypes_label, samples_label, ctypes, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
50 factor_group) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
51 ## - Generate |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
52 est_prop <- music_prop( |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
53 bulk.eset = bulk_data, sc.eset = sc_data, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
54 clusters = ctypes_label, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
55 samples = samples_label, select.ct = ctypes, verbose = T) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
56 ## - |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
57 estimated_music_props <- est_prop$Est.prop.weighted |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
58 estimated_nnls_props <- est_prop$Est.prop.allgene |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
59 ## - |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
60 fact_data <- set_factor_data(bulk_data, factor_group) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
61 ## - |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
62 return(list(est_music = estimated_music_props, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
63 est_nnls = estimated_nnls_props, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
64 bulk_sample_totals = colSums(exprs(bulk_data)), |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
65 plot_groups = fact_data)) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
66 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
67 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
68 music_on_all <- function(files) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
69 results <- list() |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
70 for (sc_name in names(files)) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
71 cat(paste0("sc-group:", sc_name, "\n")) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
72 scgroup <- files[[sc_name]] |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
73 ## - sc Data |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
74 sc_est <- readRDS(scgroup$dataset) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
75 ## - params |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
76 celltypes_label <- scgroup$label_cell |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
77 samples_label <- scgroup$label_sample |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
78 celltypes <- scgroup$celltype |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
79 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
80 results[[sc_name]] <- list() |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
81 for (bulk_name in names(scgroup$bulk)) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
82 cat(paste0(" - bulk-group:", bulk_name, "\n")) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
83 bulkgroup <- scgroup$bulk[[bulk_name]] |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
84 ## - bulk Data |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
85 bulk_est <- readRDS(bulkgroup$dataset) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
86 ## - bulk params |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
87 pheno_facts <- bulkgroup$pheno_facts |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
88 pheno_excl <- bulkgroup$pheno_excl |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
89 ## |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
90 results[[sc_name]][[bulk_name]] <- process_pair( |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
91 sc_est, bulk_est, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
92 celltypes_label, samples_label, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
93 celltypes, bulkgroup$factor_group) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
94 ## |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
95 rm(bulk_est) ## unload |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
96 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
97 rm(sc_est) ## unload |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
98 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
99 return(results) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
100 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
101 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
102 plot_all_individual_heatmaps <- function(results) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
103 pdf(out_heatmulti_pdf, width = 8, height = 8) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
104 for (sc_name in names(results)) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
105 for (bk_name in names(results[[sc_name]])) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
106 res <- results[[sc_name]][[bk_name]] |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
107 plot_hmap <- Prop_heat_Est( |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
108 data.matrix(res[[method_key]]), method.name = est_method) + |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
109 ggtitle(paste0("[", est_method, "Cell type ", |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
110 "proportions in ", |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
111 bk_name, " (Bulk) based on ", |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
112 sc_name, " (scRNA)")) + |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
113 xlab("Cell Types (scRNA)") + |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
114 ylab("Samples (Bulk)") + |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
115 theme(axis.text.x = element_text(angle = -90), |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
116 axis.text.y = element_text(size = 6)) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
117 print(plot_hmap) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
118 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
119 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
120 dev.off() |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
121 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
122 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
123 merge_factors_spread <- function(grudat_spread, factor_groups) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
124 ## Generated |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
125 merge_it <- function(matr, plot_groups, valname) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
126 ren <- melt(lapply(matr, function(mat) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
127 mat["ct"] <- rownames(mat); return(mat)})) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
128 ## - Grab factors and merge into list |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
129 ren_new <- merge(ren, plot_groups, by.x = "variable", by.y = "Samples") |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
130 colnames(ren_new) <- c("Sample", "Cell", valname, "Bulk", "Factors") |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
131 return(ren_new) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
132 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
133 tab <- merge(merge_it(grudat$spread$prop, factor_groups, "value.prop"), |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
134 merge_it(grudat$spread$scale, factor_groups, "value.scale"), |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
135 by = c("Sample", "Cell", "Bulk", "Factors")) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
136 return(tab) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
137 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
138 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
139 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
140 plot_grouped_heatmaps <- function(results) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
141 pdf(out_heatmulti_pdf, width = 8, height = 8) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
142 for (sc_name in names(results)) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
143 named_list <- sapply( |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
144 names(results[[sc_name]]), |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
145 function(n) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
146 ## We transpose the data here, because |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
147 ## the plotting function omits by default |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
148 ## the Y-axis which are the samples. |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
149 ## Since the celltypes are the common factor |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
150 ## these should be the Y-axis instead. |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
151 t(data.matrix(results[[sc_name]][[n]][[method_key]])) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
152 }, simplify = F, USE.NAMES = T) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
153 named_methods <- names(results[[sc_name]]) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
154 ## |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
155 plot_hmap <- Prop_heat_Est( |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
156 named_list, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
157 method.name = named_methods) + |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
158 ggtitle(paste0("[", est_method, "] Cell type ", |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
159 "proportions of ", |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
160 "Bulk Datasets based on ", |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
161 sc_name, " (scRNA)")) + |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
162 xlab("Samples (Bulk)") + |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
163 ylab("Cell Types (scRNA)") + |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
164 theme(axis.text.x = element_text(angle = -90), |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
165 axis.text.y = element_text(size = 6)) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
166 print(plot_hmap) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
167 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
168 dev.off() |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
169 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
170 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
171 ## Desired plots |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
172 ## 1. Pie chart: |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
173 ## - Per Bulk dataset (using just normalised proportions) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
174 ## - Per Bulk dataset (multiplying proportions by nreads) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
175 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
176 unlist_names <- function(results, method, prepend_bkname=FALSE) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
177 unique(sort( |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
178 unlist(lapply(names(results), function(scname) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
179 lapply(names(results[[scname]]), function(bkname) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
180 res <- get(method)(results[[scname]][[bkname]][[method_key]]) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
181 if (prepend_bkname) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
182 ## We *do not* assume unique bulk sample names |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
183 ## across different bulk datasets. |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
184 res <- paste0(bkname, "::", res) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
185 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
186 return(res) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
187 }) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
188 })) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
189 )) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
190 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
191 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
192 summarized_matrix <- function(results) { # nolint |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
193 ## We assume that cell types MUST be unique, but that sample |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
194 ## names do not need to be. For this reason, we must prepend |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
195 ## the bulk dataset name to the individual sample names. |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
196 all_celltypes <- unlist_names(results, "colnames") |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
197 all_samples <- unlist_names(results, "rownames", prepend_bkname = TRUE) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
198 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
199 ## Iterate through all possible samples and populate a table. |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
200 ddff <- data.frame() |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
201 ddff_scale <- data.frame() |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
202 for (cell in all_celltypes) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
203 for (sample in all_samples) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
204 group_sname <- unlist(strsplit(sample, split = "::")) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
205 bulk <- group_sname[1] |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
206 id_sample <- group_sname[2] |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
207 for (scgroup in names(results)) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
208 if (bulk %in% names(results[[scgroup]])) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
209 mat_prop <- results[[scgroup]][[bulk]][[method_key]] |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
210 vec_counts <- results[[scgroup]][[bulk]]$bulk_sample_totals |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
211 ## - We use sample instead of id_sample because we need to |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
212 ## extract bulk sets from the complete matrix later. It's |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
213 ## messy, yes. |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
214 if (cell %in% colnames(mat_prop)) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
215 ddff[cell, sample] <- mat_prop[id_sample, cell] |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
216 ddff_scale[cell, sample] <- mat_prop[id_sample, cell] * vec_counts[[id_sample]] #nolint |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
217 } else { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
218 ddff[cell, sample] <- 0 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
219 ddff_scale[cell, sample] <- 0 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
220 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
221 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
222 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
223 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
224 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
225 return(list(prop = ddff, scaled = ddff_scale)) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
226 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
227 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
228 flatten_factor_list <- function(results) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
229 ## Get a 2d DF of all factors across all bulk samples. |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
230 res <- c() |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
231 for (scgroup in names(results)) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
232 for (bulkgroup in names(results[[scgroup]])) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
233 dat <- results[[scgroup]][[bulkgroup]]$plot_groups |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
234 dat$Samples <- paste0(bulkgroup, "::", dat$Samples) #nolint |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
235 res <- rbind(res, dat) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
236 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
237 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
238 return(res) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
239 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
240 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
241 group_by_dataset <- function(summat) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
242 bulk_names <- unlist( |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
243 lapply(names(files), function(x) names(files[[x]]$bulk))) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
244 mat_names <- colnames(summat$prop) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
245 bd <- list() |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
246 bd_scale <- list() |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
247 bd_spread_scale <- list() |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
248 bd_spread_prop <- list() |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
249 for (bname in bulk_names) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
250 subs <- mat_names[startsWith(mat_names, paste0(bname, "::"))] |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
251 ## - |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
252 bd[[bname]] <- rowSums(summat$prop[, subs]) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
253 bd_scale[[bname]] <- rowSums(summat$scaled[, subs]) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
254 bd_spread_scale[[bname]] <- summat$scaled[, subs] |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
255 bd_spread_prop[[bname]] <- summat$prop[, subs] |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
256 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
257 return(list(prop = as.data.frame(bd), |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
258 scaled = as.data.frame(bd_scale), |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
259 spread = list(scale = bd_spread_scale, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
260 prop = bd_spread_prop))) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
261 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
262 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
263 summarize_heatmaps <- function(grudat_spread_melt, do_factors) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
264 ## - |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
265 do_single <- function(grudat_melted, yaxis, xaxis, fillval, title, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
266 ylabs = element_blank(), xlabs = element_blank(), |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
267 use_log = TRUE, size = 11) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
268 ## Convert from matrix to long format |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
269 melted <- grudat_melted ## copy? |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
270 if (use_log) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
271 melted[[fillval]] <- log10(melted[[fillval]] + 1) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
272 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
273 return(ggplot(melted) + |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
274 geom_tile(aes_string(y = yaxis, x = xaxis, fill = fillval), |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
275 colour = "white") + |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
276 scale_fill_gradient2(low = "steelblue", high = "red", |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
277 mid = "white", name = element_blank()) + |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
278 theme(axis.text.x = element_text(angle = -90, hjust = 0, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
279 size = size)) + |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
280 ggtitle(label = title) + xlab(xlabs) + ylab(ylabs)) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
281 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
282 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
283 do_gridplot <- function(title, xvar, plot="both", ncol=2, size = 11) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
284 do_logged <- (plot %in% c("log", "both")) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
285 do_normal <- (plot %in% c("normal", "both")) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
286 plist <- list() |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
287 if (do_logged) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
288 plist[["1"]] <- do_single(grudat_spread_melt, "Cell", xvar, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
289 "value.scale", "Reads (log10+1)", |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
290 size = size) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
291 plist[["2"]] <- do_single(grudat_spread_melt, "Cell", xvar, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
292 "value.prop", "Sample (log10+1)", |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
293 size = size) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
294 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
295 if (do_normal) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
296 plist[["A"]] <- do_single(grudat_spread_melt, "Cell", xvar, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
297 "value.scale", "Reads", use_log = F, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
298 size = size) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
299 plist[["B"]] <- do_single(grudat_spread_melt, "Cell", xvar, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
300 "value.prop", "Sample", use_log = F, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
301 size = size) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
302 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
303 return(plot_grid(ggdraw() + draw_label(title, fontface = "bold"), |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
304 plot_grid(plotlist = plist, ncol = ncol), |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
305 ncol = 1, rel_heights = c(0.05, 0.95))) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
306 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
307 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
308 p1 <- do_gridplot("Cell Types vs Bulk Datasets", "Bulk", "both", ) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
309 p2a <- do_gridplot("Cell Types vs Samples", "Sample", "normal", 1, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
310 size = 8) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
311 p2b <- do_gridplot("Cell Types vs Samples (log10+1)", "Sample", "log", 1, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
312 size = 8) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
313 p3 <- ggplot + theme_void() |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
314 if (do_factors) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
315 p3 <- do_gridplot("Cell Types against Factors", "Factors", "both") |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
316 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
317 return(list(bulk = p1, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
318 samples = list(log = p2b, normal = p2a), |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
319 factors = p3)) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
320 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
321 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
322 summarize_boxplots <- function(grudat_spread, do_factors) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
323 common1 <- ggplot(grudat_spread, aes(x = value.prop)) + ggtitle("Sample") + |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
324 xlab(element_blank()) + ylab(element_blank()) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
325 common2 <- ggplot(grudat_spread, aes(x = value.scale)) + ggtitle("Reads") + |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
326 xlab(element_blank()) + ylab(element_blank()) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
327 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
328 A <- B <- list() #nolint |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
329 ## Cell type by sample |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
330 A$p1 <- common2 + geom_boxplot(aes(y = Cell, color = Bulk)) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
331 A$p2 <- common1 + geom_boxplot(aes(y = Cell, color = Bulk)) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
332 ## Sample by Cell type |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
333 B$p1 <- common2 + geom_boxplot(aes(y = Bulk, color = Cell)) + |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
334 ylab("Bulk Dataset") |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
335 B$p2 <- common1 + geom_boxplot(aes(y = Bulk, color = Cell)) + |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
336 ylab("Bulk Dataset") |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
337 ## -- Factor plots are optional |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
338 A$p3 <- B$p3 <- A$p4 <- B$p4 <- ggplot() + theme_void() |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
339 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
340 if (do_factors) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
341 A$p3 <- common1 + geom_boxplot(aes(y = Cell, color = Factors)) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
342 A$p4 <- common2 + geom_boxplot(aes(y = Cell, color = Factors)) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
343 B$p3 <- common1 + geom_boxplot(aes(y = Bulk, color = Factors)) + |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
344 ylab("Bulk Dataset") |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
345 B$p4 <- common2 + geom_boxplot(aes(y = Bulk, color = Factors)) + |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
346 ylab("Bulk Dataset") |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
347 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
348 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
349 title_a <- "Cell Types against Bulk" |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
350 title_b <- "Bulk Datasets against Cells" |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
351 if (do_factors) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
352 title_a <- paste0(title_a, " and Factors") |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
353 title_b <- paste0(title_b, " and Factors") |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
354 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
355 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
356 a_all <- plot_grid(ggdraw() + draw_label(title_a, fontface = "bold"), |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
357 plot_grid(plotlist = A, ncol = 2), |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
358 ncol = 1, rel_heights = c(0.05, 0.95)) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
359 b_all <- plot_grid(ggdraw() + draw_label(title_b, fontface = "bold"), |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
360 plot_grid(plotlist = B, ncol = 2), |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
361 ncol = 1, rel_heights = c(0.05, 0.95)) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
362 return(list(cell = a_all, bulk = b_all)) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
363 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
364 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
365 filter_output <- function(grudat_spread_melt, out_filt) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
366 print_red <- function(comment, red_list) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
367 cat(paste(comment, paste(red_list, collapse = ", "), "\n")) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
368 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
369 grudat_filt <- grudat_spread_melt |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
370 print_red("Total Cell types:", unique(grudat_filt$Cell)) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
371 if (!is.null(out_filt$cells)) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
372 grudat_filt <- grudat_filt[grudat_filt$Cell %in% out_filt$cells, ] |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
373 print_red(" - selecting:", out_filt$cells) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
374 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
375 print_red("Total Factors:", unique(grudat_spread_melt$Factors)) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
376 if (!is.null(out_filt$facts)) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
377 grudat_filt <- grudat_filt[grudat_filt$Factors %in% out_filt$facts, ] |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
378 print_red(" - selecting:", out_filt$facts) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
379 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
380 return(grudat_filt) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
381 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
382 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
383 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
384 results <- music_on_all(files) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
385 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
386 if (heat_grouped_p) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
387 plot_grouped_heatmaps(results) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
388 } else { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
389 plot_all_individual_heatmaps(results) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
390 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
391 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
392 save.image("/tmp/sesh.rds") |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
393 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
394 summat <- summarized_matrix(results) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
395 grudat <- group_by_dataset(summat) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
396 grudat_spread_melt <- merge_factors_spread(grudat$spread, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
397 flatten_factor_list(results)) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
398 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
399 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
400 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
401 ## The output filters ONLY apply to boxplots, since these take |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
402 do_factors <- (length(unique(grudat_spread_melt[["Factors"]])) > 1) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
403 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
404 grudat_spread_melt_filt <- filter_output(grudat_spread_melt, out_filt) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
405 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
406 heat_maps <- summarize_heatmaps(grudat_spread_melt_filt, do_factors) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
407 box_plots <- summarize_boxplots(grudat_spread_melt_filt, do_factors) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
408 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
409 pdf(out_heatsumm_pdf, width = 14, height = 14) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
410 print(heat_maps) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
411 print(box_plots) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
412 dev.off() |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
413 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
414 ## Generate output tables |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
415 stats_prop <- lapply(grudat$spread$prop, function(x) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
416 t(apply(x, 1, summary))}) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
417 stats_scale <- lapply(grudat$spread$scale, function(x) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
418 t(apply(x, 1, summary))}) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
419 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
420 writable2 <- function(obj, prefix, title) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
421 write.table(obj, |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
422 file = paste0("report_data/", prefix, "_", |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
423 title, ".tabular"), |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
424 quote = F, sep = "\t", col.names = NA) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
425 } |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
426 ## Make the value table printable |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
427 grudat_spread_melt$value.scale <- as.integer(grudat_spread_melt$value.scale) # nolint |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
428 colnames(grudat_spread_melt) <- c("Sample", "Cell", "Bulk", "Factors", |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
429 "CT Prop in Sample", "Number of Reads") |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
430 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
431 writable2(grudat_spread_melt, "values", "Data Table") |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
432 writable2(summat$prop, "values", "Matrix of Cell Type Sample Proportions") |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
433 writable2({ |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
434 aa <- as.matrix(summat$scaled); mode(aa) <- "integer"; aa |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
435 }, "values", "Matrix of Cell Type Read Counts") |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
436 |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
437 for (bname in names(stats_prop)) { |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
438 writable2(stats_prop[[bname]], "stats", paste0(bname, ": Sample Props")) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
439 writable2(stats_scale[[bname]], "stats", paste0(bname, ": Read Props")) |
8c64a2da3869
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 8beed1a19fcd9dc59f7746e1dfa735a2d5f29784"
bgruening
parents:
diff
changeset
|
440 } |