iotbx.pdb

The PDB format is the predominant working format for atomic parameters (coordinates, occupancies, displacement parameters, etc.) in macromolecular crystallography. Many small-molecule programs also support this format. The PDB format specifications are available at http://www.pdb.org/. Technically, the format is very simple, therefore a vast number of parsers exist in scientific packages. The tools in iotbx.pdb are more complex than many, but have been designed to accommodate all valid scenarios found in real-world situations. Most of the interaction with models is done through an object called the “PDB hierarchy”, the rationale of which is explained in the background section.

Because of certain limitations of the PDB format (which was designed in the 1970s), in the long term macromolecular crystallography applications will move towards greater use of the mmCIF format for storing models. iotbx.pdb supports reading and writing mmCIF through the iotbx.cif parser, and the internal representation of the PDB hierarchy is identical for both formats. Throughout the documentation we refer to models as “PDB files”, but in most cases an mmCIF will work equally well.

Quick overview

Here is a simple example of reading in a single-model PDB (or mmCIF) model and traversing the hierarchy, deleting any zinc atoms:

from iotbx.pdb import hierarchy
pdb_in = hierarchy.input(file_name="model.pdb")
for chain in pdb_in.hierarchy.only_model().chains() :
  for residue_group in chain.residue_groups() :
    for atom_group in residue_group.atom_groups() :
      for atom in atom_group.atoms() :
        if (atom.element.strip().upper() == "ZN") :
          atom_group.remove_atom(atom)
      if (atom_group.atoms_size() == 0) :
        residue_group.remove_atom_group(atom_group)
    if (residue_group.atom_groups_size() == 0) :
      chain.remove_residue_group(residue_group)
f = open("model_Zn_free.pdb", "w")
f.write(pdb_in.hierarchy.as_pdb_string(
  crystal_symmetry=pdb_in.input.crystal_symmetry()))
f.close()

The hierarchy provides an atom selection syntax that allows us to perform the same operation with much less code:

sel_cache = pdb_in.hierarchy.atom_selection_cache()
non_zn_sel = sel_cache.selection("not (resname ZN)")
hierarchy_new = pdb_in.hierarchy.select(non_zn_sel)
...

This however creates a new hierarchy root, rather than modifying the existing structure in place.

For applications that deal with actual crystal scattering, in addition to the PDB hierarchy we also need the corresponding X-ray structure:

from iotbx.pdb import hierarchy
pdb_in = hierarchy.input(file_name="model.pdb")
xray_structure = pdb_in.input.xray_structure_simple()

The scatterers will be labeled to match the atom objects.

Background: the PDB hierarchy

(The overview is adapted from an article by Ralf Grosse-Kunstleve; the original can be found here.)

The evolution of the cctbx PDB handling tools has gone through three main stages spread out over several years. A simple parser implemented in Python has been available for a long time. In many cases Python’s runtime performance is sufficient for interactive processing of PDB files, but can be limiting for large files, or for repeatedly traversing the entire PDB database. This has prompted us to implement a fast C++ parser that is described in Grosse-Kunstleve et al. (2006). However, initially the fast cctbx PDB handling tools only supported “read-only” access. Writing of PDB files was supported only at a very basic level. This shortcoming has been removed and the current CCTBX version provides comprehensive tools for reading, manipulating, and writing PDB files. These tools are available from both Python and C++, under the iotbx.pdb module.

This article presents an overview of the main types in the iotbx.pdb module, considerations that lead to the design, and related important nomenclature. It is not a tutorial for using the iotbx.pdb facilities. For this, refer to the separate iotbx.pdb tutorial given at the 2008 SBGrid meeting. See also http://cci.lbl.gov/hybrid_36/ which describes iotbx.pdb facilities for handling very large models.

Real-world PDB files

The simplicity of the PDB format is only superficial and, in the general case, stops after the initial parsing level. The structure of the PDB file implies a hierarchy of objects. A first approximation is this hierarchical view is:

model
  chain
    residue
      atom

This is only an approximation because of a feature that is easily overlooked at first: the “altloc” (official PDB nomenclature) column 17 of PDB ATOM records, specifying “alternative location” identifiers for atoms in alternative conformations. As it turned out, about 90% of the development time invested into iotbx.pdb was in some form related to alternative conformations. Our goal was to provide robust tools that work even for the most unusual (but valid) cases, since this is a vital characteristic of any automated system. The main difficulties encountered while pursuing this goal were:

  • Chains with conformers that have different sequences
  • Chains with duplicate resseq+icode (residue sequence number + insertion code)
  • Conformers interleaved or separated

These difficulties are best illustrated with examples. An old version of PDB entry 2IZQ (from Aug 2008) includes a chain with conformers that have different sequences, the residue with resseq 11 in chain A, atoms 220 through 283:

HEADER    ANTIBIOTIC                              26-JUL-06   2IZQ
ATOM    220  N  ATRP A  11      20.498  12.832  34.558  0.50  6.03           N
................ATRP A  11 ...................................................
ATOM    243  HH2ATRP A  11      15.522   9.077  38.323  0.50 10.40           H
ATOM    244  N  CPHE A  11      20.226  13.044  34.556  0.15  6.35           N
................CPHE A  11 ...................................................
ATOM    254  CZ CPHE A  11      16.789   9.396  34.594  0.15 10.98           C
ATOM    255  N  BTYR A  11      20.553  12.751  34.549  0.35  5.21           N
................BTYR A  11 ...................................................
ATOM    261  CD1BTYR A  11      18.548  10.134  34.268  0.35  9.45           C
ATOM    262  HB2CPHE A  11      21.221  10.536  34.146  0.15  7.21           H
ATOM    263  CD2BTYR A  11      18.463  10.012  36.681  0.35  9.08           C
ATOM    264  HB3CPHE A  11      21.198  10.093  35.647  0.15  7.21           H
ATOM    265  CE1BTYR A  11      17.195   9.960  34.223  0.35 10.76           C
ATOM    266  HD1CPHE A  11      19.394   9.937  32.837  0.15 10.53           H
ATOM    267  CE2BTYR A  11      17.100   9.826  36.693  0.35 11.29           C
ATOM    268  HD2CPHE A  11      18.873  10.410  36.828  0.15  9.24           H
ATOM    269  CZ BTYR A  11      16.546   9.812  35.432  0.35 11.90           C
ATOM    270  HE1CPHE A  11      17.206   9.172  32.650  0.15 12.52           H
ATOM    271  OH BTYR A  11      15.178   9.650  35.313  0.35 19.29           O
ATOM    272  HE2CPHE A  11      16.661   9.708  36.588  0.15 11.13           H
ATOM    273  HZ CPHE A  11      15.908   9.110  34.509  0.15 13.18           H
ATOM    274  H  BTYR A  11      20.634  12.539  33.720  0.35  6.25           H
................BTYR A  11 ...................................................
ATOM    282  HH BTYR A  11      14.978   9.587  34.520  0.35 28.94           H

The original atom numbering does not have gaps. Here we have omitted blocks of atoms with constant resname and resseq+icode to save space.

As of Jun 8 2010, there are 74 files with mixed residue names in the PDB, i.e. only about 0.1% of the files. However, these files are perfectly valid and a PDB processing library is suitable as a component of an automated system only if it handles them sensibly.

An old version of PDB entry 1ZEH (Aug 2008) includes a chain with consecutive duplicate resseq+icode, atoms 878 through 894:

HEADER    HORMONE                                 01-MAY-98   1ZEH
HETATM  878  C1 ACRS     5      12.880  14.021   1.197  0.50 33.23           C
HETATM  879  C1 BCRS     5      12.880  14.007   1.210  0.50 34.27           C
................ACRS     5 ...................................................
HETATM  892  O1 ACRS     5      11.973  14.116   2.233  0.50 34.24           O
HETATM  893  O1 BCRS     5      11.973  14.107   2.248  0.50 35.28           O
HETATM  894  O   HOH     5      -0.924  19.122  -8.629  1.00 11.73           O
HETATM  895  O   HOH     6     -19.752  11.918   3.524  1.00 13.44           O
HETATM  896  O   HOH     7      -1.169  17.936  -6.103  1.00 12.89           O

To a human inspecting the old 1ZEH entry, it is of course immediately obvious that the water with resseq 5 is not related to the previous residue with resseq 5. However, arriving at this conclusion with an automatic procedure is not entirely straightforward. The human brings in the knowledge that water atoms without hydrogen are not covalently connected to other atoms. This is very detailed, specialized knowledge. Introducing such heuristics into an automatic procedure is likely to lead to surprises in some situations and is best avoided, if possible.

In the PDB archive, alternative conformers of a residue always appear consecutively. However, as mentioned in the introduction, the PDB format is also the predominant working format. Some programs produce files with conformers separated in this way (this file was provided to us by a user):

ATOM   1716  N  ALEU   190      28.628   4.549  20.230  0.70  3.78           N
ATOM   1717  CA ALEU   190      27.606   5.007  19.274  0.70  3.71           C
ATOM   1718  CB ALEU   190      26.715   3.852  18.800  0.70  4.15           C
ATOM   1719  CG ALEU   190      25.758   4.277  17.672  0.70  4.34           C
ATOM   1829  N  BLEU   190      28.428   4.746  20.343  0.30  5.13           N
ATOM   1830  CA BLEU   190      27.378   5.229  19.418  0.30  4.89           C
ATOM   1831  CB BLEU   190      26.539   4.062  18.892  0.30  4.88           C
ATOM   1832  CG BLEU   190      25.427   4.359  17.878  0.30  5.95           C
ATOM   1724  N  ATHR   191      27.350   7.274  20.124  0.70  3.35           N
ATOM   1725  CA ATHR   191      26.814   8.243  21.048  0.70  3.27           C
ATOM   1726  CB ATHR   191      27.925   9.229  21.468  0.70  3.73           C
ATOM   1727  OG1ATHR   191      28.519   9.718  20.259  0.70  5.22           O
ATOM   1728  CG2ATHR   191      28.924   8.567  22.345  0.70  4.21           C
ATOM   1729  C  ATHR   191      25.587   8.983  20.559  0.70  3.53           C
ATOM   1730  O  ATHR   191      24.872   9.566  21.383  0.70  3.93           O
                       ... residues 191 through 203 not shown
ATOM   1828  O  AGLY   203       8.948  14.861  23.401  0.70  5.84           O
ATOM   1833  CD1BLEU   190      26.014   4.711  16.521  0.30  6.21           C
ATOM   1835  C  BLEU   190      26.506   6.219  20.135  0.30  4.99           C
ATOM   1836  O  BLEU   190      25.418   5.939  20.669  0.30  5.91           O
ATOM   1721  CD2ALEU   190      24.674   3.225  17.536  0.70  5.31           C
ATOM   1722  C  ALEU   190      26.781   6.055  20.023  0.70  3.36           C
ATOM   1723  O  ALEU   190      25.693   5.796  20.563  0.70  3.68           O
ATOM   8722  C  DLEU   190      26.781   6.055  20.023  0.70  3.36           C
ATOM   8723  O  DLEU   190      25.693   5.796  20.563  0.70  3.68           O
ATOM   9722  C  CLEU   190      26.781   6.055  20.023  0.70  3.36           C
ATOM   9723  O  CLEU   190      25.693   5.796  20.563  0.70  3.68

In this file, conformers A and B of residue 190 appear consecutively, but conformers C and D appear only after conformers A and B of all residues 191 through 203. While this is not the most intuitive way of ordering the residues in a file, it is still considered valid because the original intention is clear. Since it was our goal to develop a comprehensive library suitable for automatically processing files produced by any popular program, we found it important to correctly handle non-consecutive conformers.

iotbx.pdb.hierarchy

When developing the procedure capable of handling the variety of real-world situations shown above, we strived to keep the underlying rule-set as simple as possible and to avoid highly specific heuristics (e.g. “water is never covalently bound”). Complex rules imply complex implementations, are difficult to explain and understand, tend to lead to surprises, and are therefore likely to be rejected by the community. With this and the real-world situations in mind, we arrived at the following primary organization of the PDB hierarchy:

Primary PDB hierarchy:

  model(s)
    id
    chain(s)
      id
      residue_group(s)
        resseq
        icode
        atom_group(s)
          resname
          altloc
          atom(s)

In this presentation the “(s)” indicates a list of objects of the given type. i.e. a hierarchy contains a list of models, each model has an “id” (a simple string) and holds a list of chains, etc.

Comparing with the “first approximation hierarchy” above, the residue type is replaced with two new types: residue_group and atom_group. These types had to be introduced to cover all the real-world cases shown above. The residue_group and atom_group types are new and unusual. Before we go into the details of these types, it will be helpful to consider the bigger picture by introducing the alternative secondary view of the PDB hierarchy:

Secondary view of PDB hierarchy:

  model(s)
    id
    chain(s)
      id
      conformer(s)
        altloc
        residue(s)
          resname
          resseq
          icode
          atom(s)

This organization is probably more intuitive at first. The first two levels (model, chain) are exactly the same as in the primary hierarchy. Each chain holds a list of conformer objects, which are characterized by the altloc character from column 17 in the PDB ATOM records. A conformer is understood to be a complete copy of a chain, but usually two conformers share some or even most atoms. A residue is characterized by a unique resname and the resseq+icode.

The secondary view of the hierarchy evolved in the context of generating geometry restraints for refinement (e.g. bond, angle, and dihedral restraints), where this organization is most useful. It is also the organization introduced in Grosse-Kunstleve et al. (2006), where it was actually the primary organization. While working with the conformer-residue organization, we found that it is difficult to manipulate a hierarchy (e.g. add or delete atoms) in obvious ways. Finally, while developing the automatic generation of constrained occupancy groups for alternative conformations, the conformer-residue organization proved to be unworkable. The main difficulty is that the relative order of residues with alternative conformations is lost in the conformer-residue organization; it is only given indirectly by interleaved residues with shared atoms – if they exist. As convenient as the conformer-residue organization is for the generation of restraints, it is a hindrance for other purposes.

The names for the new types in the primary hierarchy were chosen not to collide with the secondary view. We could have used “conformer” and “residue” again, just reversed, but there would be the big surprise that one residue has different resnames. To send the signal “this is not what you usually think of as a residue”, we decided to use residue_group as the type name. A residue group holds a list of atom_group objects. All atoms in an atom group have the same resname and altloc. Therefore “resname_altloc_group” would have been another plausible name, but we favored atom_group since it is more concise and better conveys what is the main content.

Detection of residue groups and atom groups

When constructing the primary hierarchy given a PDB file, the processing algorithm has to detect models, chains, residue groups, atom groups and atoms. Most steps are fairly straightforward, but none of the steps is actually completely trivial. For example, what to do if TER or ENDMDL cards are missing? What if residue sequence numbers are not consecutive? The ribosome community widely uses segid instead of chain id (even though the segid column is officially deprecated by the PDB). What if a file contains both chain id and segid? Documenting all our answers in full detail is beyond the scope of this article (and would be more distracting than helpful anyway because the source code is openly available). Therefore we concentrate on the most important rules for the detection of residue groups and atom groups.

Then central conflict we had to resolve was: - In order to handle non-consecutive conformers, we have to use the resseq+icode to find and group related residues. - However, we cannot use the resseq+icode alone as a guide, because we also want to handle chains with duplicate resseq+icode (consecutive or non-consecutive).

This lead to a two stage procedure. In the first stage, a residue group is given by a block of consecutive ATOM or HETATM records with identical resseq+icode columns (SIGATM, ANISOU, and SIGUIJ records may be interleaved), e.g.:

ATOM    234  H  ATRP A  11      20.540  12.567  33.741  0.50  7.24           H
ATOM    235  HA ATRP A  11      20.771  12.306  36.485  0.50  6.28           H
ATOM    244  N  CPHE A  11      20.226  13.044  34.556  0.15  6.35           N
ATOM    245  CA CPHE A  11      20.950  12.135  35.430  0.15  5.92

However, there is an important pre-condition: unless a sub-block of ATOM records with identical resname+resseq+icode columns contains a main-conformer atom (almost “blank altloc”), e.g.:

HEADER    ANTIBIOTIC RESISTANCE                   07-MAY-97   1AJQ
CRYST1   52.120   65.080   76.300 100.20 111.44 105.81 P 1           1
HETATM 6097 CA    CA     1       5.676  34.115  52.446  1.00 18.50          CA
HETATM 6100  C2  SPA     1      11.860  36.159  33.853  1.00 14.30           C
HETATM 6107  C6  SPA     1      13.085  36.522  34.644  1.00 17.34           C

In this case the sub-block is assigned to a separate residue group.

Within each residue group, all atoms are grouped by altloc+resname and assigned to atom groups. The order of the atoms in a residue group does not affect the assignment to atom groups.

After all atom records are assigned to residue groups and atom groups,

  • residue groups with identical resseq+icode
  • that do not contain main-conformer atoms

are merged in the second processing stage. While two residue groups are merged, atom groups with identical altloc+resname from the two sources are also merged. Note that the grouping steps in this process may change the order of the atoms. However, our implementation preserves the relative order of the atoms as much as possible. I.e. in the hierarchy, resseq+icode appear in the original “first seen” order, and similarly for altloc+resname within a residue group.

Construction of secondary view of hierarchy

The secondary view of the hierarchy is constructed trivially from the primary hierarchy objects. For each chain, the complete list of altloc characters is determined in a first pass. In a second pass, a conformer object is created for each altloc, and a second loop over the chain assigns the atoms to each conformer. Main-conformer atoms are assigned to all conformers, atoms in alternative conformations only to the corresponding conformer. Because of the difficulties alluded to earlier, the conformer and residue objects in the secondary view are “read-only”. I.e. all manipulations such as addition or removal of residues, have to be performed on the primary hierarchy. Re-constructing the secondary view after the primary hierarchy has been changed is very fast (fractions of seconds even for the largest files, e.g. 0.22 s for PDB entry 1HTQ with almost one million atoms).

The iotbx/examples/pdb_hierarchy.py script shows how to construct the primary hierarchy from a PDB file, and how to obtain the secondary view.

Errors and warnings

The tools in iotbx.pdb are designed to be as tolerant as reasonably possible when processing input PDB files. E.g., as of Jun 8 2010, all 65802 files in the PDB archive can be processed without generating exceptions. However, to assist users and developers in creating PDB files without ambiguities, the hierarchy object provides methods for flagging likely problems as errors and warnings. It is up to the application how to react to the diagnostics.

The phenix.pdb.hierarchy command can be used to quickly obtain a summary of the hierarchy in a PDB file and some diagnostics. This example command highlights all main features:

phenix.pdb.hierarchy pdb1jxw.ent.gz

Output:
  file pdb1jxw.ent.gz
    total number of:
      models:       1
      chains:       2
      alt. conf.:   5
      residues:    49
      atoms:      786
      anisou:       0
    number of atom element+charge types: 5
    histogram of atom element+charge frequency:
      " H  " 383
      " C  " 261
      " O  "  77
      " N  "  59
      " S  "   6
    residue name classes:
      "common_amino_acid" 48
      "other"              1
    number of chain ids: 2
    histogram of chain id frequency:
      " " 1
      "A" 1
    number of alt. conf. ids: 3
    histogram of alt. conf. id frequency:
      "A" 2
      "B" 2
      "C" 1
    residue alt. conf. situations:
      pure main conf.:     32
      pure alt. conf.:      3
      proper alt. conf.:   14
      improper alt. conf.:  0
    chains with mix of proper and improper alt. conf.: 0
    number of residue names: 16
    histogram of residue name frequency:
      "CYS" 6
      "THR" 6
      "ALA" 5
      "ILE" 5
      "PRO" 5
      "GLY" 4
      "ASN" 3
      "SER" 3
      "ARG" 2
      "LEU" 2
      "TYR" 2
      "VAL" 2
      "ASP" 1
      "EOH" 1    other
      "GLU" 1
      "PHE" 1
    ### WARNING: consecutive residue_groups with same resid ###
    number of consecutive residue groups with same resid: 2
      residue group:
        "ATOM    378  N   PRO A  22 .*.     N  "
        ... 12 atoms not shown
        "ATOM    391  HD3APRO A  22 .*.     H  "
      next residue group:
        "ATOM    392  CB BSER A  22 .*.     C  "
        ... 6 atoms not shown
        "ATOM    399  HB3CSER A  22 .*.     H  "
      ------------------------------------------
      residue group:
        "ATOM    432  N   LEU A  25 .*.     N  "
        ... 18 atoms not shown
        "ATOM    439  CD1CLEU A  25 .*.     C  "
      next residue group:
        "ATOM    452  CG1BILE A  25 .*.     C  "
        ... 13 atoms not shown
        "ATOM    466 HD13CILE A  25 .*.     H  "

The diagnostics are mainly intended for PDB working files, but we have tested the iotbx.pdb module by processing the entire PDB archive. (This took about 3700 CPU seconds, but using 40 CPUs the last job finished after only 277 seconds. Disk and network I/O is rate-limiting in this case, not the performance of the PDB handling library.) The results are summarized in the following table:

Total number of .ent files: 65802 (2010 Jun 8)

56873   WARNING: duplicate chain id
    3   WARNING: consecutive residue_groups with same resid
    2   ERROR:   duplicate atom labels
    1   ERROR:   improper alt. conf.
    0   ERROR:   duplicate model id
    0   ERROR:   residue group with multiple resnames using same altloc

About 86% of the PDB entries re-use the same chain id for multiple chains (which are either separated by other chains or TER cards). In many cases, the re-used chain id is the blank character, which is clearly a minor issue. However, we flag this situation to assist people in producing new PDB files with unambiguous chain ids.

The next item in the list, “consecutive residue_groups with same resid” (where resid=resseq+icode), was mentioned before. This situation is best avoided to minimize the chances of mis-interpreting the PDB files. “duplicate atom labels” pose a serious practical problem (therefore flagged as “ERROR”) since it is impossible to uniquely select atoms with duplicate labels, for example via an atom selection syntax as used in many programs (CNS, PyMOL, PHENIX, VMD, etc.) or via PDB records in the connectivity annotation section (LINK, SSBOND, CISPEP). Atom serial numbers are not suitable for this purpose since many programs do not preserve them.

Only one PDB entry (1JRT) includes “improper alt. conf.” as introduced in the previous section.

There are no PDB entries with two other potential problems diagnosed by the iotbx.pdb module. MODEL ids are unique throughout the PDB archive (as an aside: and all MODEL records have a matching ENDMDL record). Finally, in all 74 files with mixed residue names (i.e. conformers with different sequences), there is exactly one residue name for a given altloc.

Atom selections

The PDB hierarchy enables fast selection lookup based on a simple syntax similar to the one used in CNS or PyMOL. Many programs in Phenix make heavy use of these selections to handle user input, but they are equally important internally, where they simplify the task of pulling specific atoms out of the hierarchy.

The syntax allows for selection of atomic properties such as atom name, residue number, chain ID, or B-factor, which can be combined by the use of simple boolean statements (and, or, or not). The class iotbx.pdb.atom_selection.cache implements these selections, and is created directly by the hierarchy object:

from iotbx.pdb import hierarchy
pdb_in = hierarchy.input(file_name="model.pdb")
pdb_atoms = pdb_in.hierarchy.atoms()
xray_structure = pdb_in.input.xray_structure_simple()
sel_cache = pdb_in.hierarchy.atom_selection_cache()
c_alpha_sel = sel_cache.selection("name ca") # XXX not case sensitive!
c_alpha_atoms = pdb_atoms.select(c_alpha_sel)
c_alpha_xray_structure = xray_structure.select(c_alpha_sel)
c_alpha_hierarchy = pdb_in.hierarchy.select(c_alpha_sel)

These selection operations work equivalently to the scitbx.array_family selections described elsewhere, and the iotbx.pdb.atom_selection.cache object also provides an analogous function iselection that returns the corresponding size_t array of indices (equivalent to calling c_alpha_sel.iselection() in the example above). The iotbx.pdb.hierarchy.root and cctbx.xray.structure classes are not themselves arrays, but since they store comparable data (and in the latter case, an actual array internally) they are also implemented with the select() method.

Other practical examples of the syntax:

All atoms

all

All atoms with H in the name (* is a wildcard character)

name *H*

Atoms names with * (backslash disables wildcard function)

name o2\*

Atom names with spaces

name 'O 1'

Atom names with primes don’t necessarily have to be quoted

name o2'

Boolean “and”, “or”, and “not”

resname ALA and (name ca or name c or name n or name o)
chain a and not altid b
resid 120 and icode c and model 2
segid a and element c and charge 2+ and anisou

Note that the and, or, and not operators have equal priority, so parentheses may be required to indicate which clauses go together. The first example above selects for all atoms with the specified names in alanine residues, but if the parentheses are omitted:

resname ALA and name ca or name c or name n or name o

it will instead select C-alpha atoms in ALA, plus all atoms named C, N, or O regardless of residue name.

A single residue by number

resseq 188

Note that if there are several chains containing residue number 188, all of them will be selected. To be more specific and select residue 188 in particular chain:

chain A and resid 188

this will select residue 188 only in chain A.

A range of residues

resseq 2:10

This selects all residue numbers falling within this range, independent of their order in the PDB file. The numbering must be ascending; resseq 10:2 will not work.

Insertion codes

resid combines the residue number (resseq) with the insertion code (icode); thus the following selections are identical:

resid 188
resseq 188 and icode ' '

as are these:

resid 27C
resseq 27 and icode 'C'

Specifying ordered ranges of residues

For some purposes, such as specifying TLS groups, it may be impractical to specify a numerical range of resseq attributes. This is especially the case when the residue numbering is not continuous and ascending, which is found in some PDB entries, or when the insertion code is non-blank. An alternative is to define a series of residues by their combined number and insertion code, using the through keyword:

chain A and resid 1000 through 17J

In this case, the residues will be examined in the order that they appear in the PDB file, and every atom falling between 1000 and 17J in chain A will be included. This is the only situation where the ordering of atoms is important in atom selections.

B-factors and occupancies

You may also select atoms based on their numerical properties:

bfactor > 80
bfactor = 0
occupancy < 1
occupancy = 0

Other

A few additional keywords are supported:

element H
water
pepnames
hetero

These examples specify hydrogen atoms, water molecules (detected by residue name), common amino acid residues, and atoms labeled as HETATM, respectively.

Selecting no atoms

(not all)

Extracting selections from atom arrays

In addition to the string-based selection mechanism, it is also possible to derive selections from any object in the PDB hierarchy:

import iotbx.pdb.hierarchy
pdb_in = iotbx.pdb.hierarchy.input(file_name="model.cif")
for chain in pdb_in.hierarchy.only_model().chains() :
  chain_atoms = chain.atoms()
  chain_selection = chain_atoms.extract_i_seq()

This is especially useful when referencing a string-based selection, as it allows us to compare any hierarchy object to the selection:

selection = pdb_in.hierarchy.atom_selection_cache().selection("hetatm")
for chain in pdb_in.hierarchy.only_model().chains() :
  for residue_group in chain.residue_groups() :
    residue_isel = residue_group.atoms().extract_i_seq()
    if (selection.select(residue_isel).all_eq(True)) :
      do_something_with_heteroatom_residue(residue_group)

One word of caution: this assumes that the i_seq attribute of each atom represents its position in the hierarchy (and corresponding array returned by hierarchy.atoms()). The i_seq will be initialized by default when constructing the hierarchy, but modifications to the hierarchy will not be propagated to the individual atoms. You can reset the i_seq at any time:

hierarchy.reset_atom_i_seq()

or:

pdb_atoms = hierarchy.atoms()
pdb_atoms.reset_i_seq()

API documentation

Input methods and objects

class iotbx.pdb.hierarchy.input(file_name=None, pdb_string=None, source_info=<libtbx.AutoType object at 0x1a98750>)

Bases: iotbx.pdb.hierarchy.input_hierarchy_pair

Class used for reading a PDB hierarchy from a file or string.

Examples

>>> import iotbx.pdb.hierarchy
>>> pdb_in = iotbx.pdb.hierarchy.input(pdb_string='''
... ATOM      1  N   ASP A  37      10.710  14.456   9.568  1.00 15.78           N
... ATOM      2  CA  ASP A  37       9.318  14.587   9.999  1.00 18.38           C
... ''')
>>> print pdb_in.hierarchy.atoms_size()
2
"")

Attributes

input (iotbx.pdb.pdb_input_from_any)
hierarchy (iotbx.pdb.hierarchy.root)

Methods

construct_hierarchy
crystal_symmetry
hierarchy_to_input_atom_permutation
input_to_hierarchy_atom_permutation
xray_structure_simple
iotbx.pdb.input(file_name=None, source_info=<class 'iotbx.pdb.Please_pass_string_or_None'>, lines=None, pdb_id=None, raise_sorry_if_format_error=False)

Main input method for both PDB and mmCIF files; will automatically determine the actual format and return the appropriate data type.

Parameters:

file_name: path to PDB or mmCIF file

source_info: string describing source of input (e.g. file name)

lines: flex.std_string array of input lines

pdb_id: PDB ID to automatically retrieve from local mirror

raise_sorry_if_format_error: re-raise any low-level parser errors as a

libtbx.utils.Sorry exception instance for clean user feedback

Returns:

An object representing the result of parsing, including an array of atom

objects; the actual class will differ depending on the input format. Much of

the API will be the same in either case.

class iotbx.pdb.mmcif.cif_input(file_name=None, cif_object=None, source_info=<class 'iotbx.pdb.Please_pass_string_or_None'>, lines=None, pdb_id=None, raise_sorry_if_format_error=False)

Bases: iotbx.pdb.pdb_input_mixin

Methods

as_pdb_string
atoms
atoms_with_labels
connectivity_annotation_section
connectivity_section
construct_hierarchy
crystal_symmetry
crystal_symmetry_from_cryst1
crystallographic_section
deposition_date
extract_cryst1_z_columns
extract_f_model_core_constants
extract_header_year
extract_tls_params
extract_wavelength
file_type
get_experiment_type
get_matthews_coeff
get_program_name
get_r_rfree_sigma
get_solvent_content
heterogen_section
model_ids
model_indices
process_mtrix_records
remark_section
scale_matrix
source_info
special_position_settings
ter_indices
title_section
write_pdb_file
xray_structure_simple
xray_structures_simple
atoms()
atoms_with_labels()
connectivity_annotation_section()
connectivity_section()
construct_hierarchy(set_atom_i_seq=True)
crystal_symmetry(crystal_symmetry=None, weak_symmetry=False)
crystal_symmetry_from_cryst1()
crystallographic_section()
deposition_date()
extract_cryst1_z_columns()
extract_f_model_core_constants()
extract_header_year()
extract_tls_params(hierarchy)
extract_wavelength(first_only=True)
file_type()
get_experiment_type()
get_matthews_coeff()
get_program_name()
get_r_rfree_sigma(file_name)
get_solvent_content()
heterogen_section()
model_ids()
model_indices()
process_mtrix_records(error_handle=True, eps=0.0001)

Read MTRIX records from a pdb file

remark_section()
scale_matrix()
source_info()
ter_indices()
title_section()

PDB hierarchy objects

class iotbx.pdb.hierarchy.root((object)arg1)

Bases: Boost.Python.instance

Root node of the PDB hierarchy object. This is returned by the method construct_hierarchy() of the PDB/mmCIF input objects, but it may also be created programatically. Note that it does not contain any reference to crystal symmetry or source scattering information, meaning that in practice it must often be tracked alongside an equivalent cctbx.xray.structure object. Pickling is supported, simply by writing out and reading back the PDB-format representation of the hierarchy.

Examples

>>> hierarchy = iotbx.pdb.hierarchy.root()

Attributes

info

Methods

adopt_xray_structure
altloc_indices
append_model
as_cif_block
as_cif_input
as_pdb_input
as_pdb_string
as_str
atom_groups
atom_selection_cache
atoms
atoms_reset_serial
atoms_size
atoms_with_i_seq_mismatch
atoms_with_labels
chains
chunk_selections
contains_nucleic_acid
contains_protein
contains_rna
deep_copy
distance_based_simple_two_way_bond_sets
extract_xray_structure
find_model_index
get_atom_selection_cache
get_conformer_indices
get_overall_counts
get_peptide_c_alpha_selection
insert_model
is_similar_hierarchy
memory_id
models
models_size
occupancy_groups_simple
only_atom
only_atom_group
only_chain
only_conformer
only_model
only_residue
only_residue_group
overall_counts
pre_allocate_models
remove_hd
remove_model
reset_atom_i_seqs
reset_i_seq_if_necessary
residue_groups
select This module supports asynchronous I/O on multiple file descriptors.
show
transfer_chains_from_other
write_mmcif_file
write_pdb_file
adopt_xray_structure(xray_structure, assert_identical_id_str=True)

Apply the current (refined) atomic parameters from the cctbx.xray.structure object to the atoms in the PDB hierarchy. This will fail if the labels of the scatterers do not match the atom labels.

altloc_indices((root)arg1) → object :
C++ signature :
boost::python::api::object altloc_indices(iotbx::pdb::hierarchy::root)
append_model((root)arg1, (model)model) → None :
C++ signature :
void append_model(iotbx::pdb::hierarchy::root {lvalue},iotbx::pdb::hierarchy::model {lvalue})
as_cif_block(crystal_symmetry=None)
as_cif_input(crystal_symmetry=None)

Generate corresponding mmcif input object.

as_pdb_input(crystal_symmetry=None)

Generate corresponding pdb.input object.

as_pdb_string(crystal_symmetry=None, cryst1_z=None, write_scale_records=True, append_end=False, interleaved_conf=0, atoms_reset_serial_first_value=None, atom_hetatm=True, sigatm=True, anisou=True, siguij=True, output_break_records=True, cstringio=None, return_cstringio=<libtbx.AutoType object at 0x1a98750>)

Generate complete PDB-format string representation. External crystal symmetry is strongly recommended if this is being output to a file.

Parameters:
  • crystal_symmetry – cctbx.crystal.symmetry object or equivalent (such as an xray.structure object or Miller array)
  • write_scale_records – write fractional scaling records (SCALE) if crystal symmetry is provided
  • anisou – write ANISOU records for anisotropic atoms
  • sigatm – write SIGATM records if applicable
  • siguij – write SIGUIJ records if applicable
Returns:

Python str

as_str(prefix='', level_id=None, level_id_exception=<type 'exceptions.ValueError'>)

Alias for show().

atom_groups()

Iterate over all atom groups (by model, then chain, then residue group)

atom_selection_cache(special_position_settings=None)
atoms((root)arg1[, (int)interleaved_conf=0]) → af_shared_atom :
C++ signature :
scitbx::af::shared<iotbx::pdb::hierarchy::atom> atoms(iotbx::pdb::hierarchy::root {lvalue} [,int=0])
atoms_reset_serial((root)arg1[, (int)interleaved_conf=0[, (int)first_value=1]]) → None :
C++ signature :
void atoms_reset_serial(iotbx::pdb::hierarchy::root {lvalue} [,int=0 [,int=1]])
atoms_size((root)arg1) → int :
C++ signature :
unsigned int atoms_size(iotbx::pdb::hierarchy::root {lvalue})
atoms_with_i_seq_mismatch((root)arg1) → af_shared_atom :
C++ signature :
scitbx::af::shared<iotbx::pdb::hierarchy::atom> atoms_with_i_seq_mismatch(iotbx::pdb::hierarchy::root {lvalue})
atoms_with_labels()

Generator for atom_with_labels objects, presented in the same order as the array returned by the atoms() method.

chains()

Iterate over all chains in all models.

chunk_selections(residues_per_chunk)
contains_nucleic_acid()

Inspect residue names (stored in atom_group objects) to determine if any of them are RNA or DNA.

contains_protein()

Inspect residue names (stored in atom_group objects) to determine if any of them are protein.

contains_rna()

Inspect residue names (stored in atom_group objects) to determine if any of them are RNA.

deep_copy((root)arg1) → root :
C++ signature :
iotbx::pdb::hierarchy::root deep_copy(iotbx::pdb::hierarchy::root {lvalue})
distance_based_simple_two_way_bond_sets(fallback_expected_bond_length=1.4, fallback_search_max_distance=2.5)
extract_xray_structure(crystal_symmetry=None)

Generate the equivalent cctbx.xray.structure object. If the crystal symmetry is not provided, this will be placed in a P1 box. In practice it is usually best to keep the original xray structure object around, but this method is helpful in corner cases.

find_model_index((root)arg1, (model)model[, (bool)must_be_present=False]) → int :
C++ signature :
long find_model_index(iotbx::pdb::hierarchy::root {lvalue},iotbx::pdb::hierarchy::model [,bool=False])
get_atom_selection_cache((root)arg1, (object)arg2) → None :
C++ signature :
void get_atom_selection_cache(iotbx::pdb::hierarchy::root,boost::python::api::object)
get_conformer_indices()
get_overall_counts((root)arg1, (object)arg2) → None :
C++ signature :
void get_overall_counts(iotbx::pdb::hierarchy::root,boost::python::api::object)
get_peptide_c_alpha_selection()

Extract atom selection (flex.size_t) for protein C-alpha atoms.

info
insert_model((root)arg1, (int)i, (model)model) → None :
C++ signature :
void insert_model(iotbx::pdb::hierarchy::root {lvalue},long,iotbx::pdb::hierarchy::model {lvalue})
is_similar_hierarchy((root)arg1, (root)other) → bool :
C++ signature :
bool is_similar_hierarchy(iotbx::pdb::hierarchy::root {lvalue},iotbx::pdb::hierarchy::root)
memory_id((root)arg1) → int :
C++ signature :
unsigned long memory_id(iotbx::pdb::hierarchy::root {lvalue})
models((root)arg1) → list :
C++ signature :
boost::python::list models(iotbx::pdb::hierarchy::root)
models_size((root)arg1) → int :
C++ signature :
unsigned int models_size(iotbx::pdb::hierarchy::root {lvalue})
occupancy_groups_simple(common_residue_name_class_only=None, always_group_adjacent=True, ignore_hydrogens=True)
only_atom()
only_atom_group()
only_chain()
only_conformer()
only_model()
only_residue()
only_residue_group()
overall_counts()

Calculate basic statistics for contents of the PDB hierarchy, including number of residues of each type.

Returns:iotbx.pdb.hierarchy.overall_counts object
pre_allocate_models((root)arg1, (int)number_of_additional_models) → None :
C++ signature :
void pre_allocate_models(iotbx::pdb::hierarchy::root {lvalue},unsigned int)
remove_hd(reset_i_seq=False)

Remove all hydrogen/deuterium atoms in-place. Returns the number of atoms deleted.

remove_model((root)arg1, (int)i) → None :
C++ signature :
void remove_model(iotbx::pdb::hierarchy::root {lvalue},long)

remove_model( (root)arg1, (model)model) -> None :

C++ signature :
void remove_model(iotbx::pdb::hierarchy::root {lvalue},iotbx::pdb::hierarchy::model {lvalue})
reset_atom_i_seqs((root)arg1) → int :
C++ signature :
unsigned long reset_atom_i_seqs(iotbx::pdb::hierarchy::root {lvalue})
reset_i_seq_if_necessary()
residue_groups()

Iterate over all residue groups (by model and then chain)

select((root)arg1, (bool)atom_selection[, (bool)copy_atoms=False]) → root :
C++ signature :
iotbx::pdb::hierarchy::root select(iotbx::pdb::hierarchy::root {lvalue},scitbx::af::const_ref<bool, scitbx::af::trivial_accessor> [,bool=False])

select( (root)arg1, (size_t)atom_selection [, (bool)copy_atoms=False]) -> root :

C++ signature :
iotbx::pdb::hierarchy::root select(iotbx::pdb::hierarchy::root {lvalue},scitbx::af::const_ref<unsigned long, scitbx::af::trivial_accessor> [,bool=False])
show(out=None, prefix='', level_id=None, level_id_exception=<type 'exceptions.ValueError'>)

Display a summary of hierarchy contents.

transfer_chains_from_other(other)
write_mmcif_file(file_name, crystal_symmetry=None, data_block_name=None)
write_pdb_file(file_name, open_append=False, crystal_symmetry=None, cryst1_z=None, write_scale_records=True, append_end=False, interleaved_conf=0, atoms_reset_serial_first_value=None, atom_hetatm=True, sigatm=True, anisou=True, siguij=True)
class iotbx.pdb.hierarchy.model((object)arg1, (root)parent[, (str)id=''])

Bases: Boost.Python.instance

Class representing MODEL blocks in a PDB file (or equivalent mmCIF). There will always be at least one of these in a hierarchy root extracted from a PDB file even if no MODEL records are present.

Attributes

id

Methods

append_chain
atom_groups
atoms
atoms_size
chains
chains_size
detached_copy
find_chain_index
insert_chain
is_identical_hierarchy
is_similar_hierarchy
memory_id
only_atom
only_atom_group
only_chain
only_conformer
only_residue
only_residue_group
parent
pre_allocate_chains
remove_chain
residue_groups
transfer_chains_from_other
append_chain((model)arg1, (chain)chain) → None :
C++ signature :
void append_chain(iotbx::pdb::hierarchy::model {lvalue},iotbx::pdb::hierarchy::chain {lvalue})
atom_groups()
atoms((model)arg1[, (int)interleaved_conf=0]) → af_shared_atom :
C++ signature :
scitbx::af::shared<iotbx::pdb::hierarchy::atom> atoms(iotbx::pdb::hierarchy::model {lvalue} [,int=0])
atoms_size((model)arg1) → int :
C++ signature :
unsigned int atoms_size(iotbx::pdb::hierarchy::model {lvalue})
chains((model)arg1) → list :
C++ signature :
boost::python::list chains(iotbx::pdb::hierarchy::model)
chains_size((model)arg1) → int :
C++ signature :
unsigned int chains_size(iotbx::pdb::hierarchy::model {lvalue})
detached_copy((model)arg1) → model :
C++ signature :
iotbx::pdb::hierarchy::model detached_copy(iotbx::pdb::hierarchy::model {lvalue})
find_chain_index((model)arg1, (chain)chain[, (bool)must_be_present=False]) → int :
C++ signature :
long find_chain_index(iotbx::pdb::hierarchy::model {lvalue},iotbx::pdb::hierarchy::chain [,bool=False])
id
insert_chain((model)arg1, (int)i, (chain)chain) → None :
C++ signature :
void insert_chain(iotbx::pdb::hierarchy::model {lvalue},long,iotbx::pdb::hierarchy::chain {lvalue})
is_identical_hierarchy((model)arg1, (model)other) → bool :
C++ signature :
bool is_identical_hierarchy(iotbx::pdb::hierarchy::model {lvalue},iotbx::pdb::hierarchy::model)
is_similar_hierarchy((model)arg1, (model)other) → bool :
C++ signature :
bool is_similar_hierarchy(iotbx::pdb::hierarchy::model {lvalue},iotbx::pdb::hierarchy::model)
memory_id((model)arg1) → int :
C++ signature :
unsigned long memory_id(iotbx::pdb::hierarchy::model {lvalue})
only_atom()
only_atom_group()
only_chain()
only_conformer()
only_residue()
only_residue_group()
parent((model)arg1[, (bool)optional=True]) → object :
C++ signature :
boost::python::api::object parent(iotbx::pdb::hierarchy::model [,bool=True])
pre_allocate_chains((model)arg1, (int)number_of_additional_chains) → None :
C++ signature :
void pre_allocate_chains(iotbx::pdb::hierarchy::model {lvalue},unsigned int)
remove_chain((model)arg1, (int)i) → None :
C++ signature :
void remove_chain(iotbx::pdb::hierarchy::model {lvalue},long)

remove_chain( (model)arg1, (chain)chain) -> None :

C++ signature :
void remove_chain(iotbx::pdb::hierarchy::model {lvalue},iotbx::pdb::hierarchy::chain {lvalue})
residue_groups()
transfer_chains_from_other((model)arg1, (model)other) → None :
C++ signature :
void transfer_chains_from_other(iotbx::pdb::hierarchy::model {lvalue},iotbx::pdb::hierarchy::model {lvalue})
class iotbx.pdb.hierarchy.chain((object)arg1, (model)parent[, (str)id=''])

Bases: Boost.Python.instance

Class representing a continuous chain of atoms, as defined by the combination of chain ID field and TER records (or the chain index in mmCIF format). Note that this does not necessarily correspond to a covalently linked entity, as it may be used to group various heteroatoms (including water), but chemically distinct protein or nucleic acid chains will typically be grouped into exactly one chain object apiece.

Attributes

id

Methods

append_residue_group
as_padded_sequence
as_sequence
atom_groups
atoms
atoms_size
conformers
detached_copy
find_pure_altloc_ranges
find_residue_group_index
get_residue_ids
get_residue_names_and_classes
get_residue_names_padded
insert_residue_group
is_identical_hierarchy
is_na
is_protein
is_similar_hierarchy
memory_id
merge_disconnected_residue_groups_with_pure_altloc
merge_residue_groups
occupancy_groups_simple
only_atom
only_atom_group
only_conformer
only_residue
only_residue_group
parent
pre_allocate_residue_groups
remove_residue_group
residue_groups
residue_groups_size
residues
append_residue_group((chain)arg1, (residue_group)residue_group) → None :
C++ signature :
void append_residue_group(iotbx::pdb::hierarchy::chain {lvalue},iotbx::pdb::hierarchy::residue_group {lvalue})
as_padded_sequence(missing_char='X', skip_insertions=False, pad=True, substitute_unknown='X', pad_at_start=True)

Extract protein or nucleic acid sequence, taking residue numbering into account so that apparent gaps will be filled with substitute characters.

as_sequence(substitute_unknown='X')

Naively extract single-character protein or nucleic acid sequence, without accounting for residue numbering.

Parameters:substitute_unknown – character to use for unrecognized 3-letter codes
atom_groups()
atoms((chain)arg1[, (int)interleaved_conf=0]) → af_shared_atom :
C++ signature :
scitbx::af::shared<iotbx::pdb::hierarchy::atom> atoms(iotbx::pdb::hierarchy::chain {lvalue} [,int=0])
atoms_size((chain)arg1) → int :
C++ signature :
unsigned int atoms_size(iotbx::pdb::hierarchy::chain {lvalue})
conformers((chain)arg1) → object :
C++ signature :
boost::python::api::object conformers(iotbx::pdb::hierarchy::chain)
detached_copy((chain)arg1) → chain :
C++ signature :
iotbx::pdb::hierarchy::chain detached_copy(iotbx::pdb::hierarchy::chain {lvalue})
find_pure_altloc_ranges((chain)arg1[, (str)common_residue_name_class_only=None]) → tiny_size_t_2 :
C++ signature :
scitbx::af::shared<scitbx::af::tiny<unsigned long, 2ul> > find_pure_altloc_ranges(iotbx::pdb::hierarchy::chain {lvalue} [,char const*=None])
find_residue_group_index((chain)arg1, (residue_group)residue_group[, (bool)must_be_present=False]) → int :
C++ signature :
long find_residue_group_index(iotbx::pdb::hierarchy::chain {lvalue},iotbx::pdb::hierarchy::residue_group [,bool=False])
get_residue_ids(skip_insertions=False, pad=True, pad_at_start=True)
get_residue_names_and_classes()

Extract the residue names and counts of each residue type (protein, nucleic acid, etc) within the chain.

Returns:a tuple containing a list of residue names, and a dictionary of residue type frequencies.
get_residue_names_padded(skip_insertions=False, pad=True, pad_at_start=True)
id
insert_residue_group((chain)arg1, (int)i, (residue_group)residue_group) → None :
C++ signature :
void insert_residue_group(iotbx::pdb::hierarchy::chain {lvalue},long,iotbx::pdb::hierarchy::residue_group {lvalue})
is_identical_hierarchy((chain)arg1, (chain)other) → bool :
C++ signature :
bool is_identical_hierarchy(iotbx::pdb::hierarchy::chain {lvalue},iotbx::pdb::hierarchy::chain)
is_na(min_content=0.8, ignore_water=True)

Determine whether the chain represents a nucleic acid polymer, based on the frequency of base names.

is_protein(min_content=0.8, ignore_water=True)

Determine whether the chain represents an amino acid polymer, based on the frequency of residue names.

is_similar_hierarchy((chain)arg1, (chain)other) → bool :
C++ signature :
bool is_similar_hierarchy(iotbx::pdb::hierarchy::chain {lvalue},iotbx::pdb::hierarchy::chain)
memory_id((chain)arg1) → int :
C++ signature :
unsigned long memory_id(iotbx::pdb::hierarchy::chain {lvalue})
merge_disconnected_residue_groups_with_pure_altloc((chain)arg1) → size_t :
C++ signature :
scitbx::af::shared<unsigned long> merge_disconnected_residue_groups_with_pure_altloc(iotbx::pdb::hierarchy::chain {lvalue})
merge_residue_groups((chain)arg1, (residue_group)primary, (residue_group)secondary) → None :
C++ signature :
void merge_residue_groups(iotbx::pdb::hierarchy::chain {lvalue},iotbx::pdb::hierarchy::residue_group {lvalue},iotbx::pdb::hierarchy::residue_group {lvalue})
occupancy_groups_simple(common_residue_name_class_only=None, always_group_adjacent=True)
only_atom()
only_atom_group()
only_conformer()
only_residue()
only_residue_group()
parent((chain)arg1[, (bool)optional=True]) → object :
C++ signature :
boost::python::api::object parent(iotbx::pdb::hierarchy::chain [,bool=True])
pre_allocate_residue_groups((chain)arg1, (int)number_of_additional_residue_groups) → None :
C++ signature :
void pre_allocate_residue_groups(iotbx::pdb::hierarchy::chain {lvalue},unsigned int)
remove_residue_group((chain)arg1, (int)i) → None :
C++ signature :
void remove_residue_group(iotbx::pdb::hierarchy::chain {lvalue},long)

remove_residue_group( (chain)arg1, (residue_group)residue_group) -> None :

C++ signature :
void remove_residue_group(iotbx::pdb::hierarchy::chain {lvalue},iotbx::pdb::hierarchy::residue_group {lvalue})
residue_groups((chain)arg1) → list :
C++ signature :
boost::python::list residue_groups(iotbx::pdb::hierarchy::chain)
residue_groups_size((chain)arg1) → int :
C++ signature :
unsigned int residue_groups_size(iotbx::pdb::hierarchy::chain {lvalue})
residues()
class iotbx.pdb.hierarchy.residue_group((object)arg1, (chain)parent[, (str)resseq=''[, (str)icode=''[, (bool)link_to_previous=True]]])

Bases: Boost.Python.instance

Attributes

icode
link_to_previous
resseq

Methods

append_atom_group
atom_groups
atom_groups_size
atoms
atoms_size
conformers
detached_copy
edit_blank_altloc
find_atom_group_index
have_conformers
id_str
insert_atom_group
is_identical_hierarchy
is_similar_hierarchy
memory_id
merge_atom_groups
move_blank_altloc_atom_groups_to_front
only_atom
only_atom_group
parent
pre_allocate_atom_groups
remove_atom_group
resid
resseq_as_int
unique_resnames
append_atom_group((residue_group)arg1, (atom_group)atom_group) → None :
C++ signature :
void append_atom_group(iotbx::pdb::hierarchy::residue_group {lvalue},iotbx::pdb::hierarchy::atom_group {lvalue})
atom_groups((residue_group)arg1) → list :
C++ signature :
boost::python::list atom_groups(iotbx::pdb::hierarchy::residue_group)
atom_groups_size((residue_group)arg1) → int :
C++ signature :
unsigned int atom_groups_size(iotbx::pdb::hierarchy::residue_group {lvalue})
atoms((residue_group)arg1[, (int)interleaved_conf=0]) → af_shared_atom :
C++ signature :
scitbx::af::shared<iotbx::pdb::hierarchy::atom> atoms(iotbx::pdb::hierarchy::residue_group {lvalue} [,int=0])
atoms_size((residue_group)arg1) → int :
C++ signature :
unsigned int atoms_size(iotbx::pdb::hierarchy::residue_group {lvalue})
conformers((residue_group)arg1) → object :
C++ signature :
boost::python::api::object conformers(iotbx::pdb::hierarchy::residue_group)
detached_copy((residue_group)arg1) → residue_group :
C++ signature :
iotbx::pdb::hierarchy::residue_group detached_copy(iotbx::pdb::hierarchy::residue_group {lvalue})
edit_blank_altloc((residue_group)arg1) → tuple :
C++ signature :
scitbx::af::tiny<unsigned int, 2ul> edit_blank_altloc(iotbx::pdb::hierarchy::residue_group {lvalue})
find_atom_group_index((residue_group)arg1, (atom_group)atom_group[, (bool)must_be_present=False]) → int :
C++ signature :
long find_atom_group_index(iotbx::pdb::hierarchy::residue_group {lvalue},iotbx::pdb::hierarchy::atom_group [,bool=False])
have_conformers((residue_group)arg1) → bool :
C++ signature :
bool have_conformers(iotbx::pdb::hierarchy::residue_group {lvalue})
icode
id_str()
insert_atom_group((residue_group)arg1, (int)i, (atom_group)atom_group) → None :
C++ signature :
void insert_atom_group(iotbx::pdb::hierarchy::residue_group {lvalue},long,iotbx::pdb::hierarchy::atom_group {lvalue})
is_identical_hierarchy((residue_group)arg1, (residue_group)other) → bool :
C++ signature :
bool is_identical_hierarchy(iotbx::pdb::hierarchy::residue_group {lvalue},iotbx::pdb::hierarchy::residue_group)
is_similar_hierarchy((residue_group)arg1, (residue_group)other) → bool :
C++ signature :
bool is_similar_hierarchy(iotbx::pdb::hierarchy::residue_group {lvalue},iotbx::pdb::hierarchy::residue_group)
memory_id((residue_group)arg1) → int :
C++ signature :
unsigned long memory_id(iotbx::pdb::hierarchy::residue_group {lvalue})
merge_atom_groups((residue_group)arg1, (atom_group)primary, (atom_group)secondary) → None :
C++ signature :
void merge_atom_groups(iotbx::pdb::hierarchy::residue_group {lvalue},iotbx::pdb::hierarchy::atom_group {lvalue},iotbx::pdb::hierarchy::atom_group {lvalue})
move_blank_altloc_atom_groups_to_front((residue_group)arg1) → int :
C++ signature :
unsigned int move_blank_altloc_atom_groups_to_front(iotbx::pdb::hierarchy::residue_group {lvalue})
only_atom()
only_atom_group()
parent((residue_group)arg1[, (bool)optional=True]) → object :
C++ signature :
boost::python::api::object parent(iotbx::pdb::hierarchy::residue_group [,bool=True])
pre_allocate_atom_groups((residue_group)arg1, (int)number_of_additional_atom_groups) → None :
C++ signature :
void pre_allocate_atom_groups(iotbx::pdb::hierarchy::residue_group {lvalue},unsigned int)
remove_atom_group((residue_group)arg1, (int)i) → None :
C++ signature :
void remove_atom_group(iotbx::pdb::hierarchy::residue_group {lvalue},long)

remove_atom_group( (residue_group)arg1, (atom_group)atom_group) -> None :

C++ signature :
void remove_atom_group(iotbx::pdb::hierarchy::residue_group {lvalue},iotbx::pdb::hierarchy::atom_group {lvalue})
resid((residue_group)arg1) → str :
C++ signature :
std::string resid(iotbx::pdb::hierarchy::residue_group {lvalue})
resseq
resseq_as_int((residue_group)arg1) → int :
C++ signature :
int resseq_as_int(iotbx::pdb::hierarchy::residue_group {lvalue})
unique_resnames((residue_group)arg1) → std_string :
C++ signature :
scitbx::af::shared<std::string> unique_resnames(iotbx::pdb::hierarchy::residue_group {lvalue})
class iotbx.pdb.hierarchy.atom_group((object)arg1, (residue_group)parent[, (str)altloc=''[, (str)resname='']])

Bases: Boost.Python.instance

Attributes

altloc
resname

Methods

append_atom
append_atom_with_other_parent
atoms
atoms_size
confid
detached_copy
find_atom_index
get_atom
id_str
insert_atom
memory_id
occupancy
only_atom
parent
pre_allocate_atoms
remove_atom
altloc
append_atom((atom_group)arg1, (atom)atom) → None :
C++ signature :
void append_atom(iotbx::pdb::hierarchy::atom_group {lvalue},iotbx::pdb::hierarchy::atom {lvalue})
append_atom_with_other_parent((atom_group)arg1, (atom)atom) → None :
C++ signature :
void append_atom_with_other_parent(iotbx::pdb::hierarchy::atom_group {lvalue},iotbx::pdb::hierarchy::atom)
atoms((atom_group)arg1) → af_shared_atom :
C++ signature :
scitbx::af::shared<iotbx::pdb::hierarchy::atom> atoms(iotbx::pdb::hierarchy::atom_group)
atoms_size((atom_group)arg1) → int :
C++ signature :
unsigned int atoms_size(iotbx::pdb::hierarchy::atom_group {lvalue})
confid((atom_group)arg1) → str :
C++ signature :
std::string confid(iotbx::pdb::hierarchy::atom_group {lvalue})
detached_copy((atom_group)arg1) → atom_group :
C++ signature :
iotbx::pdb::hierarchy::atom_group detached_copy(iotbx::pdb::hierarchy::atom_group {lvalue})
find_atom_index((atom_group)arg1, (atom)atom[, (bool)must_be_present=False]) → int :
C++ signature :
long find_atom_index(iotbx::pdb::hierarchy::atom_group {lvalue},iotbx::pdb::hierarchy::atom [,bool=False])
get_atom(name)

Extract the child atom with the given (unaligned) name.

Parameters:name – atom name, explicit case but no spaces.
Returns:atom object if found, otherwise None
id_str(suppress_segid=None)
insert_atom((atom_group)arg1, (int)i, (atom)atom) → None :
C++ signature :
void insert_atom(iotbx::pdb::hierarchy::atom_group {lvalue},long,iotbx::pdb::hierarchy::atom {lvalue})
memory_id((atom_group)arg1) → int :
C++ signature :
unsigned long memory_id(iotbx::pdb::hierarchy::atom_group {lvalue})
occupancy(raise_error_if_non_uniform=False)

Calculate the mean occupancy for atoms in this group, with option of raising ValueError if they differ.

only_atom()
parent((atom_group)arg1[, (bool)optional=True]) → object :
C++ signature :
boost::python::api::object parent(iotbx::pdb::hierarchy::atom_group [,bool=True])
pre_allocate_atoms((atom_group)arg1, (int)number_of_additional_atoms) → None :
C++ signature :
void pre_allocate_atoms(iotbx::pdb::hierarchy::atom_group {lvalue},unsigned int)
remove_atom((atom_group)arg1, (int)i) → None :
C++ signature :
void remove_atom(iotbx::pdb::hierarchy::atom_group {lvalue},long)

remove_atom( (atom_group)arg1, (atom)atom) -> None :

C++ signature :
void remove_atom(iotbx::pdb::hierarchy::atom_group {lvalue},iotbx::pdb::hierarchy::atom {lvalue})
resname
class iotbx.pdb.hierarchy.atom((object)arg1)

Bases: Boost.Python.instance

The basic unit of the PDB hierarchy (or the PDB input object in general), representing a single point scatterer corresponding to an ATOM or HETATM record in PDB format (plus associated ANISOU or related records if present). Note that this does not directly store attributes of higher-level entities whose identity is also recorded in ATOM records, such as the chain ID or residue name. These may be retrieved either by walking up the hierarchy starting with atom.parent(), or by calling atom.fetch_labels().

Attributes

b
charge
element
fdp
fp
hetero
i_seq
name
occ
segid
serial
sigb
sigocc
sigxyz
tmp
uij
xyz

Methods

angle
chain
charge_as_int
charge_tidy
data_offsets
detached_copy
determine_chemical_element_simple
distance
element_is_hydrogen
fetch_labels
format_anisou_record
format_atom_record
format_atom_record_group
format_sigatm_record
format_siguij_record
has_siguij
id_str
is_in_same_conformer_as
memory_id
parent
pdb_element_charge_columns
pdb_label_columns
quote
serial_as_int
set_b
set_charge
set_chemical_element_simple_if_necessary
set_element
set_element_and_charge_from_scattering_type_if_necessary
set_fdp
set_fp
set_hetero
set_name
set_occ
set_segid
set_serial
set_sigb
set_sigocc
set_sigxyz
set_uij
set_xyz
siguij_erase
siguij_is_defined
sizeof_data
uij_erase
uij_is_defined
angle((atom)arg1, (object)atom_1_xyz, (object)atom_3_xyz[, (bool)deg=False]) → object :
C++ signature :
boost::optional<double> angle(iotbx::pdb::hierarchy::atom {lvalue},scitbx::vec3<double>,scitbx::vec3<double> [,bool=False])

angle( (atom)arg1, (atom)atom_1, (atom)atom_3 [, (bool)deg=False]) -> object :

C++ signature :
boost::optional<double> angle(iotbx::pdb::hierarchy::atom {lvalue},iotbx::pdb::hierarchy::atom,iotbx::pdb::hierarchy::atom [,bool=False])
b
chain()

Convenience method for fetching the chain object associated with this atom (or None of not defined).

charge
charge_as_int()

Extract the atomic charge from the (string) charge field.

Returns:Python int, defaulting to zero
charge_tidy((atom)arg1[, (bool)strip=False]) → object :
C++ signature :
boost::optional<std::string> charge_tidy(iotbx::pdb::hierarchy::atom {lvalue} [,bool=False])
data_offsets() → dict :
C++ signature :
boost::python::dict data_offsets()
detached_copy((atom)arg1) → atom :
C++ signature :
iotbx::pdb::hierarchy::atom detached_copy(iotbx::pdb::hierarchy::atom {lvalue})
determine_chemical_element_simple((atom)arg1) → object :
C++ signature :
boost::optional<std::string> determine_chemical_element_simple(iotbx::pdb::hierarchy::atom {lvalue})
distance((atom)arg1, (object)other_xyz) → float :
C++ signature :
double distance(iotbx::pdb::hierarchy::atom {lvalue},scitbx::vec3<double>)

distance( (atom)arg1, (atom)other) -> float :

C++ signature :
double distance(iotbx::pdb::hierarchy::atom {lvalue},iotbx::pdb::hierarchy::atom)
element
element_is_hydrogen((atom)arg1) → bool :
C++ signature :
bool element_is_hydrogen(iotbx::pdb::hierarchy::atom {lvalue})
fdp
fetch_labels((atom)arg1) → atom_with_labels :
C++ signature :
iotbx::pdb::hierarchy::atom_with_labels fetch_labels(iotbx::pdb::hierarchy::atom {lvalue})
format_anisou_record((atom)arg1) → object :
C++ signature :
boost::python::api::object format_anisou_record(iotbx::pdb::hierarchy::atom)
format_atom_record((atom)self[, (str)replace_floats_with=None]) → object :
C++ signature :
boost::python::api::object format_atom_record(iotbx::pdb::hierarchy::atom [,char const*=None])
format_atom_record_group((atom)self[, (bool)atom_hetatm=True[, (bool)sigatm=True[, (bool)anisou=True[, (bool)siguij=True]]]]) → object :
C++ signature :
boost::python::api::object format_atom_record_group(iotbx::pdb::hierarchy::atom [,bool=True [,bool=True [,bool=True [,bool=True]]]])
format_sigatm_record((atom)arg1) → object :
C++ signature :
boost::python::api::object format_sigatm_record(iotbx::pdb::hierarchy::atom)
format_siguij_record((atom)arg1) → object :
C++ signature :
boost::python::api::object format_siguij_record(iotbx::pdb::hierarchy::atom)
fp
has_siguij() → bool :
C++ signature :
bool has_siguij()
hetero
i_seq
id_str((atom)arg1[, (bool)pdbres=False[, (bool)suppress_segid=False]]) → str :
C++ signature :
std::string id_str(iotbx::pdb::hierarchy::atom {lvalue} [,bool=False [,bool=False]])
is_in_same_conformer_as(other)

Indicate whether two atoms are part of the same conformer and thus are capable of interacting directly, as defined by the parent atom_group and model object(s).

memory_id((atom)arg1) → int :
C++ signature :
unsigned long memory_id(iotbx::pdb::hierarchy::atom {lvalue})
name
occ
parent((atom)arg1[, (bool)optional=True]) → object :
C++ signature :
boost::python::api::object parent(iotbx::pdb::hierarchy::atom [,bool=True])
pdb_element_charge_columns((atom)arg1) → str :
C++ signature :
std::string pdb_element_charge_columns(iotbx::pdb::hierarchy::atom {lvalue})
pdb_label_columns((atom)arg1) → str :
C++ signature :
std::string pdb_label_columns(iotbx::pdb::hierarchy::atom {lvalue})
quote((atom)arg1[, (bool)full=False]) → str :
C++ signature :
std::string quote(iotbx::pdb::hierarchy::atom {lvalue} [,bool=False])
segid
serial
serial_as_int((atom)arg1) → int :
C++ signature :
int serial_as_int(iotbx::pdb::hierarchy::atom {lvalue})
set_b((atom)arg1, (float)new_b) → atom :
C++ signature :
iotbx::pdb::hierarchy::atom set_b(iotbx::pdb::hierarchy::atom,double)
set_charge((atom)arg1, (str)new_charge) → atom :
C++ signature :
iotbx::pdb::hierarchy::atom {lvalue} set_charge(iotbx::pdb::hierarchy::atom {lvalue},char const*)
set_chemical_element_simple_if_necessary((atom)arg1[, (bool)tidy_existing=True]) → bool :
C++ signature :
bool set_chemical_element_simple_if_necessary(iotbx::pdb::hierarchy::atom {lvalue} [,bool=True])
set_element((atom)arg1, (str)new_element) → atom :
C++ signature :
iotbx::pdb::hierarchy::atom {lvalue} set_element(iotbx::pdb::hierarchy::atom {lvalue},char const*)
set_element_and_charge_from_scattering_type_if_necessary(scattering_type)
set_fdp((atom)arg1, (float)new_fdp) → atom :
C++ signature :
iotbx::pdb::hierarchy::atom set_fdp(iotbx::pdb::hierarchy::atom,double)
set_fp((atom)arg1, (float)new_fp) → atom :
C++ signature :
iotbx::pdb::hierarchy::atom set_fp(iotbx::pdb::hierarchy::atom,double)
set_hetero((atom)arg1, (bool)new_hetero) → atom :
C++ signature :
iotbx::pdb::hierarchy::atom set_hetero(iotbx::pdb::hierarchy::atom,bool)
set_name((atom)arg1, (str)new_name) → atom :
C++ signature :
iotbx::pdb::hierarchy::atom {lvalue} set_name(iotbx::pdb::hierarchy::atom {lvalue},char const*)
set_occ((atom)arg1, (float)new_occ) → atom :
C++ signature :
iotbx::pdb::hierarchy::atom set_occ(iotbx::pdb::hierarchy::atom,double)
set_segid((atom)arg1, (str)new_segid) → atom :
C++ signature :
iotbx::pdb::hierarchy::atom {lvalue} set_segid(iotbx::pdb::hierarchy::atom {lvalue},char const*)
set_serial((atom)arg1, (object)new_serial) → atom :
C++ signature :
iotbx::pdb::hierarchy::atom {lvalue} set_serial(iotbx::pdb::hierarchy::atom {lvalue},boost::python::api::object)
set_sigb((atom)arg1, (float)new_sigb) → atom :
C++ signature :
iotbx::pdb::hierarchy::atom set_sigb(iotbx::pdb::hierarchy::atom,double)
set_sigocc((atom)arg1, (float)new_sigocc) → atom :
C++ signature :
iotbx::pdb::hierarchy::atom set_sigocc(iotbx::pdb::hierarchy::atom,double)
set_sigxyz((atom)arg1, (object)new_sigxyz) → atom :
C++ signature :
iotbx::pdb::hierarchy::atom set_sigxyz(iotbx::pdb::hierarchy::atom,scitbx::vec3<double>)
set_uij((atom)arg1, (object)new_uij) → atom :
C++ signature :
iotbx::pdb::hierarchy::atom set_uij(iotbx::pdb::hierarchy::atom,scitbx::sym_mat3<double>)
set_xyz((atom)arg1, (object)new_xyz) → atom :
C++ signature :
iotbx::pdb::hierarchy::atom set_xyz(iotbx::pdb::hierarchy::atom,scitbx::vec3<double>)
sigb
sigocc
siguij_erase((atom)arg1) → None :
C++ signature :
void siguij_erase(iotbx::pdb::hierarchy::atom {lvalue})
siguij_is_defined((atom)arg1) → bool :
C++ signature :
bool siguij_is_defined(iotbx::pdb::hierarchy::atom {lvalue})
sigxyz
sizeof_data() → int :
C++ signature :
unsigned long sizeof_data()
tmp
uij
uij_erase((atom)arg1) → None :
C++ signature :
void uij_erase(iotbx::pdb::hierarchy::atom {lvalue})
uij_is_defined((atom)arg1) → bool :
C++ signature :
bool uij_is_defined(iotbx::pdb::hierarchy::atom {lvalue})
xyz
class iotbx.pdb.hierarchy.atom_with_labels((object)arg1)

Bases: iotbx_pdb_hierarchy_ext.atom

Stand-in for atom object, which explicitly records the attributes normally reserved for parent classes such as residue name, chain ID, etc.

Attributes

altloc
b
chain_id
charge
element
fdp
fp
hetero
i_seq
icode
is_first_after_break
is_first_in_chain
model_id
name
occ
resname
resseq
segid
serial
sigb
sigocc
sigxyz
tmp
uij
xyz

Methods

angle
chain
charge_as_int
charge_tidy
data_offsets
detached_copy
determine_chemical_element_simple
distance
element_is_hydrogen
fetch_labels
format_anisou_record
format_atom_record
format_atom_record_group
format_sigatm_record
format_siguij_record
has_siguij
id_str
is_in_same_conformer_as
memory_id
parent
pdb_element_charge_columns
pdb_label_columns
quote
resid
resseq_as_int
serial_as_int
set_b
set_charge
set_chemical_element_simple_if_necessary
set_element
set_element_and_charge_from_scattering_type_if_necessary
set_fdp
set_fp
set_hetero
set_name
set_occ
set_segid
set_serial
set_sigb
set_sigocc
set_sigxyz
set_uij
set_xyz
siguij_erase
siguij_is_defined
sizeof_data
uij_erase
uij_is_defined
altloc
chain_id
detached_copy((atom_with_labels)arg1) → atom_with_labels :
C++ signature :
iotbx::pdb::hierarchy::atom_with_labels detached_copy(iotbx::pdb::hierarchy::atom_with_labels {lvalue})
fetch_labels()
format_anisou_record((atom_with_labels)arg1) → str :
C++ signature :
std::string format_anisou_record(iotbx::pdb::hierarchy::atom_with_labels {lvalue})
format_atom_record((atom_with_labels)arg1[, (str)replace_floats_with=None]) → str :
C++ signature :
std::string format_atom_record(iotbx::pdb::hierarchy::atom_with_labels {lvalue} [,char const*=None])
format_atom_record_group((atom_with_labels)arg1[, (bool)atom_hetatm=True[, (bool)sigatm=True[, (bool)anisou=True[, (bool)siguij=True]]]]) → str :
C++ signature :
std::string format_atom_record_group(iotbx::pdb::hierarchy::atom_with_labels {lvalue} [,bool=True [,bool=True [,bool=True [,bool=True]]]])
format_sigatm_record((atom_with_labels)arg1) → str :
C++ signature :
std::string format_sigatm_record(iotbx::pdb::hierarchy::atom_with_labels {lvalue})
format_siguij_record((atom_with_labels)arg1) → str :
C++ signature :
std::string format_siguij_record(iotbx::pdb::hierarchy::atom_with_labels {lvalue})
icode
id_str((atom_with_labels)arg1[, (bool)pdbres=False[, (bool)suppress_segid=False]]) → str :
C++ signature :
std::string id_str(iotbx::pdb::hierarchy::atom_with_labels {lvalue} [,bool=False [,bool=False]])
is_first_after_break
is_first_in_chain
model_id
quote((atom_with_labels)arg1[, (bool)full=False]) → str :
C++ signature :
std::string quote(iotbx::pdb::hierarchy::atom_with_labels {lvalue} [,bool=False])
resid((atom_with_labels)arg1) → str :
C++ signature :
std::string resid(iotbx::pdb::hierarchy::atom_with_labels {lvalue})
resname
resseq
resseq_as_int((atom_with_labels)arg1) → int :
C++ signature :
int resseq_as_int(iotbx::pdb::hierarchy::atom_with_labels {lvalue})
serial_as_int((atom_with_labels)arg1) → int :
C++ signature :
int serial_as_int(iotbx::pdb::hierarchy::atom_with_labels {lvalue})
class iotbx.pdb.hierarchy.conformer((object)arg1, (chain)parent, (str)altloc)

Bases: Boost.Python.instance

Alternate view into a chain object, grouping sequential residues with equivalent altlocs. As a general rule it is preferrable to iterate over chain.residue_groups() instead.

Attributes

altloc

Methods

as_padded_sequence
as_sec_str_sequence
as_sequence
atoms
atoms_size
format_fasta
get_residue_ids
get_residue_names_and_classes
get_residue_names_padded
is_na
is_protein
memory_id
only_atom
only_residue
parent
residues
residues_size
altloc
as_padded_sequence(missing_char='X', skip_insertions=False, pad=True, substitute_unknown='X', pad_at_start=True)
as_sec_str_sequence(helix_sele, sheet_sele, missing_char='X', pad=True, pad_at_start=True)
as_sequence(substitute_unknown='X')
atoms((conformer)arg1) → af_shared_atom :
C++ signature :
scitbx::af::shared<iotbx::pdb::hierarchy::atom> atoms(iotbx::pdb::hierarchy::conformer {lvalue})
atoms_size((conformer)arg1) → int :
C++ signature :
unsigned int atoms_size(iotbx::pdb::hierarchy::conformer {lvalue})
format_fasta(max_line_length=79)
get_residue_ids(skip_insertions=False, pad=True, pad_at_start=True)
get_residue_names_and_classes()
get_residue_names_padded(skip_insertions=False, pad=True, pad_at_start=True)
is_na(min_content=0.8)
is_protein(min_content=0.8)
memory_id((conformer)arg1) → int :
C++ signature :
unsigned long memory_id(iotbx::pdb::hierarchy::conformer {lvalue})
only_atom()
only_residue()
parent((conformer)arg1[, (bool)optional=True]) → object :
C++ signature :
boost::python::api::object parent(iotbx::pdb::hierarchy::conformer [,bool=True])
residues((conformer)arg1) → list :
C++ signature :
boost::python::list residues(iotbx::pdb::hierarchy::conformer)
residues_size((conformer)arg1) → int :
C++ signature :
unsigned int residues_size(iotbx::pdb::hierarchy::conformer {lvalue})
class iotbx.pdb.hierarchy.residue((object)arg1, (root)root)

Bases: Boost.Python.instance

Attributes

icode
is_pure_main_conf
link_to_previous
resname
resseq

Methods

atoms
atoms_size
find_atom_by
id_str
memory_id
only_atom
parent
resid
residue_name_plus_atom_names_interpreter
resseq_as_int
root
standalone_copy
atoms((residue)arg1) → af_shared_atom :
C++ signature :
scitbx::af::shared<iotbx::pdb::hierarchy::atom> atoms(iotbx::pdb::hierarchy::residue)
atoms_size((residue)arg1) → int :
C++ signature :
unsigned int atoms_size(iotbx::pdb::hierarchy::residue {lvalue})
find_atom_by((residue)arg1, (str)name) → atom :
C++ signature :
boost::optional<iotbx::pdb::hierarchy::atom> find_atom_by(iotbx::pdb::hierarchy::residue {lvalue},char const*)
icode
id_str((residue)arg1[, (int)suppress_segid=0]) → str :
C++ signature :
std::string id_str(iotbx::pdb::hierarchy::residue {lvalue} [,int=0])
is_pure_main_conf
memory_id((residue)arg1) → int :
C++ signature :
unsigned long memory_id(iotbx::pdb::hierarchy::residue {lvalue})
only_atom()
parent((residue)arg1[, (bool)optional=True]) → object :
C++ signature :
boost::python::api::object parent(iotbx::pdb::hierarchy::residue [,bool=True])
resid((residue)arg1) → str :
C++ signature :
std::string resid(iotbx::pdb::hierarchy::residue {lvalue})
residue_name_plus_atom_names_interpreter(translate_cns_dna_rna_residue_names=None, return_mon_lib_dna_name=False)
resname
resseq
resseq_as_int((residue)arg1) → int :
C++ signature :
int resseq_as_int(iotbx::pdb::hierarchy::residue {lvalue})
root((residue)arg1) → object :
C++ signature :
boost::python::api::object root(iotbx::pdb::hierarchy::residue)
standalone_copy()
class iotbx.pdb.hierarchy.af_shared_atom((object)arg1)

Bases: Boost.Python.instance

Methods

append
build_dict
clear
deep_copy
extend
extract_b
extract_element
extract_fdp
extract_fp
extract_hetero
extract_i_seq
extract_name
extract_occ
extract_segid
extract_serial
extract_sigb
extract_sigocc
extract_sigxyz
extract_tmp_as_size_t
extract_uij
extract_xyz
insert
reserve
reset_i_seq
reset_serial
reset_tmp
reset_tmp_for_occupancy_groups_simple
select This module supports asynchronous I/O on multiple file descriptors.
set_adps_from_scatterers
set_b
set_chemical_element_simple_if_necessary
set_fdp
set_fp
set_occ
set_sigb
set_sigocc
set_sigxyz
set_uij
set_xyz
size
append((af_shared_atom)arg1, (atom)arg2) → None :
C++ signature :
void append(scitbx::af::shared<iotbx::pdb::hierarchy::atom> {lvalue},iotbx::pdb::hierarchy::atom)
build_dict((af_shared_atom)arg1[, (bool)strip_names=False[, (bool)upper_names=False[, (bool)convert_stars_to_primes=False[, (bool)throw_runtime_error_if_duplicate_keys=True]]]]) → dict :
C++ signature :
boost::python::dict build_dict(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor> [,bool=False [,bool=False [,bool=False [,bool=True]]]])
clear((af_shared_atom)arg1) → None :
C++ signature :
void clear(scitbx::af::shared<iotbx::pdb::hierarchy::atom> {lvalue})
deep_copy((af_shared_atom)arg1) → af_shared_atom :
C++ signature :
scitbx::af::shared<iotbx::pdb::hierarchy::atom> deep_copy(scitbx::af::shared<iotbx::pdb::hierarchy::atom> {lvalue})
extend((af_shared_atom)arg1, (af_shared_atom)arg2) → None :
C++ signature :
void extend(scitbx::af::shared<iotbx::pdb::hierarchy::atom> {lvalue},scitbx::af::shared<iotbx::pdb::hierarchy::atom>)
extract_b((af_shared_atom)arg1) → double :
C++ signature :
scitbx::af::shared<double> extract_b(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>)
extract_element((af_shared_atom)arg1[, (bool)strip=False]) → std_string :
C++ signature :
scitbx::af::shared<std::string> extract_element(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor> [,bool=False])
extract_fdp((af_shared_atom)arg1) → double :
C++ signature :
scitbx::af::shared<double> extract_fdp(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>)
extract_fp((af_shared_atom)arg1) → double :
C++ signature :
scitbx::af::shared<double> extract_fp(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>)
extract_hetero((af_shared_atom)arg1) → size_t :
C++ signature :
scitbx::af::shared<unsigned long> extract_hetero(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>)
extract_i_seq((af_shared_atom)arg1) → size_t :
C++ signature :
scitbx::af::shared<unsigned long> extract_i_seq(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>)
extract_name((af_shared_atom)arg1) → std_string :
C++ signature :
scitbx::af::shared<std::string> extract_name(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>)
extract_occ((af_shared_atom)arg1) → double :
C++ signature :
scitbx::af::shared<double> extract_occ(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>)
extract_segid((af_shared_atom)arg1) → std_string :
C++ signature :
scitbx::af::shared<std::string> extract_segid(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>)
extract_serial((af_shared_atom)arg1) → std_string :
C++ signature :
scitbx::af::shared<std::string> extract_serial(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>)
extract_sigb((af_shared_atom)arg1) → double :
C++ signature :
scitbx::af::shared<double> extract_sigb(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>)
extract_sigocc((af_shared_atom)arg1) → double :
C++ signature :
scitbx::af::shared<double> extract_sigocc(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>)
extract_sigxyz((af_shared_atom)arg1) → vec3_double :
C++ signature :
scitbx::af::shared<scitbx::vec3<double> > extract_sigxyz(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>)
extract_tmp_as_size_t((af_shared_atom)arg1) → size_t :
C++ signature :
scitbx::af::shared<unsigned long> extract_tmp_as_size_t(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>)
extract_uij((af_shared_atom)arg1) → sym_mat3_double :
C++ signature :
scitbx::af::shared<scitbx::sym_mat3<double> > extract_uij(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>)
extract_xyz((af_shared_atom)arg1) → vec3_double :
C++ signature :
scitbx::af::shared<scitbx::vec3<double> > extract_xyz(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>)
insert((af_shared_atom)arg1, (int)arg2, (atom)arg3) → None :
C++ signature :
void insert(scitbx::af::shared<iotbx::pdb::hierarchy::atom> {lvalue},long,iotbx::pdb::hierarchy::atom)
reserve((af_shared_atom)arg1, (int)arg2) → None :
C++ signature :
void reserve(scitbx::af::shared<iotbx::pdb::hierarchy::atom> {lvalue},unsigned long)
reset_i_seq((af_shared_atom)arg1) → None :
C++ signature :
void reset_i_seq(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>)
reset_serial((af_shared_atom)arg1[, (int)first_value=1]) → None :
C++ signature :
void reset_serial(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor> [,int=1])
reset_tmp((af_shared_atom)arg1[, (int)first_value=0[, (int)increment=1]]) → atom_data_tmp_sentinel :
C++ signature :
std::auto_ptr<iotbx::pdb::hierarchy::atoms::atom_tmp_sentinel> reset_tmp(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor> [,int=0 [,int=1]])
reset_tmp_for_occupancy_groups_simple((af_shared_atom)arg1) → atom_data_tmp_sentinel :
C++ signature :
std::auto_ptr<iotbx::pdb::hierarchy::atoms::atom_tmp_sentinel> reset_tmp_for_occupancy_groups_simple(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>)
select((af_shared_atom)self, (bool)flags) → af_shared_atom :
C++ signature :
scitbx::af::shared<iotbx::pdb::hierarchy::atom> select(scitbx::af::shared<iotbx::pdb::hierarchy::atom>,scitbx::af::const_ref<bool, scitbx::af::trivial_accessor>)

select( (af_shared_atom)self, (object)indices [, (bool)reverse=False]) -> af_shared_atom :

C++ signature :
scitbx::af::shared<iotbx::pdb::hierarchy::atom> select(scitbx::af::shared<iotbx::pdb::hierarchy::atom>,scitbx::af::const_ref<unsigned int, scitbx::af::trivial_accessor> [,bool=False])

select( (af_shared_atom)self, (size_t)indices [, (bool)reverse=False]) -> af_shared_atom :

C++ signature :
scitbx::af::shared<iotbx::pdb::hierarchy::atom> select(scitbx::af::shared<iotbx::pdb::hierarchy::atom>,scitbx::af::const_ref<unsigned long, scitbx::af::trivial_accessor> [,bool=False])
set_adps_from_scatterers((af_shared_atom)arg1, (xray_scatterer)scatterers, (unit_cell)unit_cell) → None :
C++ signature :
void set_adps_from_scatterers(scitbx::af::const_ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>,scitbx::af::const_ref<cctbx::xray::scatterer<double, std::string, std::string>, scitbx::af::trivial_accessor>,cctbx::uctbx::unit_cell)
set_b((af_shared_atom)arg1, (object)new_b) → af_shared_atom :
C++ signature :
scitbx::af::ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor> set_b(scitbx::af::ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>,scitbx::af::const_ref<double, scitbx::af::trivial_accessor>)
set_chemical_element_simple_if_necessary((af_shared_atom)arg1[, (bool)tidy_existing=True]) → int :
C++ signature :
unsigned long set_chemical_element_simple_if_necessary(scitbx::af::ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor> [,bool=True])
set_fdp((af_shared_atom)arg1, (object)new_fdp) → af_shared_atom :
C++ signature :
scitbx::af::ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor> set_fdp(scitbx::af::ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>,scitbx::af::const_ref<double, scitbx::af::trivial_accessor>)
set_fp((af_shared_atom)arg1, (object)new_fp) → af_shared_atom :
C++ signature :
scitbx::af::ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor> set_fp(scitbx::af::ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>,scitbx::af::const_ref<double, scitbx::af::trivial_accessor>)
set_occ((af_shared_atom)arg1, (object)new_occ) → af_shared_atom :
C++ signature :
scitbx::af::ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor> set_occ(scitbx::af::ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>,scitbx::af::const_ref<double, scitbx::af::trivial_accessor>)
set_sigb((af_shared_atom)arg1, (object)new_sigb) → af_shared_atom :
C++ signature :
scitbx::af::ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor> set_sigb(scitbx::af::ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>,scitbx::af::const_ref<double, scitbx::af::trivial_accessor>)
set_sigocc((af_shared_atom)arg1, (object)new_sigocc) → af_shared_atom :
C++ signature :
scitbx::af::ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor> set_sigocc(scitbx::af::ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>,scitbx::af::const_ref<double, scitbx::af::trivial_accessor>)
set_sigxyz((af_shared_atom)arg1, (vec3_double)new_sigxyz) → af_shared_atom :
C++ signature :
scitbx::af::ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor> set_sigxyz(scitbx::af::ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>,scitbx::af::const_ref<scitbx::vec3<double>, scitbx::af::trivial_accessor>)
set_uij((af_shared_atom)arg1, (sym_mat3_double)new_uij) → af_shared_atom :
C++ signature :
scitbx::af::ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor> set_uij(scitbx::af::ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>,scitbx::af::const_ref<scitbx::sym_mat3<double>, scitbx::af::trivial_accessor>)
set_xyz((af_shared_atom)arg1, (vec3_double)new_xyz) → af_shared_atom :
C++ signature :
scitbx::af::ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor> set_xyz(scitbx::af::ref<iotbx::pdb::hierarchy::atom, scitbx::af::trivial_accessor>,scitbx::af::const_ref<scitbx::vec3<double>, scitbx::af::trivial_accessor>)
size((af_shared_atom)arg1) → int :
C++ signature :
unsigned long size(scitbx::af::shared<iotbx::pdb::hierarchy::atom> {lvalue})

Accessory classes and functions

class iotbx.pdb.hierarchy.overall_counts

Bases: object

Methods

as_str
errors
errors_and_warnings
raise_chains_with_mix_of_proper_and_improper_alt_conf_if_necessary
raise_duplicate_atom_labels_if_necessary
raise_improper_alt_conf_if_necessary
raise_residue_groups_with_multiple_resnames_using_same_altloc_if_necessary
show
show_chains_with_mix_of_proper_and_improper_alt_conf
show_consecutive_residue_groups_with_same_resid
show_duplicate_atom_labels
show_improper_alt_conf
show_residue_groups_with_multiple_resnames_using_same_altloc
warnings Python part of the warnings subsystem.
as_str(prefix='', residue_groups_max_show=10, duplicate_atom_labels_max_show=10)
errors()
errors_and_warnings()
raise_chains_with_mix_of_proper_and_improper_alt_conf_if_necessary()
raise_duplicate_atom_labels_if_necessary(max_show=10)
raise_improper_alt_conf_if_necessary()
raise_residue_groups_with_multiple_resnames_using_same_altloc_if_necessary(max_show=10)
show(out=None, prefix='', flag_errors=True, flag_warnings=True, residue_groups_max_show=10, duplicate_atom_labels_max_show=10)
show_chains_with_mix_of_proper_and_improper_alt_conf(out=None, prefix='')
show_consecutive_residue_groups_with_same_resid(out=None, prefix='', max_show=10)
show_duplicate_atom_labels(out=None, prefix='', max_show=10)
show_improper_alt_conf(out=None, prefix='')
show_residue_groups_with_multiple_resnames_using_same_altloc(out=None, prefix='', max_show=10)
warnings()