annotate scripts/dendrogram.R @ 4:7009462b958f draft default tip

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