public class PDBFileReader extends LocalPDBDirectory
The wrapper class for parsing a PDB file.
Several flags can be set for this class
#setAutoFetch(boolean) - if the PDB file can not be found locally, should it be fetched
from the PDB ftp servers? (default:false)LocalPDBDirectory.setFileParsingParameters(FileParsingParameters)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; }
LocalPDBDirectory.FetchBehavior, LocalPDBDirectory.ObsoleteBehavior| Modifier and Type | Field and Description |
|---|---|
static String[] |
PDB_OBSOLETE_DIR |
static String[] |
PDB_SPLIT_DIR |
DEFAULT_PDB_FILE_SERVER, LAST_REMEDIATION_DATE, lineSplit, PDB_FILE_SERVER_PROPERTY| Constructor and Description |
|---|
PDBFileReader()
Constructs a new PDBFileReader, initializing the extensions member variable.
|
PDBFileReader(String path)
Constructs a new PDBFileReader, initializing the extensions member variable.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
getFilename(String pdbId)
Converts a PDB ID into a filename with the proper extension
|
protected String[] |
getObsoleteDirPath()
Location of obsolete files within the directory, as an array of paths.
|
protected String[] |
getSplitDirPath()
Location of split files within the directory, as an array of paths.
|
Structure |
getStructure(InputStream inStream)
Handles the actual parsing of the file into a Structure object.
|
addExtension, checkFileExists, clearExtensions, deleteStructure, downloadStructure, getDir, getExtensions, getFetchBehavior, getFileParsingParameters, getInputStream, getLocalFile, getObsoleteBehavior, getPath, getServerName, getStructure, getStructure, getStructure, getStructureById, initPaths, prefetchStructure, setFetchBehavior, setFileParsingParameters, setObsoleteBehavior, setPathpublic static final String[] PDB_SPLIT_DIR
public static final String[] PDB_OBSOLETE_DIR
public PDBFileReader()
UserConfiguration,
i.e. to system property/environment variable UserConfiguration.PDB_DIR.
Both autoFetch and splitDir are initialized to falsepublic PDBFileReader(String path)
If path is null, initialize using the system property/environment variable
UserConfiguration.PDB_DIR.
path - Path to the PDB file directoryprotected String getFilename(String pdbId)
LocalPDBDirectorygetFilename in class LocalPDBDirectorypublic Structure getStructure(InputStream inStream) throws IOException
LocalPDBDirectorygetStructure in class LocalPDBDirectoryIOExceptionprotected String[] getSplitDirPath()
LocalPDBDirectorygetSplitDirPath in class LocalPDBDirectoryprotected String[] getObsoleteDirPath()
LocalPDBDirectorygetObsoleteDirPath in class LocalPDBDirectoryCopyright © 2000–2018 BioJava. All rights reserved.