GFF2GTF.py2
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
GFF2GTF.py2的更多相关文章
- python py2与py3的编码问题
一:什么是编码 将明文转换为计算机可以识别的编码文本称为"编码".反之从计算机可识别的编码文本转回为明文为"解码". 那么什么是明文呢,首先我们从一段信息说起, ...
- Python 高度定制化自己的线程类和进程类代码,获取启动进程或线程方法的结果(兼容Py2和Py3)
#encoding=utf-8 from threading import Thread from multiprocessing import Process import multiprocess ...
- py2与py3区别总结
1. py2中的str是py3中的bytes py2中的Unicode是py3中的str 声明一个字符串变量时,py2 和py3都是str类型,但py2代表字节类型,py3代表文本类型 隐式转换: p ...
- 1.python虚拟环境的安装-用以同时使用py2,py3
第一步:安装环境支持[linux下在前加sudo] http://www.lfd.uci.edu/~gohlke/pythonlibs/#pycurl pip install virtualenv 第 ...
- python模块之lib2to3(py2转py3自动化工具)
# -*- coding: utf-8 -*- #python 27 #xiaodeng #python模块之lib2to3(py2转py3自动化工具) #http://tieba.baidu.com ...
- [py]py2自带Queue模块实现了3类队列
py2自带Queue实现了3类队列 先搞清楚几个单词 Queue模块实现了三类队列: FIFO(First In First Out,先进先出,默认为该队列), 我们平时泛指的队列, LIFO(Las ...
- 用python实现一个简单的socket网络聊天通讯 (Linux --py2.7平台与windows--py3.6平台)
windows --> windows 写法均在py3.6 客户端写法 import socket client = socket.socket() client.connect(('192 ...
- ubuntun16.04+cuda9.0+cudnn7+anaconda3+pytorch+anaconda3下py2安装pytorch
一.电脑配置 说明: 电脑配置: LEGION笔记本CPU Inter Core i7 8代GPU NVIDIA GeForce GTX1060Windows10 所需的环境: Anaconda3(6 ...
- Anaconda3+python3环境下如何创建python2环境(win+Linux下适用,同一个anaconda下py2/3共存)
本人之前已经在anaconda环境下已经安装了python3的环境,现在因为一些需求,要安装python2环境 1.打开anaconda的anaconda prompt查看当前环境: conda in ...
- 字符编码py2,py3操作,SecureCRT的会话编码的设置
对之前的字符串类型和二进制类型(bytes类型),可以这样关联记忆,把字符串类型当作是Unicode,把bytes类型当作是GBK或者UTF-8或者是日文编码.这样字符串要转成二进制,那么就需要编码e ...
随机推荐
- springboot集成es7(基于high level client)
环境: ES: 7.12.0 1.springboot工程引入es相关jar <dependency> <groupId>org.elasticsearch</group ...
- vvv动态组件和keep-alive
<!DOCTYPE html><html> <head> <style> </style> <script src="a.j ...
- adobe 色轮
https://color.adobe.com/zh/create/color-wheel
- No.1.5
优先级:不同选择器具有不同的优先级,优先级高的选择器样式会覆盖优先级低选择器的样式 优先级公式:!imporant>行内样式>id选择器>类选择器>标签选择器>通配符选择 ...
- vue-quill-editor 图片上传处理
<template> <div class="quill-editor"> <!-- 图片上传组件辅助--> <el-upload cla ...
- from pathlib import Path
from pathlib import Path #引入库 P.parent #获取父级目录 P.exists() #判断当前路径是否存在 P.mkdir(parents=Fasle) # 根据路径创 ...
- kibana启动时报错:Validation Failed: 1: this action would add [2] total shards, but this cluster currently has [999]/[1000] maximum shards open
解决方案: curl -XPUT -H "Content-Type:application/json" -d '{"persistent":{"clu ...
- element 的Descriptions 描述列表固定宽度
在el-descriptions-item上添加label-class-name="" css中使用自定义的class名设置样式(不能用<style scoped>包裹 ...
- Delphi实现大写字母键打开提示
uses XPMan 编辑框的passwordChar属性设置成 *
- 【七侠传】冲刺阶段--Day6
[七侠传]冲刺阶段--Day6 团队成员 20181221曾宇涛 20181202李祎铭 20181209沙桐 20181215薛胜瀚 20181216杨越麒 20181223何家豪 20181232 ...