Mercurial > repos > bgruening > music_deconvolution
annotate scripts/dendrogram.R @ 3:064056f47ff2 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 20f8561478535013e111d982b99639f48f1bea79"
author | bgruening |
---|---|
date | Sat, 29 Jan 2022 12:49:59 +0000 |
parents | f7ade72ba78c |
children |
rev | line source |
---|---|
0
7de1b99d16ed
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 08c6fd3885bdfbf8b5c3f4dcc2d04729b577e3e1"
bgruening
parents:
diff
changeset
|
1 ## |
7de1b99d16ed
"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))) |
7de1b99d16ed
"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))) |
7de1b99d16ed
"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))) |
7de1b99d16ed
"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))) |
7de1b99d16ed
"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 |
7de1b99d16ed
"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. |
7de1b99d16ed
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 08c6fd3885bdfbf8b5c3f4dcc2d04729b577e3e1"
bgruening
parents:
diff
changeset
|
8 |
7de1b99d16ed
"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) { |
7de1b99d16ed
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 08c6fd3885bdfbf8b5c3f4dcc2d04729b577e3e1"
bgruening
parents:
diff
changeset
|
10 if (lfile == "None") { |
7de1b99d16ed
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 08c6fd3885bdfbf8b5c3f4dcc2d04729b577e3e1"
bgruening
parents:
diff
changeset
|
11 return(NULL) |
7de1b99d16ed
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 08c6fd3885bdfbf8b5c3f4dcc2d04729b577e3e1"
bgruening
parents:
diff
changeset
|
12 } |
3
064056f47ff2
"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
7de1b99d16ed
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 08c6fd3885bdfbf8b5c3f4dcc2d04729b577e3e1"
bgruening
parents:
diff
changeset
|
14 stringsAsFactors = FALSE)$V1) |
7de1b99d16ed
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 08c6fd3885bdfbf8b5c3f4dcc2d04729b577e3e1"
bgruening
parents:
diff
changeset
|
15 } |
7de1b99d16ed
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 08c6fd3885bdfbf8b5c3f4dcc2d04729b577e3e1"
bgruening
parents:
diff
changeset
|
16 |
7de1b99d16ed
"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) |
7de1b99d16ed
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 08c6fd3885bdfbf8b5c3f4dcc2d04729b577e3e1"
bgruening
parents:
diff
changeset
|
18 source(args[1]) |
7de1b99d16ed
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 08c6fd3885bdfbf8b5c3f4dcc2d04729b577e3e1"
bgruening
parents:
diff
changeset
|
19 |
7de1b99d16ed
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 08c6fd3885bdfbf8b5c3f4dcc2d04729b577e3e1"
bgruening
parents:
diff
changeset
|
20 |
7de1b99d16ed
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 08c6fd3885bdfbf8b5c3f4dcc2d04729b577e3e1"
bgruening
parents:
diff
changeset
|
21 ## Perform the estimation |
7de1b99d16ed
"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 |
7de1b99d16ed
"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, |
7de1b99d16ed
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 08c6fd3885bdfbf8b5c3f4dcc2d04729b577e3e1"
bgruening
parents:
diff
changeset
|
24 samples = samples_label, |
7de1b99d16ed
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 08c6fd3885bdfbf8b5c3f4dcc2d04729b577e3e1"
bgruening
parents:
diff
changeset
|
25 select.ct = celltypes) |
7de1b99d16ed
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 08c6fd3885bdfbf8b5c3f4dcc2d04729b577e3e1"
bgruening
parents:
diff
changeset
|
26 |
7de1b99d16ed
"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 |
7de1b99d16ed
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 08c6fd3885bdfbf8b5c3f4dcc2d04729b577e3e1"
bgruening
parents:
diff
changeset
|
28 ## realtive abundance |
1
f7ade72ba78c
"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 |
f7ade72ba78c
"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") |
f7ade72ba78c
"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
7de1b99d16ed
"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
f7ade72ba78c
"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") |
f7ade72ba78c
"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") |
f7ade72ba78c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
bgruening
parents:
0
diff
changeset
|
35 |
0
7de1b99d16ed
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 08c6fd3885bdfbf8b5c3f4dcc2d04729b577e3e1"
bgruening
parents:
diff
changeset
|
36 |
1
f7ade72ba78c
"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) { |
f7ade72ba78c
"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 |
f7ade72ba78c
"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 |
f7ade72ba78c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
bgruening
parents:
0
diff
changeset
|
40 ## genes list. |
f7ade72ba78c
"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( |
f7ade72ba78c
"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"), |
f7ade72ba78c
"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, |
f7ade72ba78c
"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), |
f7ade72ba78c
"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"), |
f7ade72ba78c
"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, |
f7ade72ba78c
"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), |
f7ade72ba78c
"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"), |
f7ade72ba78c
"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", |
f7ade72ba78c
"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")), |
f7ade72ba78c
"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"), |
f7ade72ba78c
"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", |
f7ade72ba78c
"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")) |
f7ade72ba78c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
bgruening
parents:
0
diff
changeset
|
54 ## ) |
f7ade72ba78c
"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) { |
f7ade72ba78c
"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 |
f7ade72ba78c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
bgruening
parents:
0
diff
changeset
|
57 }) |
f7ade72ba78c
"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) { |
f7ade72ba78c
"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 |
f7ade72ba78c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
bgruening
parents:
0
diff
changeset
|
60 }) |
f7ade72ba78c
"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) |
f7ade72ba78c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
bgruening
parents:
0
diff
changeset
|
62 |
f7ade72ba78c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
bgruening
parents:
0
diff
changeset
|
63 |
f7ade72ba78c
"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]]) |
f7ade72ba78c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
bgruening
parents:
0
diff
changeset
|
65 |
f7ade72ba78c
"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))) { |
f7ade72ba78c
"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% |
f7ade72ba78c
"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] |
f7ade72ba78c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
bgruening
parents:
0
diff
changeset
|
69 } |
f7ade72ba78c
"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( |
f7ade72ba78c
"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), |
f7ade72ba78c
"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")) |
f7ade72ba78c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
bgruening
parents:
0
diff
changeset
|
73 |
f7ade72ba78c
"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( |
f7ade72ba78c
"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, |
f7ade72ba78c
"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, |
f7ade72ba78c
"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, |
f7ade72ba78c
"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 |
f7ade72ba78c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
bgruening
parents:
0
diff
changeset
|
79 ) |
0
7de1b99d16ed
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 08c6fd3885bdfbf8b5c3f4dcc2d04729b577e3e1"
bgruening
parents:
diff
changeset
|
80 |
1
f7ade72ba78c
"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 |
f7ade72ba78c
"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 |
f7ade72ba78c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
bgruening
parents:
0
diff
changeset
|
83 |
f7ade72ba78c
"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 |
f7ade72ba78c
"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 |
f7ade72ba78c
"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") |
f7ade72ba78c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
bgruening
parents:
0
diff
changeset
|
87 |
f7ade72ba78c
"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( |
f7ade72ba78c
"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)), |
f7ade72ba78c
"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", |
f7ade72ba78c
"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) + |
f7ade72ba78c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
bgruening
parents:
0
diff
changeset
|
92 theme_minimal() + |
f7ade72ba78c
"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()) + |
f7ade72ba78c
"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), |
f7ade72ba78c
"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(), |
f7ade72ba78c
"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") |
f7ade72ba78c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
bgruening
parents:
0
diff
changeset
|
97 |
f7ade72ba78c
"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( |
f7ade72ba78c
"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)), |
f7ade72ba78c
"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) + |
f7ade72ba78c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
bgruening
parents:
0
diff
changeset
|
101 theme_minimal() + |
f7ade72ba78c
"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()) + |
f7ade72ba78c
"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), |
f7ade72ba78c
"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(), |
f7ade72ba78c
"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
7de1b99d16ed
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 08c6fd3885bdfbf8b5c3f4dcc2d04729b577e3e1"
bgruening
parents:
diff
changeset
|
106 |
1
f7ade72ba78c
"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( |
f7ade72ba78c
"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)), |
f7ade72ba78c
"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) + |
f7ade72ba78c
"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()) + |
f7ade72ba78c
"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), |
f7ade72ba78c
"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), |
f7ade72ba78c
"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), |
f7ade72ba78c
"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"), |
f7ade72ba78c
"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), |
f7ade72ba78c
"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
7de1b99d16ed
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 08c6fd3885bdfbf8b5c3f4dcc2d04729b577e3e1"
bgruening
parents:
diff
changeset
|
117 |
1
f7ade72ba78c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
bgruening
parents:
0
diff
changeset
|
118 } |
f7ade72ba78c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
bgruening
parents:
0
diff
changeset
|
119 |
f7ade72ba78c
"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) |
f7ade72ba78c
"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)) |
f7ade72ba78c
"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)") |
f7ade72ba78c
"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)") |
f7ade72ba78c
"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) { |
f7ade72ba78c
"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) |
f7ade72ba78c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
bgruening
parents:
0
diff
changeset
|
126 } |
f7ade72ba78c
"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()) |
f7ade72ba78c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
bgruening
parents:
0
diff
changeset
|
128 |
f7ade72ba78c
"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) { |
f7ade72ba78c
"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, |
f7ade72ba78c
"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") |
f7ade72ba78c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit 683bb72ae92b5759a239b7e3bf4c5a229ed35b54"
bgruening
parents:
0
diff
changeset
|
132 } |