Class PDBFileReader

java.lang.Object
org.biojava.nbio.structure.io.LocalPDBDirectory
org.biojava.nbio.structure.io.PDBFileReader
All Implemented Interfaces:
StructureIOFile, StructureProvider

public class PDBFileReader extends LocalPDBDirectory
The wrapper class for parsing a PDB file.

Several flags can be set for this class

Example

Q: How can I get a Structure object from a PDB file?

A:

 public Structure loadStructure(String pathToPDBFile){
        PDBFileReader pdbreader = new PDBFileReader();

        Structure structure = null;
        try{
                structure = pdbreader.getStructure(pathToPDBFile);
                System.out.println(structure);
        } catch (IOException e) {
                e.printStackTrace();
        }
        return structure;
 }
 
Access PDB files from a directory, take care of compressed PDB files
 public Structure loadStructureById() {
        String path = "/path/to/PDB/directory/";

        PDBFileReader pdbreader = new PDBFileReader();
        pdbreader.setPath(path);
        Structure structure = null;
        try {
                structure = pdbreader.getStructureById("5pti");
        } catch (IOException e){
                e.printStackTrace();
        }
        return structure;

 }
 
Author:
Andreas Prlic
  • Field Details

  • Constructor Details

    • PDBFileReader

      public PDBFileReader()
      Constructs a new PDBFileReader, initializing the extensions member variable. The path is initialized in the same way as UserConfiguration, i.e. to system property/environment variable UserConfiguration.PDB_DIR. Both autoFetch and splitDir are initialized to false
    • PDBFileReader

      public PDBFileReader(String path)
      Constructs a new PDBFileReader, initializing the extensions member variable. The path is initialized to the given path, both autoFetch and splitDir are initialized to false.

      If path is null, initialize using the system property/environment variable UserConfiguration.PDB_DIR.

      Parameters:
      path - Path to the PDB file directory
  • Method Details