conda install -c bioconda gtftools
GTFtools是一款用Python编写的命令行工具,专门用于处理基因转录格式(GTF)文件。GTF文件是一种用于描述基因、外显子、转录本等基因组元素位置和属性的文件格式,被广泛应用于基因组学研究。
GTFtools不仅可以应用于人类,还可以应用于非人类基因模型,如实验室小鼠。
GTFtools的主要功能
合并外显子: GTFtools可以合并同一基因的所有剪接异构体(splice isoforms)的外显子。这对于计算具有多个剪接异构体的基因的非重叠外显子长度非常有用。
计算基因和转录本长度: GTFtools可以计算基因和转录本的长度,这对于基因表达分析(如TPM或FPKM的计算)至关重要。
提取特定基因组区域: GTFtools可以提取基因组中的特定区域,如基因、外显子、内含子、非编码区、上游和下游区域等。
输出SNP信息: GTFtools可以处理SNP信息,输出位于基因组特定区域(如基因附近)的SNPs。
该功能可以合并同一个基因的所有splice isoforms的外显子,并生成bed格式文件,可以用来计算具有多个isoforms的基因的非重叠外显子长度。
python gtftools.py -m merged_exons.bed demo.gtf
python gtftools.py -d independent_introns.bed demo.gtf
由于一个基因可能有多种亚型,因此有多种方法可以根据文献计算基因长度。有三种简单的方法是将亚型长度的平均值、中位数和最大值视为基因的长度。第四种方法是计算所有亚型的合并外显子的长度(即非重叠外显子长度)。因此,总共提供了四种不同类型的基因长度(基因亚型的平均、中位数和最大值长度,以及基因亚型合并外显子的长度)。
由于一个基因可能有多个isoforms,因此GTFtools提供了四种基因长度计算方法:mean,median,max及merged exons。其中merged exons就是TCGA count转TPM时所用的长度。
python gtftools.py -l gene_length.txt demo.gtf
python gtftools.py -r isoform_length.txt demo.gtf
python gtftools.py -g genes.bed demo.gtf
包含至少具有三列的 SNP 列表的输入文件,第一列是染色体,第二列是坐标,第三列是 SNP 名称,例如 rs ID 号。使用此选项,GTFtools将为提供的GTF文件中注释的每个基因搜索并输出顺式SNP。
python gtftools.py -p snp_list.txt demo.gtf > cisSNP.bed
-f 指定用于计算基因顺式范围的上游和下游距离。-f以“distup-distdown”的格式指定,其中distup表示与TSS的上游距离,distdown表示与基因末端的下游距离。请注意,此参数仅在使用“-g”选项时生效。
例如提取基因上游2000,下游1000的信息。
python gtftools.py -g gene.bed -f 2000-1000 demo.gtf
### 意味着基因上游的2000个碱基和下游的1000个碱基将被克隆为顺式范围,顺式范围将输出到gene.bed文件。默认情况下,-f 设置为 0-0,表示使用 -g 计算基因信息时不会计算顺式范围。
python gtftools.py -q splice_regions.bed demo.gtf
python gtftools.py -e exons.bed demo.gtf
python gtftools.py -i introns.bed demo.gtf
python gtftools.py -b intergenic_regions.bed demo.gtf
python gtftools.py -u utr.bed demo.gtf
python gtftools.py -t tss_regions.bed -w 1000-300 demo.gtf
python gtftools.py -g gene.bed -c 1-2,X,Y demo.gtf
一款纯Python编写的GTF处理脚本 - GTFtools - 简书 (jianshu.com)
GTFtools:a software package for analyzing various features of gene models