Commit 4a815785 by Celine Mercier

obi import: added basic taxdump import

parent 75b54c83
......@@ -8,6 +8,8 @@ from obitools3.dms.view.typed_view.view_NUC_SEQS cimport View_NUC_SEQS
from obitools3.dms.column.column cimport Column
from obitools3.dms.obiseq cimport Nuc_Seq
from obitools3.dms import DMS
from obitools3.dms.taxo.taxo cimport Taxonomy
from obitools3.utils cimport tobytes, \
get_obitype, \
......@@ -19,7 +21,10 @@ from obitools3.dms.capi.obitypes cimport obitype_t, \
from obitools3.dms.capi.obierrno cimport obi_errno
from obitools3.apps.optiongroups import addSequenceInputOption, addTabularInputOption, addMinimalOutputOption
from obitools3.apps.optiongroups import addSequenceInputOption, \
addTabularInputOption, \
addMinimalOutputOption, \
addTaxdumpInputOption
from obitools3.uri.decode import open_uri
......@@ -42,7 +47,7 @@ def addOptions(parser):
addSequenceInputOption(parser)
addTabularInputOption(parser)
addMinimalOutputOption(parser)
# addTaxdumpInputOption(parser)
addTaxdumpInputOption(parser)
def run(config):
......@@ -83,8 +88,21 @@ def run(config):
DMS.obi_atexit()
logger("info","obi import : imports file into an DMS")
input = open_uri(config['obi']['inputURI'])
if input is None:
raise Exception("Could not open input URI")
# TODO read taxdump with URI?
if 'taxdump' in config['obi']:
taxo = Taxonomy.open_taxdump(input[0], config['obi']['taxdump'])
# Read prefix (temporary fix)
uri = config['obi']['outputURI'].split('/')
idx = uri.index('taxonomy') + 1
taxo.write(uri[idx])
taxo.close()
input[0].close()
return
if input[2]==Nuc_Seq:
v = View_NUC_SEQS
......
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