예제 #1
0
    def setResidueInformation(self, resInfo=None):
        """
        set residue information based on resName - it is set here since it is a convenience thing
        """
        # resType - determines interaction parameters
        if self.resName in resInfo['resType']:
            self.resType = resInfo['resType'][self.resName]
          
        # Q - group charge
        if self.resName in resInfo['Q']:
            self.Q       = resInfo['Q'][self.resName]
        else:
            self.Q       = 0.00

        # type - 'amino-acid' / 'ion' / 'ligand' / 'N-terminus' / 'C-terminus'
        if   self.resName in lib.residueList("standard"):
            self.type    = "amino-acid"
        elif self.resName in resInfo['type']:
            self.type    = resInfo['type'][self.resName]

        # pKa_mod - model or water pKa value
        if self.resName in resInfo['pKa']:
            self.pKa_mod = resInfo['pKa'][self.resName]
            self.pKa_pro = resInfo['pKa'][self.resName]
        else:
            self.pKa_mod = resInfo['pKa']['default']
            self.pKa_pro = resInfo['pKa']['default']
예제 #2
0
    def setResidueInformation(self, resInfo=None):
        """
        set residue information based on resName - it is set here since it is a convenience thing
        """
        # resType - determines interaction parameters
        if self.resName in resInfo['resType']:
            self.resType = resInfo['resType'][self.resName]

        # Q - group charge
        if self.resName in resInfo['Q']:
            self.Q = resInfo['Q'][self.resName]
        else:
            self.Q = 0.00

        # type - 'amino-acid' / 'ion' / 'ligand' / 'N-terminus' / 'C-terminus'
        if self.resName in lib.residueList("standard"):
            self.type = "amino-acid"
        elif self.resName in resInfo['type']:
            self.type = resInfo['type'][self.resName]

        # pKa_mod - model or water pKa value
        if self.resName in resInfo['pKa']:
            self.pKa_mod = resInfo['pKa'][self.resName]
            self.pKa_pro = resInfo['pKa'][self.resName]
        else:
            self.pKa_mod = resInfo['pKa']['default']
            self.pKa_pro = resInfo['pKa']['default']
예제 #3
0
    def setupReferenceLists(self):
        """ 
        setup lists with references to residues and atoms needed to calculate pKa values
        lists: residue_dictionary
               NHlist
               COlist
               propka_residues
        """ 
        # initializing empty dictionary
        self.residue_dictionary = {}
        for key in lib.residueList("propka1"):
          self.residue_dictionary[key] = []
        self.residue_dictionary['ION'] = []

        for chain in self.chains:
            # make list with N-H & C=O fragments
            chain.appendToBackBoneLists(self.NHlist, self.COlist)

            # setup the residue dictionary with references to all residues
            chain.appendToResidueDictionary(self.residue_dictionary)

            # residues with propka interactions, 
            # IMPORTANT, this list is assumed to be ordered according to resNumb to loop ver pairs
            chain.appendPropkaResidues(self.propka_residues)

        return
예제 #4
0
    def setupReferenceLists(self):
        """ 
        setup lists with references to residues and atoms needed to calculate pKa values
        lists: residue_dictionary
               NHlist
               COlist
               propka_residues
        """
        # initializing empty dictionary
        self.residue_dictionary = {}
        for key in lib.residueList("propka1"):
            self.residue_dictionary[key] = []
        self.residue_dictionary['ION'] = []

        for chain in self.chains:
            # make list with N-H & C=O fragments
            chain.appendToBackBoneLists(self.NHlist, self.COlist)

            # setup the residue dictionary with references to all residues
            chain.appendToResidueDictionary(self.residue_dictionary)

            # residues with propka interactions,
            # IMPORTANT, this list is assumed to be ordered according to resNumb to loop ver pairs
            chain.appendPropkaResidues(self.propka_residues)

        return
예제 #5
0
파일: chain.py 프로젝트: ASCM/apbs-pdb2pqr
 def calculateTotalPKA(self):
     """
     Calculates the total pKa from pKa_mod and the determinants
     """
     residue_list = lib.residueList("propka1")
     for residue in self.residues:
         if residue.resName in residue_list:
             residue.calculateTotalPKA()
예제 #6
0
 def calculateTotalPKA(self):
     """
     Calculates the total pKa from pKa_mod and the determinants
     """
     residue_list = lib.residueList("propka1")
     for residue in self.residues:
         if residue.resName in residue_list:
             residue.calculateTotalPKA()
예제 #7
0
 def checked(self, options=None):
     """
     Checks that I understand all residues.
     """
     excluded_resNames = lib.residueList("excluded")
     if self.resName in excluded_resNames:
         return False
     else:
         return True
예제 #8
0
 def appendBasicResidues(self, basic_residues, pka_residues):
     """
     Creates and returns a list for base-backbone interactions
     """
     basic_residue_list = lib.residueList("bases")
     for residue in self.residues:
         if residue.resName in basic_residue_list:
             basic_residues.append(residue)
             pka_residues.append(residue)
예제 #9
0
파일: chain.py 프로젝트: ASCM/apbs-pdb2pqr
 def appendBasicResidues(self, basic_residues, pka_residues):
     """
     Creates and returns a list for base-backbone interactions
     """
     basic_residue_list = lib.residueList("bases")
     for residue in self.residues:
         if residue.resName in basic_residue_list:
             basic_residues.append(residue)
             pka_residues.append(residue)
예제 #10
0
 def checked(self, options=None):
     """
     Checks that I understand all residues.
     """
     excluded_resNames = lib.residueList("excluded")
     if self.resName in excluded_resNames:
         return False
     else:
         return True
예제 #11
0
파일: chain.py 프로젝트: ASCM/apbs-pdb2pqr
 def printDeterminants(self):
     """
     prints the resulting pKa values and determinants to stdout
     """
     # Get same order as propka2.0
     residue_list = lib.residueList("propka1")
     for residue_type in residue_list:
       for residue in self.residues:
         if residue.resName == residue_type:
             print("%s" % ( residue.getDeterminantString() ))
예제 #12
0
 def printDeterminants(self):
     """
     prints the resulting pKa values and determinants to stdout
     """
     # Get same order as propka2.0
     residue_list = lib.residueList("propka1")
     for residue_type in residue_list:
         for residue in self.residues:
             if residue.resName == residue_type:
                 pka_print("%s" % (residue.getDeterminantString()))
예제 #13
0
    def printSummary(self):
        """
        prints the resulting pKa values in summary form to stdout
        """

        residue_list = lib.residueList("propka1")
        for residue_type in residue_list:
            for residue in self.residues:
                if residue.resName == residue_type:
                    str = residue.getSummaryString()
                    pka_print(str)
예제 #14
0
파일: chain.py 프로젝트: ASCM/apbs-pdb2pqr
    def printSummary(self):
        """
        prints the resulting pKa values in summary form to stdout
        """

        residue_list = lib.residueList("propka1")
        for residue_type in residue_list:
          for residue in self.residues:
            if residue.resName == residue_type:
                str = residue.getSummaryString()
                print(str)
예제 #15
0
파일: chain.py 프로젝트: ASCM/apbs-pdb2pqr
 def appendAcidicResidues(self, acidic_residues, pka_residues):
     """
     Creates and returns a list for acid-backbone interactions
     """
     acidic_residue_list = lib.residueList("acids")
     for residue in self.residues:
         if residue.resName in acidic_residue_list:
             if residue.location == "BONDED":
                 """ do nothing """
             else:
                 acidic_residues.append(residue)
                 pka_residues.append(residue)
예제 #16
0
 def appendAcidicResidues(self, acidic_residues, pka_residues):
     """
     Creates and returns a list for acid-backbone interactions
     """
     acidic_residue_list = lib.residueList("acids")
     for residue in self.residues:
         if residue.resName in acidic_residue_list:
             if residue.location == "BONDED":
                 """ do nothing """
             else:
                 acidic_residues.append(residue)
                 pka_residues.append(residue)
예제 #17
0
파일: chain.py 프로젝트: ASCM/apbs-pdb2pqr
    def calculateCharge(self, pH):
        """
        Calculates the total charge of this chain at pH 'pH'
        """
        propka1_residue_labels = lib.residueList("propka1")
        Qpro = 0.00
        Qmod = 0.00
        for residue in self.residues:
          if residue.resName in propka1_residue_labels:
            Qpro += residue.getCharge(pH, "folded")
            Qmod += residue.getCharge(pH, "unfolded")

        return Qpro, Qmod
예제 #18
0
파일: chain.py 프로젝트: ASCM/apbs-pdb2pqr
    def writeSummary(self, file, verbose=True):
        """
        prints the resulting pKa values in summary form to stdout
        """

        residue_list = lib.residueList("propka1")
        for residue_type in residue_list:
          for residue in self.residues:
            if residue.resName == residue_type:
                str = "%s\n" % ( residue.getSummaryString() )
                file.write(str)
                if verbose == True:
                  print(str)
예제 #19
0
    def calculateCharge(self, pH):
        """
        Calculates the total charge of this chain at pH 'pH'
        """
        propka1_residue_labels = lib.residueList("propka1")
        Qpro = 0.00
        Qmod = 0.00
        for residue in self.residues:
            if residue.resName in propka1_residue_labels:
                Qpro += residue.getCharge(pH, "folded")
                Qmod += residue.getCharge(pH, "unfolded")

        return Qpro, Qmod
예제 #20
0
    def writeSummary(self, file, verbose=True):
        """
        prints the resulting pKa values in summary form to stdout
        """

        residue_list = lib.residueList("propka1")
        for residue_type in residue_list:
            for residue in self.residues:
                if residue.resName == residue_type:
                    str = "%s\n" % (residue.getSummaryString())
                    file.write(str)
                    if verbose == True:
                        pka_print(str)
예제 #21
0
파일: chain.py 프로젝트: ASCM/apbs-pdb2pqr
 def writeDeterminants(self, file, verbose=True):
     """
     prints the resulting pKa values and determinants to stdout
     """
     # Get same order as propka2.0
     residue_list = lib.residueList("propka1")
     for residue_type in residue_list:
       for residue in self.residues:
         if residue.resName == residue_type:
             str = "%s\n" % ( residue.getDeterminantString() )
             file.write(str)
             if verbose == True:
               print(str)
예제 #22
0
 def writeDeterminants(self, file, verbose=True):
     """
     prints the resulting pKa values and determinants to stdout
     """
     # Get same order as propka2.0
     residue_list = lib.residueList("propka1")
     for residue_type in residue_list:
         for residue in self.residues:
             if residue.resName == residue_type:
                 str = "%s\n" % (residue.getDeterminantString())
                 file.write(str)
                 if verbose == True:
                     pka_print(str)
예제 #23
0
def getSummarySection(protein, verbose=False):
    """
    prints out the pka-section of the result
    """
    # getting the same order as in propka2.0
    residue_list = lib.residueList("propka1")
    str = "%s\n" % (getSummaryHeader())
    # printing pKa summary
    for chain in protein.chains:
        for residue_type in residue_list:
            for residue in chain.residues:
                if residue.resName == residue_type:
                    str += "%s\n" % (residue.getSummaryString())

    return str
예제 #24
0
def getSummarySection(protein, verbose=False):
    """
    prints out the pka-section of the result
    """
    # getting the same order as in propka2.0
    residue_list = lib.residueList("propka1")
    str  = "%s\n" % ( getSummaryHeader() )
    # printing pKa summary
    for chain in protein.chains:
      for residue_type in residue_list:
        for residue in chain.residues:
          if residue.resName == residue_type:
            str += "%s\n" % ( residue.getSummaryString() )

    return  str
예제 #25
0
def setIonDeterminants(protein, version=None):
    """
    adding ion determinants/perturbations
    """
    ionizable_residues = lib.residueList("propka1")
    for residue in protein.propka_residues:
        if residue.resName in ionizable_residues:
            for ion in protein.residue_dictionary["ION"]:
                distance = calculate.InterResidueDistance(residue, ion)
                if distance < version.coulomb_cutoff[1]:
                    label = "%s%4d%2s" % (ion.resName, ion.resNumb, ion.chainID)
                    weight = version.calculatePairWeight(residue.Nmass, ion.Nmass)
                    # the pKa of both acids and bases are shifted up by negative ions (and vice versa)
                    value = (-ion.Q) * version.calculateCoulombEnergy(distance, weight)
                    newDeterminant = Determinant(label, value)
                    residue.determinants[2].append(newDeterminant)
예제 #26
0
def setIonDeterminants(protein, version=None):
    """
    adding ion determinants/perturbations
    """
    ionizable_residues = lib.residueList("propka1")
    for residue in protein.propka_residues:
        if residue.resName in ionizable_residues:
            for ion in protein.residue_dictionary["ION"]:
                distance = calculate.InterResidueDistance(residue, ion)
                if distance < version.coulomb_cutoff[1]:
                    label  = "%s%4d%2s" % (ion.resName, ion.resNumb, ion.chainID)
                    weight = version.calculatePairWeight(residue.Nmass, ion.Nmass)
                    # the pKa of both acids and bases are shifted up by negative ions (and vice versa)
                    value  =  (-ion.Q) * version.calculateCoulombEnergy(distance, weight)
                    newDeterminant = Determinant(label, value)
                    residue.determinants[2].append(newDeterminant)
예제 #27
0
파일: chain.py 프로젝트: ASCM/apbs-pdb2pqr
    def calculateFoldingEnergy(self, pH=None, reference=None, options=None):
        """
        Calculates the folding energy given the correct pKa values; given
        pKa values calculated for the entire protein 'all chains' will give 
        the total folding energy partitioned to chains, not chain folding 
        energies.
        """
        propka1_residue_labels = lib.residueList("propka1")
        dG = 0.00
        for residue in self.residues:
          if residue.resName in propka1_residue_labels:
            ddG = residue.calculateFoldingEnergy(pH=pH, reference=reference, options=options)
            dG += ddG
            #print "%s %6.2lf" % (residue.label, ddG)

        return dG
예제 #28
0
파일: chain.py 프로젝트: ASCM/apbs-pdb2pqr
    def calculateDesolvation(self, atoms, version=None, options=None):
        """
        Calculates the desolvation for each residue in this chain. Note, 'atoms' contains ALL atoms, not only 
        atoms belonging to this chain. Thus, you will get the desolvation of this chain in the presence of all.
        """
        propka1_list = lib.residueList("propka1")
        for residue in self.residues:
          if   residue.location == "BONDED":
            do_it = False
          elif residue.type     == "ion":
            do_it = True
          elif residue.resName in propka1_list:
            do_it = True
          else:
            do_it = False

          if do_it == True:
              residue.calculateDesolvation(atoms, version=version, options=options)
예제 #29
0
    def calculateFoldingEnergy(self, pH=None, reference=None, options=None):
        """
        Calculates the folding energy given the correct pKa values; given
        pKa values calculated for the entire protein 'all chains' will give 
        the total folding energy partitioned to chains, not chain folding 
        energies.
        """
        propka1_residue_labels = lib.residueList("propka1")
        dG = 0.00
        for residue in self.residues:
            if residue.resName in propka1_residue_labels:
                ddG = residue.calculateFoldingEnergy(pH=pH,
                                                     reference=reference,
                                                     options=options)
                dG += ddG
                #print "%s %6.2lf" % (residue.label, ddG)

        return dG
예제 #30
0
파일: chain.py 프로젝트: ASCM/apbs-pdb2pqr
    def makeSequence(self, mutation=None):
        """
        creates a sequence from the chain object to be used in Scwrl-mutations
        """
        sequence = ""
        for residue in self.residues:
          if residue.resName in lib.residueList("standard"):
            if   mutation == None:
              code, resName = lib.convertResidueCode(resName=residue.resName)
              sequence += code.lower()
            elif residue.label in mutation:
              new_label = mutation[residue.label]['label']
              code, resName = lib.convertResidueCode(resName=new_label[:3])
              sequence += code.upper()
            else:
              code, resName = lib.convertResidueCode(resName=residue.resName)
              sequence += code.lower()

        return sequence
예제 #31
0
    def makeBackBoneInteractionList(self):
        """ 
        making a nice 'object' to make the acid/base interactions nice and easy to loop over in 'determinants'
        backbone_interactions = [[acids, NH], [bases, CO]]
        """ 
        backbone_interactions = []
        # --- ACIDS ---
        residues = []
        for resName in lib.residueList("acids"):
          residues.extend(self.residue_dictionary[resName])
        backbone_interactions.append([residues, self.NHlist])
        # --- BASES ---
        residues = []
        # famous propka2.0 exceptions
        for resName in ["HIS"]:
          residues.extend(self.residue_dictionary[resName])
        backbone_interactions.append([residues, self.COlist])

        return backbone_interactions
예제 #32
0
    def makeBackBoneInteractionList(self):
        """ 
        making a nice 'object' to make the acid/base interactions nice and easy to loop over in 'determinants'
        backbone_interactions = [[acids, NH], [bases, CO]]
        """
        backbone_interactions = []
        # --- ACIDS ---
        residues = []
        for resName in lib.residueList("acids"):
            residues.extend(self.residue_dictionary[resName])
        backbone_interactions.append([residues, self.NHlist])
        # --- BASES ---
        residues = []
        # famous propka2.0 exceptions
        for resName in ["HIS"]:
            residues.extend(self.residue_dictionary[resName])
        backbone_interactions.append([residues, self.COlist])

        return backbone_interactions
예제 #33
0
    def checkResidue(self, options=None):
        """
        Checks that I understand all residues. 
        """

        residue_list = lib.residueList("all")
        rename = {
            "LYP": "LYS",
            "CYX": "CYS",
            "HSD": "HIS",
        }

        # renaming residue if in rename dictionary
        if self.resName in rename:
            newName = rename[self.resName]
            if options.verbose == True:
                pka_print("Warning: renaming %s to %s" %
                          (self.resName, newName))
            self.resName = newName
            for atom in self.atoms:
                atom.resName = newName
        else:
            """OK - lets rock"""

        # after rename residue cases, check heavy atoms
        if self.resName in residue_list:
            # OK - lets rock
            self.checkAtoms(options=options)
        # Chresten's stuff
        elif self.type == "ion":
            outstr = "%s%4d -  OK %s" % (self.resName, self.resNumb, self.type)
            pka_print(outstr)
        #elif self.resName in version.ions.keys():
        #    str  = "%-3s%4d - %s with charge %+d" % (self.resName,
        #                                             self.resNumb,
        #                                             version.ions_long_names[self.resName],
        #                                             version.ions[self.resName])
        #    pka_print(str)
        else:
            outstr = "%s%4d - unidentified residue" % (self.resName,
                                                       self.resNumb)
            pka_print(outstr)
예제 #34
0
def main():
    """
    Simple check on the corresponding atoms-dictionary
    """

    corresponding_atoms = makeCorrespondingAtomNames()

    resNames = residueList("standard")

    for resName1 in resNames:
      for resName2 in resNames:
        str = "%s %s \n" % (resName1, resName2)
        for i in range(len(corresponding_atoms[resName1][resName2])):
          name1, name2 = corresponding_atoms[resName1][resName2][i]
          str += " %-3s %-3s" % (name1, name2)
          name1, name2 = corresponding_atoms[resName2][resName1][i]
          str += "%-5s %-3s %-3s\n" % (" ", name1, name2)
        print(str)
        if resName1 == resName2:
          break
예제 #35
0
    def calculateDesolvation(self, atoms, version=None, options=None):
        """
        Calculates the desolvation for each residue in this chain. Note, 'atoms' contains ALL atoms, not only 
        atoms belonging to this chain. Thus, you will get the desolvation of this chain in the presence of all.
        """
        propka1_list = lib.residueList("propka1")
        for residue in self.residues:
            if residue.location == "BONDED":
                do_it = False
            elif residue.type == "ion":
                do_it = True
            elif residue.resName in propka1_list:
                do_it = True
            else:
                do_it = False

            if do_it == True:
                residue.calculateDesolvation(atoms,
                                             version=version,
                                             options=options)
예제 #36
0
def main():
    """
    Simple check on the corresponding atoms-dictionary
    """

    corresponding_atoms = makeCorrespondingAtomNames()

    resNames = residueList("standard")

    for resName1 in resNames:
        for resName2 in resNames:
            str = "%s %s \n" % (resName1, resName2)
            for i in range(len(corresponding_atoms[resName1][resName2])):
                name1, name2 = corresponding_atoms[resName1][resName2][i]
                str += " %-3s %-3s" % (name1, name2)
                name1, name2 = corresponding_atoms[resName2][resName1][i]
                str += "%-5s %-3s %-3s\n" % (" ", name1, name2)
            print(str)
            if resName1 == resName2:
                break
예제 #37
0
    def checkResidue(self, options=None):
        """
        Checks that I understand all residues. 
        """

        residue_list = lib.residueList("all")
        rename = {"LYP": "LYS",
                  "CYX": "CYS",
                  "HSD": "HIS",
                 }

        # renaming residue if in rename dictionary
        if self.resName in rename:
            newName = rename[self.resName]
            if options.verbose == True:
                print("Warning: renaming %s to %s" % (self.resName, newName))
            self.resName = newName
            for atom in self.atoms:
                atom.resName = newName
        else:
            """OK - lets rock"""

        # after rename residue cases, check heavy atoms
        if self.resName in residue_list:
            # OK - lets rock
            self.checkAtoms(options=options)
        # Chresten's stuff
        elif self.type == "ion":
            outstr  = "%s%4d -  OK %s" % (self.resName, self.resNumb, self.type)
            print(outstr)
        #elif self.resName in version.ions.keys():
        #    str  = "%-3s%4d - %s with charge %+d" % (self.resName, 
        #                                             self.resNumb, 
        #                                             version.ions_long_names[self.resName], 
        #                                             version.ions[self.resName])
        #    print(str)            
        else:
            outstr  = "%s%4d - unidentified residue" % (self.resName, self.resNumb)
            print(outstr)
예제 #38
0
def getDeterminantSection(protein, verbose=False):
    """
    prints out the pka-section of the result
    """
    # getting the same order as in propka2.0
    residue_list = lib.residueList("propka1")
    str = "%s\n" % (getDeterminantsHeader())

    # printing determinants
    for chain in protein.chains:
        for residue_type in residue_list:
            for residue in chain.residues:
                if residue.resName == residue_type:
                    str += "%s\n" % (residue.getDeterminantString())

    # Add a warning in case of coupled residues
    if protein.coupled_residues:
        str += "%s\n" % (getTheLine())
        str += "  Residues that are found to be 'coupled', i.e. titrates together, has been marked by '*' in the above\n"
        str += "  section. Please rerun PropKa with the --display-coupled-residues option for detailed information.\n"

    return str
예제 #39
0
    def makeSequence(self, mutation=None):
        """
        creates a sequence from the chain object to be used in Scwrl-mutations
        """
        sequence = ""
        for residue in self.residues:
            if residue.resName in lib.residueList("standard"):
                if mutation == None:
                    code, resName = lib.convertResidueCode(
                        resName=residue.resName)
                    sequence += code.lower()
                elif residue.label in mutation:
                    new_label = mutation[residue.label]['label']
                    code, resName = lib.convertResidueCode(
                        resName=new_label[:3])
                    sequence += code.upper()
                else:
                    code, resName = lib.convertResidueCode(
                        resName=residue.resName)
                    sequence += code.lower()

        return sequence
예제 #40
0
def getDeterminantSection(protein, verbose=False):
    """
    prints out the pka-section of the result
    """
    # getting the same order as in propka2.0
    residue_list = lib.residueList("propka1")
    str  = "%s\n" % ( getDeterminantsHeader() )

    # printing determinants
    for chain in protein.chains:
      for residue_type in residue_list:
        for residue in chain.residues:
          if residue.resName == residue_type:
            str += "%s\n" % ( residue.getDeterminantString() )


    # Add a warning in case of coupled residues
    if protein.coupled_residues:
        str += "%s\n" % ( getTheLine() )
        str += "  Residues that are found to be 'coupled', i.e. titrates together, has been marked by '*' in the above\n"
        str += "  section. Please rerun PropKa with the --display-coupled-residues option for detailed information.\n"

    return  str
예제 #41
0
def makeCorrespondingAtomNames():
    """
    setting up a dictionary to define 'corresponding atoms' between two residues for 'overlap'
    """

    # getting list of all atoms
    resNames = residueList("standard")

    names = {}

    #   ----- back-bone & 'CB' section -----
    # simplifying the setup by including back-bone and 'CB' with this loop
    for resName1 in resNames:
      names[resName1] = {}
      for resName2 in resNames:
        names[resName1][resName2] = [['N',  'N'],
                                     ['CA', 'CA'],
                                     ['C',  'C'],
                                     ['O',  'O']]
        if resName1 != "GLY" and resName2 != "GLY":
          names[resName1][resName2].append(['CB', 'CB'])

    #   ----- self-overlap section -----
    # setting up all atoms for self-comparison
    for resName in resNames:
      atmNames = atomList(resName)
      for atmName in atmNames:
        if atmName not in ['N', 'CA', 'CB', 'C', 'O']:
          names[resName][resName].append([atmName, atmName])


    #   ----- side-chain section -----
    # side-chains left to consider (sorted alphabetically):
    # ['ARG', 'ASN', 'ASP', 'CYS', 'GLN', 'GLU', 'HIS', 'ILE', 'LEU', 'LYS', 'MET', 'PHE', 'PRO', 'SER', 'THR', 'TRP', 'TYR', 'VAL']


    # ARG
    # None 


    # ASN
    str1 = "ASN  CG"
    str2 = "ARG  CG"
    extendCorrespondingAtomsDictionary(names, str1, str2)


    # ASP
    str1 = "ASP  CG"
    str2 = "ARG  CG"
    extendCorrespondingAtomsDictionary(names, str1, str2)

    str1 = "ASP  OD1 OD2"
    str2 = "ASN  OD1 ND2"
    extendCorrespondingAtomsDictionary(names, str1, str2)


    # CYS
    # None 


    # GLN
    str1 = "GLN  CG CD"
    str2 = "ARG  CG CD"
    extendCorrespondingAtomsDictionary(names, str1, str2)

    str1 = "GLN  CG"
    str2 = "ASN  CG"
    extendCorrespondingAtomsDictionary(names, str1, str2)

    str1 = "GLN  CG"
    str2 = "ASP  CG"
    extendCorrespondingAtomsDictionary(names, str1, str2)


    # GLU


    # HIS


    # ILE


    # LEU


    # LYS


    # MET


    # PHE


    # PRO


    # SER


    # THR


    # TRP


    # TYR
    str1 = "TYR  CG"
    str2 = "LYS  CG"
    extendCorrespondingAtomsDictionary(names, str1, str2)


    # VAL


    return  names
예제 #42
0
def makeCorrespondingAtomNames():
    """
    setting up a dictionary to define 'corresponding atoms' between two residues for 'overlap'
    """

    # getting list of all atoms
    resNames = residueList("standard")

    names = {}

    #   ----- back-bone & 'CB' section -----
    # simplifying the setup by including back-bone and 'CB' with this loop
    for resName1 in resNames:
        names[resName1] = {}
        for resName2 in resNames:
            names[resName1][resName2] = [['N', 'N'], ['CA', 'CA'], ['C', 'C'],
                                         ['O', 'O']]
            if resName1 != "GLY" and resName2 != "GLY":
                names[resName1][resName2].append(['CB', 'CB'])

    #   ----- self-overlap section -----
    # setting up all atoms for self-comparison
    for resName in resNames:
        atmNames = atomList(resName)
        for atmName in atmNames:
            if atmName not in ['N', 'CA', 'CB', 'C', 'O']:
                names[resName][resName].append([atmName, atmName])

    #   ----- side-chain section -----
    # side-chains left to consider (sorted alphabetically):
    # ['ARG', 'ASN', 'ASP', 'CYS', 'GLN', 'GLU', 'HIS', 'ILE', 'LEU', 'LYS', 'MET', 'PHE', 'PRO', 'SER', 'THR', 'TRP', 'TYR', 'VAL']

    # ARG
    # None

    # ASN
    str1 = "ASN  CG"
    str2 = "ARG  CG"
    extendCorrespondingAtomsDictionary(names, str1, str2)

    # ASP
    str1 = "ASP  CG"
    str2 = "ARG  CG"
    extendCorrespondingAtomsDictionary(names, str1, str2)

    str1 = "ASP  OD1 OD2"
    str2 = "ASN  OD1 ND2"
    extendCorrespondingAtomsDictionary(names, str1, str2)

    # CYS
    # None

    # GLN
    str1 = "GLN  CG CD"
    str2 = "ARG  CG CD"
    extendCorrespondingAtomsDictionary(names, str1, str2)

    str1 = "GLN  CG"
    str2 = "ASN  CG"
    extendCorrespondingAtomsDictionary(names, str1, str2)

    str1 = "GLN  CG"
    str2 = "ASP  CG"
    extendCorrespondingAtomsDictionary(names, str1, str2)

    # GLU

    # HIS

    # ILE

    # LEU

    # LYS

    # MET

    # PHE

    # PRO

    # SER

    # THR

    # TRP

    # TYR
    str1 = "TYR  CG"
    str2 = "LYS  CG"
    extendCorrespondingAtomsDictionary(names, str1, str2)

    # VAL

    return names
예제 #43
0
    def calculateAveragePKA(self, version=None, options=None):
        """ 
        Calculates the pKa values of each configuration and averages them
        """ 
        # initializing dictionaries for making averages, key = 'residue.label'
        pkas         = {}
        Nmass        = {}
        Emass        = {}
        Nlocl        = {}
        Elocl        = {}
        determinants = {}
        number_of_configurations = len(self.configurations)
        # setting up list for 'propka1 pka residues'
        pka_residues = []
        for resName in lib.residueList("propka1"):
          pka_residues.extend(self.residue_dictionary[resName])
        # initializing dictionaries for making averages, key = 'configuration label'
        for residue in pka_residues:
          key = residue.label
          pkas[key]  = {}
          Nmass[key] = {}
          Emass[key] = {}
          Nlocl[key] = {}
          Elocl[key] = {}
          # initializing dictionary for making averages, key = 'determinant.label'
          determinants[key] = [{}, {}, {}]

        # perform pKa calulation on each configuration and add pKa properties to dictionaries
        for key in self.configurations:
          self.setConfiguration(key=key, options=options)
          self.calculateConfigurationPKA(version=version, options=options)
          # printing out the pKa section for this configuration
          if options.verbose == True:
              output.printPKASection(self)

          # transferring property to right dictionary
          for residue in pka_residues:
            residue_key = residue.label
            pkas[residue_key][key]  = residue.pKa_pro
            Nmass[residue_key][key] = residue.Nmass
            Emass[residue_key][key] = residue.Emass
            Nlocl[residue_key][key] = residue.Nlocl
            Elocl[residue_key][key] = residue.Elocl
            for type in range(3):
              for determinant in residue.determinants[type]:
                if determinant.label in determinants[residue_key][type]:
                  determinants[residue_key][type][determinant.label] += determinant.value
                else:
                  determinants[residue_key][type][determinant.label]  = determinant.value

        # print each configuration-pKa in nice matrix
        residue_list   =    self.residue_dictionary["ASP"]
        residue_list.extend(self.residue_dictionary["GLU"])
        str = "%4s" % ("Res#")
        for residue in residue_list:
          str += "%6d" % (residue.resNumb)
        pka_print(str)
        index = 0
        for key in self.configurations:
          str = "%4s:" % (key)
          for residue in residue_list:
            reskey = residue.label
            str += "%6.2lf" % (pkas[reskey][key])
            #str += "%6.2lf" % (Emass[reskey][key])
            #str += "%6.2lf" % (Elocl[reskey][key])
          pka_print(str)

        # get the average pKa properties by dividing the sum with number of configurations, len(configuration keys)
        from determinants import Determinant
        for residue in pka_residues:
          residue_key = residue.label
          sum_pka = 0.00; sum_Nmass = 0.00; sum_Emass = 0.00; sum_Nlocl = 0.00; sum_Elocl = 0.00
          for key in pkas[residue_key].keys():
            sum_pka   += pkas[residue_key][key]
            sum_Nmass += Nmass[residue_key][key]
            sum_Emass += Emass[residue_key][key]
            sum_Nlocl += Nlocl[residue_key][key]
            sum_Elocl += Elocl[residue_key][key]
          residue.pKa_pro = sum_pka/len( pkas[residue_key].keys() )
          residue.Nmass   = sum_Nmass/len( pkas[residue_key].keys() )
          residue.Emass   = sum_Emass/len( pkas[residue_key].keys() )
          residue.Nlocl   = sum_Nlocl/len( pkas[residue_key].keys() )
          residue.Elocl   = sum_Elocl/len( pkas[residue_key].keys() )
          residue.determinants = [[], [], []]
          for type in range(3):
            for key in determinants[residue_key][type].keys():
              value = determinants[residue_key][type][key] / len( pkas[residue_key].keys() )
              if abs(value) > 0.005:  # <-- removing determinant that appears as 0.00
                newDeterminant = Determinant(key, value)
                residue.determinants[type].append(newDeterminant)

        return
예제 #44
0
    def calculateAveragePKA(self, version=None, options=None):
        """ 
        Calculates the pKa values of each configuration and averages them
        """
        # initializing dictionaries for making averages, key = 'residue.label'
        pkas = {}
        Nmass = {}
        Emass = {}
        Nlocl = {}
        Elocl = {}
        determinants = {}
        number_of_configurations = len(self.configurations)
        # setting up list for 'propka1 pka residues'
        pka_residues = []
        for resName in lib.residueList("propka1"):
            pka_residues.extend(self.residue_dictionary[resName])
        # initializing dictionaries for making averages, key = 'configuration label'
        for residue in pka_residues:
            key = residue.label
            pkas[key] = {}
            Nmass[key] = {}
            Emass[key] = {}
            Nlocl[key] = {}
            Elocl[key] = {}
            # initializing dictionary for making averages, key = 'determinant.label'
            determinants[key] = [{}, {}, {}]

        # perform pKa calulation on each configuration and add pKa properties to dictionaries
        for key in self.configurations:
            self.setConfiguration(key=key, options=options)
            self.calculateConfigurationPKA(version=version, options=options)
            # printing out the pKa section for this configuration
            if options.verbose == True:
                output.printPKASection(self)

            # transferring property to right dictionary
            for residue in pka_residues:
                residue_key = residue.label
                pkas[residue_key][key] = residue.pKa_pro
                Nmass[residue_key][key] = residue.Nmass
                Emass[residue_key][key] = residue.Emass
                Nlocl[residue_key][key] = residue.Nlocl
                Elocl[residue_key][key] = residue.Elocl
                for type in range(3):
                    for determinant in residue.determinants[type]:
                        if determinant.label in determinants[residue_key][
                                type]:
                            determinants[residue_key][type][
                                determinant.label] += determinant.value
                        else:
                            determinants[residue_key][type][
                                determinant.label] = determinant.value

        # print each configuration-pKa in nice matrix
        residue_list = self.residue_dictionary["ASP"]
        residue_list.extend(self.residue_dictionary["GLU"])
        str = "%4s" % ("Res#")
        for residue in residue_list:
            str += "%6d" % (residue.resNumb)
        pka_print(str)
        index = 0
        for key in self.configurations:
            str = "%4s:" % (key)
            for residue in residue_list:
                reskey = residue.label
                str += "%6.2lf" % (pkas[reskey][key])
                #str += "%6.2lf" % (Emass[reskey][key])
                #str += "%6.2lf" % (Elocl[reskey][key])
            pka_print(str)

        # get the average pKa properties by dividing the sum with number of configurations, len(configuration keys)
        from determinants import Determinant
        for residue in pka_residues:
            residue_key = residue.label
            sum_pka = 0.00
            sum_Nmass = 0.00
            sum_Emass = 0.00
            sum_Nlocl = 0.00
            sum_Elocl = 0.00
            for key in pkas[residue_key].keys():
                sum_pka += pkas[residue_key][key]
                sum_Nmass += Nmass[residue_key][key]
                sum_Emass += Emass[residue_key][key]
                sum_Nlocl += Nlocl[residue_key][key]
                sum_Elocl += Elocl[residue_key][key]
            residue.pKa_pro = sum_pka / len(pkas[residue_key].keys())
            residue.Nmass = sum_Nmass / len(pkas[residue_key].keys())
            residue.Emass = sum_Emass / len(pkas[residue_key].keys())
            residue.Nlocl = sum_Nlocl / len(pkas[residue_key].keys())
            residue.Elocl = sum_Elocl / len(pkas[residue_key].keys())
            residue.determinants = [[], [], []]
            for type in range(3):
                for key in determinants[residue_key][type].keys():
                    value = determinants[residue_key][type][key] / len(
                        pkas[residue_key].keys())
                    if abs(
                            value
                    ) > 0.005:  # <-- removing determinant that appears as 0.00
                        newDeterminant = Determinant(key, value)
                        residue.determinants[type].append(newDeterminant)

        return