Package org.biojava.nbio.structure.io
Class PDBFileReader
java.lang.Object
org.biojava.nbio.structure.io.LocalPDBDirectory
org.biojava.nbio.structure.io.PDBFileReader
- All Implemented Interfaces:
 StructureIOFile,StructureProvider
The wrapper class for parsing a PDB file.
Several flags can be set for this class
-  
LocalPDBDirectory.setAutoFetch(boolean)- if the PDB file can not be found locally, should it be fetched from the PDB ftp servers? (default:false) -  Other parameters can be set using the 
LocalPDBDirectory.setFileParsingParameters(FileParsingParameters) 
Example
Q: How can I get a Structure object from a PDB file?
A:
publicAccess PDB files from a directory, take care of compressed PDB filesStructureloadStructure(String pathToPDBFile){PDBFileReaderpdbreader = newPDBFileReader();Structurestructure = null; try{ structure = pdbreader.getStructure(pathToPDBFile); System.out.println(structure); } catch (IOException e) { e.printStackTrace(); } return structure; }
publicStructureloadStructureById() { String path = "/path/to/PDB/directory/";PDBFileReaderpdbreader = newPDBFileReader(); pdbreader.setPath(path);Structurestructure = null; try { structure = pdbreader.getStructureById("5pti"); } catch (IOException e){ e.printStackTrace(); } return structure; }
- Author:
 - Andreas Prlic
 
- 
Nested Class Summary
Nested classes/interfaces inherited from class org.biojava.nbio.structure.io.LocalPDBDirectory
LocalPDBDirectory.FetchBehavior, LocalPDBDirectory.ObsoleteBehavior - 
Field Summary
FieldsFields inherited from class org.biojava.nbio.structure.io.LocalPDBDirectory
DEFAULT_PDB_FILE_SERVER, LAST_REMEDIATION_DATE, lineSplit, MIN_PDB_FILE_SIZE, PDB_FILE_SERVER_PROPERTY - 
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new PDBFileReader, initializing the extensions member variable.PDBFileReader(String path) Constructs a new PDBFileReader, initializing the extensions member variable. - 
Method Summary
Modifier and TypeMethodDescriptionvoiddownloadPDB(String pdbId) Deprecated.protected StringgetFilename(String pdbId) Converts a PDB ID into a filename with the proper extensionprotected String[]Location of obsolete files within the directory, as an array of paths.protected String[]Location of split files within the directory, as an array of paths.getStructure(InputStream inStream) Handles the actual parsing of the file into a Structure object.booleanDeprecated.booleanDeprecated.UseFileParsingParameters#getObsoleteBehavior()static voidvoidsetFetchCurrent(boolean fetchNewestCurrent) Deprecated.UseFileParsingParameters#setObsoleteBehavior(ObsoleteBehavior)voidsetFetchFileEvenIfObsolete(boolean fetchFileEvenIfObsolete) Deprecated.UseFileParsingParameters#setObsoleteBehavior(ObsoleteBehavior)Methods inherited from class org.biojava.nbio.structure.io.LocalPDBDirectory
addExtension, checkFileExists, clearExtensions, deleteStructure, downloadStructure, getDir, getExtensions, getFetchBehavior, getFileParsingParameters, getInputStream, getLocalFile, getObsoleteBehavior, getPath, getServerName, getStructure, getStructure, getStructure, getStructureById, initPaths, isAutoFetch, prefetchStructure, setAutoFetch, setFetchBehavior, setFileParsingParameters, setObsoleteBehavior, setPath 
- 
Field Details
- 
PDB_SPLIT_DIR
 - 
PDB_OBSOLETE_DIR
 
 - 
 - 
Constructor Details
- 
PDBFileReader
public PDBFileReader()Constructs a new PDBFileReader, initializing the extensions member variable. The path is initialized in the same way asUserConfiguration, i.e. to system property/environment variableUserConfiguration.PDB_DIR. Both autoFetch and splitDir are initialized to false - 
PDBFileReader
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
- 
main
 - 
downloadPDB
Deprecated.- Throws:
 IOException
 - 
setFetchFileEvenIfObsolete
Deprecated.UseFileParsingParameters#setObsoleteBehavior(ObsoleteBehavior)N.B. This feature won't work unless the structure wasn't found & autoFetch is set totrue.- Parameters:
 fetchFileEvenIfObsolete- the fetchFileEvenIfObsolete to set
 - 
isFetchFileEvenIfObsolete
Deprecated.UseFileParsingParameters#getObsoleteBehavior()forces the reader to fetch the file if its status is OBSOLETE. This feature has a higher priority thansetFetchCurrent(boolean).
N.B. This feature won't work unless the structure wasn't found & autoFetch is set totrue.- Returns:
 - the fetchFileEvenIfObsolete
 - Since:
 - 3.0.2
 - See Also:
 - 
#fetchCurrent
 
 - 
setFetchCurrent
Deprecated.UseFileParsingParameters#setObsoleteBehavior(ObsoleteBehavior)if enabled, the reader searches for the newest possible PDB ID, if not present in he local installation. ThesetFetchFileEvenIfObsolete(boolean)function has a higher priority than this function.
N.B. This feature won't work unless the structure wasn't found & autoFetch is set totrue.- Parameters:
 fetchCurrent- the fetchCurrent to set- Since:
 - 3.0.2
 - See Also:
 
 - 
isFetchCurrent
Deprecated.UseFileParsingParameters#getObsoleteBehavior()N.B. This feature won't work unless the structure wasn't found & autoFetch is set totrue.- Returns:
 - the fetchCurrent
 
 - 
getFilename
Description copied from class:LocalPDBDirectoryConverts a PDB ID into a filename with the proper extension- Specified by:
 getFilenamein classLocalPDBDirectory- Returns:
 - The filename, e.g. "4hhb.pdb.gz"
 
 - 
getStructure
Description copied from class:LocalPDBDirectoryHandles the actual parsing of the file into a Structure object.- Specified by:
 getStructurein classLocalPDBDirectory- Returns:
 - Throws:
 IOException
 - 
getSplitDirPath
Description copied from class:LocalPDBDirectoryLocation of split files within the directory, as an array of paths. These will be joined with either slashes (for the URL) or the file separator (for directories). The returned results should be constant, to allow for caching.- Specified by:
 getSplitDirPathin classLocalPDBDirectory- Returns:
 - A list of directories, relative to the /pub/pdb directory on the server
 
 - 
getObsoleteDirPath
Description copied from class:LocalPDBDirectoryLocation of obsolete files within the directory, as an array of paths. These will be joined with either slashes (for the URL) or the file separator (for directories). The returned results should be constant, to allow for caching.- Specified by:
 getObsoleteDirPathin classLocalPDBDirectory- Returns:
 - A list of directories, relative to the /pub/pdb directory on the server
 
 
 - 
 
FileParsingParameters#getObsoleteBehavior()