cell cycle
细胞周期相关的包:https://mp.weixin.qq.com/s/nFSa5hXuKHrGu_othopbWQ
library(scran)
sce <- SingleCellExperiment(list(counts=dat))
cyclone()函数:
- sce: SingleCellExperiment
- mm.pairs(mouse的对象)
scran包自带mouse_cycle_markers.rds
&human_cycle_markers.rds
library(org.Mm.eg.db)
mm.pairs <- readRDS(system.file("exdata", "mouse_cycle_markers.rds",
package="scran"))
ensembl <- mapIds(org.Mm.eg.db, keys=rownames(sce),
keytype="SYMBOL", column="ENSEMBL")
cyclone函数需要识别ensembl,利用org.Mm.eg.db包根据symbol添加ensembl
- 判断周期
assigned <- cyclone(sce, pairs=mm.pairs, gene.names=ensembl) save(assigned,file = 'cell_cycle_assigned.Rdata')
rpkm
counts / (基因长度*文库大小)
基因长度包:TxDb.Mmusculus.UCSC.mm10.knownGene
txDb对象:?TxDb:the TxDb class is a container for storing transcript annotations.
exons()函数取exon
genes()函数取gene
findoverlaps()取交叉
?GRanges:The GRanges class is a container for the genomic locations and their associated annotations.
transcriptLengths()转录本长度函数
!duplicate() 删除重复即后出现的值
应用到的几个函数
cbind: 根据列进行合并,即叠加所有列,m列的矩阵与n列的矩阵cbind()最后变成m+n列,合并前提:cbind(a, c)中矩阵a、c的行数必需相符
rbind: 根据行进行合并,就是行的叠加,m行的矩阵与n行的矩阵rbind()最后变成m+n行,合并前提:rbind(a, c)中矩阵a、c的列数必需相符
split():split(x, f, drop = FALSE, ...)
x data to be divided,f define the grouping
split(d$income, list(d$gender,d$over25))
将income按照gender、over25分组