Class ZipChemCompProvider
java.lang.Object
org.biojava.nbio.structure.io.mmcif.ZipChemCompProvider
- All Implemented Interfaces:
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
ConstructorDescriptionZipChemCompProvider
(String chemicalComponentDictionaryFile, String tempDir) ZipChemCompProvider is a Chemical Component provider that stores chemical components in a zip archive. -
Method Summary
Modifier and TypeMethodDescriptiongetChemComp
(String recordName) Returns a new instance of a chemical component definition.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? Default is true.
-
Constructor Details
-
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 Details
-
setRemoveCif
public void setRemoveCif(boolean doRemove) Remove downloaded .cif.gz after adding to zip archive? Default is true.- Parameters:
doRemove
-
-
getChemComp
Description copied from interface:ChemCompProvider
Returns a new instance of a chemical component definition.- Specified by:
getChemComp
in interfaceChemCompProvider
- Parameters:
recordName
- the ID of theChemComp
- Returns:
- a new
ChemComp
definition.
-
purgeTempFiles
Cleanup chemical component (.cif.gz) files downloaded to tmpdir.- Parameters:
tempdir
- : path to temporary directory for chemical components
-