Thursday 27 February 2020

Seurat for single cell RNAseq data analysis

I'm learning how to use the Seurat package for analysis of single cell RNAseq data.

Here's some notes on how I installed Seurat and made some plots, using someone else's RNAseq data set.

Installing Seurat (on a Windows laptop)
- I opened Rstudio.
- I checked the R version by going to Tools > Global options, which told me I had R 3.6.1 (Seurat requires R 3.4 or greater).
- I followed the Seurat installation instructions but with a small workaround suggested on github:
  > if (!requireNamespace("BiocManager", quietly = TRUE))
        install.packages("BiocManager")
  > BiocManager::install("multtest")
  > install.packages('Seurat')
  > library(Seurat)
- This installed Seurat 3.1.0.

Reading in and plotting some single cell data
I had someone else's single cell RNAseq data as an .rds file. I read it into R as a Seurat object using:
> dat <- readRDS('file.rds')
Then I made a UMAP plot of the data using:
> DimPlot(dat, label=TRUE)
Then to make a plot showing a particular gene's expression on the UMAP, e.g. gene Smp_089320 (see examples here):
> FeaturePlot(dat, features = c("Smp-089320"))

I also learnt from a a tutorial on visualisation using Seurat that you can make a violin plot for a gene using:
> VlnPlot(dat, features = c("Smp-089320"))
You should also be able to make a plot visualising gene expression in each cluster using:
> RidgePlot(dat, features = c("Smp-089320"))
but for some reason that gave me an error message.