Package com.chemaxon.calculations.io
Class MoleculeIo
- java.lang.Object
-
- com.chemaxon.calculations.io.MoleculeIo
-
@PublicAPI @Beta public final class MoleculeIo extends Object
Utility class withMolecule
IO related functions.Please note that this class is marked with @Beta annotation, so it can be subject of incompatible changes or removal in later releases.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Function<Molecule,String>
molExporterToSmilesFunction()
Convert aMolecule
toSMILES
.static Function<String,Molecule>
molImporterFromSourceFunction()
Import aString
source into aMolecule
.static Molecule
molImporterImport(String source)
ImportMolecule
from sourceString
.static CloseableIterator<Molecule>
molImporterIterateMolecules(InputStream is)
static SmilesMemoizingMoleculeIterator
molImporterMemoizingIterator(CloseableIterator<Molecule> base, Consumer<Exception> errorHandler)
-
-
-
Method Detail
-
molExporterToSmilesFunction
public static Function<Molecule,String> molExporterToSmilesFunction()
Convert aMolecule
toSMILES
. DelegateMolExporter.exportToFormat(chemaxon.struc.Molecule, java.lang.String)
with optionssmiles:n
to preserve name. Please note that the current implementation contains limitations of the representable structures. For example only a set of atoms (see 3.4.2 Aromaticity from http://www.daylight.com/dayhtml/doc/theory/theory.smiles.html) can be part of an aromatic ring.The implementation throws
IllegalArgumentException
when SMILES conversion failed.- Returns:
- Converter
Function
-
molImporterFromSourceFunction
public static Function<String,Molecule> molImporterFromSourceFunction()
Import aString
source into aMolecule
.- Returns:
- Importer
Function
-
molImporterImport
public static Molecule molImporterImport(String source)
ImportMolecule
from sourceString
.- Parameters:
source
- Source- Returns:
- Imported
Molecule
- Throws:
IllegalArgumentException
- whenMolImporter.importMol(java.lang.String)
failed
-
molImporterIterateMolecules
public static CloseableIterator<Molecule> molImporterIterateMolecules(InputStream is) throws IOException
- Parameters:
is
- Delegated toMolImporter(java.io.InputStream)
- Returns:
- Iterator
- Throws:
IOException
- propagated fromMolImporter(java.io.InputStream)
-
molImporterMemoizingIterator
public static SmilesMemoizingMoleculeIterator molImporterMemoizingIterator(CloseableIterator<Molecule> base, Consumer<Exception> errorHandler)
- Parameters:
base
- BaseCloseableIterator
errorHandler
- Error handler to pass toSmilesMemoizingMoleculeIterator#SmilesMemoizingMoleculeIterator(com.chemaxon.calculations.io.CloseableIterator, com.google.common.base.Function, com.chemaxon.calculations.io.Sink)
Errors are expected during the execution of SMILES conversion of iterated structures for memoization- Returns:
- Constructed instance
-
-