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
setParseCAOnly(boolean)
- parse only the Atom records for C-alpha atoms (default:false)setParseSecStruc(boolean)
- a flag if the secondary structure information from the PDB file (author's assignment) should be parsed.
If true the assignment can be accessed through AminoAcid
.getSecStruc(); (default:false)setAlignSeqRes(boolean)
- should the AminoAcid sequences from the SEQRES
and ATOM records of a PDB file be aligned? (default:true)setAutoFetch(boolean)
- if the PDB file can not be found locally, should it be fetched
from the EBI - ftp server? (default:false)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; }
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.
|
void |
clearExtensions()
clear the supported file extensions
|
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 |
getStructureById(java.lang.String pdbId)
load a structure from local file system and return a PDBStructure object
|
boolean |
isAlignSeqRes()
get the flag if the SEQRES and ATOM amino acids are going to be aligned
|
boolean |
isAutoFetch()
should the parser to fetch missing PDB files from the EBI FTP server automatically?
default is false
|
boolean |
isParseCAOnly()
return the flag if only the CA atoms should be parsed
|
boolean |
isParseSecStruc() |
static void |
main(java.lang.String[] args) |
void |
setAlignSeqRes(boolean alignSeqRes)
set the flag if the SEQRES and ATOM amino acids should be aligned and linked
|
void |
setAutoFetch(boolean autoFetch)
tell the parser to fetch missing PDB files from the EBI FTP server automatically.
|
void |
setParseCAOnly(boolean parseCAOnly)
only the CA atoms should be parsed from the PDB file
|
void |
setParseSecStruc(boolean parseSecStruc) |
void |
setPath(java.lang.String p)
directory where to find PDB files
|
public static void main(java.lang.String[] args)
public boolean isParseCAOnly()
public void setParseCAOnly(boolean parseCAOnly)
parseCAOnly
- public boolean isAlignSeqRes()
public void setAlignSeqRes(boolean alignSeqRes)
alignSeqRes
- public boolean isAutoFetch()
isAutoFetch
in interface StructureIOFile
public void setAutoFetch(boolean autoFetch)
setAutoFetch
in interface StructureIOFile
autoFetch
- public boolean isParseSecStruc()
public void setParseSecStruc(boolean parseSecStruc)
public void setPath(java.lang.String p)
setPath
in interface StructureIOFile
p
- a String specifying the path valuepublic java.lang.String getPath()
getPath
in interface StructureIOFile
setPath(java.lang.String)
public void addExtension(java.lang.String s)
addExtension
in interface StructureIOFile
s
- a String ...public void clearExtensions()
clearExtensions
in interface StructureIOFile
public Structure getStructureById(java.lang.String pdbId) throws java.io.IOException
getStructureById
in interface StructureIO
pdbId
- 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 StructureIOFile
filename
- a Stringjava.io.IOException
- ...public Structure getStructure(java.io.File filename) throws java.io.IOException
getStructure
in interface StructureIOFile
filename
- a File objectjava.io.IOException
- ...