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