salmon 转录本定量转为基因水平定量

需要提前安装GenomicFeatures 和 tximport

library(GenomicFeatures)
library(tximport)
gtf_file='gene.gtf'
txdb <- makeTxDbFromGFF(gtf_file)
k <- keys(txdb, keytype = "TXNAME")
tx2gene <- select(txdb, k, "GENEID", "TXNAME")
count_dir='/data1/download'
name=c('SRR1','SRR2','SRR3','SRR4')
files <- file.path(count_dir, name,"quant.sf")
names(files) <- paste0(name)
txi.salmon <- tximport(files, type = "salmon", tx2gene = tx2gene)
counts=txi.salmon$counts
tpm=txi.salmon$abundance
write.table(tpm,'gene.tmp',sep='\t',quote=F)
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容