public class PDBFileReader extends java.lang.Object implements StructureIOFile
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)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; }
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_PDB_FILE_SERVER |
static long |
lastRemediationDate |
static java.lang.String |
lineSplit |
static java.lang.String |
LOAD_CHEM_COMP_PROPERTY |
static java.lang.String |
PDB_FILE_SERVER_PROPERTY |
| Constructor and Description |
|---|
PDBFileReader() |
| Modifier and Type | Method and Description |
|---|---|
void |
addExtension(java.lang.String s)
define supported file extensions
compressed extensions .Z,.gz do not need to be specified
they are dealt with automatically.
|
boolean |
checkFileExists(java.lang.String pdbId) |
void |
clearExtensions()
clear the supported file extensions
|
void |
downloadPDB(java.lang.String pdbId) |
FileParsingParameters |
getFileParsingParameters()
Get the parameters that should be used for file parsing
|
java.io.InputStream |
getInputStream(java.lang.String pdbId)
try to find the file in the filesystem and return a filestream in order to parse it
rules how to find file
- first check: if file is in path specified by PDBpath
- second check: if not found check in PDBpath/xy/ where xy is second and third char of PDBcode.
|
java.io.InputStream |
getInputStreamBioAssembly(java.lang.String pdbId)
Returns an input stream for a biological assembly file based on the passed in pdbId and
the biological assembly id
setBioAssemblyId(int). |
java.lang.String |
getPath()
Returns the path value.
|
Structure |
getStructure(java.io.File filename)
opens filename, parses it and returns a Structure object
|
Structure |
getStructure(java.lang.String filename)
opens filename, parses it and returns
aStructure object .
|
Structure |
getStructure(java.net.URL u) |
Structure |
getStructureById(java.lang.String pdbId)
load a structure from local file system and return a PDBStructure object
|
boolean |
isAutoFetch()
Fetch files automatically from FTP server.
|
boolean |
isFetchCurrent()
N.B. This feature won't work unless the structure wasn't found & autoFetch is set to
true. |
boolean |
isFetchFileEvenIfObsolete()
forces the reader to fetch the file if its status is OBSOLETE.
|
boolean |
isPdbDirectorySplit()
Flag that defines if the PDB directory is containing all PDB files or is split into sub dirs (like the FTP site).
|
static void |
main(java.lang.String[] args) |
void |
setAutoFetch(boolean autoFetch)
Tell the parser to fetch missing PDB files from the FTP server automatically.
|
void |
setBioAssemblyFallback(boolean bioAssemblyFallback)
Set bioAssemblyFallback to true, to download the original PDB file in cases that a biological assembly file is not available.
|
void |
setBioAssemblyId(int bioAssemblyId)
Sets the ID of the biological assembly to be loaded.
|
void |
setFetchCurrent(boolean fetchNewestCurrent)
if enabled, the reader searches for the newest possible PDB ID, if not present in he local installation.
|
void |
setFetchFileEvenIfObsolete(boolean fetchFileEvenIfObsolete)
N.B. This feature won't work unless the structure wasn't found & autoFetch is set to
true. |
void |
setFileParsingParameters(FileParsingParameters params)
Set the parameters that should be used for file parsing
|
void |
setPath(java.lang.String p)
directory where to find PDB files
|
void |
setPdbDirectorySplit(boolean pdbDirectorySplit)
Flag that defines if the PDB directory is containing all PDB files or is split into sub dirs (like the FTP site).
|
public static final java.lang.String LOAD_CHEM_COMP_PROPERTY
public static final java.lang.String lineSplit
public static final java.lang.String DEFAULT_PDB_FILE_SERVER
public static final java.lang.String PDB_FILE_SERVER_PROPERTY
public static final long lastRemediationDate
public static void main(java.lang.String[] args)
public void setPath(java.lang.String p)
setPath in interface StructureIOFilep - a String specifying the path valuepublic java.lang.String getPath()
getPath in interface StructureIOFilesetPath(java.lang.String)public void addExtension(java.lang.String s)
addExtension in interface StructureIOFiles - a String ...public void clearExtensions()
clearExtensions in interface StructureIOFilepublic boolean isPdbDirectorySplit()
isPdbDirectorySplit in interface StructureIOFilepublic void setPdbDirectorySplit(boolean pdbDirectorySplit)
setPdbDirectorySplit in interface StructureIOFilepdbDirectorySplit - boolean. If set to false all files are in one directory.public void setBioAssemblyId(int bioAssemblyId)
bioAssemblyId - ID of the biological assembly to be loadedpublic void setBioAssemblyFallback(boolean bioAssemblyFallback)
bioAssemblyFallback - if true, tries reading original PDB file in case the biological assembly file is not availablepublic java.io.InputStream getInputStream(java.lang.String pdbId)
throws java.io.IOException
java.io.IOExceptionpublic java.io.InputStream getInputStreamBioAssembly(java.lang.String pdbId)
throws java.io.IOException
setBioAssemblyId(int). Files are cached in a local directory.pdbId - java.io.IOExceptionpublic boolean checkFileExists(java.lang.String pdbId)
public void downloadPDB(java.lang.String pdbId)
public Structure getStructureById(java.lang.String pdbId) throws java.io.IOException
getStructureById in interface StructureIOgetStructureById in interface StructureIOFilepdbId - a String specifying the id value (PDB code)java.io.IOException - ...public Structure getStructure(java.lang.String filename) throws java.io.IOException
getStructure in interface StructureIOFilefilename - a Stringjava.io.IOException - ...public Structure getStructure(java.io.File filename) throws java.io.IOException
getStructure in interface StructureIOFilefilename - a File objectjava.io.IOException - ...public Structure getStructure(java.net.URL u) throws java.io.IOException
java.io.IOExceptionpublic void setFileParsingParameters(FileParsingParameters params)
StructureIOFilesetFileParsingParameters in interface StructureIOFileparams - FileParsingParameterspublic FileParsingParameters getFileParsingParameters()
StructureIOFilegetFileParsingParameters in interface StructureIOFilepublic boolean isAutoFetch()
StructureIOFileisAutoFetch in interface StructureIOFilepublic void setAutoFetch(boolean autoFetch)
StructureIOFilesetAutoFetch in interface StructureIOFileautoFetch - flag.public void setFetchFileEvenIfObsolete(boolean fetchFileEvenIfObsolete)
true.fetchFileEvenIfObsolete - the fetchFileEvenIfObsolete to setpublic boolean isFetchFileEvenIfObsolete()
setFetchCurrent(boolean). true.fetchCurrentpublic void setFetchCurrent(boolean fetchNewestCurrent)
setFetchFileEvenIfObsolete(boolean) function has a higher priority than this function. true.fetchCurrent - the fetchCurrent to setsetFetchFileEvenIfObsolete(boolean)public boolean isFetchCurrent()
true.