Package org.biojava.nbio.structure.chem
Class ZipChemCompProvider
- java.lang.Object
-
- org.biojava.nbio.structure.chem.ZipChemCompProvider
-
- All Implemented Interfaces:
ChemCompProvider
public class ZipChemCompProvider extends Object implements ChemCompProvider
This chemical component provider retrieves and caches chemical component definition files from a zip archive specified in its construction. If the archive does not contain the record, an attempt is made to download it using DownloadChemCompProvider. The downloaded file is then added to the archive. The class is thread-safe and the same ZipChemCompProvider should be used by all threads to prevent simultaneous read or write to the zip archive. A zip archive will be created if missing.- Since:
- 12/05/12 updated 3/5/2016 for Java 7 ZipFileSystem
- Author:
- edlunde, larsonm
-
-
Constructor Summary
Constructors Constructor Description ZipChemCompProvider(String chemicalComponentDictionaryFile, String tempDir)
ZipChemCompProvider is a Chemical Component provider that stores chemical components in a zip archive.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ChemComp
getChemComp(String recordName)
(non-Javadoc)static void
purgeTempFiles(String tempdir)
Cleanup chemical component (.cif.gz) files downloaded to tmpdir.void
setRemoveCif(boolean doRemove)
Remove downloaded .cif.gz after adding to zip archive?
-
-
-
Constructor Detail
-
ZipChemCompProvider
public ZipChemCompProvider(String chemicalComponentDictionaryFile, String tempDir) throws IOException
ZipChemCompProvider is a Chemical Component provider that stores chemical components in a zip archive. Missing chemical components are downloaded and appended to the archive. If non-existent a new zip archive will be created.- Parameters:
chemicalComponentDictionaryFile
- : path to zip archive for chemical components.tempDir
- : path for temporary directory, (null) defaults to path in property "java.io.tmpdir".- Throws:
IOException
-
-
Method Detail
-
setRemoveCif
public void setRemoveCif(boolean doRemove)
Remove downloaded .cif.gz after adding to zip archive? Default is true.- Parameters:
doRemove
-
-
getChemComp
public ChemComp getChemComp(String recordName)
(non-Javadoc)- Specified by:
getChemComp
in interfaceChemCompProvider
- Parameters:
recordName
- : three letter PDB name for a residue- Returns:
- ChemComp from .zip or ChemComp from repository. Will return empty ChemComp when unable to find a residue and will return null if not provided a valid recordName.
- See Also:
ChemCompProvider.getChemComp(java.lang.String)
-
purgeTempFiles
public static void purgeTempFiles(String tempdir)
Cleanup chemical component (.cif.gz) files downloaded to tmpdir.- Parameters:
tempdir
- : path to temporary directory for chemical components
-
-