StructureIOFile
, StructureProvider
public class PDBFileReader extends LocalPDBDirectory
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)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 filesStructure
loadStructure(String pathToPDBFile){PDBFileReader
pdbreader = newPDBFileReader
();Structure
structure = null; try{ structure = pdbreader.getStructure(pathToPDBFile); System.out.println(structure); } catch (IOException e) { e.printStackTrace(); } return structure; }
publicStructure
loadStructureById() { String path = "/path/to/PDB/directory/";PDBFileReader
pdbreader = newPDBFileReader
(); pdbreader.setPath(path);Structure
structure = null; try { structure = pdbreader.getStructureById("5pti"); } catch (IOException e){ e.printStackTrace(); } return structure; }
LocalPDBDirectory.FetchBehavior, LocalPDBDirectory.ObsoleteBehavior
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String[] |
PDB_OBSOLETE_DIR |
|
static java.lang.String[] |
PDB_SPLIT_DIR |
DEFAULT_PDB_FILE_SERVER, LAST_REMEDIATION_DATE, lineSplit, PDB_FILE_SERVER_PROPERTY
Constructor | Description |
---|---|
PDBFileReader() |
Constructs a new PDBFileReader, initializing the extensions member variable.
|
PDBFileReader(java.lang.String path) |
Constructs a new PDBFileReader, initializing the extensions member variable.
|
Modifier and Type | Method | Description |
---|---|---|
void |
downloadPDB(java.lang.String pdbId) |
Deprecated.
|
protected java.lang.String |
getFilename(java.lang.String pdbId) |
Converts a PDB ID into a filename with the proper extension
|
protected java.lang.String[] |
getObsoleteDirPath() |
Location of obsolete files within the directory, as an array of paths.
|
protected java.lang.String[] |
getSplitDirPath() |
Location of split files within the directory, as an array of paths.
|
Structure |
getStructure(java.io.InputStream inStream) |
Handles the actual parsing of the file into a Structure object.
|
boolean |
isFetchCurrent() |
Deprecated.
Use
FileParsingParameters#getObsoleteBehavior() |
boolean |
isFetchFileEvenIfObsolete() |
Deprecated.
Use
FileParsingParameters#getObsoleteBehavior() |
static void |
main(java.lang.String[] args) |
|
void |
setFetchCurrent(boolean fetchNewestCurrent) |
Deprecated.
Use
FileParsingParameters#setObsoleteBehavior(ObsoleteBehavior) |
void |
setFetchFileEvenIfObsolete(boolean fetchFileEvenIfObsolete) |
Deprecated.
Use
FileParsingParameters#setObsoleteBehavior(ObsoleteBehavior) |
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
public static final java.lang.String[] PDB_SPLIT_DIR
public static final java.lang.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(java.lang.String path)
If path is null, initialize using the system property/environment variable
UserConfiguration.PDB_DIR
.
path
- Path to the PDB file directorypublic static void main(java.lang.String[] args)
@Deprecated public void downloadPDB(java.lang.String pdbId) throws java.io.IOException
java.io.IOException
@Deprecated public void setFetchFileEvenIfObsolete(boolean fetchFileEvenIfObsolete)
FileParsingParameters#setObsoleteBehavior(ObsoleteBehavior)
true
.fetchFileEvenIfObsolete
- the fetchFileEvenIfObsolete to set@Deprecated public boolean isFetchFileEvenIfObsolete()
FileParsingParameters#getObsoleteBehavior()
setFetchCurrent(boolean)
. true
.#fetchCurrent
@Deprecated public void setFetchCurrent(boolean fetchNewestCurrent)
FileParsingParameters#setObsoleteBehavior(ObsoleteBehavior)
setFetchFileEvenIfObsolete(boolean)
function has a higher priority than this function. true
.fetchCurrent
- the fetchCurrent to setsetFetchFileEvenIfObsolete(boolean)
@Deprecated public boolean isFetchCurrent()
FileParsingParameters#getObsoleteBehavior()
true
.protected java.lang.String getFilename(java.lang.String pdbId)
LocalPDBDirectory
getFilename
in class LocalPDBDirectory
public Structure getStructure(java.io.InputStream inStream) throws java.io.IOException
LocalPDBDirectory
getStructure
in class LocalPDBDirectory
java.io.IOException
protected java.lang.String[] getSplitDirPath()
LocalPDBDirectory
getSplitDirPath
in class LocalPDBDirectory
protected java.lang.String[] getObsoleteDirPath()
LocalPDBDirectory
getObsoleteDirPath
in class LocalPDBDirectory