Current location - Education and Training Encyclopedia - Resume - Seurat (v4) Official Tutorial
Seurat (v4) Official Tutorial
The complex cell types were compared and analyzed by Seurat integration program. Here, we propose several key objectives:

1 Create "integrated" data analysis for downstream analysis

2 Identify cell types that appear in two data sets.

3. Obtaining cell type markers that are conserved in both control and stimulated cells.

4 Compare data sets to find out the specific response of cell types to stimuli.

1 Set Seurat Object

Library (Seurat)

SeuratData (Seuratdata)

Library (patchwork)

InstallData("ifnb ")

LoadData("ifnb ")

ifnb

str(ifnb)

ifnb.list & lt- SplitObject(ifnb,split.by = "stim ")

ifnb.list & lt- lapply(X = ifnb.list,FUN = function(x) {

X<- standardized data (x)

x & lt- FindVariableFeatures(x,selection.method = "vst ",nfeatures = 2000)

})

Function & lt-selectintegrationfeatures (object.list = ifnb.list)

2 Perform integration

Then, we use the FindIntegrationAnchors () function to identify the anchors, which takes a list of Seurat objects as input and uses these anchors to integrate the two data sets through IntegrateData ().

immune.anchors <。 -finditionanchors(object . list = ifnb . list,anchor.features = features)

Immune anchor

Str (immune anchor)

immune.combined & lt-integrated data(anchorset = immune . anchors)

3. Conduct comprehensive analysis

Now, we can make a single comprehensive analysis of all cells!

DefaultAssay & lt- "integration"

immune.combined & lt- ScaleData(immune.combined,verbose = FALSE)

immune.combined & lt- RunPCA(immune.combined,npcs = 30,verbose = FALSE)

immune.combined & lt- RunUMAP(immune.combined,reduction = "pca ",dims = 1:30)

immune.combined & lt- FindNeighbors(immune.combined,reduction = "pca ",dims = 1:30)

Immune. combined & lt-find clusters (immune. combined, resolution = 0.5)

p 1 & lt; - DimPlot(immune.combined,reduction = "umap ",group.by = "stim ")

p2 & lt- DimPlot(immune.combined,reduction = "umap ",label = TRUE,repel = TRUE)

p 1 + p2

In order to display these two conditions side by side, we can use the split.by parameter to display the classification color of each condition.

DimPlot(immune.combined,reduction = "umap ",split.by = "stim ")

4 Identify conservative cell type markers

In order to identify typical cell type marker genes that are conserved under different conditions, we provide FindConservedMarkers () function. This function performs differential gene expression test on each data set/group, and uses meta-analysis method in MetaDE R package to merge P values. For example, we can calculate the conservative marker genes in cluster 6 (NK cells) that have nothing to do with stimulation conditions.

DefaultAssay & lt- "ribonucleic acid"

'''

bio manager::install(' mult test ')

install.packages('metap ')

Library ("multiple tests")

'''

nk.markers & lt-findconsavedmarkers(immune . combined,ident. 1 = 6,grouping.var = "stim ",verbose = FALSE)

Head (nk.markers)

We can explore these marker genes for each cell group and use them to annotate our cell groups as specific cell types.

Str (natural marker)

Line name (natural tag)

Title (line name (natural tag))

FeaturePlot(immune.combined,features = head(row names(NK . markers),5),min.cutoff = "q9 ")

FeaturePlot(immune.combined,features = c("CD3D "," SELL "," CREM "," CD8A "," GNLY "," CD79A "," FCGR3A ",

" CCL2 "," PPBP "),min.cutoff = "q9 ")

Immune. combined & lt-renames (immune. combined, 0 = "CD 14 Mono ",1 = "CD4 naive t", 2 = "CD4 memory t ",

3 = "CD 16 mono ",4 = "B", 5 = "CD8 T ",6 = "NK", 7 = "T activation ",8 = "DC", 9 = "B activation ",

10 = "Mk ", 1 1 = "pDC ", 12 = "Eryth ", 13 = "Mono/Mk Doublets ", 14 = "HSPC ")

DimPlot(immune.combined,label = TRUE)

DotPlot () function with split.by parameter can be used to view the conserved cell type markers under various conditions, and show the expression level and the percentage of cell population expressing any given gene. Here, we draw 2-3 strong marker genes for each of our 14 clusters.

Idents (immune combination)<- factor (ideas (immune. combined), level = c("HSPC ","Mono/Mk Doublets ",

"pDC", "Eryth", "Mk", "DC", "CD 14 mono", "CD 16 mono", "b activation", "b", "CD8 T", "NK", "t activation",

"CD4 naive test", "CD4 memory test").

markers . to . plot & lt; - c("CD3D "," CREM "," HSPH 1 "," SELL "," GIMAP5 "," CACYBP "," GNLY "," NKG7 "," CCL5 ",

" CD8A "," MS4A 1 "," CD79A "," MIR 155HG "," NME 1 "," FCGR3A "," VMO 1 "," CCL2 "," S 100A9 "," HLA-DQA 1 ",

" GPR 183 "," PPBP "," GNG 1 1 "," HBA2 "," HBB "," TSPAN 13 "," IL3RA "," IGJ "," PRSS57 ")

DotPlot(immune.combined,features = markers.to.plot,cols = c("blue "," red "),dot.scale = 8,split.by = "stim") +

Rotating shaft ()

5 Identify differentially expressed genes under different conditions

Now that we have arranged the stimulated cells and the control cells, we can start a comparative analysis to see the differences caused by stimulation. One way to observe these changes widely is to draw the average expression of stimulated cells and control cells, and look for the genes with visual abnormalities on the scatter plot. Here, we take the average expression of stimulated and control naive T cells and CD 14 monocyte population, and generate a scatter plot to highlight the genes that have shown significant response to interferon stimulation.

Library (ggplot2)

Library (Copt)

theme_set(theme_cowplot())

Identifier (immune combination)

T cells & lt- subset (immune combination, idents = "CD4 naive T ")

Head (T cell)

Tail (T cell)

T cell

'''

my _ tcells & lt-immune.combined@assays$RNA[,orig.ident=c('IMMUNE_CTRL ',' IMMUNE_STIM')]

Title (my _ cell)

Column Name (My Cell)

'''

The level at this time is CD4 initial T cells.

T cell identifier <-"STIM" # # The level at this time is control and stimulation.

T cell RNA

T cells @ analysis RNA))

Mean t cell

Average T cell $ gene <-row name (average T cell)

Mean t cell

CD 14 . mono & lt; -subset (immune.combined, ideas = "CD14mono")

idents(CD 14 . mono)& lt; -"Dope"

avg . CD 14 . mono & lt; -as . data . frame(log 1p(average expression(CD 14 . mono,verbose = FALSE)gene & lt; -line name (avg.cd 14.mono)

avg CD 14 . mono

genes.to.label = c("ISG 15 "、" LY6E "、" IFI6 "、" ISG20 "、" MX 1 "、" IFIT2 "、" IFIT 1 "、" CXCL 10 "、" CCL8 ")

p 1 & lt; -ggplot (mean T cells, aes(CTRL, Stim))+geom _ point ()+ggtitle ("CD4 naive T cells").

p 1

p 1 & lt; - LabelPoints(plot = p 1,points = genes.to.label,repel = FALSE)

P2<-ggplot (avg.cd14.mono, aes(CTRL, stim))+geom _ point ()+ggtitle ("cd14 monocyte").

p2 & lt- LabelPoints(plot = p2,points = genes.to.label,repel = TRUE)

p 1 + p2

'''

Library (dplyr)

Mean t cell

Average T cells%>%

Select (CTRL, STIM)% & gt;; % un list()% & gt; %

Sd ()

'''

As you can see, many of the same genes are up-regulated in these two cell types, which may represent a conservative interferon response pathway.

Because we are confident that we can identify common cell types under different conditions, we can ask which genes of the same type of cells have changed under different conditions. First, we create a column in the metadata slot to store the cell type and stimulation information, and switch the current identifier to this column. Then we use FindMarkers () to find different genes between stimulated B cells and control B cells. Please note that many of the top genes shown here are the same as the core interferon response genes we have drawn before. In addition, genes such as CXCL 10, which we see are specific genes for interferon response between monocytes and B cells, also show high significance in this list.

head(immune.combined@meta.data, 10)

Immune combined stimulation, sep = "_ ")

head(immune.combined@meta.data, 10)

Immune.combined $ celltype & lt--logo (immune combination)

head(immune.combined@meta.data, 10)

Identifier (immune combination)

Idents (immune combination)<- "celltype.stim "

Identifier (immune combination)

B. Interferon. Reaction & lt-find markers (immune. combined, ident. 1 = "B_STIM ",ident.2 = "B_CTRL", verbose = FALSE).

Head (B. Interferon reaction, n = 15)

Another useful way to visualize these changes in gene expression is to use the split.by option of the FeaturePlot () or VlnPlot () function. This will display the feature map of a given gene list divided by grouping variables (here, stimulus conditions). Genes such as CD3D and GNLY are typical cell type markers (for T cells and NK/ CD8 T cells), which are virtually unaffected by interferon stimulation and show similar gene expression patterns in the control group and the stimulation group. On the other hand, IFI6 and ISG 15 are core interferon response genes, so they are up-regulated in all cell types. Finally, CD 14 and CXCL 10 are genes that show cell type-specific interferon response. The expression of CD65438 +04 in CD 14 monocytes decreased after stimulation, which may lead to misclassification in the framework of supervised analysis, emphasizing the value of comprehensive analysis. After interferon stimulation, CXCL 10 showed obvious up-regulation in monocytes and B cells, but not in other cell types.

FeaturePlot(immune.combined,features = c("CD3D "," GNLY "," IFI6 "),split.by = "stim ",max.cutoff = 3,

Cols = c ("gray", "red"))

Plot & lt- VlnPlot(immune.combined. bound, features = c("LYZ ","ISG 15 ","CXCL 10 "), split.by = "stim", group.by = "celltype ",split.

Point size = 0, merge = false)

wrap_plots(plots = plots,ncol = 1)

The complex cell types were compared and analyzed by Seurat integration program. Here, we propose several key objectives:

1 Create "integrated" data analysis for downstream analysis

2 Identify cell types that appear in two data sets.

3. Obtaining cell type markers that are conserved in both control and stimulated cells.

4 Compare data sets to find out the specific response of cell types to stimuli.

1 Set Seurat Object

Library (Seurat)

SeuratData (Seuratdata)

Library (patchwork)

InstallData("ifnb ")

LoadData("ifnb ")

ifnb

str(ifnb)

ifnb.list & lt- SplitObject(ifnb,split.by = "stim ")

ifnb.list & lt- lapply(X = ifnb.list,FUN = function(x) {

X<- standardized data (x)

x & lt- FindVariableFeatures(x,selection.method = "vst ",nfeatures = 2000)

})

Function & lt-selectintegrationfeatures (object.list = ifnb.list)

2 Perform integration

Then, we use the FindIntegrationAnchors () function to identify the anchors, which takes a list of Seurat objects as input and uses these anchors to integrate the two data sets through IntegrateData ().

immune.anchors <。 -finditionanchors(object . list = ifnb . list,anchor.features = features)

Immune anchor

Str (immune anchor)

immune.combined & lt-integrated data(anchorset = immune . anchors)

3. Conduct comprehensive analysis

Now, we can make a single comprehensive analysis of all cells!

DefaultAssay & lt- "integration"

immune.combined & lt- ScaleData(immune.combined,verbose = FALSE)

immune.combined & lt- RunPCA(immune.combined,npcs = 30,verbose = FALSE)

immune.combined & lt- RunUMAP(immune.combined,reduction = "pca ",dims = 1:30)

immune.combined & lt- FindNeighbors(immune.combined,reduction = "pca ",dims = 1:30)

Immune. combined & lt-find clusters (immune. combined, resolution = 0.5)

p 1 & lt; - DimPlot(immune.combined,reduction = "umap ",group.by = "stim ")

p2 & lt- DimPlot(immune.combined,reduction = "umap ",label = TRUE,repel = TRUE)

p 1 + p2

In order to display these two conditions side by side, we can use the split.by parameter to display the classification color of each condition.

DimPlot(immune.combined,reduction = "umap ",split.by = "stim ")

4 Identify conservative cell type markers

In order to identify typical cell type marker genes that are conserved under different conditions, we provide FindConservedMarkers () function. This function performs differential gene expression test on each data set/group, and uses meta-analysis method in MetaDE R package to merge P values. For example, we can calculate the conservative marker genes in cluster 6 (NK cells) that have nothing to do with stimulation conditions.

DefaultAssay & lt- "ribonucleic acid"

'''

bio manager::install(' mult test ')

install.packages('metap ')

Library ("multiple tests")

'''

nk.markers & lt-findconsavedmarkers(immune . combined,ident. 1 = 6,grouping.var = "stim ",verbose = FALSE)

Head (nk.markers)

We can explore these marker genes for each cell group and use them to annotate our cell groups as specific cell types.

Str (natural marker)

Line name (natural tag)

Title (line name (natural tag))

FeaturePlot(immune.combined,features = head(row names(NK . markers),5),min.cutoff = "q9 ")

FeaturePlot(immune.combined,features = c("CD3D "," SELL "," CREM "," CD8A "," GNLY "," CD79A "," FCGR3A ",

" CCL2 "," PPBP "),min.cutoff = "q9 ")

Immune. combined & lt-renames (immune. combined, 0 = "CD 14 Mono ",1 = "CD4 naive t", 2 = "CD4 memory t ",

3 = "CD 16 mono ",4 = "B", 5 = "CD8 T ",6 = "NK", 7 = "T activation ",8 = "DC", 9 = "B activation ",

10 = "Mk ", 1 1 = "pDC ", 12 = "Eryth ", 13 = "Mono/Mk Doublets ", 14 = "HSPC ")

DimPlot(immune.combined,label = TRUE)

DotPlot () function with split.by parameter can be used to view the conserved cell type markers under various conditions, and show the expression level and the percentage of cell population expressing any given gene. Here, we draw 2-3 strong marker genes for each of our 14 clusters.

Idents (immune combination)<- factor (ideas (immune. combined), level = c("HSPC ","Mono/Mk Doublets ",

"pDC", "Eryth", "Mk", "DC", "CD 14 mono", "CD 16 mono", "b activation", "b", "CD8 T", "NK", "t activation",

"CD4 naive test", "CD4 memory test").

markers . to . plot & lt; - c("CD3D "," CREM "," HSPH 1 "," SELL "," GIMAP5 "," CACYBP "," GNLY "," NKG7 "," CCL5 ",

" CD8A "," MS4A 1 "," CD79A "," MIR 155HG "," NME 1 "," FCGR3A "," VMO 1 "," CCL2 "," S 100A9 "," HLA-DQA 1 ",

" GPR 183 "," PPBP "," GNG 1 1 "," HBA2 "," HBB "," TSPAN 13 "," IL3RA "," IGJ "," PRSS57 ")

DotPlot(immune.combined,features = markers.to.plot,cols = c("blue "," red "),dot.scale = 8,split.by = "stim") +

Rotating shaft ()

5 Identify differentially expressed genes under different conditions

Now that we have arranged the stimulated cells and the control cells, we can start a comparative analysis to see the differences caused by stimulation. One way to observe these changes widely is to draw the average expression of stimulated cells and control cells, and look for the genes with visual abnormalities on the scatter plot. Here, we take the average expression of stimulated and control naive T cells and CD 14 monocyte population, and generate a scatter plot to highlight the genes that have shown significant response to interferon stimulation.

Library (ggplot2)

Library (Copt)

theme_set(theme_cowplot())

Identifier (immune combination)

T cells & lt- subset (immune combination, idents = "CD4 naive T ")

Head (T cell)

Tail (T cell)

T cell

'''

my _ tcells & lt-immune.combined@assays$RNA[,orig.ident=c('IMMUNE_CTRL ',' IMMUNE_STIM')]

Title (my _ cell)

Column Name (My Cell)

'''

The level at this time is CD4 initial T cells.

T cell identifier <-"STIM" # # The level at this time is control and stimulation.

T cell RNA

T cells @ analysis RNA))

Mean t cell

Average T cell $ gene <-row name (average T cell)

Mean t cell

CD 14 . mono & lt; -subset (immune.combined, ideas = "CD14mono")

idents(CD 14 . mono)& lt; -"Dope"

avg . CD 14 . mono & lt; -as . data . frame(log 1p(average expression(CD 14 . mono,verbose = FALSE)gene & lt; -line name (avg.cd 14.mono)

avg CD 14 . mono

genes.to.label = c("ISG 15 "、" LY6E "、" IFI6 "、" ISG20 "、" MX 1 "、" IFIT2 "、" IFIT 1 "、" CXCL 10 "、" CCL8 ")

p 1 & lt; -ggplot (mean T cells, aes(CTRL, Stim))+geom _ point ()+ggtitle ("CD4 naive T cells").

p 1

p 1 & lt; - LabelPoints(plot = p 1,points = genes.to.label,repel = FALSE)

P2<-ggplot (avg.cd14.mono, aes(CTRL, stim))+geom _ point ()+ggtitle ("cd14 monocyte").

p2 & lt- LabelPoints(plot = p2,points = genes.to.label,repel = TRUE)

p 1 + p2

'''

Library (dplyr)

Mean t cell

Average T cells%>%

Select (CTRL, STIM)% & gt;; % un list()% & gt; %

Sd ()

'''

As you can see, many of the same genes are up-regulated in these two cell types, which may represent a conservative interferon response pathway.

Because we are confident that we can identify common cell types under different conditions, we can ask which genes of the same cell type have changed under different conditions. First, we create a column in the metadata slot to store the cell type and stimulation information, and switch the current identifier to this column. Then we use FindMarkers () to find different genes between stimulated B cells and control B cells. Please note that many of the top genes shown here are the same as the core interferon response genes we have drawn before. In addition, genes such as CXCL 10, which we see are specific genes for interferon response between monocytes and B cells, also show high significance in this list.

head(immune.combined@meta.data, 10)

Immune combined stimulation, sep = "_ ")

head(immune.combined@meta.data, 10)

Immune.combined $ celltype & lt--logo (immune combination)

head(immune.combined@meta.data, 10)

Identifier (immune combination)

Idents (immune combination)<- "celltype.stim "

Identifier (immune combination)

B. Interferon. Reaction & lt-find markers (immune. combined, ident. 1 = "B_STIM ",ident.2 = "B_CTRL", verbose = FALSE).

Head (B. Interferon reaction, n = 15)

Another useful way to visualize these changes in gene expression is to use the split.by option of the FeaturePlot () or VlnPlot () function. This will display the feature map of a given gene list divided by grouping variables (here, stimulus conditions). Genes such as CD3D and GNLY are typical cell type markers (for T cells and NK/ CD8 T cells), which are virtually unaffected by interferon stimulation and show similar gene expression patterns in the control group and the stimulation group. On the other hand, IFI6 and ISG 15 are core interferon response genes, so they are up-regulated in all cell types. Finally, CD 14 and CXCL 10 are genes that show cell type-specific interferon response. The expression of CD65438 +04 in CD 14 monocytes decreased after stimulation, which may lead to misclassification in the framework of supervised analysis, emphasizing the value of comprehensive analysis. After interferon stimulation, CXCL 10 showed obvious up-regulation in monocytes and B cells, but not in other cell types.

FeaturePlot(immune.combined,features = c("CD3D "," GNLY "," IFI6 "),split.by = "stim ",max.cutoff = 3,

Cols = c ("gray", "red"))

Plot & lt- VlnPlot(immune.combined. bound, features = c("LYZ ","ISG 15 ","CXCL 10 "), split.by = "stim", group.by = "celltype ",split.

Point size = 0, merge = false)

wrap_plots(plots = plots,ncol = 1)