pKaTool/stab_fit/Double_mutant.py
def find_double_mutants(self,mutants):
        """Find all double mutant cycles in a list of mutants"""
        dbl_muts=[]
        sorted_muts=[]
        for prot in mutants:
            import string
            muts=sorted(prot.split('+'))
            if not 'wt' in muts:
                muts.append('wt')
                muts.sort()
            sorted_muts.append(string.join(muts,'+'))
        #sorted_muts.append('')
        sorted_muts.remove('ph+wt')
        #
        # Now all mutants are sorted, then we try to split all possible ways
        #
        for mut1 in sorted_muts:
            for mut2 in sorted_muts:
                if mut2==mut1:
                    continue
                for mut3 in sorted_muts:
                    if mut3==mut1 or mut3==mut2:
                        continue
                    wt=mut1
                    leg1=self.addmuts([mut1,mut2])
                    leg2=self.addmuts([mut1,mut3])
                    dbl=self.addmuts([mut1,mut2,mut3])
                    # 
                    # Make sure all are different
                    #
                    cycle=[wt,leg1,leg2,dbl]
                    same=False
                    for pos1 in range(len(cycle)-1):
                        for pos2 in range(pos1+1,len(cycle)):
                            if cycle[pos1]==cycle[pos2]:
                                same=True
                    if same:
                        continue
                    #
                    # Check that all mutations exist
                    #
                    allfound=True
                    for mut in cycle:
                        if not mut in sorted_muts:
                            allfound=False
                    #
                    # Everything is ok. Now which interaction are we measuring?
                    #
                    if allfound:
                        dbl_muts.append([wt.replace('+wt',''),leg1.replace('+wt',''),leg2.replace('+wt',''),dbl.replace('+wt',''),
                                        sorted([mut2.replace('+wt',''),mut3.replace('+wt',''),'Context: %s' %mut1])])
        return dbl_muts
Find all double mutant cycles in a list of mutants
Find all double mutant cycles in a list of mutants
Find all double mutant cycles in a list of mutants
def find_double_mutants(self,mutants):
        dbl_muts=[]
        sorted_muts=[]
        for prot in mutants:
            import string
            muts=sorted(prot.split('+'))
            if not 'wt' in muts:
                muts.append('wt')
                muts.sort()
            sorted_muts.append(string.join(muts,'+'))
        sorted_muts.remove('ph+wt')
         Now all mutants are sorted, then we try to split all possible ways
        for mut1 in sorted_muts:
            for mut2 in sorted_muts:
                if mut2==mut1:
                    continue
                for mut3 in sorted_muts:
                    if mut3==mut1 or mut3==mut2:
                        continue
                    wt=mut1
                    leg1=self.addmuts([mut1,mut2])
                    leg2=self.addmuts([mut1,mut3])
                    dbl=self.addmuts([mut1,mut2,mut3])
                     Make sure all are different
                    cycle=[wt,leg1,leg2,dbl]
                    same=False
                    for pos1 in range(len(cycle)-1):
                        for pos2 in range(pos1+1,len(cycle)):
                            if cycle[pos1]==cycle[pos2]:
                                same=True
                    if same:
                        continue
                     Check that all mutations exist
                    allfound=True
                    for mut in cycle:
                        if not mut in sorted_muts:
                            allfound=False
                     Everything is ok. Now which interaction are we measuring?
                    if allfound:
                        dbl_muts.append([wt.replace('+wt',''),leg1.replace('+wt',''),leg2.replace('+wt',''),dbl.replace('+wt',''),
                                        sorted([mut2.replace('+wt',''),mut3.replace('+wt',''),'Context: %s' %mut1])])
        return dbl_muts
def find_double_mutants ( self , mutants ) : dbl_muts = [ ] sorted_muts = [ ] for prot in mutants : import string muts = sorted ( prot . split ( '+' ) ) if not 'wt' in muts : muts . append ( 'wt' ) muts . sort ( ) sorted_muts . append ( string . join ( muts , '+' ) ) sorted_muts . remove ( 'ph+wt' ) for mut1 in sorted_muts : for mut2 in sorted_muts : if mut2 == mut1 : continue for mut3 in sorted_muts : if mut3 == mut1 or mut3 == mut2 : continue wt = mut1 leg1 = self . addmuts ( [ mut1 , mut2 ] ) leg2 = self . addmuts ( [ mut1 , mut3 ] ) dbl = self . addmuts ( [ mut1 , mut2 , mut3 ] ) cycle = [ wt , leg1 , leg2 , dbl ] same = False for pos1 in range ( len ( cycle ) - 1 ) : for pos2 in range ( pos1 + 1 , len ( cycle ) ) : if cycle [ pos1 ] == cycle [ pos2 ] : same = True if same : continue allfound = True for mut in cycle : if not mut in sorted_muts : allfound = False if allfound : dbl_muts . append ( [ wt . replace ( '+wt' , '' ) , leg1 . replace ( '+wt' , '' ) , leg2 . replace ( '+wt' , '' ) , dbl . replace ( '+wt' , '' ) , sorted ( [ mut2 . replace ( '+wt' , '' ) , mut3 . replace ( '+wt' , '' ) , 'Context: %s' % mut1 ] ) ] ) return dbl_muts
Find all double mutant cycles in a list of mutants
Find all double mutant cycles in a list of mutants
"""Find all double mutant cycles in a list of mutants""" #sorted_muts.append('') # # Now all mutants are sorted, then we try to split all possible ways # #  # Make sure all are different # # # Check that all mutations exist # # # Everything is ok. Now which interaction are we measuring? #
self
mutants