Skip to content

Commit

Permalink
seurat report fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
salzcamino committed Apr 28, 2024
1 parent eff2bc8 commit 55a065d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion R/seuratFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()
#[email protected] <- data.frame()
}
}

Expand Down
4 changes: 2 additions & 2 deletions inst/rmarkdown/seurat/reportSeuratClustering.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```

Expand Down Expand Up @@ -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)
```

Expand Down
8 changes: 4 additions & 4 deletions inst/rmarkdown/seurat/reportSeuratDimRed.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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){
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions inst/rmarkdown/seurat/reportSeuratFeatureSelection.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
Expand Down

0 comments on commit 55a065d

Please sign in to comment.