# require an hbond between the OD1 atom of residue 2 and the N of residue 4 secondOD1 = rlNestDescription.selectResidue(2).selectAtom("OD1") secondCG = rlNestDescription.selectResidue(2).selectAtom("CG") fourthN = rlNestDescription.selectResidue(4).selectAtom("N") fourthH = rlNestDescription.selectResidue(4).selectAtom("H") rlNestDescription.addCondition(HBondCondition(fourthN, fourthH, secondOD1, secondCG, 2.5, 120, 90)) # these are not 'real' atoms, but descriptions of those atoms we want in the nest secondN = rlNestDescription.selectResidue(2).selectAtom("N") thirdN = rlNestDescription.selectResidue(3).selectAtom("N") fourthN = rlNestDescription.selectResidue(4).selectAtom("N") # a 'Measure' is like a ruler or a compass - an instrument for making measurements nnnAngleMeasure = AngleMeasure(secondN, thirdN, fourthN) nnDistanceMeasure = DistanceMeasure(secondN, fourthN) # provide a 'header' for the columns print("pdbid\tmotif\t%s\t%s" % (nnnAngleMeasure, nnDistanceMeasure)) # this works for 1 or many structures for structure in structures: # let the user know what file is being processed now sys.stderr.write("Processing : %s\n" % structure) # this structure may have a number of nests, check them all for nest in structure.listFeaturesThatMatch(rlNestDescription): # use the measure on this object... nnnAngle = nnnAngleMeasure.measure(nest)
import sys from Tailor.Description import ChainDescription from Tailor.DataSource import structureFromFile from Tailor.Engine import Matcher from Tailor.Measure import DistanceMeasure # read in the structure filepath = sys.argv[1] structure = structureFromFile(filepath) # create a simple description description = ChainDescription({"chainType" : "Protein"}) description.createResidues(3) description.createPhiBoundCondition(2, -30, 100) # create a simple measure o = description.selectResidue(1).selectAtom("O") n = description.selectResidue(3).selectAtom("N") distanceMeasure = DistanceMeasure(o, n) # match and measure matcher = Matcher(description) for fragment in matcher.findAll(structure): print(fragment.chainID, "".join([str(r) for r in fragment]), distanceMeasure.measure(fragment))