Class ZipChemCompProvider

java.lang.Object
org.biojava.nbio.structure.io.mmcif.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 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

      public ChemComp getChemComp(String recordName)
      Description copied from interface: ChemCompProvider
      Returns a new instance of a chemical component definition.
      Specified by:
      getChemComp in interface ChemCompProvider
      Parameters:
      recordName - the ID of the ChemComp
      Returns:
      a new ChemComp definition.
    • 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