Package csb :: Package bio :: Package io :: Module wwpdb :: Class AbstractStructureParser |
[frames] | no frames]

# Class AbstractStructureParser

source code

    object --+
             |
            AbstractStructureParser

Known Subclasses:
  - RegularStructureParser
  - , LegacyStructureParser

A base PDB structure format-aware parser. Subclasses must implement the internal abstract method `_parse_header` in order to complete the implementation.

Nested Classes
| __metaclass__ Metaclass for defining Abstract Base Classes (ABCs).

Instance Methods
__del__(self) | source code
__init__(self, structure_file, check_ss=False, mapper=None) x.__init__(...) initializes x; see help(type(x)) for signature | source code
csb.core.EnumItem |
guess_chain_type(self, residue_labels) Try to guess what is the sequence type of a chunk of PDB `residue_label`s. | source code
csb.core.EnumItem |
guess_sequence_type(self, residue_label) Try to guess what is the sequence type of a PDB `residue_label`. | source code
list |
models(self) Find all available model identifiers in the structure. | source code
parse(self, filename=None, model=None) | source code
Structure |
parse_biomolecule(self, number=1, single=False) Parse and return the Structure of the biological unit (quaternary structure) as annotated by the REMARK 350 BIOMOLECULE record. | source code
Ensemble |
parse_models(self, models=`(``)`) Parse the specified models in the file and build an Ensemble. | source code
str |
parse_residue(self, residue_label, as_type=None) Try to parse a PDB `residue_label` and return its closest 'normal' string representation. | source code
str |
parse_residue_safe(self, residue_label, as_type) Same as `parse_residue`, but returns UNK/Any instead of raising UnknownPDBResidueError. | source code
Structure |
parse_structure(self, model=None) Parse and return the Structure with the specified model identifier. | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Static Methods
AbstractStructureParser |
create_parser(structure_file, check_ss=False, mapper=None) A StructureParser factory, which instantiates and returns the proper parser object based on the contents of the PDB file. | source code

Class Variables
| __abstractmethods__ = ``frozenset([``'``_parse_header``'``])``

Properties
str | filename Current input PDB file name
AbstractResidueMapper | mapper Current residue mapping strategy
Inherited from `object`: `__class__`

Method Details

### __init__(self, structure_file, check_ss=False, mapper=None) (Constructor) | source code
x.__init__(...) initializes x; see help(type(x)) for signature Parameters: `structure_file` (str) - the input PD file to parse `check_ss` (bool) - if True, secondary structure errors in the file will cause SecStructureFormatError exceptions `mapper` (AbstractResidueMapper) - residue mapper, used to align ATOM records to SEQRES. If None, use the default (CombinedResidueMapper) Raises: `IOError` - when the input file cannot be found Overrides: object.__init__ (inherited documentation)

### create_parser(structure_file, check_ss=False, mapper=None) Static Method | source code
A StructureParser factory, which instantiates and returns the proper parser object based on the contents of the PDB file. If the file contains a SEQRES section, RegularStructureParser is returned, otherwise LegacyStructureParser is instantiated. In the latter case LegacyStructureParser will read the sequence data directly from the ATOMs. Parameters: `structure_file` (str) - the PDB file to parse `check_ss` (bool) - if True, secondary structure errors in the file will cause SecStructureFormatError exceptions `mapper` (AbstractResidueMapper) - residue mapper, used to align ATOM records to SEQRES. If None, use the default (CombinedResidueMapper) Returns: AbstractStructureParser

### guess_chain_type(self, residue_labels) | source code
Try to guess what is the sequence type of a chunk of PDB `residue_label`s. The list of labels is probed starting from the middle first, because PDB chains often contain modified / unknown residues at the termini. If none of the probed residues can be used to determine chain's type, just give up and return SequenceTypes.Unknown. Parameters: `residue_labels` (iterable) - an iterable of PDB residue labels Returns: csb.core.EnumItem a SequenceTypes enum member

### guess_sequence_type(self, residue_label) | source code
Try to guess what is the sequence type of a PDB `residue_label`. Parameters: `residue_label` (str) - a PDB-conforming name of a residue Returns: csb.core.EnumItem a SequenceTypes enum member Raises: `UnknownPDBResidueError` - when there is no such PDB residue name in the catalog tables

### models(self) | source code
Find all available model identifiers in the structure. Returns: list a list of model IDs

### parse_biomolecule(self, number=1, single=False) | source code
Parse and return the Structure of the biological unit (quaternary structure) as annotated by the REMARK 350 BIOMOLECULE record. Parameters: `number` (int) - biomolecule number `single` (bool) - if True, assign new single-letter chain identifiers. If False, assign multi-letter chain identifiers whith a number appended to the original identifier, like "A1", "A2", ... Returns: Structure structure of biological unit

### parse_models(self, models=`(``)`) | source code
Parse the specified models in the file and build an Ensemble. Parameters: `models` (tuple) - an iterable object providing model identifiers. If not specified, all models will be parsed. Returns: Ensemble an ensemble with all parsed models

### parse_residue(self, residue_label, as_type=None) | source code
Try to parse a PDB `residue_label` and return its closest 'normal' string representation. If a sequence type (`as_type`) is defined, guess the alphabet based on that information, otherwise try first to parse it as a protein residue. Parameters: `residue_label` (str) - a PDB-conforming name of a residue `as_type` - suggest a sequence type (SequenceTypes member) @type scb.core.EnumItem Returns: str a normalized residue name Raises: `UnknownPDBResidueError` - when there is no such PDB residue name in the catalog table(s)

### parse_residue_safe(self, residue_label, as_type) | source code
Same as `parse_residue`, but returns UNK/Any instead of raising UnknownPDBResidueError. Parameters: `residue_label` (str) - a PDB-conforming name of a residue `as_type` - suggest a sequence type (SequenceTypes member) @type scb.core.EnumItem Returns: str a normalized residue name

### parse_structure(self, model=None) | source code
Parse and return the Structure with the specified model identifier. If no explicit model is specified, parse the first model in the structure. Parameters: `model` (str) - parse exactly the model with this ID Returns: Structure object representation of the selected model Raises: `ValueError` - When an invalid model ID is specified `PDBParseError` - When the input PDB file suffers from unrecoverable corruption. More specialized exceptions will be raised depending on the context (see PDBParseError's subclasses).

Property Details

### filename Current input PDB file name Get Method: unreachable.filename(self) - Current input PDB file name Set Method: unreachable.filename(self, name) Type: str

### mapper Current residue mapping strategy Get Method: unreachable.mapper(self) - Current residue mapping strategy Set Method: unreachable.mapper(self, value) Type: AbstractResidueMapper