annotate scripts/dendrogram.R @ 1:1b2bed57b440 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d5c7ca22af1d4f0eaa7a607886554bebb95e8c50
author bgruening
date Mon, 28 Oct 2024 17:32:07 +0000
parents 22232092be53
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
1 ##
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
2 suppressWarnings(suppressPackageStartupMessages(library(xbioc)))
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
3 suppressWarnings(suppressPackageStartupMessages(library(MuSiC)))
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
4 suppressWarnings(suppressPackageStartupMessages(library(reshape2)))
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
5 suppressWarnings(suppressPackageStartupMessages(library(cowplot)))
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
6 ## We use this script to generate a clustering dendrogram of cell
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
7 ## types, using the prior labelling from scRNA.
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
8
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
9 read_list <- function(lfile) {
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
10 if (lfile == "None") {
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
11 return(NULL)
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
12 }
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
13 return(read.table(file = lfile, header = FALSE, check.names = FALSE,
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
14 stringsAsFactors = FALSE)$V1)
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
15 }
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
16
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
17 args <- commandArgs(trailingOnly = TRUE)
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
18 source(args[1])
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
19
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
20
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
21 ## Perform the estimation
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
22 ## Produce the first step information
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
23 sub.basis <- music_basis(scrna_eset, clusters = celltypes_label,
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
24 samples = samples_label,
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
25 select.ct = celltypes)
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
26
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
27 ## Plot the dendrogram of design matrix and cross-subject mean of
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
28 ## realtive abundance
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
29 ## Hierarchical clustering using Complete Linkage
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
30 d1 <- dist(t(log(sub.basis$Disgn.mtx + 1e-6)), method = "euclidean")
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
31 hc1 <- hclust(d1, method = "complete")
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
32 ## Hierarchical clustering using Complete Linkage
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
33 d2 <- dist(t(log(sub.basis$M.theta + 1e-8)), method = "euclidean")
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
34 hc2 <- hclust(d2, method = "complete")
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
35
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
36
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
37 if (length(data.to.use) > 0) {
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
38 ## We then perform bulk tissue cell type estimation with pre-grouping
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
39 ## of cell types: C, list_of_cell_types, marker genes name, marker
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
40 ## genes list.
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
41 ## data.to.use = list(
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
42 ## "C1" = list(cell.types = c("Neutro"),
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
43 ## marker.names=NULL,
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
44 ## marker.list=NULL),
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
45 ## "C2" = list(cell.types = c("Podo"),
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
46 ## marker.names=NULL,
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
47 ## marker.list=NULL),
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
48 ## "C3" = list(cell.types = c("Endo","CD-PC","LOH","CD-IC","DCT","PT"),
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
49 ## marker.names = "Epithelial",
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
50 ## marker.list = read_list("../test-data/epith.markers")),
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
51 ## "C4" = list(cell.types = c("Macro","Fib","B lymph","NK","T lymph"),
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
52 ## marker.names = "Immune",
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
53 ## marker.list = read_list("../test-data/immune.markers"))
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
54 ## )
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
55 grouped_celltypes <- lapply(data.to.use, function(x) {
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
56 x$cell.types
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
57 })
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
58 marker_groups <- lapply(data.to.use, function(x) {
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
59 x$marker.list
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
60 })
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
61 names(marker_groups) <- names(data.to.use)
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
62
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
63
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
64 cl_type <- as.character(scrna_eset[[celltypes_label]])
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
65
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
66 for (cl in seq_len(length(grouped_celltypes))) {
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
67 cl_type[cl_type %in%
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
68 grouped_celltypes[[cl]]] <- names(grouped_celltypes)[cl]
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
69 }
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
70 pData(scrna_eset)[[clustertype_label]] <- factor(
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
71 cl_type, levels = c(names(grouped_celltypes),
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
72 "CD-Trans", "Novel1", "Novel2"))
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
73
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
74 est_bulk <- music_prop.cluster(
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
75 bulk.eset = bulk_eset, sc.eset = scrna_eset,
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
76 group.markers = marker_groups, clusters = celltypes_label,
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
77 groups = clustertype_label, samples = samples_label,
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
78 clusters.type = grouped_celltypes
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
79 )
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
80
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
81 estimated_music_props <- est_bulk$Est.prop.weighted.cluster
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
82 ## NNLS is not calculated here
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
83
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
84 ## Show different in estimation methods
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
85 ## Jitter plot of estimated cell type proportions
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
86 methods_list <- c("MuSiC")
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
87
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
88 jitter_fig <- Jitter_Est(
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
89 list(data.matrix(estimated_music_props)),
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
90 method.name = methods_list, title = "Jitter plot of Est Proportions",
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
91 size = 2, alpha = 0.7) +
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
92 theme_minimal() +
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
93 labs(x = element_blank(), y = element_blank()) +
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
94 theme(axis.text = element_text(size = 6),
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
95 axis.text.x = element_blank(),
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
96 legend.position = "none")
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
97
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
98 plot_box <- Boxplot_Est(list(
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
99 data.matrix(estimated_music_props)),
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
100 method.name = methods_list) +
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
101 theme_minimal() +
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
102 labs(x = element_blank(), y = element_blank()) +
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
103 theme(axis.text = element_text(size = 6),
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
104 axis.text.x = element_blank(),
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
105 legend.position = "none")
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
106
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
107 plot_hmap <- Prop_heat_Est(list(
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
108 data.matrix(estimated_music_props)),
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
109 method.name = methods_list) +
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
110 labs(x = element_blank(), y = element_blank()) +
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
111 theme(axis.text.y = element_text(size = 6),
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
112 axis.text.x = element_text(angle = -90, size = 5),
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
113 plot.title = element_text(size = 9),
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
114 legend.key.width = unit(0.15, "cm"),
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
115 legend.text = element_text(size = 5),
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
116 legend.title = element_text(size = 5))
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
117
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
118 }
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
119
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
120 pdf(file = outfile_pdf, width = 8, height = 8)
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
121 par(mfrow = c(1, 2))
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
122 plot(hc1, cex = 0.6, hang = -1, main = "Cluster log(Design Matrix)")
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
123 plot(hc2, cex = 0.6, hang = -1, main = "Cluster log(Mean of RA)")
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
124 if (length(data.to.use) > 0) {
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
125 plot_grid(jitter_fig, plot_box, plot_hmap, ncol = 2, nrow = 2)
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
126 }
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
127 message(dev.off())
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
128
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
129 if (length(data.to.use) > 0) {
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
130 write.table(estimated_music_props,
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
131 file = outfile_tab, quote = F, col.names = NA, sep = "\t")
22232092be53 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d007ae51743e621dc47524f681501e72ef3a2910"
bgruening
parents:
diff changeset
132 }