コード例 #1
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)
コード例 #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)
コード例 #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)