Chain.filter() — check if this chain passes all criteria

filter(structure_types='structure', minimal_resolution=99.0, minimal_chain_length=30, max_nonstdres=10, chop_nonstd_termini=True, minimal_stdres=30)
This checks the chain with various criteria, and returns True only if all of them are met. This is useful in combination with Chain.write() to produce sequences of chains. See also Model.make_chains().

structure_types refers to the experimental method used to determine the structure. The following types are recognized: 'structureX' for X-ray, 'structureN' for NMR and 'structureM' for model, 'structureE' for electron microscopy, 'structureF' for fiber diffraction, 'structureU' for neutron diffraction, 'structure' for any structure.

chop_nonstd_termini, if set, removes a single non-standard residue (if present) from each terminus of the chain. This is done before the chain length criteria below are considered.

minimal_resolution refers to the cut-off value of the experimental resolution of the structure. Structures with resolutions larger than this threshold are not accepted.

minimal_chain_length refers to the lower limit of the chain length. Chains whose lengths are smaller than this value are not accepted.

max_nonstdres sets the maximum limit of non-standard residues that is tolerated.

minimal_stdres sets the minimum number of standard residues that are required to process the chain. Chains that don't have at least this number of standard residues are not accepted.
Example: examples/commands/make_chains.py

# Example for: chain.filter(), chain.write()

# This will read a PDB file (segment), and write out all of its chains
# satisfying the listed conditions into separate alignment files in the
# PIR format.

from modeller import *

env = Environ()
mdl = Model(env, file='../atom_files/pdb1lzd.ent')
for c in mdl.chains:
    if c.filter(minimal_chain_length=30, minimal_resolution=2.0,
                minimal_stdres=30, chop_nonstd_termini=True,
                structure_types='structureN structureX'):
        filename = '1lzd%s.chn' % c.name
        print("Wrote out " + filename)
        atom_file, align_code = c.atom_file_and_code(filename)
        c.write(filename, atom_file, align_code, format='PIR',
                chop_nonstd_termini=True)