obi import: fixed creation of quality columns (to discuss)
This commit is contained in:
@ -19,7 +19,8 @@ from obitools3.utils cimport tobytes, \
|
||||
update_obitype
|
||||
|
||||
from obitools3.dms.capi.obitypes cimport obitype_t, \
|
||||
OBI_VOID
|
||||
OBI_VOID, \
|
||||
OBI_QUAL
|
||||
|
||||
from obitools3.dms.capi.obierrno cimport obi_errno
|
||||
|
||||
@ -45,7 +46,7 @@ def addOptions(parser):
|
||||
|
||||
addSequenceInputOption(parser)
|
||||
addMinimalOutputOption(parser)
|
||||
|
||||
# addTaxdumpInputOption(parser)
|
||||
|
||||
|
||||
def run(config):
|
||||
@ -89,6 +90,8 @@ def run(config):
|
||||
|
||||
input = open_uri(config['obi']['inputURI'])
|
||||
|
||||
print(input)
|
||||
|
||||
if input[2]==Nuc_Seq:
|
||||
v = View_NUC_SEQS
|
||||
else:
|
||||
@ -97,9 +100,13 @@ def run(config):
|
||||
output = open_uri(config['obi']['outputURI'],
|
||||
input=False,
|
||||
newviewtype=v)
|
||||
#quality=get_quality) # TODO
|
||||
|
||||
#print(input)
|
||||
#print(output)
|
||||
if output is None:
|
||||
raise Exception("Could not create output view")
|
||||
|
||||
print("input:", input)
|
||||
print("output:", output)
|
||||
|
||||
pb = ProgressBar(1000000, config, seconde=5) # TODO should be number of records in file
|
||||
|
||||
@ -107,14 +114,11 @@ def run(config):
|
||||
|
||||
NA_value = config['obi']['nastring']
|
||||
|
||||
get_quality = False
|
||||
NUC_SEQS_view = False
|
||||
if isinstance(output[1], View) :
|
||||
view = output[1]
|
||||
if output[2] == View_NUC_SEQS :
|
||||
NUC_SEQS_view = True
|
||||
if "QUALITY" in view : # TODO
|
||||
get_quality = True
|
||||
else:
|
||||
raise NotImplementedError()
|
||||
|
||||
@ -123,8 +127,6 @@ def run(config):
|
||||
id_col = view[b"ID"]
|
||||
def_col = view[b"DEFINITION"]
|
||||
seq_col = view[b"NUC_SEQ"]
|
||||
if get_quality :
|
||||
qual_col = view[b"QUALITY"]
|
||||
|
||||
dcols = {}
|
||||
|
||||
@ -134,6 +136,15 @@ def run(config):
|
||||
pb(i)
|
||||
|
||||
if NUC_SEQS_view :
|
||||
|
||||
# Check if there is a sequencing quality associated # TODO
|
||||
if i == 0:
|
||||
get_quality = b"QUALITY" in seq
|
||||
if get_quality:
|
||||
print("yah")
|
||||
Column.new_column(view, b"QUALITY", OBI_QUAL)
|
||||
qual_col = view[b"QUALITY"]
|
||||
|
||||
id_col[i] = seq.id
|
||||
def_col[i] = seq.definition
|
||||
seq_col[i] = seq.seq
|
||||
|
Reference in New Issue
Block a user