老規(guī)矩,推薦大家看官網(wǎng),資料:
- 官網(wǎng)scMappR:https://cran.r-project.org/web/packages/scMappR/vignettes/scMappR_Vignette.html
- 數(shù)據(jù):https://github.com/wilsonlabgroup/scMappR_Data
- 文章:https://academic.oup.com/nargab/article/3/1/lqab011/6148840
- 文章中所有數(shù)據(jù)和代碼:https://figshare.com/s/3b5cfb597a0b3bc2801c
此包簡單介紹:
當(dāng)整個(gè)組織的RNA-seq(bulk RNA-seq)完成時(shí),確定基因表達(dá)的變化在多大程度上是由于細(xì)胞類型比例的變化往往是一個(gè)挑戰(zhàn)。這一挑戰(zhàn)可以通過單細(xì)胞RNA-seq(scRNA-seq)方法來解決,該方法在單細(xì)胞分辨率下測(cè)量基因表達(dá),利用scRNA-seq從bulk RNA-seq中了解細(xì)胞類型比例(RNA-seq反褶積)。
scMappR(single cell Mapper),通過利用scRNAseq和現(xiàn)有的反褶積方法生成細(xì)胞類型表達(dá)數(shù)據(jù),為從bulk RNA-seq中獲得的DEGs分配細(xì)胞類型特異性評(píng)分。
scMappR能同時(shí)推斷哪些細(xì)胞類型驅(qū)動(dòng)特定DEG的表達(dá),并利用推斷的DEG細(xì)胞類型特異性來完成細(xì)胞類型特異性通路分析。
原理圖:
為了推斷哪些細(xì)胞類型驅(qū)動(dòng)了特定DEG的表達(dá),scMappR工作流首先使用已建立的反褶積工具來推斷細(xì)胞類型的比例。

主要功能:
- 1.Transforming summary statistics of differentially expressed genes by cell-type specific information
- scMappR_and_pathway_analysis()函數(shù)
- two_method_pathway_enrichment()函數(shù)
- cwFoldChange_evaluate()函數(shù)
- 2.Enriching cell-type markers in a list of genes
- 3.Processing scRNA-seq count data into a signature matrix
本教程需要使用的數(shù)據(jù)在:https://github.com/wilsonlabgroup/scMappR_Data,可前往自行下載下來保存到本地。
環(huán)境準(zhǔn)備
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
if (!requireNamespace("devtools", quietly = TRUE))
install.packages("devtools")
BiocManager::install("pcaMethods")
BiocManager::install("GSVA")
devtools::install_github("wilsonlabgroup/scMappR")
library(scMappR)
signature matrix構(gòu)建過程
我主要比較關(guān)心cell-type signature matrix是如何構(gòu)建的~
文章中主要使用scMappR構(gòu)建了一個(gè)cell-type signature matrix,然后使用CIBERSORT:(https://cibersortx.stanford.edu/) 進(jìn)行尿液外泌體的細(xì)胞類型溯源。

溯源結(jié)果如下:

那么這里的關(guān)鍵就是:cell-type signature matrix的構(gòu)建。
scMappR包可以將單細(xì)胞count矩陣轉(zhuǎn)化為signature matrix,步驟如下:
- scMappR 輸入一個(gè)count矩陣列表(列表內(nèi)可以是 list、 dCGMatrix 或matrix對(duì)象類型) ,使用Seurat V4 對(duì)其進(jìn)行重新處理
- 然后,基于 CellMarker 和 Panglao 數(shù)據(jù)庫,使用 GSVA 和 Fisher精確檢驗(yàn)方法查找細(xì)胞類型marker并識(shí)別潛在的細(xì)胞類型
- 最后,使用odds ratios值與ranks值創(chuàng)建一個(gè)signature matrix
- 這個(gè)包內(nèi)置可選的組織數(shù)據(jù)有: “brain”, “epithelial”, “endothelial”, “blood”, “connective”,“eye”, “epidermis”, “Digestive”, “Immune”, “pancreas”, “l(fā)iver”, “reproductive”, “kidney”, “respiratory”
主要使用的函數(shù)為:process_dgTMatrix_lists
去這個(gè)包內(nèi)部一探究竟:


這個(gè)函數(shù)內(nèi)部使用Seurat包處理單細(xì)胞數(shù)據(jù),進(jìn)行注釋等操作。
只有一個(gè)樣本的情況
只有一個(gè)樣本時(shí),不需要進(jìn)行樣本整合。
sm示例數(shù)據(jù)包含752個(gè)基因,236個(gè)細(xì)胞,組織類型為小鼠的眼睛。
rm(list=ls())
library(scMappR)
library(ggplot2)
library(RColorBrewer)
library(tidyverse)
# 參考數(shù)據(jù)例子
data(sm)
class(sm)
colnames(sm)
rownames(sm)
dim(sm)
sm[1:4,1:4]
4 x 4 sparse Matrix of class "dgCMatrix"
TCTCTAACACAGGCCT GTTAAGCTCAAGGTAA ATTCTACGTAAGGGAA TAAGCGTCAAGCTGTT
Abi1 . 7 1 1
AC026478.1 1 8 2 1
AC102483.1 7 2 3 7
AC120860.1 . 1 1 1
# 轉(zhuǎn)成list對(duì)象
toProcess <- list(example = sm)
# 一鍵生成signature matrix
tst1 <- process_dgTMatrix_lists(toProcess, name = "testProcess", species_name = "mouse",
naming_preference = "eye", rda_path = "scMappR_Data-master/",
toSave = TRUE, saveSCObject = TRUE, path = "./")
# 探索一下數(shù)據(jù)結(jié)果
str(tst1)
tst1$wilcoxon_rank_mat_t[1:4,1:4]
tst1$wilcoxon_rank_mat_or[1:4,1:4]
str(tst1$generes)
tst1$cellLabel
這個(gè)步驟有用到一個(gè)marker數(shù)據(jù),為包中:mouse_cell_markers.rda:https://github.com/wilsonlabgroup/scMappR_Data
lname <- load("scMappR_Data-master/mouse_cell_markers.rda")
lname
str(gmt_list,max.level = 1)
List of 5
$ gmt_both :List of 721
$ gmt_cellmarker:List of 579
$ gmt_gobp :List of 19394
$ gmt_panglao :List of 142
$ gmt_subtype :List of 19
總共有5個(gè)來源的常見細(xì)胞類型marker庫
# CellMarker數(shù)據(jù)庫marker
head(gmt_list$gmt_cellmarker)
$`Human: Kidney: Proximal tubular cell`
[1] "Akp3" "Alppl2" "Alpi"
$`Human: Liver: Ito cell (hepatic stellate cell)`
character(0)
$`Human: Endometrium: Trophoblast cell`
[1] "Psg16" "Psg23" "Ceacam2" "Ceacam13" "Psg22" "Psg26" "Ceacam14" "Psg21" "Ceacam12" "Psg29" "Ceacam3" "Psg20" "Psg25"
[14] "Ceacam5" "Psg19" "Ceacam1" "Psg27" "Psg18" "Psg28" "Ceacam10" "Psg17" "Gm5155" "Ceacam11"
$`Human: Germ: Primordial germ cell`
[1] "Ddx4"
$`Human: Corneal epithelium: Epithelial cell`
[1] "Klf6"
$`Human: Placenta: Cytotrophoblast`
[1] "Fgf10"
# 看看有多少種組織
names(gmt_list$gmt_cellmarker)
[1] "Human: Kidney: Proximal tubular cell"
...
[565] "Human: Fetal liver: Lymphoblast"
[566] "Human: Fetal liver: Erythroblast"
[567] "Human: Fetal liver: Endothelial cell"
[568] "Human: Fetal liver: Kupffer cell"
[569] "Human: Fetal liver: Mesenchymal cell"
[570] "Human: Fetal liver: Hepatocyte"
[571] "Mouse: Liver: Hepatocyte"
[572] "Human: Lung: Basal cell"
[573] "Human: Lung: Secretory cell"
[574] "Human: Lung: Ciliated cell"
[575] "Human: Lung: Brush cell (Tuft cell)"
[576] "Human: Lung: Neuroendocrine cell"
[577] "Human: Lung: Ionocyte cell"
[578] "Mouse: Trachea: Basal cell"
[579] "Mouse: Trachea: Cycling basal cell"
根據(jù)上面的process_dgTMatrix_lists函數(shù),生成一個(gè)tst1對(duì)象,內(nèi)容為:
- wilcoxon_rank_mat_t:數(shù)據(jù)框,為signature matrix的ranks值,rank值為(-log10(Padj) * sign(fold-change))

- wilcoxon_rank_mat_or:數(shù)據(jù)框,signature matrix的odds-ratios值

ranks值與or值的核心代碼:所以,以后如果需要比較靈活的生成signature matrix,直接用下面的公式就可以了。

對(duì)于signature matrix,行是marker基因,列是注釋的cell-type
- generes:注釋后的細(xì)胞類型差異表達(dá)結(jié)果,為list對(duì)象,每一個(gè)list為此細(xì)胞類型中的細(xì)胞相對(duì)于剩余所有細(xì)胞的差異表達(dá)結(jié)果

- cellLabel:細(xì)胞注釋詳細(xì)情況,由四種方法分別注釋的結(jié)果CellMarkerFisher,PanglaoFisher,CellMarkerGSVA,PanglaoGSVA。以及the top 30 markers per cluser。

其余情況
這個(gè)包還有列出有多個(gè)樣本時(shí)和已經(jīng)有注釋的Seurat對(duì)象如果操作,那么,到這里,知道了ranks值與or值的核心代碼,其實(shí)就可以脫離這個(gè)包自己造signature matrix了。