Esempio n. 1
0
def addtoDeterminantList(residue1, residue2, distance, iterative_interactions,
                         version):
    """
    Adds 'iterative determinants' to list ..., [[R1, R2], [side-chain, coulomb], [A1, A2]], ...
    Note, the sign is determined when the interaction is added to the iterative object!
    Note, distance < coulomb_cutoff here
    """
    add_interaction = False
    hbond_value = 0.00
    coulomb_value = 0.00

    # Side-chain interactions
    if True:
        atoms1 = residue1.makeDeterminantAtomList(residue2.resName,
                                                  version=version)
        atoms2 = residue2.makeDeterminantAtomList(residue1.resName,
                                                  version=version)
        atom_distance = 999.
        for atom1 in atoms1:
            for atom2 in atoms2:
                # select the smallest inter-atom distance
                atom_distance = min(calculate.InterAtomDistance(atom1, atom2),
                                    atom_distance)
        dpka_max, cutoff = version.SideChainParameters[residue1.resType][
            residue2.resType]
        weight = version.calculatePairWeight(residue1.Nmass, residue2.Nmass)
        if atom_distance < cutoff[1]:
            add_interaction = True
            exception, hbond_value = version.checkExceptions(
                residue1, residue2)
            if residue1.resType == "COO" and residue2.resType == "COO":
                """ do nothing """
                #print("xxx %6.2lf" % (atom_distance))
            #exception = False # circumventing exception
            if exception == True:
                """ do nothing, value should have been assigned """
                #print(" exception for %s %s (I)" % (residue1.label, residue2.label))
            else:
                f_angle = 1.0
                hbond_value = version.calculateSideChainEnergy(
                    atom_distance, dpka_max, cutoff, weight, f_angle)

    # Back-bone interactions
    """ Not done, never iterative """

    # Coulomb interactions
    do_coulomb = version.checkCoulombPair(residue1, residue2, distance)
    if do_coulomb == True:
        add_interaction = True
        weight = version.calculatePairWeight(residue1.Nmass, residue2.Nmass)
        coulomb_value = version.calculateCoulombEnergy(distance, weight)

    # adding the interaction to 'iterative_interactions'
    if add_interaction == True:
        interaction = []
        pair = [residue1, residue2]
        values = [hbond_value, coulomb_value]
        annihilation = [0., 0.]
        interaction = [pair, values, annihilation]
        iterative_interactions.append(interaction)
Esempio n. 2
0
def setBackBoneBaseDeterminants(data_clump, version=None):
    """
    adding back-bone determinants/perturbations for bases:
    Angle: atom1 -- atom2-atom3, i.e. C=O -- H-N(HIS)
    data_clump = [bases, CO]
    """
    residues, interactions = data_clump
    for residue in residues:
        if residue.location != "BONDED":
            dpKa_max, cutoff = version.BackBoneParameters[residue.resType]
            for interaction in interactions:
                distance = 999.
                atom1 = interaction[1]
                atoms = residue.makeDeterminantAtomList("back-bone", version=version)
                for atom in atoms:
                    current_distance = calculate.InterAtomDistance(atom1, atom)
                    if current_distance < distance:
                        atom2 = atom
                        distance = current_distance
                if distance < cutoff[1]:
                    if residue.resType in version.angularDependentSideChainInteractions:
                        atom3 = residue.getThirdAtomInAngle(atom2)
                        distance, f_angle, nada = calculate.AngleFactorX(atom1, atom2, atom3)
                    else:
                        f_angle = 1.0
                    if f_angle > 0.001:
                        # add determinant
                        label = "%s%4d%2s" % (atom2.resName, atom2.resNumb, atom2.chainID)
                        value = residue.Q * calculate.HydrogenBondEnergy(distance, dpKa_max, cutoff, f_angle)
                        newDeterminant = Determinant(label, value)
                        residue.determinants[1].append(newDeterminant)
Esempio n. 3
0
def setBackBoneAcidDeterminants(data_clump, version=None):
    """
    adding back-bone determinants/perturbations for acids:
    Angle: atom1 -- atom2-atom3, i.e. COO -- H-N
    data_clump = [acids, NH]
    """
    residues, interactions = data_clump
    for residue in residues:
        if residue.location != "BONDED":
            dpKa_max, cutoff = version.BackBoneParameters[residue.resType]
            for interaction in interactions:
                atom2 = interaction[1]
                atom3 = interaction[0]
                atoms = residue.makeDeterminantAtomList("back-bone", version=version)
                shortest_distance = 999.
                for atom in atoms:
                    distance = calculate.InterAtomDistance(atom, atom2)
                    if distance < shortest_distance:
                        shortest_distance = distance
                        atom1 = atom
                distance, f_angle, nada = calculate.AngleFactorX(atom1, atom2, atom3)
                if distance < cutoff[1] and f_angle > 0.001:
                    label = "%s%4d%2s" % (atom2.resName, atom2.resNumb, atom2.chainID)
                    value = residue.Q * calculate.HydrogenBondEnergy(distance, dpKa_max, cutoff, f_angle)
                    newDeterminant = Determinant(label, value)
                    residue.determinants[1].append(newDeterminant)
Esempio n. 4
0
def addSidechainDeterminants(residue1, residue2, version=None):
    """
    adding side-chain determinants/perturbations
    Note, resNumb1 > resNumb2
    """
    distance = 999.0
    closest_atom1 = None
    closest_atom2 = None
    atoms1 = residue1.makeDeterminantAtomList(residue2.resName,
                                              version=version)
    atoms2 = residue2.makeDeterminantAtomList(residue1.resName,
                                              version=version)
    for atom1 in atoms1:
        for atom2 in atoms2:
            # select the smallest inter-atom distance
            current_distance = calculate.InterAtomDistance(atom1, atom2)
            if current_distance < distance:
                closest_atom1 = atom1
                closest_atom2 = atom2
                distance = current_distance

    dpka_max, cutoff = version.SideChainParameters[residue1.resType][
        residue2.resType]
    if distance < cutoff[1]:
        if residue2.resType in version.angularDependentSideChainInteractions:
            atom3 = residue2.getThirdAtomInAngle(closest_atom2)
            distance, f_angle, nada = calculate.AngleFactorX(
                closest_atom1, closest_atom2, atom3)
        elif residue1.resType in version.angularDependentSideChainInteractions:
            atom3 = residue1.getThirdAtomInAngle(closest_atom1)
            distance, f_angle, nada = calculate.AngleFactorX(
                closest_atom2, closest_atom1, atom3)
        else:
            # i.e. no angular dependence
            f_angle = 1.0

        weight = version.calculatePairWeight(residue1.Nmass, residue2.Nmass)
        exception, value = version.checkExceptions(residue1, residue2)
        #exception = False # circumventing exception
        if exception == True:
            """ do nothing, value should have been assigned """
            #pka_print(" exception for %s %s %6.2lf" % (residue1.label, residue2.label, value))
        else:
            value = version.calculateSideChainEnergy(distance, dpka_max,
                                                     cutoff, weight, f_angle)
        if residue1.Q == residue2.Q:
            # acid pair or base pair
            if residue1.pKa_mod < residue2.pKa_mod:
                newDeterminant1 = Determinant(residue2.label, -value)
                newDeterminant2 = Determinant(residue1.label, value)
            else:
                newDeterminant1 = Determinant(residue2.label, value)
                newDeterminant2 = Determinant(residue1.label, -value)
        else:
            newDeterminant1 = Determinant(residue2.label, value * residue1.Q)
            newDeterminant2 = Determinant(residue1.label, value * residue2.Q)
        if residue1.resName not in version.exclude_sidechain_interactions:
            residue1.determinants[0].append(newDeterminant1)
        if residue2.resName not in version.exclude_sidechain_interactions:
            residue2.determinants[0].append(newDeterminant2)
Esempio n. 5
0
    def findSSbonds(self):
        """
        Finds all SS-pairs and sets location to 'BONDED' if distance < 2.50
        """
        # create CYS-list if not on protein object
        if self.residue_dictionary == None:
            CYSlist = []
            for chain in self.chains:
                for residue in chain.residues:
                    if residue.resName == "CYS":
                        CYSlist.append(residue)
        else:
            CYSlist = self.residue_dictionary["CYS"]

        # Searching all CYS pairs
        for residue1 in CYSlist:
            S1 = residue1.getAtom("SG")
            for residue2 in CYSlist:
                if residue1 == residue2:
                    break
                else:
                    S2 = residue2.getAtom("SG")
                    distance = calculate.InterAtomDistance(S1, S2)
                    if distance < 2.50:
                        residue1.location = "BONDED"
                        residue2.location = "BONDED"
                        residue1.pKa_mod = 99.99
                        residue2.pKa_mod = 99.99

        # cleaning out 'bonded' CYS from dictionary
        self.cleanBondedResiduesFromList(self.residue_dictionary["CYS"])

        return
Esempio n. 6
0
def printCooArgAtomDistances(residue_coo, residue_arg):
    """
    printing out all COO and ARG distances for debugging, picking closest + runner-up
    """
    for atom_coo in residue_coo.makeDeterminantAtomList(residue_arg.resName):
        for atom_arg in residue_arg.makeDeterminantAtomList(
                residue_coo.resName):
            distance = calculate.InterAtomDistance(atom_coo, atom_arg)
            print("%3s %3s %6.2lf" % (atom_coo.name, atom_arg.name, distance))