@TestClass(value="org.openscience.cdk.io.MDLV2000ReaderTest") public class MDLV2000Reader extends DefaultChemObjectReader
IAtomContainer
or IChemModel
from an MDL molfile, and
a IChemFile
from a SD file, with a IChemSequence
of
IChemModel
's, where each IChemModel will contain one IMolecule.
From the Atom block it reads atomic coordinates, element types and formal charges. From the Bond block it reads the bonds and the orders. Additionally, it reads 'M CHG', 'G ', 'M RAD' and 'M ISO' lines from the property block.
If all z coordinates are 0.0, then the xy coordinates are taken as 2D, otherwise the coordinates are read as 3D.
The title of the MOL file is read and can be retrieved with:
molecule.getProperty(CDKConstants.TITLE);
RGroups which are saved in the MDL molfile as R#, are renamed according to their appearance, e.g. the first R# is named R1. With PseudAtom.getLabel() "R1" is returned (instead of R#). This is introduced due to the SAR table generation procedure of Scitegics PipelinePilot.
IChemObjectReader.Mode
Constructor and Description |
---|
MDLV2000Reader() |
MDLV2000Reader(InputStream in)
Constructs a new MDLReader that can read Molecule from a given InputStream.
|
MDLV2000Reader(InputStream in,
IChemObjectReader.Mode mode) |
MDLV2000Reader(Reader in)
Constructs a new MDLReader that can read Molecule from a given Reader.
|
MDLV2000Reader(Reader in,
IChemObjectReader.Mode mode) |
Modifier and Type | Method and Description |
---|---|
boolean |
accepts(Class<? extends IChemObject> classObject)
Returns whether the given
IChemObject can be read or written. |
void |
close()
Closes this IChemObjectIO's resources.
|
void |
customizeJob() |
List<IAtom> |
getAtomsByLinePosition() |
IResourceFormat |
getFormat()
Returns the
IResourceFormat class for this IO class. |
IOSetting[] |
getIOSettings()
Returns an array of
IOSetting s defined by this IChemObjectIO class. |
<T extends IChemObject> |
read(T object)
Takes an object which subclasses IChemObject, e.g.
|
void |
setReader(InputStream input)
Sets the InputStream from which this ChemObjectReader should read
the contents.
|
void |
setReader(Reader input)
Sets the Reader from which this ChemObjectReader should read
the contents.
|
addChemObjectIOListener, handleError, handleError, handleError, handleError, removeChemObjectIOListener, setErrorHandler, setReaderMode
public MDLV2000Reader()
public MDLV2000Reader(InputStream in)
in
- The InputStream to read frompublic MDLV2000Reader(InputStream in, IChemObjectReader.Mode mode)
public MDLV2000Reader(Reader in)
in
- The Reader to read frompublic MDLV2000Reader(Reader in, IChemObjectReader.Mode mode)
@TestMethod(value="testGetFormat") public IResourceFormat getFormat()
IChemObjectIO
IResourceFormat
class for this IO class.@TestMethod(value="testSetReader_Reader") public void setReader(Reader input) throws CDKException
IChemObjectReader
CDKException
@TestMethod(value="testSetReader_InputStream") public void setReader(InputStream input) throws CDKException
IChemObjectReader
CDKException
@TestMethod(value="testAccepts") public boolean accepts(Class<? extends IChemObject> classObject)
IChemObjectIO
IChemObject
can be read or written.classObject
- IChemObject
of which is tested if it can be handled.IChemObject
can be handled.public <T extends IChemObject> T read(T object) throws CDKException
object
- The object that subclasses
IChemObjectCDKException
@TestMethod(value="testClose") public void close() throws IOException
IChemObjectIO
IOException
public void customizeJob()
public IOSetting[] getIOSettings()
IChemObjectIO
IOSetting
s defined by this IChemObjectIO class.getIOSettings
in interface IChemObjectIO
getIOSettings
in class DefaultChemObjectReader
IOSetting
s for this class.