1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,21 +0,0 @@ |
1 |
- |
|
2 |
-reportMusic <- function(inSCE, output_file = NULL, |
|
3 |
- output_dir = NULL) { |
|
4 |
- |
|
5 |
- if (is.null(output_dir)){ |
|
6 |
- output_dir<- getwd() |
|
7 |
- } |
|
8 |
- |
|
9 |
- rmarkdown::render(system.file("rmarkdown/reportMusicRun.Rmd", package = "singleCellTK"), |
|
10 |
- params = list(object = inSCE, |
|
11 |
- bulkData = bulkData, |
|
12 |
- analysisName = analysisName, |
|
13 |
- analysisType = c("EstCellProp","PreGroupedClustProp","SingleCellClust")), |
|
14 |
- output_file = output_file, |
|
15 |
- output_dir = output_dir, |
|
16 |
- intermediates_dir = output_dir, |
|
17 |
- knit_root_dir = output_dir) |
|
18 |
- |
|
19 |
-} |
|
20 |
- |
|
21 |
-reportMusicresults |
|
22 | 0 |
\ No newline at end of file |
23 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,299 +0,0 @@ |
1 |
-#' @title Deconvolution of RNASeq data using single cell data |
|
2 |
-#' @description A wrapper that performs deconvolution and clustering using MuSiC tool and |
|
3 |
-#' SingleCellExperiment object |
|
4 |
-#' @param inSCE A \link[SingleCellExperiment]{SingleCellExperiment} object. |
|
5 |
-#' @param analysisType Character. Specify which function to run |
|
6 |
-#' Available options are "EstCellProp","PreGroupedClustProp","SingleCellClust" |
|
7 |
-#' @param analysisName Character. User-defined analysis name. |
|
8 |
-#' This will be used as the slot name and results can be stored and retrived from SCE object using this name |
|
9 |
-#' @param markers List. list of gene names. Same as group.markers option from MuSiC package. The list include differential expressed genes within groups. |
|
10 |
-#' List name must be the same as `clusters`. Default is NULL |
|
11 |
-#' @param clusters character, the colData of single cell dataset used as clusters; Default is "cellType" |
|
12 |
-#' @param samples . Default is sampleID. |
|
13 |
-#' groups = NULL, |
|
14 |
-#' @param selectCt vector of cell types, default as NULL. If NULL, then use all cell types provided by single cell dataset; NULL, #same as select.ct |
|
15 |
-#' @param cellSize data.frame of cell sizes.same as cell_size; data.frame of cell sizes. 1st column contains the names of cell types, 2nd column has the cell sizes per cell type. Default as NULL. If NULL, then estimate cell size from data; |
|
16 |
-#' @param ctCov logical. If TRUE, use the covariance across cell types; #same as ctCov in MuSiC |
|
17 |
-#' @param preClusterlist list of cell types. The list identify groups of similar cell types. |
|
18 |
-#' @param verbose logical, default as TRUE. |
|
19 |
-#' @param iter.max numeric, maximum iteration number. Default 1000 |
|
20 |
-#' @param nu regulation parameter, take care of weight when taking reciprocal 1e-04, |
|
21 |
-#' @param eps Threshold of convergence. Default 0.01, |
|
22 |
-#' @param centered logic, subtract avg of Y and D. Default FALSE |
|
23 |
-#' @param normalize logic, divide Y and D by their standard deviation. Default FALSE |
|
24 |
-#' @return SingleCellExperiment object containing the outputs of the |
|
25 |
-#' specified algorithms in the \link{colData} |
|
26 |
-#' of \code{inSCE}. |
|
27 |
-#' @examples |
|
28 |
-#' data(scExample, package = "singleCellTK") |
|
29 |
-#' Add bulk data here |
|
30 |
-#' \dontrun{ |
|
31 |
-#' sce <- runMusic(sce,bulkdata, analysisType = "EstCellProp",analysisName = "test") |
|
32 |
-#' } |
|
33 |
-#' @export |
|
34 |
- |
|
35 |
- |
|
36 |
- |
|
37 |
-#' @rdname s4_methods |
|
38 |
-setGeneric("getMusicResults", signature = c("x","y"), |
|
39 |
- function(x,y) {standardGeneric("getMusicResults")} |
|
40 |
-) |
|
41 |
- |
|
42 |
-setClass("y", representation(name = "character")) |
|
43 |
- |
|
44 |
- |
|
45 |
-#' @rdname s4_methods |
|
46 |
-setMethod("getMusicResults", signature = c(x = "SingleCellExperiment"), function(x,y){ |
|
47 |
- results <- S4Vectors::metadata(x)$sctk$music[[y]] |
|
48 |
- if(is.null(results)) { |
|
49 |
- stop("No results from 'Music' are found. Please run `runMusic` first.") |
|
50 |
- } |
|
51 |
- return(results) |
|
52 |
-}) |
|
53 |
- |
|
54 |
-#' @rdname s4_methods |
|
55 |
-setGeneric("getMusicResults<-", function(x,y, value) standardGeneric("getMusicResults<-")) |
|
56 |
- |
|
57 |
-#' @rdname s4_methods |
|
58 |
-setReplaceMethod("getMusicResults", signature(x = "SingleCellExperiment",y = "character"), function(x,y, value) { |
|
59 |
- S4Vectors::metadata(x)$sctk$music[[y]] <- value |
|
60 |
- return(x) |
|
61 |
-}) |
|
62 |
- |
|
63 |
- |
|
64 |
-runMusic<-function(inSCE, |
|
65 |
- bulkData, #camelcase |
|
66 |
- analysisName = "NULL", |
|
67 |
- analysisType = c("EstCellProp","PreGroupedClustProp","SingleCellClust"), |
|
68 |
- markers = NULL, |
|
69 |
- clusters = "cellType", # not a default -- user input |
|
70 |
- samples = "sampleID", #sample is the default and not sampleID but keeping this as sampleID for testing purpose |
|
71 |
- preClusterlist = NULL, |
|
72 |
- DEmarkers = NULL, |
|
73 |
- groups = NULL, |
|
74 |
- selectCt = NULL, #same as select.ct |
|
75 |
- cellSize = NULL, #same as cell_size |
|
76 |
- ctCov = FALSE, #same as ctCov |
|
77 |
- verbose = TRUE, |
|
78 |
- iterMax = 1000, #same as iter.max |
|
79 |
- nu = 1e-04, |
|
80 |
- eps = 0.01, |
|
81 |
- centered = FALSE, |
|
82 |
- normalize = FALSE, |
|
83 |
- nonZero = TRUE # sane as non.zero |
|
84 |
-) { |
|
85 |
- |
|
86 |
- |
|
87 |
- |
|
88 |
- # Estimate cell type proportions |
|
89 |
- |
|
90 |
- |
|
91 |
- .musicProp <-function(bulkData, |
|
92 |
- inSCE, |
|
93 |
- analysisType, |
|
94 |
- markers, |
|
95 |
- clusters, |
|
96 |
- samples, |
|
97 |
- selectCt, |
|
98 |
- cellSize, |
|
99 |
- ctCov, |
|
100 |
- iterMax, |
|
101 |
- nu, |
|
102 |
- eps, |
|
103 |
- centered, |
|
104 |
- normalize){ |
|
105 |
- # Can also supply list of marker genes here as an input |
|
106 |
- est_prop = music_prop(bulk.mtx = bulkData, |
|
107 |
- sc.sce = inSCE, |
|
108 |
- markers = markers, |
|
109 |
- samples = samples, |
|
110 |
- clusters = clusters, |
|
111 |
- select.ct= selectCt, |
|
112 |
- cell_size = cellSize, |
|
113 |
- ct.cov = ctCov, |
|
114 |
- iter.max = iterMax, |
|
115 |
- nu= nu, |
|
116 |
- eps = eps, |
|
117 |
- centered = centered, |
|
118 |
- normalize = normalize) |
|
119 |
- est_prop$analysisType = analysisType |
|
120 |
- return(est_prop) |
|
121 |
- } |
|
122 |
- |
|
123 |
- |
|
124 |
- |
|
125 |
- |
|
126 |
- |
|
127 |
- ############################################################################### |
|
128 |
- ##### Estimation of cell types with pre-grouping of cell types |
|
129 |
- ############################################################################### |
|
130 |
- |
|
131 |
- |
|
132 |
- |
|
133 |
- |
|
134 |
- .musicBase<- function(inSCE, |
|
135 |
- clusters, |
|
136 |
- samples, |
|
137 |
- markers, |
|
138 |
- selectCt, |
|
139 |
- nonZero, |
|
140 |
- cellSize, |
|
141 |
- ctCov |
|
142 |
- ){ |
|
143 |
- |
|
144 |
- basis_object = music_basis(x = inSCE, |
|
145 |
- clusters = clusters, |
|
146 |
- samples = samples, |
|
147 |
- markers = markers, |
|
148 |
- select.ct = selectCt, |
|
149 |
- non.zero = nonZero, |
|
150 |
- cell_size = cellSize, |
|
151 |
- ct.cov = ctCov) |
|
152 |
- |
|
153 |
- basis_object$analysisType = analysisType |
|
154 |
- # putting things back to sce |
|
155 |
- # should this be a new S4? How to create a new slot? |
|
156 |
- return(basis_object) |
|
157 |
- |
|
158 |
- } |
|
159 |
- |
|
160 |
- .musicPropCluster<- function(bulk.mtx, |
|
161 |
- inSCE, |
|
162 |
- clusters, |
|
163 |
- groups, |
|
164 |
- preClusterlist, # list of list cluster groups |
|
165 |
- DEmarkers, # group names should be same as cluster names |
|
166 |
- samples, |
|
167 |
- iterMax, |
|
168 |
- nu, |
|
169 |
- eps, |
|
170 |
- centered, |
|
171 |
- normalize){ |
|
172 |
- |
|
173 |
- |
|
174 |
- # Preprocess cluster labels |
|
175 |
- data<-colData(inSCE) |
|
176 |
- clusterExclude = levels(factor(unique(data[[clusters]][data[[clusters]] %in% unlist(preClusterlist) == FALSE]))) |
|
177 |
- mergeall<-append(preClusterlist,clusterExclude) |
|
178 |
- names(mergeall)<-c(names(preClusterlist),clusterExclude) |
|
179 |
- cluster_new<-data.frame(do.call(cbind,mergeall)) %>% gather() %>% unique() %>% dplyr::rename(!!clusters:= "value", !!groups:= "key") |
|
180 |
- |
|
181 |
- # adding cluster labels to phenodata |
|
182 |
- data %>% |
|
183 |
- data.frame() %>% |
|
184 |
- rownames_to_column("row") %>% |
|
185 |
- left_join(cluster_new) %>% |
|
186 |
- transform(clusters = as.factor(clusters)) %>% |
|
187 |
- column_to_rownames("row") -> data |
|
188 |
- colData(inSCE)<- DataFrame(data) |
|
189 |
- |
|
190 |
- |
|
191 |
- prop_clust = music_prop.cluster(bulk.mtx = bulkData, |
|
192 |
- sc.sce = inSCE, |
|
193 |
- group.markers = DEmarkers, |
|
194 |
- clusters = clusters, |
|
195 |
- groups = groups, |
|
196 |
- samples = samples, |
|
197 |
- clusters.type = preClusterlist, |
|
198 |
- iter.max = iterMax, |
|
199 |
- nu = nu, |
|
200 |
- eps = eps, |
|
201 |
- centered = centered, |
|
202 |
- normalize = normalize,) |
|
203 |
- |
|
204 |
- return(prop_clust) |
|
205 |
- } |
|
206 |
- |
|
207 |
- |
|
208 |
- ##################################################################### |
|
209 |
- ## Run the tool |
|
210 |
- ##################################################################### |
|
211 |
- |
|
212 |
- # Estimate cell type proportions |
|
213 |
- |
|
214 |
- if(analysisType == "EstCellProp"){ |
|
215 |
- |
|
216 |
- temp_result<- .musicProp(bulkData, |
|
217 |
- inSCE, |
|
218 |
- analysisType, |
|
219 |
- markers, |
|
220 |
- clusters, |
|
221 |
- samples, |
|
222 |
- selectCt, |
|
223 |
- cellSize, |
|
224 |
- ctCov, |
|
225 |
- iterMax, |
|
226 |
- nu, |
|
227 |
- eps, |
|
228 |
- centered, |
|
229 |
- normalize) |
|
230 |
- temp_result$analysisType = analysisType |
|
231 |
- } |
|
232 |
- |
|
233 |
- # Clustering of single cell data |
|
234 |
- |
|
235 |
- else if (analysisType == "SingleCellClust"){ |
|
236 |
- |
|
237 |
- temp_result<- .musicBase(inSCE, |
|
238 |
- clusters, |
|
239 |
- samples, |
|
240 |
- markers, |
|
241 |
- selectCt, |
|
242 |
- nonZero, |
|
243 |
- cellSize, |
|
244 |
- ctCov) |
|
245 |
- |
|
246 |
- temp_result$analysisType = analysisType |
|
247 |
- |
|
248 |
- } |
|
249 |
- |
|
250 |
- # Bulk tissue type estimation |
|
251 |
- |
|
252 |
- else if(analysisType == "PreGroupedClustProp") { |
|
253 |
- |
|
254 |
- if(class(preClusterlist) == "list"){ |
|
255 |
- |
|
256 |
- temp_result = .musicPropCluster(bulk.mtx = bulkData, |
|
257 |
- inSCE = inSCE, |
|
258 |
- DEmarkers = IEmarkers, |
|
259 |
- clusters = clusters, |
|
260 |
- groups = groups, |
|
261 |
- samples = samples, |
|
262 |
- preClusterlist = preClusterlist, |
|
263 |
- iterMax = iterMax, |
|
264 |
- nu = nu, |
|
265 |
- eps = eps, |
|
266 |
- centered = centered, |
|
267 |
- normalize = normalize) |
|
268 |
- |
|
269 |
- temp_result$analysisType = analysisType |
|
270 |
- |
|
271 |
- } |
|
272 |
- |
|
273 |
- |
|
274 |
- |
|
275 |
- } |
|
276 |
- |
|
277 |
- |
|
278 |
- temp_result[["params"]]<-c(as.list(environment())) |
|
279 |
- |
|
280 |
- |
|
281 |
- |
|
282 |
- if(length(inSCE@metadata$sctk$music)>0){ |
|
283 |
- getMusicResults(x = inSCE, y = analysisName) <- temp_result |
|
284 |
- # metadata(inSCE)$sctk$music[[analysisName]]<-temp_result |
|
285 |
- } |
|
286 |
- else{ |
|
287 |
- new_list<-c() |
|
288 |
- metadata(inSCE)$sctk$music<-new_list |
|
289 |
- # metadata(inSCE)$sctk$music[[analysisName]]<-temp_result |
|
290 |
- getMusicResults(x = inSCE, y = analysisName)<-temp_result |
|
291 |
- } |
|
292 |
- |
|
293 |
- |
|
294 |
- |
|
295 |
- return(inSCE) |
|
296 |
- |
|
297 |
-} |
|
298 |
- |
|
299 |
- |
304 | 4 |
deleted file mode 100644 |
... | ... |
@@ -1,72 +0,0 @@ |
1 |
-title: "Plotting MuSiC results" |
|
2 |
-date: "`r format(Sys.time(), '%B %d, %Y')`" |
|
3 |
-output: |
|
4 |
- html_document: |
|
5 |
- number_sections: yes |
|
6 |
- toc: yes |
|
7 |
- code_folding: hide |
|
8 |
- |
|
9 |
-# Larger report calling runMusic and plotMusic |
|
10 |
-# 3 RMD - |
|
11 |
-#knitchild |
|
12 |
-# Check seurat rmarkdown |
|
13 |
- |
|
14 |
- |
|
15 |
-```{r MuSiC_library, message = FALSE, include = FALSE} |
|
16 |
-require(singleCellTK) |
|
17 |
-require(ggplot2) |
|
18 |
-require(dplyr) |
|
19 |
-``` |
|
20 |
- |
|
21 |
- |
|
22 |
- |
|
23 |
-```{r MuSiC_params} |
|
24 |
-sce <- params$object |
|
25 |
-analysisName<-params$analysisName |
|
26 |
-analysisType<-params$analysisType |
|
27 |
-heatmapTitle<-params$heatmapTitle |
|
28 |
-``` |
|
29 |
- |
|
30 |
- |
|
31 |
- |
|
32 |
-```{r MuSiC_output, results = "asis", fig.align = "center"} |
|
33 |
- |
|
34 |
-results <- plotMusicResults(sce, analysisType = analysisType, analysisName =analysisName, heatmapTitle = heatmapTitle) |
|
35 |
- |
|
36 |
- |
|
37 |
- # Tab for tool results |
|
38 |
- cat(paste0('# Music Results', ' {.tabset} \n\n')) |
|
39 |
- |
|
40 |
- # Subtab for a separate plot of the tool results |
|
41 |
- cat(paste0('## Heatmap \n\n')) |
|
42 |
- if (analysisType %in% c("EstCellProp","PreGroupedClustProp")){ |
|
43 |
- metadata(results)$sctk$music[[analysisName]][["Heatmap"]] |
|
44 |
- } |
|
45 |
- |
|
46 |
- if(analysisType == "SingleCellClust"){ |
|
47 |
- |
|
48 |
- cat(paste0('## Clusters \n\n')) |
|
49 |
- metadata(results)$sctk$music[[analysisName]][["clusters"]] |
|
50 |
- # getMusicPlots(sce,analysisName,"Clusters") |
|
51 |
- } |
|
52 |
- |
|
53 |
- # Final tab to display the parameters used |
|
54 |
- cat(paste0('## Parameters \n\n')) |
|
55 |
- print(params) |
|
56 |
-``` |
|
57 |
- |
|
58 |
- |
|
59 |
- |
|
60 |
-```{r MuSiC_description, include = FALSE, warning = FALSE, message = FALSE} |
|
61 |
-description_toolName <- descMusic() |
|
62 |
- |
|
63 |
-# {.unlisted .unnumbered .toc-ignore} |
|
64 |
-`r description_runMusic` |
|
65 |
-``` |
|
66 |
- |
|
67 |
- |
|
68 |
- |
|
69 |
- |
|
70 |
- |
71 | 0 |
deleted file mode 100644 |
... | ... |
@@ -1,54 +0,0 @@ |
1 |
-title: "Single Cell Deconvolution with MuSiC using singleCellTK package" |
|
2 |
-author: "Amulya Shastry" |
|
3 |
-date: "2022-10-25" |
|
4 |
-output: html_document |
|
5 |
- |
|
6 |
- |
|
7 |
- |
|
8 |
-```{r MuSiC_library, message = FALSE, include = FALSE} |
|
9 |
-require(singleCellTK) |
|
10 |
-require(ggplot2) |
|
11 |
-require(dplyr) |
|
12 |
-``` |
|
13 |
- |
|
14 |
- |
|
15 |
- |
|
16 |
- |
|
17 |
-```{r} |
|
18 |
- |
|
19 |
-musicParams <- list( |
|
20 |
- inSCE, |
|
21 |
- bulkData, |
|
22 |
- analysisName = "NULL", |
|
23 |
- analysisType = c("EstCellProp","PreGroupedClustProp","SingleCellClust"), |
|
24 |
- markers = NULL, |
|
25 |
- clusters = "cellType", |
|
26 |
- samples = "sampleID", |
|
27 |
- preClusterlist = NULL, |
|
28 |
- DEmarkers = NULL, |
|
29 |
- groups = NULL, |
|
30 |
- selectCt = NULL, |
|
31 |
- cellSize = NULL, #same as cell_size |
|
32 |
- ctCov = FALSE, #same as ctCov |
|
33 |
- verbose = TRUE, |
|
34 |
- iterMax = 1000, #same as iter.max |
|
35 |
- nu = 1e-04, |
|
36 |
- eps = 0.01, |
|
37 |
- centered = FALSE, |
|
38 |
- normalize = FALSE, |
|
39 |
- nonZero = TRUE |
|
40 |
-) |
|
41 |
- |
|
42 |
- |
|
43 |
-sce <- do.call("runMusic", musicParams) |
|
44 |
- |
|
45 |
-``` |
|
46 |
- |
|
47 |
- |
|
48 |
- |
|
49 |
- |
|
50 |
- |
|
51 |
- |
|
52 |
- |
53 | 0 |
deleted file mode 100644 |
... | ... |
@@ -1,32 +0,0 @@ |
1 |
-% Generated by roxygen2: do not edit by hand |
|
2 |
-% Please edit documentation in R/plotMusicResults.R |
|
3 |
-\name{plotMusicResults} |
|
4 |
-\alias{plotMusicResults} |
|
5 |
-\title{Plotting function of runMusic.R} |
|
6 |
-\usage{ |
|
7 |
-plotMusicResults( |
|
8 |
- inSCE, |
|
9 |
- analysisType = c("EstCellProp", "PreGroupedClustProp", "SingleCellClust"), |
|
10 |
- heatmapTitle = NULL, |
|
11 |
- analysisName = NULL |
|
12 |
-) |
|
13 |
-} |
|
14 |
-\arguments{ |
|
15 |
-\item{inSCE}{A \link[SingleCellExperiment]{SingleCellExperiment} object.} |
|
16 |
- |
|
17 |
-\item{analysisType}{Character. Specify which function to run |
|
18 |
-Available options are "EstCellProp","PreGroupedClustProp","SingleCellClust"} |
|
19 |
- |
|
20 |
-\item{heatmapTitle}{Character. Title for heatmap; Default is NULL} |
|
21 |
- |
|
22 |
-\item{analysisName}{Character. User-defined analysis name. |
|
23 |
-This will be used as the slot name and results can be stored and retrived from SCE object using this name} |
|
24 |
-} |
|
25 |
-\value{ |
|
26 |
-SingleCellExperiment object containing the outputs of the |
|
27 |
- specified algorithms in the \link{colData} |
|
28 |
-of \code{inSCE}. |
|
29 |
-} |
|
30 |
-\description{ |
|
31 |
-A wrapper that plots heatmap and cluster plots for results from runMusic.R |
|
32 |
-} |
33 | 0 |
deleted file mode 100644 |
... | ... |
@@ -1,151 +0,0 @@ |
1 |
-title: "MuSiC analysis" |
|
2 |
-author: "Amulya Shastry" |
|
3 |
-date: "2022-10-28" |
|
4 |
-output: |
|
5 |
- html_document: |
|
6 |
- toc: true |
|
7 |
- toc_depth: 5 |
|
8 |
-bibliography: references.bib |
|
9 |
-csl: ieee.csl |
|
10 |
- |
|
11 |
-```{r setup, include=FALSE} |
|
12 |
-knitr::opts_chunk$set(echo = TRUE) |
|
13 |
- |
|
14 |
-library(singleCellTK) |
|
15 |
-library(SingleCellExperiment) |
|
16 |
-library(dplyr) |
|
17 |
-library(S4Vectors) |
|
18 |
-``` |
|
19 |
- |
|
20 |
-````{=html} |
|
21 |
-<head> |
|
22 |
-<meta name="viewport" content="width=device-width, initial-scale=1"> |
|
23 |
-</head> |
|
24 |
-<body> |
|
25 |
-```` |
|
26 |
- |
|
27 |
- |
|
28 |
- |
|
29 |
-## Introduction |
|
30 |
- |
|
31 |
-This section describes how to perform deconvolution of bulk data using single cell data with the package MuSiC under SingleCellTK |
|
32 |
- |
|
33 |
-To view detailed instructions on how to use these methods, please select 'Interactive Analysis' for shiny application or 'Console Analysis' for using these methods on R console from the tabs below: <br> |
|
34 |
- |
|
35 |
-## Workflow Guide |
|
36 |
- |
|
37 |
-````{=html} |
|
38 |
-<div class="tab"> |
|
39 |
- <button class="tablinks" onclick="openTab(event, 'interactive')" id="ia-button">Interactive Analysis</button> |
|
40 |
- <button class="tablinks" onclick="openTab(event, 'console')" id="console-button">Console Analysis</button> |
|
41 |
-</div> |
|
42 |
- |
|
43 |
-<div id="interactive" class="tabcontent"> |
|
44 |
-```` |
|
45 |
- |
|
46 |
-**Entry of The Panel** |
|
47 |
- |
|
48 |
-From anywhere of the UI, the panel for marker finding can be accessed from the top navigation panel at the circled tab shown below. |
|
49 |
- |
|
50 |
- |
|
51 |
-````{=html} |
|
52 |
-</details> |
|
53 |
-<br/> |
|
54 |
- |
|
55 |
-</div> |
|
56 |
- |
|
57 |
-<div id="console" class="tabcontent"> |
|
58 |
-```` |
|
59 |
- |
|
60 |
-**Parameters** |
|
61 |
- |
|
62 |
-For MuSic we provide two inputs a) SCE objct b) bulk RNA data. ALong with this, we choose the type of analysis we want to perform. Currently MuSiC under SCKT supports deconvolution using bulk dataset. |
|
63 |
- |
|
64 |
- |
|
65 |
-```{R egCall, eval = FALSE} |
|
66 |
-sce <- <-runMusic(inSCE = sce,Mouse.bulkeset, |
|
67 |
- bulkData, |
|
68 |
- analysisName = "NULL", |
|
69 |
- analysisType = c("EstCellProp","PreGroupedClustProp","SingleCellClust"), |
|
70 |
- markers = NULL, |
|
71 |
- clusters = "cellType", |
|
72 |
- samples = "sampleID", |
|
73 |
- preClusterlist = NULL, |
|
74 |
- DEmarkers = NULL, |
|
75 |
- groups = NULL, |
|
76 |
- selectCt = NULL, |
|
77 |
- cellSize = NULL, |
|
78 |
- ctCov = FALSE, |
|
79 |
- verbose = TRUE, |
|
80 |
- iterMax = 1000, |
|
81 |
- nu = 1e-04, |
|
82 |
- eps = 0.01, |
|
83 |
- centered = FALSE, |
|
84 |
- normalize = FALSE, |
|
85 |
- nonZero = TRUE ) |
|
86 |
-``` |
|
87 |
- |
|
88 |
-Here `inSCE` and `bulkData` are important for deconolution along with `analysisName` which is used to store the results and access them for plotting, `analysisType` defines one of the three music functions estimate cell type proportions, and estimate cell type proportions with pre-grouping of cells which has two steps i) Cluster single cell data ii) estimate bulk type proprotions. |
|
89 |
-For estimating cell type proportions with pre-grouping of the cells, `DEmarkers` and `preClusterlist` is necessary. |
|
90 |
- |
|
91 |
-The returned SCE object will contain the results in the `metadata` slot along with the analysisType |
|
92 |
- |
|
93 |
- |
|
94 |
-**Example** |
|
95 |
- |
|
96 |
- |
|
97 |
-```{R example, eval = FALSE} |
|
98 |
-library(singleCellTK) |
|
99 |
-sce <- importExampleData("mouse.sce.rda") |
|
100 |
-bulk <-importExampleData("mouse_bulk.rda") |
|
101 |
- |
|
102 |
- |
|
103 |
-``` |
|
104 |
- |
|
105 |
- |
|
106 |
-```{r EstCellProp, eval = FALSE} |
|
107 |
- |
|
108 |
-# Estimation of cell type proportions |
|
109 |
-sce <-runMusic(inSCE = sce,bulkData = bulk,analysisType ="EstCellProp", analysisName = "testEstCellProp") |
|
110 |
- |
|
111 |
-``` |
|
112 |
- |
|
113 |
- |
|
114 |
-```{R import_prep, include=FALSE} |
|
115 |
-library(singleCellTK) |
|
116 |
-sce <- R.filesets::loadRDS(file = "/Users/amulyashastry/Documents/Code/R/Rotation_campbell/Music_wrapper/AshastrySingleCellTk/singleCellTK/data/new_sce_with_music_basis.rds") |
|
117 |
-``` |
|
118 |
- |
|
119 |
- |
|
120 |
-```{R } |
|
121 |
-source("../../R/plotMusicResults.R") |
|
122 |
-library(singleCellTK) |
|
123 |
-library(SingleCellExperiment) |
|
124 |
-library(dplyr) |
|
125 |
-library(S4Vectors) |
|
126 |
-plotMusicResults(sce,analysisType ="EstCellProp", analysisName = "testEstCellProp",useAssay = "Est.prop.allgene") |
|
127 |
- |
|
128 |
-``` |
|
129 |
- |
|
130 |
-````{=html} |
|
131 |
-</details> |
|
132 |
-<br/> |
|
133 |
-```` |
|
134 |
- |
|
135 |
- |
|
136 |
-````{=html} |
|
137 |
-</div> |
|
138 |
-<script> |
|
139 |
-document.getElementById("ia-button").click(); |
|
140 |
-</script> |
|
141 |
-</body> |
|
142 |
-```` |
|
143 |
- |
|
144 |
- |
|
145 |
- |
|
146 |
- |
|
147 |
- |
|
148 |
- |
|
149 |
- |
150 | 0 |
deleted file mode 100644 |
... | ... |
@@ -1,87 +0,0 @@ |
1 |
-title: "Music results" |
|
2 |
-author: "Amulya Shastry" |
|
3 |
-date: "2022-10-27" |
|
4 |
-params: |
|
5 |
- object: object |
|
6 |
- analysisName: analysisName |
|
7 |
- analysisType: analysisType |
|
8 |
- heatmapTitle: heatmapTitle |
|
9 |
- bulkData: bulkData, |
|
10 |
- analysisName: r! NULL, |
|
11 |
- analysisType: c("EstCellProp","PreGroupedClustProp","SingleCellClust"), |
|
12 |
- markers: r!NULL, |
|
13 |
- clusters: clusters, # not a default -- user input |
|
14 |
- samples: "sampleID", #sample is the default and not sampleID but keeping this as sampleID for testing purpose |
|
15 |
- preClusterlist: NULL, |
|
16 |
- DEmarkers: NULL, |
|
17 |
- groups: NULL, |
|
18 |
- selectCt: NULL, #same as select.ct |
|
19 |
- cellSize: NULL, #same as cell_size |
|
20 |
- ctCov: FALSE, #same as ctCov |
|
21 |
- verbose: TRUE, |
|
22 |
- iterMax: 1000, #same as iter.max |
|
23 |
- nu: 1e-04, |
|
24 |
- eps: 0.01, |
|
25 |
- centered: FALSE, |
|
26 |
- normalize: FALSE, |
|
27 |
- nonZero: TRUE |
|
28 |
-output: html_document |
|
29 |
- |
|
30 |
-```{r setup, include=FALSE} |
|
31 |
-knitr::opts_chunk$set(echo = TRUE) |
|
32 |
-``` |
|
33 |
- |
|
34 |
- |
|
35 |
-```{r MuSiC_params} |
|
36 |
-sce <- params$object |
|
37 |
-analysisName<-params$analysisName |
|
38 |
-analysisType<-params$analysisType |
|
39 |
-heatmapTitle<-params$heatmapTitle |
|
40 |
-``` |
|
41 |
- |
|
42 |
- |
|
43 |
-<!-- Music Run --> |
|
44 |
- |
|
45 |
-```{r, echo=FALSE, results='asis', warning=FALSE, message=FALSE} |
|
46 |
-showSession <- FALSE |
|
47 |
-musicRun <- knitr::knit_child('reportMusicRun.Rmd', quiet = TRUE, envir = environment()) |
|
48 |
-``` |
|
49 |
- |
|
50 |
-<!-- Music Results --> |
|
51 |
- |
|
52 |
-```{r, echo=FALSE, results='asis', warning=FALSE, message=FALSE} |
|
53 |
-showSession <- FALSE |
|
54 |
-musicResults <- knitr::knit_child('reportMusicResults.Rmd', quiet = TRUE, envir = environment()) |
|
55 |
-``` |
|
56 |
- |
|
57 |
- |
|
58 |
- |
|
59 |
-```{r, echo=FALSE, results='asis', warning=FALSE, message=FALSE} |
|
60 |
-cat(musicRun, sep = '\n') |
|
61 |
-cat(musicResults, sep = '\n') |
|
62 |
-``` |
|
63 |
- |
|
64 |
- |
|
65 |
- |
|
66 |
- |
|
67 |
- |
|
68 |
-```{r, echo=FALSE} |
|
69 |
-showSession <- params$showSession |
|
70 |
-``` |
|
71 |
- |
|
72 |
- |
|
73 |
- |
|
74 |
-```{r, results='asis', eval=showSession, echo=FALSE} |
|
75 |
-cat("# Session Information\n\n") |
|
76 |
-``` |
|
77 |
- |
|
78 |
- |
|
79 |
-```{r, results='markup', eval=showSession, echo=showSession} |
|
80 |
-sessionInfo() |
|
81 |
-``` |
|
82 |
- |
|
83 |
- |
|
84 |
- |
|
85 |
- |