/**
  * Sets the given cml. Does not update other fields like for example smiles
  *
  * @param cml
  */
 public void setCML(String cml) {
   InputStream inputStream = new ByteArrayInputStream(cml.getBytes());
   CMLReader cmlReader = new CMLReader(inputStream);
   try {
     IChemFile readFile = (IChemFile) cmlReader.read(new ChemFile());
     setAtomContainer((AtomContainer) ChemFileManipulator.getAllAtomContainers(readFile).get(0));
   } catch (CDKException e) {
     throw new RuntimeException("failed to read atomContainer", e);
   }
 }
  /**
   * Creates a new DBMolecule that is an exact copy of the given instance including the same id.
   *
   * @param dBMolecule
   */
  public DBMolecule(DBMolecule dBMolecule) {

    super(dBMolecule);

    setAtomContainer(dBMolecule.getMolecule());
    fingerPrint = (BitSet) dBMolecule.getFingerPrint().clone();
    persistedFingerPrint = makePersistedFingerPrint(fingerPrint);
    smiles = dBMolecule.toSMILES();
    annotations = new ArrayList<Annotation>(dBMolecule.getAnnotations());
  }
 public IAtomContainer getAtomContainer() {
   if (atomContainer == null) {
     InputStream in = FileStoreKeeper.FILE_STORE.retrieve(fileStoreKey);
     CMLReader cmlReader = new CMLReader(in);
     try {
       IChemFile readFile = (IChemFile) cmlReader.read(new ChemFile());
       setAtomContainer((AtomContainer) ChemFileManipulator.getAllAtomContainers(readFile).get(0));
     } catch (CDKException e) {
       throw new RuntimeException("failed to read atomContainer", e);
     }
   }
   return atomContainer;
 }
  public DBMolecule(String name, ICDKMolecule cdkMolecule) throws BioclipseException {

    super();
    this.name = name;
    try {
      fingerPrint =
          cdkMolecule.getFingerprint(
              net.bioclipse.core.domain.IMolecule.Property.USE_CACHED_OR_CALCULATED);
    } catch (BioclipseException e) {
      logger.error("Could not create fingerprint for molecule", e);
    }
    persistedFingerPrint = makePersistedFingerPrint(fingerPrint);
    setAtomContainer(cdkMolecule.getAtomContainer());
    smiles = "";
    annotations = new ArrayList<Annotation>();
  }