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

最新文章

  1. PHP基础知识之魔术方法
  2. 关于Entity Framework使用的简单例子
  3. CentOS 7 程序自启动的问题
  4. matplotlib 基础
  5. gspx请求周期(备忘)
  6. hdu 1008 注意同层情况
  7. 42.旋转数组的最小元素[Get min value of rotated array]
  8. Android Dialogs(6)Dialog类使用示例:用系统theme和用自定义的theme
  9. 网站页面优化必然趋势—WebP 图片!
  10. mysql重装后出现乱码解决办法
  11. 1.JAVA WEB 笔记中文乱码
  12. 【LeetCode】数组-3(605)-种花问题( 1 的两侧不能有 1 )
  13. 程序员之殇 —— (The Beginning of the End)噩梦、崩坏
  14. js every some 遍历函数理解
  15. vue脚手架构
  16. TroubleShoot: Fail to deploy Windows UAP to device: 0x80073CFD
  17. requestURI的组成部分
  18. Bing词典vs有道词典比对测试报告——体验篇之软件适应性
  19. 2017北京国庆刷题Day1 morning
  20. LeetCode解题报告—— Longest Valid Parentheses

热门文章

  1. C语言中的转义字符\b的含义
  2. 如何使用cmd(dos命令)关闭IIS中某个站点
  3. mathcurve.com
  4. C++实现单链表相关操作
  5. OSP6部署流程
  6. golang基本数据类型
  7. Net6的核心组件之中间件
  8. Python3注释
  9. oracle 函数instr
  10. MFC调用外部dll时,出现无法解析的外部符号的解决方法)