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