org.proteinshader.structure.io
Class PDBLineParser

java.lang.Object
  extended by org.proteinshader.structure.io.PDBLineParser

public class PDBLineParser
extends Object

Parses a line from a PDB file and adds it to a Structure.

The line must be from a structure entry for a '.pdb' file formated according to the PDB Contents Guide (Version 2.2, 20 Dec 1996). The record name in the first 6 characters of the line will be used to determine what CategoryEnum and RecordEnum the line belongs to, so the appropriate information can be added to the Structure object that was given as an argument to the constructor.


Field Summary
static VisibilityEnum ATOM_VISIBILITY
          The default visibilty for Atoms.
static VisibilityEnum BOND_VISIBILITY
          The default visibilty for Bonds.
static String DEFAULT_CHAIN_ID
          Default chainID to use if the chainID field of a record is blank.
static String DEFAULT_MODEL_ID
          Default modelID to use if there is only one unnamed model.
static int MIN_CHAR_PER_LINE
          The minimum number of columns in a line from a PDB file.
 
Constructor Summary
PDBLineParser(Structure structure)
          Constructs a PDBLineParser for the Structure given as an argument.
 
Method Summary
 List<String> getBadLines()
          Returns a list with all bad lines that were found by parseLine().
 void parseLine(String line, int lineNumber)
          Verifies that the line is a valid PDB record before adding it's data to the Structure.
 void processSecondaryStructures()
          Any Helix and BetaStrand records that were found while parsing lines will now be added to the Structure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MODEL_ID

public static final String DEFAULT_MODEL_ID
Default modelID to use if there is only one unnamed model.

See Also:
Constant Field Values

DEFAULT_CHAIN_ID

public static final String DEFAULT_CHAIN_ID
Default chainID to use if the chainID field of a record is blank.

See Also:
Constant Field Values

MIN_CHAR_PER_LINE

public static final int MIN_CHAR_PER_LINE
The minimum number of columns in a line from a PDB file.

See Also:
Constant Field Values

ATOM_VISIBILITY

public static final VisibilityEnum ATOM_VISIBILITY
The default visibilty for Atoms.


BOND_VISIBILITY

public static final VisibilityEnum BOND_VISIBILITY
The default visibilty for Bonds.

Constructor Detail

PDBLineParser

public PDBLineParser(Structure structure)
Constructs a PDBLineParser for the Structure given as an argument.

Parameters:
structure - the Structure that readLine() will add data to.
Throws:
NullPointerException - if structure is null.
Method Detail

parseLine

public void parseLine(String line,
                      int lineNumber)
               throws StructureReaderException
Verifies that the line is a valid PDB record before adding it's data to the Structure. In all cases, a valid line must have at least MIN_CHAR_PER_LINE characters, and the name in the first 6 characters must match a known RecordEnum.

If a line is invalid, it will be added to a list of bad lines, which can be obtained by a call with getBadLines(). A StructureReaderException is thrown only if a very serious error occurs, such as a MODEL record with no serial number in it.

Parameters:
line - the line to get a record from.
lineNumber - - the line's number in the file.
Throws:
StructureReaderException - if a serious error occurs.

processSecondaryStructures

public void processSecondaryStructures()
Any Helix and BetaStrand records that were found while parsing lines will now be added to the Structure. This step should always be done after adding all Atom records because the constructor for a Helix or a BetaStrand needs to check that the start and end Residues really exist, and the Residues are adding to the Structure while processing Atom records.

If an error occurs while attempting to add a Helix or BetaStrand record, a message will be added to the end of the bad lines list.


getBadLines

public List<String> getBadLines()
Returns a list with all bad lines that were found by parseLine().

Returns:
A list of lines that violate the PDB record format.


Copyright © 2007-2008