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
|
update_obitype
|
||||||
|
|
||||||
from obitools3.dms.capi.obitypes cimport obitype_t, \
|
from obitools3.dms.capi.obitypes cimport obitype_t, \
|
||||||
OBI_VOID
|
OBI_VOID, \
|
||||||
|
OBI_QUAL
|
||||||
|
|
||||||
from obitools3.dms.capi.obierrno cimport obi_errno
|
from obitools3.dms.capi.obierrno cimport obi_errno
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ def addOptions(parser):
|
|||||||
|
|
||||||
addSequenceInputOption(parser)
|
addSequenceInputOption(parser)
|
||||||
addMinimalOutputOption(parser)
|
addMinimalOutputOption(parser)
|
||||||
|
# addTaxdumpInputOption(parser)
|
||||||
|
|
||||||
|
|
||||||
def run(config):
|
def run(config):
|
||||||
@ -89,17 +90,23 @@ def run(config):
|
|||||||
|
|
||||||
input = open_uri(config['obi']['inputURI'])
|
input = open_uri(config['obi']['inputURI'])
|
||||||
|
|
||||||
|
print(input)
|
||||||
|
|
||||||
if input[2]==Nuc_Seq:
|
if input[2]==Nuc_Seq:
|
||||||
v = View_NUC_SEQS
|
v = View_NUC_SEQS
|
||||||
else:
|
else:
|
||||||
v = View
|
v = View
|
||||||
|
|
||||||
output = open_uri(config['obi']['outputURI'],
|
output = open_uri(config['obi']['outputURI'],
|
||||||
input=False,
|
input=False,
|
||||||
newviewtype=v)
|
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
|
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']
|
NA_value = config['obi']['nastring']
|
||||||
|
|
||||||
get_quality = False
|
|
||||||
NUC_SEQS_view = False
|
NUC_SEQS_view = False
|
||||||
if isinstance(output[1], View) :
|
if isinstance(output[1], View) :
|
||||||
view = output[1]
|
view = output[1]
|
||||||
if output[2] == View_NUC_SEQS :
|
if output[2] == View_NUC_SEQS :
|
||||||
NUC_SEQS_view = True
|
NUC_SEQS_view = True
|
||||||
if "QUALITY" in view : # TODO
|
|
||||||
get_quality = True
|
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
@ -123,8 +127,6 @@ def run(config):
|
|||||||
id_col = view[b"ID"]
|
id_col = view[b"ID"]
|
||||||
def_col = view[b"DEFINITION"]
|
def_col = view[b"DEFINITION"]
|
||||||
seq_col = view[b"NUC_SEQ"]
|
seq_col = view[b"NUC_SEQ"]
|
||||||
if get_quality :
|
|
||||||
qual_col = view[b"QUALITY"]
|
|
||||||
|
|
||||||
dcols = {}
|
dcols = {}
|
||||||
|
|
||||||
@ -132,8 +134,17 @@ def run(config):
|
|||||||
for seq in iseq :
|
for seq in iseq :
|
||||||
|
|
||||||
pb(i)
|
pb(i)
|
||||||
|
|
||||||
if NUC_SEQS_view :
|
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
|
id_col[i] = seq.id
|
||||||
def_col[i] = seq.definition
|
def_col[i] = seq.definition
|
||||||
seq_col[i] = seq.seq
|
seq_col[i] = seq.seq
|
||||||
|
Reference in New Issue
Block a user