Bio.SeqIO.PdbIO module

Bio.SeqIO support for accessing sequences in PDB and mmCIF files.

Bio.SeqIO.PdbIO.AtomIterator(pdb_id, structure)

Return SeqRecords from Structure objects.

Base function for sequence parsers that read structures Bio.PDB parsers.

Once a parser from Bio.PDB has been used to load a structure into a Bio.PDB.Structure.Structure object, there is no difference in how the sequence parser interprets the residue sequence. The functions in this module may be used by SeqIO modules wishing to parse sequences from lists of residues.

Calling functions must pass a Bio.PDB.Structure.Structure object.

See Bio.SeqIO.PdbIO.PdbAtomIterator and Bio.SeqIO.PdbIO.CifAtomIterator for details.

class Bio.SeqIO.PdbIO.PdbSeqresIterator(source)

Bases: Bio.SeqIO.Interfaces.SequenceIterator

Parser for PDB files.

__init__(source)

Return SeqRecord objects for each chain in a PDB file.

Arguments:
  • source - input stream opened in text mode, or a path to a file

The sequences are derived from the SEQRES lines in the PDB file header, not the atoms of the 3D structure.

Specifically, these PDB records are handled: DBREF, DBREF1, DBREF2, SEQADV, SEQRES, MODRES

See: http://www.wwpdb.org/documentation/format23/sect3.html

This gets called internally via Bio.SeqIO for the SEQRES based interpretation of the PDB file format:

>>> from Bio import SeqIO
>>> for record in SeqIO.parse("PDB/1A8O.pdb", "pdb-seqres"):
...     print("Record id %s, chain %s" % (record.id, record.annotations["chain"]))
...     print(record.dbxrefs)
...
Record id 1A8O:A, chain A
['UNP:P12497', 'UNP:POL_HV1N5']

Equivalently,

>>> with open("PDB/1A8O.pdb") as handle:
...     for record in PdbSeqresIterator(handle):
...         print("Record id %s, chain %s" % (record.id, record.annotations["chain"]))
...         print(record.dbxrefs)
...
Record id 1A8O:A, chain A
['UNP:P12497', 'UNP:POL_HV1N5']

Note the chain is recorded in the annotations dictionary, and any PDB DBREF lines are recorded in the database cross-references list.

parse(handle)

Start parsing the file, and return a SeqRecord generator.

iterate(handle)

Iterate over the records in the PDB file.

__abstractmethods__ = frozenset({})
Bio.SeqIO.PdbIO.PdbAtomIterator(source)

Return SeqRecord objects for each chain in a PDB file.

Argument source is a file-like object or a path to a file.

The sequences are derived from the 3D structure (ATOM records), not the SEQRES lines in the PDB file header.

Unrecognised three letter amino acid codes (e.g. “CSD”) from HETATM entries are converted to “X” in the sequence.

In addition to information from the PDB header (which is the same for all records), the following chain specific information is placed in the annotation:

record.annotations[“residues”] = List of residue ID strings record.annotations[“chain”] = Chain ID (typically A, B ,…) record.annotations[“model”] = Model ID (typically zero)

Where amino acids are missing from the structure, as indicated by residue numbering, the sequence is filled in with ‘X’ characters to match the size of the missing region, and None is included as the corresponding entry in the list record.annotations[“residues”].

This function uses the Bio.PDB module to do most of the hard work. The annotation information could be improved but this extra parsing should be done in parse_pdb_header, not this module.

This gets called internally via Bio.SeqIO for the atom based interpretation of the PDB file format:

>>> from Bio import SeqIO
>>> for record in SeqIO.parse("PDB/1A8O.pdb", "pdb-atom"):
...     print("Record id %s, chain %s" % (record.id, record.annotations["chain"]))
...
Record id 1A8O:A, chain A

Equivalently,

>>> with open("PDB/1A8O.pdb") as handle:
...     for record in PdbAtomIterator(handle):
...         print("Record id %s, chain %s" % (record.id, record.annotations["chain"]))
...
Record id 1A8O:A, chain A
Bio.SeqIO.PdbIO.CifSeqresIterator(source)

Return SeqRecord objects for each chain in an mmCIF file.

Argument source is a file-like object or a path to a file.

The sequences are derived from the _entity_poly_seq entries in the mmCIF file, not the atoms of the 3D structure.

Specifically, these mmCIF records are handled: _pdbx_poly_seq_scheme and _struct_ref_seq. The _pdbx_poly_seq records contain sequence information, and the _struct_ref_seq records contain database cross-references.

See: http://mmcif.wwpdb.org/dictionaries/mmcif_pdbx_v40.dic/Categories/pdbx_poly_seq_scheme.html and http://mmcif.wwpdb.org/dictionaries/mmcif_pdbx_v50.dic/Categories/struct_ref_seq.html

This gets called internally via Bio.SeqIO for the sequence-based interpretation of the mmCIF file format:

>>> from Bio import SeqIO
>>> for record in SeqIO.parse("PDB/1A8O.cif", "cif-seqres"):
...     print("Record id %s, chain %s" % (record.id, record.annotations["chain"]))
...     print(record.dbxrefs)
...
Record id 1A8O:A, chain A
['UNP:P12497', 'UNP:POL_HV1N5']

Equivalently,

>>> with open("PDB/1A8O.cif") as handle:
...     for record in CifSeqresIterator(handle):
...         print("Record id %s, chain %s" % (record.id, record.annotations["chain"]))
...         print(record.dbxrefs)
...
Record id 1A8O:A, chain A
['UNP:P12497', 'UNP:POL_HV1N5']

Note the chain is recorded in the annotations dictionary, and any mmCIF _struct_ref_seq entries are recorded in the database cross-references list.

Bio.SeqIO.PdbIO.CifAtomIterator(source)

Return SeqRecord objects for each chain in an mmCIF file.

Argument source is a file-like object or a path to a file.

The sequences are derived from the 3D structure (_atom_site.* fields) in the mmCIF file.

Unrecognised three letter amino acid codes (e.g. “CSD”) from HETATM entries are converted to “X” in the sequence.

In addition to information from the PDB header (which is the same for all records), the following chain specific information is placed in the annotation:

record.annotations[“residues”] = List of residue ID strings record.annotations[“chain”] = Chain ID (typically A, B ,…) record.annotations[“model”] = Model ID (typically zero)

Where amino acids are missing from the structure, as indicated by residue numbering, the sequence is filled in with ‘X’ characters to match the size of the missing region, and None is included as the corresponding entry in the list record.annotations[“residues”].

This function uses the Bio.PDB module to do most of the hard work. The annotation information could be improved but this extra parsing should be done in parse_pdb_header, not this module.

This gets called internally via Bio.SeqIO for the atom based interpretation of the PDB file format:

>>> from Bio import SeqIO
>>> for record in SeqIO.parse("PDB/1A8O.cif", "cif-atom"):
...     print("Record id %s, chain %s" % (record.id, record.annotations["chain"]))
...
Record id 1A8O:A, chain A

Equivalently,

>>> with open("PDB/1A8O.cif") as handle:
...     for record in CifAtomIterator(handle):
...         print("Record id %s, chain %s" % (record.id, record.annotations["chain"]))
...
Record id 1A8O:A, chain A