哇槽华,是時(shí)候要整理一下以前的學(xué)習(xí)記錄了忙灼,以前傻里傻氣不知道通過(guò)平臺(tái)來(lái)記錄代碼,都是放在一個(gè)R腳本
里面結(jié)果導(dǎo)致今天別人問(wèn)一個(gè)同樣的問(wèn)題家夺,居然花了好久才找到自己以前的記錄脱柱,趕緊記下來(lái)進(jìn)行分類。
gff3文件格式參考
library(rtracklayer)
anno <- import.gff3("E://B512/Project/data/all.gff3")
exons <- anno[anno@elementMetadata$type %in% c("exon"),]
tmp <- split(exons,as.character(exons$Parent))
Gene_length <- sum(width(reduce(tmp)))
as.data.frame(Gene_length) -> PerTranscript_exon_length
write.table(PerTranscript_exon_length,"PerTranscript_exon_length.txt",quote =F)
小知識(shí):也可以通過(guò)
featureCounts
指定exon
然后計(jì)算基因Counts
拉馋,也可以得到基因或者轉(zhuǎn)錄本的有效的exon
長(zhǎng)度褐捻。