Package org.biojava.nbio.structure.ecod
Class EcodInstallation
- java.lang.Object
-
- org.biojava.nbio.structure.ecod.EcodInstallation
-
- All Implemented Interfaces:
EcodDatabase
public class EcodInstallation extends java.lang.Object implements EcodDatabase
Provides access to the Evolutionary Classification of Protein Domains (ECOD). The preferred mechanism for obtaining instances of this class is through theEcodFactoryclass. Reference: H. Cheng, R. D. Schaeffer, Y. Liao, L. N. Kinch, J. Pei, S. Shi, B. H.\ Kim, N. V. Grishin. (2014) ECOD: An evolutionary classification of protein domains. PLoS Comput Biol 10(12): e1003926. http://prodata.swmed.edu/ecod/- Author:
- Spencer Bliven
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEcodInstallation.EcodParser
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_VERSIONstatic java.lang.StringDOMAINS_PATHstatic java.util.regex.PatternECOD_REstatic java.lang.StringECOD_URL
-
Constructor Summary
Constructors Constructor Description EcodInstallation()EcodInstallation(java.lang.String cacheLocation, java.lang.String version)Use EcodFactory to create instances.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears all domains, requiring the file to be reparsed for subsequent accessesvoidensureDomainsFileInstalled()Blocks until ECOD domains file has been downloaded and parsed.java.util.List<EcodDomain>filterByHierarchy(java.lang.String hierarchy)Get a list of domains within a particular level of the hierarchyjava.util.List<EcodDomain>getAllDomains()Get all ECOD domainsjava.lang.StringgetCacheLocation()Get the location of the cache directory (usually set to the PDB_CACHE_DIR property).EcodDomaingetDomainsById(java.lang.String ecodId)Get a particular ECOD domain by the domain ID (e.g.java.util.List<EcodDomain>getDomainsForPdb(java.lang.String pdbId)public EcodInstallation(String cacheLocation) { this( cacheLocation, DEFAULT_VERSION ); } /** Get a list of all ECOD domains for a particular PDB IDjava.lang.IntegergetUpdateFrequency()The expected ECOD update frequency determines whether the version "latest" should be re-downloadedjava.lang.StringgetUrl()Get the top-level ECOD server URL.java.lang.StringgetVersion()Return the ECOD version, as parsed from the file.static voidmain(java.lang.String[] args)voidsetCacheLocation(java.lang.String cacheLocation)Set an alternate download location for filesvoidsetUpdateFrequency(java.lang.Integer updateFrequency)The "latest" version will be re-downloaded if it is older thangetUpdateFrequency()days.voidsetUrl(java.lang.String url)Specify a different mirror for the ECOD server.java.lang.StringtoString()
-
-
-
Field Detail
-
DEFAULT_VERSION
public static final java.lang.String DEFAULT_VERSION
- See Also:
- Constant Field Values
-
ECOD_URL
public static final java.lang.String ECOD_URL
- See Also:
- Constant Field Values
-
DOMAINS_PATH
public static final java.lang.String DOMAINS_PATH
- See Also:
- Constant Field Values
-
ECOD_RE
public static final java.util.regex.Pattern ECOD_RE
-
-
Constructor Detail
-
EcodInstallation
public EcodInstallation(java.lang.String cacheLocation, java.lang.String version)Use EcodFactory to create instances. The instantiation of multiple installations at the same path can lead to race conditions when downloading files.- Parameters:
cacheLocation- Location to save files, typically from the PDB_CACHE_DIR parameterrequestedVersion- ECOD requestedVersion to fetch
-
EcodInstallation
public EcodInstallation()
- See Also:
EcodFactory.getEcodDatabase()
-
-
Method Detail
-
getDomainsForPdb
public java.util.List<EcodDomain> getDomainsForPdb(java.lang.String pdbId) throws java.io.IOException
public EcodInstallation(String cacheLocation) { this( cacheLocation, DEFAULT_VERSION ); } /** Get a list of all ECOD domains for a particular PDB ID- Specified by:
getDomainsForPdbin interfaceEcodDatabase- Parameters:
pdbId-- Returns:
- the list of domains, or null if no matching domains were found
- Throws:
java.io.IOException
-
filterByHierarchy
public java.util.List<EcodDomain> filterByHierarchy(java.lang.String hierarchy) throws java.io.IOException
Get a list of domains within a particular level of the hierarchy- Specified by:
filterByHierarchyin interfaceEcodDatabase- Parameters:
hierarchy- A dot-separated list giving the X-group, H-group, and/or T-group (e.g. "1.1" for all members of the RIFT-related H-group)- Returns:
- Throws:
java.io.IOException
-
getDomainsById
public EcodDomain getDomainsById(java.lang.String ecodId) throws java.io.IOException
Get a particular ECOD domain by the domain ID (e.g. "e4hhbA1")- Specified by:
getDomainsByIdin interfaceEcodDatabase- Parameters:
ecodId-- Returns:
- Throws:
java.io.IOException
-
getAllDomains
public java.util.List<EcodDomain> getAllDomains() throws java.io.IOException
Get all ECOD domains- Specified by:
getAllDomainsin interfaceEcodDatabase- Returns:
- Throws:
java.io.IOException
-
clear
public void clear()
Clears all domains, requiring the file to be reparsed for subsequent accesses
-
getVersion
public java.lang.String getVersion() throws java.io.IOExceptionReturn the ECOD version, as parsed from the file. Note that this may differ from the version requested in the constructor for the special case of "latest"- Specified by:
getVersionin interfaceEcodDatabase- Returns:
- the ECOD version
- Throws:
java.io.IOException- If an error occurs while downloading or parsing the file
-
getUrl
public java.lang.String getUrl()
Get the top-level ECOD server URL. Defaults to "http://prodata.swmed.edu"- Returns:
- the url to the ecod server
-
setUrl
public void setUrl(java.lang.String url)
Specify a different mirror for the ECOD server.- Parameters:
urlFormat- the urlFormat to set
-
getCacheLocation
public java.lang.String getCacheLocation()
Get the location of the cache directory (usually set to the PDB_CACHE_DIR property). ECOD files will be downloaded to this directory- Returns:
-
setCacheLocation
public void setCacheLocation(java.lang.String cacheLocation)
Set an alternate download location for files- Parameters:
cacheLocation-
-
ensureDomainsFileInstalled
public void ensureDomainsFileInstalled() throws java.io.IOExceptionBlocks until ECOD domains file has been downloaded and parsed. This may be useful in multithreaded environments.- Throws:
java.io.IOException
-
getUpdateFrequency
public java.lang.Integer getUpdateFrequency()
The expected ECOD update frequency determines whether the version "latest" should be re-downloaded- Returns:
- the expected ECOD update frequency, in days
-
setUpdateFrequency
public void setUpdateFrequency(java.lang.Integer updateFrequency)
The "latest" version will be re-downloaded if it is older thangetUpdateFrequency()days. Setting this to null disables re-downloading (delete $PDB_CACHE_DIR/ecod.latest.domains.txt manually to force updating). Setting to 0 will force downloading for every program execution.- Parameters:
updateFrequency- the updateFrequency to set
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
main
public static void main(java.lang.String[] args)
-
-