Reworked a bit alignment API
This commit is contained in:
@ -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='<INPUT VIEW NAME>',
|
||||
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='<OUTPUT VIEW NAME>',
|
||||
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.")
|
||||
|
||||
|
@ -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=*,
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user