chengcz / pygtf Goto Github PK
View Code? Open in Web Editor NEWpython parser of Fastx, GTF, NCBI GFF files, and extract targeted seq from genome
License: MIT License
python parser of Fastx, GTF, NCBI GFF files, and extract targeted seq from genome
License: MIT License
When use pyGTF, i Encountered KeyError: 'ID'
my code
import sys
from pyGTF import Transcript
from pyGTF import GTFReader
with GTFReader('A.gtf',flag_stream=True) as fi:
for i in fi:
print(i.summary)
KeyError Traceback (most recent call last)
in ()
1 with GTFReader('A.gtf',flag_stream=True) as fi:
----> 2 for i in fi:
3 print(i.summary)
4
~\AppData\Local\Continuum\anaconda3\lib\site-packages\pygtf-0.1.1-py3.6.egg\pyGTF.py in iter(self)
1191 def iter(self):
1192 Iterator = self.__stream_mode() if self._flag_stream else self.__store_mode()
-> 1193 for trans in Iterator:
1194 _transid, _chro, _interval, _strand, _exon, _cds, _utr, _attr = trans
1195 _attr = {
~\AppData\Local\Continuum\anaconda3\lib\site-packages\pygtf-0.1.1-py3.6.egg\pyGTF.py in __stream_mode(self)
1205 '''
1206 t_id, t_exon, t_cds, t_utr, t_info = None, Interval(), Interval(), Interval(), {}
-> 1207 for line in self.__read_gtf():
1208 chro, _, feature, start, end, _, strand, _, attr, line_id = line
1209
~\AppData\Local\Continuum\anaconda3\lib\site-packages\pygtf-0.1.1-py3.6.egg\pyGTF.py in __read_gtf(self)
1291 attr = [x.strip().partition('=') for x in attr.split(';') if x.strip()]
1292 attr = {x[0]: x[2].strip(''\t\n\r"') for x in attr}
-> 1293 line_id = attr['ID'] if feature in self._transcript_feature else attr['Parent']
1294 else:
1295 attr = [x.strip().partition(' ') for x in attr.split(';') if x.strip()]
KeyError: 'ID'
A.gtf
NC_012007.3 StringTie transcript 10713 27534 . + . transcript_id "TCONS_00003418"; gene_id "XLOC_000004"; gene_name "LOC104879287"; oId "STRG.2.1"; cmp_ref "XR_785793.2"; class_code "="; tss_id "TSS42"; num_samples "4";
NC_012007.3 StringTie exon 10713 10945 . + . transcript_id "TCONS_00003418"; gene_id "XLOC_000004"; exon_number "1";
NC_012007.3 StringTie exon 12426 12529 . + . transcript_id "TCONS_00003418"; gene_id "XLOC_000004"; exon_number "2";
NC_012007.3 StringTie exon 12628 12700 . + . transcript_id "TCONS_00003418"; gene_id "XLOC_000004"; exon_number "3";
NC_012007.3 StringTie exon 12798 12859 . + . transcript_id "TCONS_00003418"; gene_id "XLOC_000004"; exon_number "4";
NC_012007.3 StringTie exon 12997 13119 . + . transcript_id "TCONS_00003418"; gene_id "XLOC_000004"; exon_number "5";
NC_012007.3 StringTie exon 26528 26632 . + . transcript_id "TCONS_00003418"; gene_id "XLOC_000004"; exon_number "6";
NC_012007.3 StringTie exon 26733 27534 . + . transcript_id "TCONS_00003418"; gene_id "XLOC_000004"; exon_number "7";
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.