Beispiel #1
0
    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)
            nnDistance = nnDistanceMeasure.measure(nest)

            # ...and print(out the result)
            print("%s\t%s\t%0.2f\t%0.2f" % (structure, nest.subFeatures, nnnAngle, nnDistance))

# do not let the script continue if there is a problem
except IOError, ioe:
    sys.stderr.write(str(ioe))
    sys.exit(0)
Beispiel #2
0
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))