diff --git a/python/obitools3/commands/import.pyx b/python/obitools3/commands/import.pyx index 86b48c4..1520472 100644 --- a/python/obitools3/commands/import.pyx +++ b/python/obitools3/commands/import.pyx @@ -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,17 +90,23 @@ def run(config): input = open_uri(config['obi']['inputURI']) + print(input) + if input[2]==Nuc_Seq: v = View_NUC_SEQS else: v = View - + output = open_uri(config['obi']['outputURI'], input=False, newviewtype=v) - - #print(input) - #print(output) + #quality=get_quality) # TODO + + 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 = {} @@ -132,8 +134,17 @@ def run(config): for seq in iseq : 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