Commit 0a2d2ab2 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

No commit message

No commit message
parent da8e5fd1
......@@ -20,7 +20,7 @@ import os
from jflow.xopen import xopen
from jflow.seqio import FormatError
from jflow.seqio import UnknownFileType
import re
def boolify(s):
return {'True': True, 'False': False}[s]
......@@ -94,7 +94,9 @@ class GFF3Reader(_AbstractFeatureReader):
if len(row) != 9 : raise FormatError('Invalid number of columns in your GFF3 file {0}'.format( len(row)))
attributes = {}
if row[8] and row[8] != '.' :
attributes = { p.split('=')[0] : p.split('=')[1] for p in row[8].split(';')}
for p in row[8].split(';') :
if p != "" :
attributes[p.split('=')[0]] = p.split('=')[1]
return Entry(**{'seqid' : row[0], 'source' : row[1], 'type' : row[2], 'start' : int(row[3]), 'end' : int(row[4]),
'score' : row[5], 'strand' : row[6], 'phase' : row[7], 'attributes' : attributes })
......@@ -251,12 +253,12 @@ class VCFReader(_AbstractFeatureReader):
if row[7] != '.' :
variation.addattr( 'info', { p.split('=')[0] : autocast(p.split('=')[1]) for p in row[7].split(';') })
regexp_none=re.compile("\.(\/\.)*")
format = row[8].split(':')
for lib_infos in range (9,len(row)) :
if row[lib_infos] not in [ '.', './.'] :
if not regexp_none.match(row[lib_infos]):
sformat = row[lib_infos].split(':')
variation.samples.append( Entry(**{ autocast(format[i]) : autocast(sformat[i]) for i in range(0,len(format)) }) )
variation.samples.append( Entry(**{ autocast(format[i]) : autocast(sformat[i]) if sformat[i] != '.' else None for i in range(0,len(format)) } ) )
else :
variation.samples.append( Entry(**{ autocast(format[i]) : None for i in range(0,len(format)) }) )
return variation
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment