def displacementUpdateB(objA, alnAri, objB, alnBri): ### If residue is unassigned in one of the pdb files, we reset its value for x in range(len(alnAri)): s1 = objA + " and name CA and resi " + alnAri[x] cmd.alter( s1, "b = " + str(-0.01)) for x in range(len(alnBri)): s2 = objB + " and name CA and resi " + alnBri[x] cmd.alter( s2, "b = " + str(-0.01)) cmd.sort(objA); cmd.sort(objB) for x in range(len(alnAri)): s1 = objA + " and name CA and resi " + alnAri[x] s2 = objB + " and name CA and resi " + alnAri[x] ### Names starting with __ (underscores) are normally hidden by PyMOL tempObject = "__tempObject" Displacement = cmd.distance(tempObject, s1, s2) cmd.alter( s1, "b = " + str(Displacement)) cmd.alter( s2, "b = " + str(Displacement)) cmd.delete(tempObject) cmd.sort(objA); cmd.sort(objB)
def displacementUpdateBAll(objA, alnAri, objB, alnBri): print "This will take a while to go through the for loops. Give me around 3-5 minutes..." ### If residue is unassigned in one of the pdb files, we reset its value for x in range(len(alnAri)): s1 = objA + " and resi " + alnAri[x][0] + " and name " + str(alnAri[x][1]) cmd.alter( s1, "b = " + str(-0.01)) for x in range(len(alnBri)): s2 = objB + " and resi " + alnBri[x][0] + " and name " + alnBri[x][1] cmd.alter( s2, "b = " + str(-0.01)) cmd.sort(objA); cmd.sort(objB) for x in range(len(alnAri)): s1 = objA + " and resi " + alnAri[x][0] + " and name " + alnAri[x][1] s2 = objB + " and resi " + alnAri[x][0] + " and name " + alnAri[x][1] ### Names starting with __ (underscores) are normally hidden by PyMOL tempObject = "__tempObject" Displacement = cmd.distance(tempObject, s1, s2) cmd.alter( s1, "b = " + str(Displacement)) cmd.alter( s2, "b = " + str(Displacement)) cmd.delete(tempObject) cmd.sort(objA); cmd.sort(objB)