GFF2GTF.py2
2024-10-21 23:13:42
import sys
inFile = open(sys.argv[1],'r')
for line in inFile:
#skip comment lines that start with the '#' character
if line[0] != '#':
#split line into columns by tab
data = line.strip().split('\t')
ID = ''
#if the feature is a gene
if data[2] == "gene":
#get the id
ID = data[-1].split('ID=')[-1].split(';')[0]
#if the feature is anything else
else:
# get the parent as the ID
ID = data[-1].split('Parent=')[-1].split(';')[0]
#modify the last column
data[-1] = 'gene_id "' + ID + '"; transcript_id "' + ID
#print out this new GTF line
print '\t'.join(data)
https://www.jianshu.com/p/c284a6b4e1c6
最新文章
- PHP基础知识之魔术方法
- 关于Entity Framework使用的简单例子
- CentOS 7 程序自启动的问题
- matplotlib 基础
- gspx请求周期(备忘)
- hdu 1008 注意同层情况
- 42.旋转数组的最小元素[Get min value of rotated array]
- Android Dialogs(6)Dialog类使用示例:用系统theme和用自定义的theme
- 网站页面优化必然趋势—WebP 图片!
- mysql重装后出现乱码解决办法
- 1.JAVA WEB 笔记中文乱码
- 【LeetCode】数组-3(605)-种花问题( 1 的两侧不能有 1 )
- 程序员之殇 —— (The Beginning of the End)噩梦、崩坏
- js every some 遍历函数理解
- vue脚手架构
- TroubleShoot: Fail to deploy Windows UAP to device: 0x80073CFD
- requestURI的组成部分
- Bing词典vs有道词典比对测试报告——体验篇之软件适应性
- 2017北京国庆刷题Day1 morning
- LeetCode解题报告—— Longest Valid Parentheses