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

2021-07-20  本文已影响0人  今天没回家

需要提前安装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)
上一篇下一篇

猜你喜欢

热点阅读