Class DownloadChemCompProvider
- java.lang.Object
-
- org.biojava.nbio.structure.io.mmcif.DownloadChemCompProvider
-
- All Implemented Interfaces:
ChemCompProvider
public class DownloadChemCompProvider extends java.lang.Object implements ChemCompProvider
This provider of chemical components can download and cache chemical component definition files from the RCSB PDB web site. It is the default way to access these definitions. If this provider is called he first time, it will download and install all chemical component definitions in a local directory. Once the definition files have been installed, it has quick startup time and low memory requirements. An alternative provider, that keeps all definitions in memory is theAllChemCompProvider. Another provider, that does not require any network access, but only can support a limited set of chemical component definitions, is theReducedChemCompProvider.- Author:
- Andreas Prlic
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCHEM_COMP_CACHE_DIRECTORYstatic java.lang.StringSERVER_LOCATION
-
Constructor Summary
Constructors Constructor Description DownloadChemCompProvider()DownloadChemCompProvider(java.lang.String cacheFilePath)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckDoFirstInstall()Checks if the chemical components already have been installed into the PDB directory.ChemCompgetChemComp(java.lang.String recordName)Loads the definitions for thisChemCompfrom a local file and instantiates a new object.static java.lang.StringgetLocalFileName(java.lang.String recordName)Returns the file name that contains the definition for thisChemCompstatic java.io.FilegetPath()Get this provider's cache pathbooleanisDownloadAll()By default this provider will download only some of theChemCompfiles.voidsetDownloadAll(boolean downloadAll)By default this provider will download only some of theChemCompfiles.
-
-
-
Field Detail
-
CHEM_COMP_CACHE_DIRECTORY
public static final java.lang.String CHEM_COMP_CACHE_DIRECTORY
- See Also:
- Constant Field Values
-
SERVER_LOCATION
public static final java.lang.String SERVER_LOCATION
- See Also:
- Constant Field Values
-
-
Method Detail
-
getPath
public static java.io.File getPath()
Get this provider's cache path- Returns:
-
checkDoFirstInstall
public void checkDoFirstInstall()
Checks if the chemical components already have been installed into the PDB directory. If not, will download the chemical components definitions file and split it up into small subfiles.
-
getChemComp
public ChemComp getChemComp(java.lang.String recordName)
Loads the definitions for thisChemCompfrom a local file and instantiates a new object.- Specified by:
getChemCompin interfaceChemCompProvider- Parameters:
recordName- the ID of theChemComp- Returns:
- a new
ChemCompdefinition.
-
getLocalFileName
public static java.lang.String getLocalFileName(java.lang.String recordName)
Returns the file name that contains the definition for thisChemComp- Parameters:
recordName- the ID of theChemComp- Returns:
- full path to the file
-
isDownloadAll
public boolean isDownloadAll()
By default this provider will download only some of theChemCompfiles. The user has to request that all files should be downloaded by setting this parameter to true.- Returns:
- flag if the all components should be downloaded and installed at startup. (default: false)
-
setDownloadAll
public void setDownloadAll(boolean downloadAll)
By default this provider will download only some of theChemCompfiles. The user has to request that all files should be downloaded by setting this parameter to true.- Parameters:
flag- if the all components should be downloaded and installed at startup. (default: false)
-
-