计算细胞周期,需要先对数据进行标准化
pbmc <- NormalizeData(object = pbmc, normalization.method = "LogNormalize", scale.factor = 10000)
s.genes <- cc.genes$s.genes
g2m.genes <- cc.genes$g2m.genes
pbmc<- CellCycleScoring(pbmc, s.features = s.genes, g2m.features = g2m.genes, set.ident = TRUE)
head(pbmc@meta.data)
CellCycleScoring函数回自动计算细胞周期并储存在pbmc@meta.data
# orig.ident nCount_RNA nFeature_RNA S.Score G2M.Score Phase old.ident
#P1TLH_AAACCTGAGCAGCCTC_1 P1TLH 1633.605 1436 0.07536769 0.0002187129 S P1TLH
#P1TLH_AAACCTGTCCTCATTA_1 P1TLH 1439.645 2533 -0.02311835 0.0107256067 G2M P1TLH
#P1TLH_AAACCTGTCTAAGCCA_1 P1TLH 1517.970 1030 0.03511153 -0.0900560635 S P1TLH
#P1TLH_AAACGGGAGTAGGCCA_1 P1TLH 1817.202 1808 -0.04005376 -0.0817285494 G1 P1TLH
#P1TLH_AAACGGGGTTCGGGCT_1 P1TLH 1617.453 1428 0.12846110 -0.0080281217 S P1TLH
#P1TLH_AAAGCAACAGTAAGAT_1 P1TLH 2159.746 786 0.02397663 -0.0780498558 S P1TLH
library(ggplot2)
p <- ggplot(pbmc@meta.data,aes(G2M.Score,S.Score,color = Phase))+
geom_point()
p
Fig1.png
library(scales)
p <- ggplot(pbmc@meta.data,aes(x=old.ident,fill= Phase))+
geom_bar(position ="fill")+
xlab(NULL)+ylab("PERCENT")+
scale_y_continuous(labels = percent,breaks=seq(0,1,by=0.2))
p
Fig2.png
p <- ggplot(pbmc@meta.data,aes(x=old.ident,fill= Phase))+
geom_bar(position ="dodge")+xlab(NULL)
p
Fig3.png
p <- ggplot(pbmc@meta.data,aes(x=orig.ident,fill= Phase))+
geom_bar(position ="stack")+xlab(NULL)+ylab("Cell")
p
Fig4.png
网友评论