Class MolImporter
- All Implemented Interfaces:
MoleculeImporterIface
,Closeable
,AutoCloseable
,Iterable<Molecule>
The input file format is guessed automatically or specified as an import option to the constructor. Many different formats are supported like "mol", "rgf", "sdf", "rdf", "csmol", "csrgf", "cssdf", "csrdf", "mol2", "cml", "mrv", "smiles", "cxsmiles", "pdb", "xyz", "cube", "name". For more information on formats, please visit File Formats in Marvin. MolImporter can also import gzip compressed and base64 encoded structures.
The processing is single-threaded by default. Concurrent mode can be enabled using setThreadCount(int)
.
Serialized Molecule objects can also be imported using the "chemaxon.struc.Molecule" format. In this case, processing is always single-threaded, regardless of the configured thread count.
-
Constructor Summary
ConstructorDescriptionMolImporter
(File f) Create a molecule importer for a file.MolImporter
(File f, String opts) Create a molecule importer for a file.Create a molecule importer for an input stream.MolImporter
(InputStream is, String opts) Create a molecule importer for an input stream.MolImporter
(InputStream is, String opts, String enc) Create a molecule importer for an input stream.MolImporter
(InputStream is, String opts, String enc, String fileName) Create a molecule importer for an input stream.MolImporter
(String fname) Create a molecule importer for a file.MolImporter
(String fname, Component component, String msg) Create a molecule importer with a progress monitor.MolImporter
(String fname, Object component, String msg) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the underlying input stream.Deprecated, for removal: This API element is subject to removal in a future version.As of 23.15, no replacementint
Estimates the total number of records.getFile()
Gets the file object for the input.Gets the name of the input fileGet the file format.Gets the global properties in a container that was retrieved from the input stream, earlier.Gets the last grabbed molecule string with LF style line endings by default.int
Gets the current line number.Creates an MDocument Stream with the iterator of the importer.Creates a Molecule Stream with the iterator of the importer.Gets the import options.boolean
Gets query mode.int
Gets the current record number.int
Gets the total number of records read.static MDocument
importDoc
(byte[] b) Reads a document from a byte array.static MDocument
Reads a document from a byte array.static Molecule
importMol
(byte[] b) Read a molecule from a byte array.static boolean
Deprecated, for removal: This API element is subject to removal in a future version.As of 23.15, useimportMol(byte[])
insteadstatic Molecule
Read a molecule from a byte array.static boolean
Deprecated, for removal: This API element is subject to removal in a future version.As of 23.15, useimportMol(byte[], String, String)
insteadstatic Molecule
Read a molecule from a string.static Molecule
importMol
(String s, ImportOptions options) Read a molecule from a string with the given options.static boolean
Deprecated, for removal: This API element is subject to removal in a future version.As of 23.15, useimportMol(String)
insteadstatic Molecule
Read a molecule from a string.static Molecule
Deprecated, for removal: This API element is subject to removal in a future version.(Since Marvin 5.5) There is no need to specify an encoding for a String input.static boolean
Deprecated, for removal: This API element is subject to removal in a future version.(Since Marvin 5.5) There is no need to specify an encoding for a String input.boolean
Tests whether the end of input is already reached.boolean
Deprecated, for removal: This API element is subject to removal in a future version.as of Marvin 6.2.boolean
Are the imported molecules merged into one multi-set molecule?boolean
Are the imported molecules merged into one multi-set molecule?boolean
Tests whether rewinding (seeking backwards) is possible in the underlying input stream.nextDoc()
Reads the next document.static MDocument
Deprecated, for removal: This API element is subject to removal in a future version.No longer supported, useimportMol(byte[])
instead.read()
Read the next molecule.boolean
Deprecated, for removal: This API element is subject to removal in a future version.as of Marvin 14.7.7.Deprecated, for removal: This API element is subject to removal in a future version.as of Marvin 14.7.7.Reads the next molecule in text format without creating aMolecule
object.void
seekRecord
(int k, MProgressMonitor pmon) Seek the specified record.protected void
seekVisitedRecord
(int k) Seeks an already visited position in case of rewindable input.void
setGrabbingEnabled
(boolean v) Deprecated, for removal: This API element is subject to removal in a future version.as of Marvin 6.2.void
setQueryMode
(boolean q) Sets query mode.void
setThreadCount
(int threadCount) Sets the number of threads for concurrent processing.boolean
Skips the next molecule or document instead of reading it into memory.long
tell()
Returns the current file offset.Methods inherited from class chemaxon.marvin.io.MDocSource
getDocLabel, getMoleculeIterator, iterator, seekForward, seekRecordAtFraction, skipRecords
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
MolImporter
Create a molecule importer for an input stream. Begins reading the input stream and determines the file format.- Parameters:
is
- the input stream to read- Throws:
IOException
- If I/O error occurred when determining the file format.MolFormatException
- If the molecule file is in a format that cannot be readIllegalCharsetNameException
- if illegal encoding is usedUnsupportedCharsetException
- if unsupported encoding is used
-
MolImporter
Create a molecule importer for an input stream. Begins reading the input stream and determines the file format. If the option string starts with the substring "MULTISET", then all the molecules in the stream are merged into one molecule object containing multiple atom sets. If it starts with "MOLMOVIE", then molecules are read taken to be frames of a molecule movie (default in XYZ format). If it starts with "NOMOLMOVIE", then multimolecule XYZ files are not interpreted as molecule movies. Other parts of the option string are passed to the import module. The input character encoding can also be set in "enc{encoding}" form.- Parameters:
is
- the input stream to readopts
- the file format and/or options separated by a colon; usenull
for automatic format recognition and default options- Throws:
IOException
- If I/O error occurred when determining the file format.MolFormatException
- If the molecule file is in a format that cannot be readIllegalCharsetNameException
- if illegal encoding is usedUnsupportedCharsetException
- if unsupported encoding is used
-
MolImporter
Create a molecule importer for an input stream. Begins reading the input stream and determines the file format. If the option string starts with the substring "MULTISET", then all the molecules in the stream are merged into one molecule object containing multiple atom sets. If it starts with "MOLMOVIE", then molecules are read taken to be frames of a molecule movie (default in XYZ format). If it starts with "NOMOLMOVIE", then multimolecule XYZ files are not interpreted as molecule movies. Other parts of the option string are passed to the import module. The input character encoding can also be set in "enc{encoding}" form.- Parameters:
is
- the input stream to readopts
- the file format and/or options separated by a colon; usenull
for automatic format recognition and default optionsenc
- charset name ornull
- Throws:
IOException
- If I/O error occurred when determining the file format.MolFormatException
- If the molecule file is in a format that cannot be readIllegalCharsetNameException
- if illegal encoding is usedUnsupportedCharsetException
- if unsupported encoding is used- Since:
- Marvin 3.5.5, 01/02/2006
-
MolImporter
public MolImporter(InputStream is, String opts, String enc, String fileName) throws IOException, MolFormatException Create a molecule importer for an input stream. Begins reading the input stream and determines the file format. If the option string starts with the substring "MULTISET", then all the molecules in the stream are merged into one molecule object containing multiple atom sets. If it starts with "MOLMOVIE", then molecules are read taken to be frames of a molecule movie (default in XYZ format). If it starts with "NOMOLMOVIE", then multimolecule XYZ files are not interpreted as molecule movies. Other parts of the option string are passed to the import module. The input character encoding can also be set in "enc{encoding}" form.- Parameters:
is
- the input stream to readopts
- the file format and/or options separated by a colon; usenull
for automatic format recognition and default optionsenc
- charset name ornull
fileName
- the original filename the stream is reading from- Throws:
IOException
- If I/O error occurred when determining the file format.MolFormatException
- If the molecule file is in a format that cannot be readIllegalCharsetNameException
- if illegal encoding is usedUnsupportedCharsetException
- if unsupported encoding is used- Since:
- Marvin 5.8
-
MolImporter
Create a molecule importer for a file. Begins reading the input stream and determines the file format. If the option string starts with the substring "MULTISET", then all the molecules in the stream are merged into one molecule object containing multiple atom sets. If it starts with "MOLMOVIE", then molecules are read taken to be frames of a molecule movie (default in XYZ format). If it starts with "NOMOLMOVIE", then multimolecule XYZ files are not interpreted as molecule movies. The input character encoding can also be set in "enc{encoding}" form. Other parts of the option string are passed to the import module.- Parameters:
f
- the file to readopts
- the file format and/or options separated by a colon; usenull
for automatic format recognition and default options- Throws:
IOException
- If I/O error occurred when determining the file format.MolFormatException
- If the molecule file is in a format that cannot be readIllegalCharsetNameException
- if illegal encoding is usedUnsupportedCharsetException
- if unsupported encoding is used- See Also:
-
MolImporter
Create a molecule importer for a file. Begins reading the input stream and determines the file format. If the option string starts with the substring "MULTISET", then all the molecules in the stream are merged into one molecule object containing multiple atom sets. If it starts with "MOLMOVIE", then molecules are read taken to be frames of a molecule movie (default in XYZ format). If it starts with "NOMOLMOVIE", then multimolecule XYZ files are not interpreted as molecule movies. The input character encoding can also be set in "enc{encoding}" form. Other parts of the option string are passed to the import module.- Parameters:
f
- the file to read- Throws:
IOException
- If I/O error occurred when determining the file format.MolFormatException
- If the molecule file is in a format that cannot be readIllegalCharsetNameException
- if illegal encoding is usedUnsupportedCharsetException
- if unsupported encoding is used- Since:
- Marinv 6.3
- See Also:
-
MolImporter
Create a molecule importer for a file. Begins reading the input stream and determines the file format. The filename string can contain options in the "file{options}" form. If the option string starts with the substring "MULTISET", then all the molecules in the stream are merged into one molecule object containing multiple atom sets. If it starts with "MOLMOVIE", then molecules are read taken to be frames of a molecule movie (default in XYZ format). If it starts with "NOMOLMOVIE", then multimolecule XYZ files are not interpreted as molecule movies. Other parts of the option string are passed to the import module. The input character encoding can also be set in "enc{encoding}" form.- Parameters:
fname
- name of the file to read- Throws:
IOException
- If I/O error occurred when determining the file format.MolFormatException
- If the molecule file is in a format that cannot be readIllegalCharsetNameException
- if illegal encoding is usedUnsupportedCharsetException
- if unsupported encoding is used- See Also:
-
MolImporter
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public MolImporter(String fname, Object component, String msg) throws IOException, MolFormatException Deprecated, for removal: This API element is subject to removal in a future version.UseMolImporter(String, Component, String)
instead.Create a molecule importer with a progress monitor. Begins reading the input stream and determines the file format. The filename string can contain options in the "file{options}" form. If the option string starts with "MULTISET" or "MULTISET,", then all the molecules in the stream are merged into one molecule object containing multiple atom sets. The input character encoding can also be set in "enc{encoding}" form. Other parts of the option string are passed to the import module.- Parameters:
fname
- name of the file to readcomponent
- the parent componentmsg
- displayed message, where %p is replaced by the file path- Throws:
IOException
- If I/O error occurred when determining the file format.MolFormatException
- If the molecule file is in a format that cannot be readIllegalCharsetNameException
- if illegal encoding is usedUnsupportedCharsetException
- if unsupported encoding is used- See Also:
-
MolImporter
public MolImporter(String fname, Component component, String msg) throws IOException, MolFormatException Create a molecule importer with a progress monitor. Begins reading the input stream and determines the file format. The filename string can contain options in the "file{options}" form. If the option string starts with "MULTISET" or "MULTISET,", then all the molecules in the stream are merged into one molecule object containing multiple atom sets. The input character encoding can also be set in "enc{encoding}" form. Other parts of the option string are passed to the import module.- Parameters:
fname
- name of the file to readcomponent
- the parent componentmsg
- displayed message, where %p is replaced by the file path- Throws:
IOException
- If I/O error occurred when determining the file format.MolFormatException
- If the molecule file is in a format that cannot be readIllegalCharsetNameException
- if illegal encoding is usedUnsupportedCharsetException
- if unsupported encoding is used- See Also:
-
-
Method Details
-
getFileName
Gets the name of the input file- Returns:
- the name of the input file
-
getFile
Gets the file object for the input.- Returns:
- the File or null (if the input is not a File)
-
getOptions
Gets the import options.- Returns:
- the options
-
getMolImportModule
-
isGrabbingEnabled
Deprecated, for removal: This API element is subject to removal in a future version.as of Marvin 6.2. It has no effect on the code.Tests whether molecule file content grabbing is enabled.- Returns:
true
if enabled,false
if disabled- Since:
- 4.0, 01/05/2005
-
setGrabbingEnabled
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void setGrabbingEnabled(boolean v) Deprecated, for removal: This API element is subject to removal in a future version.as of Marvin 6.2. It has no effect on the code.Enables or disables molecule file content grabbing.- Parameters:
v
-true
enables,false
disables it- Since:
- 4.0, 01/05/2005
-
getGrabbedMoleculeString
Gets the last grabbed molecule string with LF style line endings by default. If the "noLF" import option was set for MolImporter, then original line endings are kept. E.g. new MolImporter(stream, "mrv:noLF");- Returns:
- the molecule as a string
- Since:
- 4.0, 01/05/2005
-
isMultiSet
public boolean isMultiSet()Are the imported molecules merged into one multi-set molecule?- Returns:
true
if the input is a multi-set molecule
-
isMolMovie
public boolean isMolMovie()Are the imported molecules merged into one multi-set molecule?- Returns:
true
if the input is a multi-set molecule- Since:
- Marvin 5.2, 02/12/2009
-
getMolStream
Creates a Molecule Stream with the iterator of the importer. Only one iterator can exist at a time, so only one stream can exist at a time.- Specified by:
getMolStream
in interfaceMoleculeImporterIface
- Overrides:
getMolStream
in classMDocSource
-
getMDocumentStream
Creates an MDocument Stream with the iterator of the importer. Only one iterator can exist at a time, so only one stream can exist at a time.- Specified by:
getMDocumentStream
in interfaceMoleculeImporterIface
- Overrides:
getMDocumentStream
in classMDocSource
-
setThreadCount
Sets the number of threads for concurrent processing. The default value is 1 (single-threaded mode).In concurrent mode, multiple threads are started in the background, which adds a considerable overhead to the processing, so only use this mode if the number of molecules is huge. In single-threaded mode, no background thread is used, every action is done on the caller thread.
- Parameters:
threadCount
- the number of threads, set0
for the number of CPUs,1
for single-threaded mode- Throws:
IllegalStateException
- if concurrent processing is already started or if object input stream is used instead of record importer- Since:
- Marvin 5.3
-
getQueryMode
public boolean getQueryMode()Gets query mode. SMILES strings are imported as SMARTS if query mode is set.- Returns:
- query mode
- Since:
- Marvin 3.3, 11/14/2003
-
setQueryMode
public void setQueryMode(boolean q) Sets query mode. SMILES strings are imported as SMARTS if query mode is set.- Parameters:
q
- query mode- Since:
- Marvin 3.3, 11/14/2003
-
read
Read the next molecule.- Specified by:
read
in interfaceMoleculeImporterIface
- Returns:
- the next molecule, or
null
at end of file - Throws:
IOException
- If I/O error occurred
-
createMol
Deprecated, for removal: This API element is subject to removal in a future version.As of 23.15, no replacementCreates a target molecule object for import.- Returns:
- new target molecule object
- Since:
- Marvin 3.4, 05/08/2004
-
nextDoc
Reads the next document.- Specified by:
nextDoc
in classMDocSource
- Returns:
- the next document or
null
at end of file - Throws:
IOException
- If I/O error occurred- Since:
- Marvin 4.1, 04/14/2006
-
readMol
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public Molecule readMol(Molecule mol) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.as of Marvin 14.7.7. useread()
insteadRead the next molecule. All the nodes, edges, and properties are removed from mol before reading. If the 'mol' parameter is notnull
then processing is single-threaded.- Parameters:
mol
- target molecule object- Returns:
- the molecule if success,
null
at end of file - Throws:
IOException
- If I/O error occurred
-
read
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public boolean read(Molecule mol) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.as of Marvin 14.7.7. useread()
insteadRead the next molecule. All the nodes, edges, and properties are removed from mol before reading. If the 'mol' parameter is notnull
then the processing is single-threaded. This method requires the parameter 'mol' molecule to be created with MolImporter.createMol() method.- Parameters:
mol
- target molecule object- Returns:
true
after success,false
at end of file- Throws:
IOException
- If I/O error occurred
-
skipRecord
Skips the next molecule or document instead of reading it into memory.- Specified by:
skipRecord
in classMDocSource
- Returns:
true
if the end of molecule is found,false
if there is no chance to continue- Throws:
IOException
- if read error occurred- Since:
- Marvin 4.1, 04/20/2006
-
readRecordAsText
Reads the next molecule in text format without creating aMolecule
object. Processing is single-threaded.- Returns:
- the grabbed record in its original format or
null
at end of file - Throws:
MRecordParseException
- If the record could not be parsedMolExportException
- if binary data cannot be exported to MRV format textIOException
- if read error occurred- Since:
- Marvin 5.0, 11/13/2006
-
isRewindable
public boolean isRewindable()Tests whether rewinding (seeking backwards) is possible in the underlying input stream. In concurrent mode always returnsfalse
. Therefore this method should not be called before callingsetThreadCount(int)
.- Specified by:
isRewindable
in classMDocSource
- Returns:
true
if rewinding is possible,false
otherwise- Since:
- Marvin 4.1, 04/20/2006
- See Also:
-
seekRecord
Seek the specified record. This method should not be called before callingsetThreadCount(int)
. Backward seeking (rewinding) in the stream is only possible if the underlying input stream is seekable. Note, that in concurrent mode this is not true, the import is not rewindable. Forward seeking is always possible. Seeking terminates before reaching the specified position if the usercancels
the progress dialog.- Specified by:
seekRecord
in classMDocSource
- Parameters:
k
- positionpmon
- progress monitor ornull
- Throws:
EOFException
- if end of file reached while trying to seekIOException
- if read error occurred- Since:
- Marvin 4.1, 04/19/2006
- See Also:
-
seekVisitedRecord
Seeks an already visited position in case of rewindable input. This method should not be called before callingsetThreadCount(int)
.- Specified by:
seekVisitedRecord
in classMDocSource
- Parameters:
k
- the record index- Throws:
IOException
- if read error occurred- Since:
- Marvin 4.1, 06/28/2006
- See Also:
-
isEndReached
public boolean isEndReached()Tests whether the end of input is already reached.- Specified by:
isEndReached
in classMDocSource
- Returns:
true
if the end was reached,false
otherwise- Since:
- Marvin 4.1, 06/18/2006
-
estimateNumRecords
public int estimateNumRecords()Estimates the total number of records. If the end of file is already reached, then it returns the exact value. Otherwise, in case of a file with known length, it extrapolates from the last read record index and the value of the file pointer at the last read position. If the input is a stream with unknown total length, then it returns two times the current highest record number.- Specified by:
estimateNumRecords
in classMDocSource
- Returns:
- estimated number of records or -1 at the beginning of file
- Since:
- Marvin 4.1, 04/18/2006
-
tell
Returns the current file offset.- Returns:
- the file pointer
- Throws:
IOException
- if the position cannot be determined
-
getLineCount
public int getLineCount()Gets the current line number. This method should not be called before callingsetThreadCount(int)
.- Returns:
- the line number
- See Also:
-
getRecordCount
public int getRecordCount()Gets the current record number.- Specified by:
getRecordCount
in classMDocSource
- Returns:
- the record number
- Since:
- Marvin 4.1, 04/18/2006
-
getRecordCountMax
public int getRecordCountMax()Gets the total number of records read.- Specified by:
getRecordCountMax
in classMDocSource
- Returns:
- the number of records
- Since:
- Marvin 4.1, 04/18/2006
-
close
Close the underlying input stream. IMPORTANT: call this after reading molecules to close concurrent processing properly.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceMoleculeImporterIface
- Overrides:
close
in classMDocSource
- Throws:
IOException
- If an I/O error has occurred.
-
getFormat
Get the file format.- Returns:
- "mrv", "mol", "csmol", "sdf", "cssdf", "rdf", "csrdf", "smiles", "sybyl", "mol2", "pdb", "xyz", "cube", "inchi", "gzip:{inner file format}" or "chemaxon.struc.Molecule" if imported from ObjectInputStream (serialized molecule)
-
importMol
Read a molecule from a byte array. If the array contains multiple molecules (it is an SDfile for example), read only the first one. Processing is single-threaded.- Parameters:
b
- the molecule file contents- Returns:
- the molecule
- Throws:
MolFormatException
- If the molecule file is in a format that cannot be read
-
importMol
Read a molecule from a byte array. If the array contains multiple molecules (it is an SDfile for example), read only the first one. Processing is single-threaded.- Parameters:
b
- the molecule file contentsopts
- the file format and/or options separated by a colon; usenull
for automatic format recognition and default optionsenc
- encoding ornull
- Returns:
- the molecule
- Throws:
MolFormatException
- If the molecule file is in a format that cannot be read- Since:
- Marvin 5.0, 12/27/2007
-
importMol
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public static boolean importMol(byte[] b, Molecule mol) throws MolFormatException Deprecated, for removal: This API element is subject to removal in a future version.As of 23.15, useimportMol(byte[])
insteadRead a molecule from a byte array. If the array contains multiple molecules (it is an SDfile for example), read only the first one. Processing is single-threaded.- Parameters:
b
- the molecule file contentsmol
- target molecule object- Returns:
- true in case of successful reading, false if no more molecules
- Throws:
MolFormatException
- If the molecule file is in a format that cannot be read
-
importMol
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public static boolean importMol(byte[] b, String opts, String enc, Molecule mol) throws MolFormatException Deprecated, for removal: This API element is subject to removal in a future version.As of 23.15, useimportMol(byte[], String, String)
insteadRead a molecule from a byte array. If the array contains multiple molecules (it is an SDfile for example), read only the first one. Processing is single-threaded.- Parameters:
b
- the molecule file contentsopts
- the file format and/or options separated by a colon; usenull
for automatic format recognition and default optionsenc
- encoding ornull
mol
- target molecule object- Returns:
- true in case of successful reading, false if no more molecules
- Throws:
MolFormatException
- If the molecule file is in a format that cannot be read- Since:
- Marvin 5.0, 12/27/2007
-
importDoc
Reads a document from a byte array. If the array contains multiple molecules (it is an SDfile for example), read only the first one. Processing is single-threaded.- Parameters:
b
- the file contents- Returns:
- the document or
null
if no document found in input - Throws:
MolFormatException
- If the molecule file is in a format that cannot be read- Since:
- Marvin 4.1.8, 04/20/2007
-
importDoc
Reads a document from a byte array. If the array contains multiple molecules (it is an SDfile for example), read only the first one. Processing is single-threaded.- Parameters:
b
- the file contentsopts
- the file format and/or options separated by a colon; usenull
for automatic format recognition and default optionsenc
- encoding ornull
- Returns:
- the document or
null
if no document found in input - Throws:
MolFormatException
- If the molecule file is in a format that cannot be read- Since:
- Marvin 5.0, 12/27/2007
-
importMol
Read a molecule from a string. If the string contains multiple molecules (it is an SDfile for example), read only the first one. If the format is known, it is faster to useimportMol(String, String)
to avoid wasting time with format recognition. Processing is single-threaded.- Parameters:
s
- the molecule file contents- Returns:
- the molecule
- Throws:
MolFormatException
- If the molecule file is in a format that cannot be read
-
importMol
Read a molecule from a string. If the string contains multiple molecules (it is an SDfile for example), read only the first one. Processing is single-threaded.- Parameters:
s
- the molecule file contentsopts
- the file format and/or options separated by a colon; usenull
for automatic format recognition and default options- Returns:
- the molecule
- Throws:
MolFormatException
- If the molecule file is in a format that cannot be read
-
importMol
Read a molecule from a string with the given options. If the string contains multiple molecules (it is an SDfile for example), read only the first one. Processing is single-threaded. If an encoding is specified in the option, its value will not be used since the input is a string which can not be encoded.- Parameters:
s
- the molecule file contentsoptions
- options defined by an options object- Returns:
- the molecule
- Throws:
MolFormatException
- If the molecule file is in a format that cannot be read
-
importMol
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public static Molecule importMol(String s, String opts, String enc) throws MolFormatException Deprecated, for removal: This API element is subject to removal in a future version.(Since Marvin 5.5) There is no need to specify an encoding for a String input. Instead, if you have a String to import, callimportMol(String, String)
; if you have a byte array, callimportMol(byte[], String, String)
.Read a molecule from a string. If the string contains multiple molecules (it is an SDfile for example), read only the first one. Processing is single-threaded.- Parameters:
s
- the molecule file contentsopts
- the file format and/or options separated by a colon; usenull
for automatic format recognition and default optionsenc
- encoding ornull
- Returns:
- the molecule
- Throws:
MolFormatException
- If the molecule file is in a format that cannot be read- Since:
- Marvin 5.0, 12/27/2007
-
importMol
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public static boolean importMol(String s, Molecule mol) throws MolFormatException Deprecated, for removal: This API element is subject to removal in a future version.As of 23.15, useimportMol(String)
insteadRead a molecule from a string. If the string contains multiple molecules (it is an SDfile for example), read only the first one. Processing is single-threaded.- Parameters:
s
- the file contentsmol
- target molecule object- Returns:
- true in case of successful reading, false if no more molecules
- Throws:
MolFormatException
- If the molecule file is in a format that cannot be read
-
importMol
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public static boolean importMol(String s, String opts, String enc, Molecule mol) throws MolFormatException Deprecated, for removal: This API element is subject to removal in a future version.(Since Marvin 5.5) There is no need to specify an encoding for a String input. Instead, if you have a String to import, callimportMol(String, String)
; if you have a byte array, callimportMol(byte[], String, String, Molecule)
.Read a molecule from a string. If the string contains multiple molecules (it is an SDfile for example), read only the first one. Processing is single-threaded.- Parameters:
s
- the file contentsopts
- the file format and/or options separated by a colon; usenull
for automatic format recognition and default optionsenc
- encoding ornull
mol
- target molecule object- Returns:
- true in case of successful reading, false if no more molecules
- Throws:
MolFormatException
- If the molecule file is in a format that cannot be read
-
getGlobalProperties
Gets the global properties in a container that was retrieved from the input stream, earlier. Only MRV import supports global properties. Reads them by the initalization of the record importer.- Returns:
- global properties in a container or null.
- Since:
- Marvin 5.0 06/05/2007
-
parseMRV
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public static MDocument parseMRV(String sval) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.No longer supported, useimportMol(byte[])
instead.Parses a document from a string in Marvin Document (MRV) format.- Parameters:
sval
- the string- Returns:
- the imported document
- Throws:
IOException
- Since:
- Marvin 5.8, 08/25/2011
-
MolImporter(String, Component, String)
instead.