Example #1
0
    def align(self, arglist):
        """Arguments: [filename[,num_of_align,[lambda[,xi[,mu[,nu,[,nuc_per_rotation, [Seq1, Seq2]]]]]]]]
aligns the computed BS or optional the BS from a gff file
filename specifies a file in gff format is you want to be aligned
num_of_align        specifies how many alignments you want. (Default 3)
lambda   Bonus factor for hit (Default 2)
xi       Penalty factor for rotation (Default 1.0)
mu       Penalty factor for average distance between sites (Default 0.5)
nu       Penalty factor for distance difference between sites (Default 1.0)
nuc_per_rotation    specifies how many nucletides there are per rotation. (Default 10.4)
Seq1,Seq2 Sequences to be aligned.
If you want to skip a argument just  write '.' for it.
If you use '.' as filename the local data are aligned."""
        try:
            [filename, num_of_align, Lambda, xi,
             mu, nu, nuc_per_rotation,Seq1,Seq2]=(arglist + ['.']*(9-len(arglist)))[:9]

            if num_of_align=='.':
                num_of_align=3
            if Lambda=='.':
                Lambda=2.0
            if xi=='.':
                xi=1.0
            if mu=='.':
                mu=0.5
            if nu=='.':
                nu=1.0
            if nuc_per_rotation=='.':
                nuc_per_rotation=10.4
            if Seq1=='.':
                Seq1=None
            if Seq2=='.':
                Seq2=None
                
            try:
                if not Interface.align(self, filename, int(num_of_align),
                                       float(Lambda), float(xi),
                                       float(mu), float(nu),
                                       float(nuc_per_rotation),Seq1,Seq2):
                    print "No alignment for a reason or an other"
            except AttributeError,val:
                if len(val.args)==1 or (len(val.args)>1 and len(val.args[1])<2):
                    print val.args[0]
                else:
                    msg,seqs=val
                    # This function is expected to be defined in subclass
                    firstSeq,secondSeq=self.selectTwoSequences(msg,seqs)
                    if not Interface.align(self, filename, int(num_of_align),
                                           float(Lambda), float(xi),
                                           float(mu), float(nu),
                                           float(nuc_per_rotation),
                                           firstSeq,secondSeq):
                        print "No alignment for a reson or an another"
        except ValueError,e:
            print "Error: unallowed arguments passed to 'align'",e