title: "Decoding Intracellular Pathogen of H3N2 at the Single-Cell level using Yeskit" author: "Wei Zhang" date: "2021/09/10" output: html_document: toc: yes toc_depth: 4 toc_float: no theme: cerulean highlight: tango number_sections: yes df_print: tibble pdf_document: toc: yes toc_depth: '4' fig_caption: yes vignette: > %\VignetteIndexEntry{Tutorial} %\usepackage[UTF-8]{inputenc} %\VignetteEncoding{UTF-8} %\VignetteEngine{knitr::rmarkdown}


knitr::opts_chunk$set(echo = TRUE, cache = FALSE, eval = TRUE,
                      warnings = FALSE, message = FALSE,
                      fig.width = 6, fig.height = 5)

Taking the in-vitro experiment of H3N2 infection data (SRA Accession number: SRP239555) as an example, we used PathogenTrack to identify H3N2 infected cells at the single-cell level and used Yeskit to analyze and explore the biological functions that may be related to H3N2 infection.

Install Yeskit from GitHub

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
if (!requireNamespace("devtools", quietly = TRUE))
    BiocManager::install("devtools")
if (requireNamespace("Yeskit", quietly = TRUE))
    devtools::install_github("ncrna/Yeskit")

Import Yeskit

First, we load the package:

library(Yeskit)
library(topGO)

Importation

Now, let's load the single-cell count matrix:

Bystander <- scRead(sample_name = "Bystander", 
                    data_dir = system.file("extdata/H3N2_10X_matrix/Bystander/", 
                                           package="Yeskit"), 
                    gene_column = 2, project_name = "H3N2", group_name = "Bystander", 
                    meta_file = system.file("extdata/H3N2_10X_matrix/Bystander/microbes.tsv", 
                                            package="Yeskit")
                    )
Infected <- scRead(sample_name = "Infected", 
                   data_dir = system.file("extdata/H3N2_10X_matrix/Infected/", 
                                          package="Yeskit"), 
                   gene_column = 2, project_name = "H3N2", group_name = "Infected", 
                   meta_file = system.file("extdata/H3N2_10X_matrix/Infected/microbes.tsv", 
                                           package="Yeskit"))

Integration

Then, we integrate these two Seurat object

Integrated <- scIntegrate(object.list=list(Bystander, Infected), 
                               object.names = c("Bystander", "Infected"), 
                               batch.rm = "harmony", res = 0.7)

FindMarkers

slot(Integrated, "misc")$Markers <- Seurat::FindAllMarkers(object = Integrated,
                                                                assay = 'RNA', 
                                                                test.use = 'MAST')

Differential analysis

Differential analysis between Infected and Bystander

slot(Integrated, "misc")$Infected_vs_Bystander <- scDGE(object = Integrated, 
                                                             comparison = c("Infected", "Bystander"), 
                                                             group.by = "group", min.cells = 10, 
                                                             logFC = 0.25, clusters = NULL)

Differential analysis between H3N2_positive and H3N2_negative

slot(Integrated, "misc")$H3N2 <- scPathogenDGE(object = Integrated, 
                                                    species.by = "H3N2", min.cells = 5)

GO annotation

GO annotation of Markers

slot(Integrated, "misc")$Markers.GO <- scGO(object = Integrated, 
                                                 key = "Markers", 
                                                 logFC = 0.25, 
                                                 only.pos = TRUE, 
                                                 reference = "human")

GO annotation of DGEs between Infected and Bystander

slot(Integrated, "misc")$Infected_vs_Bystander.GO <- scGO(object = Integrated, 
                                                               key = "Infected_vs_Bystander", 
                                                               logFC = 0.25, only.pos = FALSE,
                                                               reference = "human")

GO annotation of DGEs between H3N2_positive and H3N2_negative

slot(Integrated, "misc")$H3N2.GO <- scPathogenGO(object = Integrated, key = "H3N2", 
                                                      clusters = NULL, species = "H3N2", 
                                                      logFC = 0.25)

MSigDB scoring

Integrated <- scMsigdbScoring(object = Integrated, 
                                   category = "H", 
                                   geneSets = c("HALLMARK_INFLAMMATORY_RESPONSE", 
                                                "HALLMARK_TNFA_SIGNALING_VIA_NFKB", 
                                                "HALLMARK_APOPTOSIS")
                                   )

Visualization

Visualization of cell clusters by scDimPlot

scDimPlot(object = Integrated, 
          reduction = "umap", 
          cols = NULL, 
          split.by = "sample", 
          ncol = 2, 
          pt.size = 2)

Visualization of cell densities by scDensityPlot

scDensityPlot(object = Integrated, 
              reduction = "umap", 
              split.by = "sample", 
              ncol = 2)

Visualization of cell population fractions by scPopulationPlot, the x axis stands for clusters

scPopulationPlot(object = Integrated, 
                 by = "cluster", 
                 cols = "sc", 
                 order = c("Bystander", "Infected"))

Visualization of cell population fractions by scPopulationPlot, the x axis stands for samples

scPopulationPlot(object = Integrated, 
                 by = "sample", 
                 order = c("Bystander", "Infected"))

Visualization of meta data by scVizMeta

scVizMeta(object = Integrated, 
          reduction = "umap", 
          signature="H3N2", 
          title = "H3N2", 
          raster = TRUE, 
          split.by = "sample", 
          pt.size = 2, 
          interval = c(
            Abundant = 1000, 
            Large = 500, 
            Medium = 100, 
            Small = 10, 
            Single = 1, 
            None = 0)
          )

Visualization of H3N2-infected cell fractions by scPathogenRatioPlot

scPathogenRatioPlot(object = Integrated, 
                    species = "H3N2", 
                    split.by = "sample", 
                    ncol = 2)

Visualization of DGEs by scVolcanoPlot

scVolcanoPlot(Integrated, 
              key = "Infected_vs_Bystander", 
              cluster = "0", 
              top_n = 10)

Visualization of enriched GO terms for up-regulated genes by scGOBarPlot

scGOBarPlot(object = Integrated, 
            key = "Infected_vs_Bystander.GO", 
            ont = "BP", 
            top_n = 6, 
            direction = "up", 
            cluster = "0")

Visualization of enriched GO terms for down-regulated genes by scGOBarPlot

scGOBarPlot(object = Integrated, 
            key = "Infected_vs_Bystander.GO", 
            ont = "BP", 
            top_n = 6, 
            direction = "down", 
            cluster = "0")

Visualization of enriched GO terms for up-regulated genes by scGODotPlot

scGODotPlot(object = Integrated, 
            key = "Infected_vs_Bystander.GO", 
            ont = "BP", 
            direction = "up", 
            top_n = 10, 
            font.size = 8)

Visualization of enriched GO terms for down-regulated genes by scGODotPlot

scGODotPlot(object = Integrated, 
            key = "Infected_vs_Bystander.GO", 
            ont = "BP", 
            direction = "down", 
            top_n = 10,
            clusters = c("0"),
            font.size = 8)

BarPlot shows enriched GO terms for up-regulated genes of H3N2pos_vs_H3N2neg

scGOBarPlot(Integrated, key = "H3N2.GO", cluster = "0", extra = "H3N2", top_n = 6)

DotPlot shows enriched GO terms for up-regulated genes of H3N2pos_vs_H3N2neg

scGODotPlot(Integrated, key = "H3N2.GO", clusters = "0", extra = "H3N2", top_n = 6)

Visualization of HALLMARK_INFLAMMATORY_RESPONSE pathway

scScoreDimPlot(Integrated, 
               signature = "HALLMARK_INFLAMMATORY_RESPONSE", 
               split.by="sample", 
               ncol = 2, 
               pt.size = 2)

Visualization of HALLMARK_TNFA_SIGNALING_VIA_NFKB pathway

scScoreDimPlot(Integrated, 
               signature = "HALLMARK_TNFA_SIGNALING_VIA_NFKB", 
               split.by="sample", 
               ncol = 2, 
               pt.size = 2)

Visualization of HALLMARK_APOPTOSIS pathway

scScoreDimPlot(Integrated, 
               signature = "HALLMARK_APOPTOSIS", 
               split.by="sample", 
               ncol = 2, 
               pt.size = 2)

Session Information

sessionInfo()


rstatistics/SCKIT documentation built on Dec. 22, 2021, 7:18 p.m.