diff --git a/R/seuratFunctions.R b/R/seuratFunctions.R index 984541428..1811de852 100644 --- a/R/seuratFunctions.R +++ b/R/seuratFunctions.R @@ -783,7 +783,7 @@ plotSeuratReduction <- if (!is.null(seuratObject@meta.data$seurat_clusters)) { Seurat::Idents(seuratObject) <- seuratObject@meta.data$seurat_clusters - seuratObject@meta.data <- data.frame() + #seuratObject@meta.data <- data.frame() } } diff --git a/inst/rmarkdown/seurat/reportSeuratClustering.Rmd b/inst/rmarkdown/seurat/reportSeuratClustering.Rmd index 271132a64..2b1f6daaf 100644 --- a/inst/rmarkdown/seurat/reportSeuratClustering.Rmd +++ b/inst/rmarkdown/seurat/reportSeuratClustering.Rmd @@ -91,7 +91,7 @@ if(!showClusterDesc){ } ``` -```{r, results='asis', warning=FALSE, message=FALSE, eval = !(plotTSNE && !is.null(metadata(data)$seurat$obj@reductions$tsne))} +```{r, results='asis', warning=FALSE, message=FALSE, eval = !(plotTSNE && !is.null(metadata(data)$seurat$obj$reductions$tsne))} data <- runSeuratTSNE(data, useReduction = "pca", dims = significant_PC) ``` @@ -127,7 +127,7 @@ for(i in 1:(((maxResolution-minResolution)*10)+1)){ } ``` -```{r, results='asis', warning=FALSE, message=FALSE, eval = !(plotUMAP && !is.null(metadata(data)$seurat$obj@reductions$umap))} +```{r, results='asis', warning=FALSE, message=FALSE, eval = !(plotUMAP && !is.null(metadata(data)$seurat$obj$reductions$umap))} data <- runSeuratUMAP(data, useReduction = "pca", dims = significant_PC) ``` diff --git a/inst/rmarkdown/seurat/reportSeuratDimRed.Rmd b/inst/rmarkdown/seurat/reportSeuratDimRed.Rmd index 84846b579..066922849 100644 --- a/inst/rmarkdown/seurat/reportSeuratDimRed.Rmd +++ b/inst/rmarkdown/seurat/reportSeuratDimRed.Rmd @@ -58,7 +58,7 @@ cat(headingDR, " PCA {.tabset .tabset-fade}\n\n") To reduce the adverse effects of the inherent technical noise in single-cell data on downstream clustering, reduced dimensions are computed where each dimension represents a set of correlated features. However, an important task is to select the number of components that should be utilized by the downstream methods. To select the number of principal components that should be used in the downstream analysis, JackStraw and Elbow plot provide convenience in the selection of the significant components that contain most of the variability. -```{r, results='asis', warning=FALSE, eval = !(runDimRed && !is.null(metadata(data)$seurat$obj@reductions$pca)) || forceRun} +```{r, results='asis', warning=FALSE, eval = !(runDimRed && !is.null(metadata(data)$seurat$obj$reductions$pca)) || forceRun} pcaParams <- list( inSCE = data, nPCs = pc.count, @@ -94,8 +94,8 @@ ElbowPlot ``` ```{r, echo=FALSE, warning=FALSE, eval= plotJackStraw} -if(!is.null(metadata(data)$seurat$obj@reductions$pca@jackstraw)){ - PC_Matrix <- metadata(data)$seurat$obj@reductions$pca@jackstraw@overall.p.values +if(!is.null(metadata(data)$seurat$obj$reductions$pca@jackstraw)){ + PC_Matrix <- metadata(data)$seurat$obj$reductions$pca@jackstraw$overall.p.values significant_PC <- which.min(PC_Matrix[,2] < 0.01) - 1 if (!exists("significant_PC") || significant_PC == 0){ @@ -129,7 +129,7 @@ JackStrawPlot PC.separated.height <- 3.5 * ceiling(pc.count/3) ``` -```{r, echo=FALSE, include=TRUE, eval = !(runDimRed && !is.null(metadata(data)$seurat$obj@reductions$pca))} +```{r, echo=FALSE, include=TRUE, eval = !(runDimRed && !is.null(metadata(data)$seurat$obj$reductions$pca))} pcaParams$inSCE <- NULL pcaParams$significant_PC <- significant_PC metadata(data)$seurat$sctk$report$pcaParams <- pcaParams diff --git a/inst/rmarkdown/seurat/reportSeuratFeatureSelection.Rmd b/inst/rmarkdown/seurat/reportSeuratFeatureSelection.Rmd index d9c116c84..13f2816c8 100644 --- a/inst/rmarkdown/seurat/reportSeuratFeatureSelection.Rmd +++ b/inst/rmarkdown/seurat/reportSeuratFeatureSelection.Rmd @@ -54,7 +54,7 @@ cat(headingFS, " Feature Selection {}\n\n") Generally, a subset of features may represent the biological variation in the overall data and to better capture this true biological signal, it is recommended to identify this subset of features that often exhibit high cell-to-cell variation and use it in the downstream analysis instead of the full set of features. For this purpose, Seurat models the mean-to-variance relationship of the expression data by first computing *log of mean* and *log of variance* using *loess* and then standardizes the values using observed mean and expected variance. The overall variance of each feature is computed from the standardized values by clipping to a maximum value and ordering the features in the order of their variance. Lastly, top genes (by default *2000*) are selected as the top most variable features that represent the highest biological variability and used in the downstream methods. -```{r, results='asis', warning=FALSE, message=FALSE, eval = !((runHVG && length(metadata(data)$seurat$obj@assays$RNA@var.features) > 0)) || forceRun} +```{r, results='asis', warning=FALSE, message=FALSE, eval = !((runHVG && length(metadata(data)$seurat$obj$RNA$var.features) > 0)) || forceRun} hvgParams <- list( inSCE = data, method = "vst", @@ -76,7 +76,7 @@ Labeled_Variable_data <- plotSeuratHVG(inSCE = data, labelPoints = 10) Labeled_Variable_data ``` -```{r, echo=FALSE, warning=FALSE, message=FALSE, include=FALSE, eval=!(runHVG && length(metadata(data)$seurat$obj@assays$RNA@var.features) > 0)} +```{r, echo=FALSE, warning=FALSE, message=FALSE, include=FALSE, eval=!(runHVG && length(metadata(data)$seurat$obj$RNA$var.features) > 0)} hvgParams$inSCE <- NULL hvgParams$labelPoints <- 10 hvgParams$totalFeatures <- variable.features