From ad8e10f2d1f6b7ff782d264f2b415ab0b7952f19 Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Fri, 12 Aug 2016 15:56:07 +0200 Subject: [PATCH] Reworked a bit alignment API --- python/obitools3/commands/align.pyx | 23 +++++++++-------------- python/obitools3/obidms/_obidms.pxd | 2 +- python/obitools3/obidms/_obidms.pyx | 11 +---------- 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/python/obitools3/commands/align.pyx b/python/obitools3/commands/align.pyx index 9cadecd..cfc6e61 100644 --- a/python/obitools3/commands/align.pyx +++ b/python/obitools3/commands/align.pyx @@ -8,10 +8,6 @@ __title__="Aligns one sequence column with itself or two sequence columns" default_config = { 'inputview' : None, - 'skip' : 0, - 'only' : None, - 'skiperror' : False, - 'moltype' : 'nuc', } def addOptions(parser): @@ -31,8 +27,7 @@ def addOptions(parser): metavar='', default=None, type=str, - help="Name of the input view, either raw if the view is in the default DMS," - " or in the form 'dms:view' if it is in another DMS.") + help="Name of the input view.") # TODO eventually 2nd view, or 2nd column? @@ -41,8 +36,7 @@ def addOptions(parser): metavar='', default=None, type=str, - help="Name of the output view, either raw if the view is in the default DMS," - " or in the form 'dms:view' if it is in another DMS.") + help="Name of the output view.") group=parser.add_argument_group('obi align specific options') @@ -106,16 +100,17 @@ def run(config): # TODO Open input view 2 if there is one - # Create output view if necessary - if config['obi']['outputview'] is not None : - oview = d.new_view(config['obi']['outputview']) - else : - oview = None + # Create output view + oview = d.new_view(config['obi']['outputview']) # TODO Take other alignment types into account when they'll be implemented # Call cython alignment function - iview.align(output_view=oview) + iview.align(oview) + + iview.save_and_close() + oview.save_and_close() + d.close() print("Done.") diff --git a/python/obitools3/obidms/_obidms.pxd b/python/obitools3/obidms/_obidms.pxd index b91f0ce..93c775d 100644 --- a/python/obitools3/obidms/_obidms.pxd +++ b/python/obitools3/obidms/_obidms.pxd @@ -78,8 +78,8 @@ cdef class OBIView_NUC_SEQS(OBIView): cpdef delete_column(self, str column_name) cpdef align(self, + OBIView oview, OBIView iview2=*, - object output_view=*, double threshold=*, bint normalize=*, int reference=*, diff --git a/python/obitools3/obidms/_obidms.pyx b/python/obitools3/obidms/_obidms.pyx index 0da902c..1824385 100644 --- a/python/obitools3/obidms/_obidms.pyx +++ b/python/obitools3/obidms/_obidms.pyx @@ -534,11 +534,10 @@ cdef class OBIView_NUC_SEQS(OBIView): # TODO - cpdef align(self, OBIView iview2=None, object output_view=None, + cpdef align(self, OBIView oview, OBIView iview2=None, double threshold=0.0, bint normalize=True, int reference=0, bint similarity_mode=True) : cdef OBIView iview1 - cdef OBIView oview cdef Obiview_p iview1_p cdef Obiview_p iview2_p @@ -574,14 +573,6 @@ cdef class OBIView_NUC_SEQS(OBIView): icol1_pp = icol1.pointer icol1_p = icol1_pp[0] - # Create the output view if needed - if output_view is None : - oview = self.dms.new_view("alignment_score_view") # TODO discuss - elif type(output_view) == str : - oview = self.dms.new_view(output_view) - else : - oview = output_view - oview.add_column(id1_col_name, type='OBI_STR', create=True) oview.add_column(id2_col_name, type='OBI_STR', create=True) oview.add_column(score_col_name, type='OBI_FLOAT', create=True)