diff --git a/single-cell-analysis/Sessions_1-2/hands_on_component.Rmd b/single-cell-analysis/Sessions_1-2/hands_on_component.Rmd index f130b5c..5e932c2 100644 --- a/single-cell-analysis/Sessions_1-2/hands_on_component.Rmd +++ b/single-cell-analysis/Sessions_1-2/hands_on_component.Rmd @@ -1,7 +1,7 @@ --- -title: "Hands-on component of Single-cell RNA-seq workshop: Sessions 1-2" +title: 'Hands-on component of Single-cell RNA-seq workshop: Sessions 1-2' author: "Krishna Choudhary" -date: "11/3/2020" +date: "3/27/2021" output: html_document --- @@ -11,28 +11,27 @@ knitr::opts_chunk$set(echo = TRUE) ##Introduction -We'll review the current practices for some of the common steps in scRNA-seq data analysis during the Sessions 1-2. We'll discuss different practices for each step and the assumptions underlying various tools and their limitations. This document provides an exposure to one of the popular tools for such analysis. As we'll discuss, the right choice of method in any application depends on a number of factors, including the biological systems under study and the characteristics of the data in hand. For the purpose of our workshop, we'll limit the hands-on component to the Seurat package in R. In general, analysis might require multiple tools in different languages and/or novel development. For more, please see the slide deck in materials. +We'll review the current practices for some of the common steps in scRNA-seq data analysis in the Sessions 1-2. We'll discuss different practices for each step and the assumptions underlying various tools and their limitations. This document provides an exposure to one of the popular tools for such analysis. As we'll discuss, the right choice of method in any application depends on a number of factors, including the biological systems under study and the characteristics of the data in hand. For the purpose of our workshop, we'll limit the hands-on component to the Seurat package in R. In general, analysis might require multiple tools in different languages and/or novel development. For more, please see the slide deck in materials. -The following is based on [this vignette](https://satijalab.org/seurat/v3.2/pbmc3k_tutorial.html) from the Seurat developers. +The following is based on [this vignette](https://satijalab.org/seurat/articles/pbmc3k_tutorial.html) from the Seurat developers. ## Setup the working environment ```{r message=FALSE, warning=FALSE} -library(tidyverse) +library(dplyr) library(Seurat) +library(patchwork) ``` ## Load the data -Please ensure that the directory named "data" in the workshop materials is in the current working directory. +Please ensure that the directory named "pbmc3k_data" in the workshop materials is in the same directory as this .Rmd file. ```{r} -data <- CreateSeuratObject(counts = Read10X("data"), +data <- CreateSeuratObject(counts = Read10X("pbmc3k_data"), project = "Hello_scWorld", #Name this whatever. min.cells = 3, # Don't keep genes observed in fewer than 3 cells - min.features = 200, # Don't keep cells with fewer than 200 genes - names.delim = NULL) # Don't try and parse the sample names - + min.features = 200) # Don't keep cells with fewer than 200 genes ``` ## Filter poor quality or uninteresting cells @@ -40,7 +39,7 @@ data <- CreateSeuratObject(counts = Read10X("data"), ```{r} #Assess percent of mitochondrial counts in each cell data[["percent_mt"]] <- PercentageFeatureSet(object = data, - pattern = "^mt-") + pattern = "^MT-") #Violin plot VlnPlot(object = data, @@ -49,12 +48,6 @@ VlnPlot(object = data, "percent_mt"), ncol = 3) -#Ridge plot -RidgePlot(object = data, - features = c("nFeature_RNA", - "percent_mt"), - ncol = 2) - #Other plotting otions plot1 <- FeatureScatter(object = data, feature1 = "nCount_RNA", @@ -67,8 +60,8 @@ plot1 + plot2 #Subset data data <- subset(x = data, subset = nFeature_RNA > 200 & - nCount_RNA > 950000 & - percent_mt < 20) + nFeature_RNA < 2500 & + percent_mt < 5) VlnPlot(object = data, features = c("nFeature_RNA", @@ -103,7 +96,8 @@ plot1 <- VariableFeaturePlot(object = data) plot2 <- LabelPoints(plot = plot1, points = top10, repel = TRUE) -print(plot2) +plot1 +plot2 ``` @@ -127,7 +121,7 @@ print(x = data[["pca"]], dims = 1:5, nfeatures = 5) DimPlot(data, reduction = "pca") -data <- JackStraw(object = data, num.replicate = 10) +data <- JackStraw(object = data, num.replicate = 100) data <- ScoreJackStraw(object = data, dims = 1:20) JackStrawPlot(data, dims = 1:15) @@ -184,17 +178,17 @@ data.markers <- FindAllMarkers(data, min.pct = 0.25, logfc.threshold = 0.25) data.markers %>% - group_by(cluster) %>% - top_n(n = 2, wt = avg_logFC) + group_by(., cluster) %>% + top_n(., n = 2, wt = avg_log2FC) ``` ## Additional visualizations ```{r} -VlnPlot(data, features = c("Vps37b", "Tcf7")) +VlnPlot(data, features = c("MS4A1", "CD79A")) -FeaturePlot(data, features = c("Vps37b", "Tcf7")) +FeaturePlot(data, features = c("MS4A1", "CD79A")) ``` ```{r} @@ -202,4 +196,3 @@ sessionInfo() ``` ## THE END. - diff --git a/single-cell-analysis/Sessions_1-2/hands_on_component.html b/single-cell-analysis/Sessions_1-2/hands_on_component.html index f6467b4..0c7aeaa 100644 --- a/single-cell-analysis/Sessions_1-2/hands_on_component.html +++ b/single-cell-analysis/Sessions_1-2/hands_on_component.html @@ -23,6 +23,8 @@ + + +