Added atexit command to obi import, obi uniq and obi less
This commit is contained in:
@ -12,6 +12,7 @@ from obitools3.dms.view.view cimport View
|
||||
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.utils cimport tobytes, \
|
||||
get_obitype, \
|
||||
@ -82,6 +83,7 @@ def run(config):
|
||||
cdef bytes NA_value
|
||||
global obi_errno
|
||||
|
||||
DMS.obi_atexit()
|
||||
|
||||
logger("info","obi import : imports file into an DMS")
|
||||
|
||||
@ -238,6 +240,6 @@ def run(config):
|
||||
print("\n")
|
||||
print(view.__repr__())
|
||||
|
||||
input[0].close() # TODO
|
||||
input[0].close() # TODO ?
|
||||
output[0].close()
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
from obitools3.apps.optiongroups import addSequenceInputOption
|
||||
from obitools3.uri.decode import open_uri
|
||||
from obitools3.dms import DMS
|
||||
|
||||
|
||||
__title__="Less equivalent"
|
||||
@ -25,7 +26,9 @@ def run(config):
|
||||
|
||||
cdef object entries
|
||||
cdef int n
|
||||
|
||||
|
||||
DMS.obi_atexit()
|
||||
|
||||
input = open_uri(config['obi']['inputURI'])
|
||||
|
||||
entries = input[1]
|
||||
|
@ -1,7 +1,7 @@
|
||||
#cython: language_level=3
|
||||
|
||||
from obitools3.apps.progress cimport ProgressBar # @UnresolvedImport
|
||||
from obitools3.dms.dms cimport DMS
|
||||
from obitools3.dms import DMS
|
||||
from obitools3.dms.view.view cimport View, Line
|
||||
from obitools3.dms.view.typed_view.view_NUC_SEQS cimport View_NUC_SEQS
|
||||
from obitools3.dms.column.column cimport Column, Column_line
|
||||
@ -44,6 +44,7 @@ def addOptions(parser):
|
||||
"used to group sequences before dereplication "
|
||||
"(option can be used several times).")
|
||||
|
||||
# TODO discuss
|
||||
# group.add_argument('--prefix', '-p',
|
||||
# action="store_true", dest="uniq:prefix",
|
||||
# default=False,
|
||||
@ -400,7 +401,6 @@ cdef uniq_sequences(View_NUC_SEQS view, View_NUC_SEQS o_view, ProgressBar pb, li
|
||||
merge_taxonomy_classification(o_view, taxonomy)
|
||||
|
||||
|
||||
|
||||
def run(config):
|
||||
|
||||
cdef tuple input
|
||||
@ -410,14 +410,16 @@ def run(config):
|
||||
cdef View_NUC_SEQS entries
|
||||
cdef View_NUC_SEQS o_view
|
||||
cdef ProgressBar pb
|
||||
|
||||
|
||||
DMS.obi_atexit()
|
||||
|
||||
logger("info","obi uniq")
|
||||
|
||||
input = open_uri(config['obi']['inputURI'])
|
||||
|
||||
if input[2] != View_NUC_SEQS:
|
||||
raise NotImplementedError('obi uniq only works on NUC_SEQS views')
|
||||
|
||||
|
||||
output = open_uri(config['obi']['outputURI'],
|
||||
input=False,
|
||||
newviewtype=View_NUC_SEQS)
|
||||
@ -434,14 +436,8 @@ def run(config):
|
||||
|
||||
# Initialize the progress bar
|
||||
pb = ProgressBar(len(entries), config, seconde=5)
|
||||
|
||||
# TODO
|
||||
# if options.prefix:
|
||||
# usm = uniqPrefixSequence
|
||||
# else:
|
||||
usm = uniq_sequences
|
||||
|
||||
usm(entries, o_view, pb, mergedKeys_list=config['uniq']['merge'], taxonomy=taxo, mergeIds=config['uniq']['mergeids'], categories=config['uniq']['categories'])
|
||||
uniq_sequences(entries, o_view, pb, mergedKeys_list=config['uniq']['merge'], taxonomy=taxo, mergeIds=config['uniq']['mergeids'], categories=config['uniq']['categories'])
|
||||
|
||||
print("\n")
|
||||
print(repr(o_view))
|
||||
|
Reference in New Issue
Block a user