@PublicAPI public class MDFileWriter extends MDWriter
MDSet
)s into text files. The
output file can either be a bunch of descriptor files, in which case
one MDSet
component is associated with one file; or it can also
be an SDfile, in which case custom tags are written along with the molecule
and with its existing tags that store the MolecularDescriptor
s
in a format that MDFileReader
can interpret. MDSet
objects is printed in all files. Always blank space
is used as a separator character. The descriptor file contains two header
lines, the first is the type name of the descriptor, while the second is
the configuration string used in the descriptor generation.Constructor and Description |
---|
MDFileWriter(int nComponents)
Creates a new
MDFileWriter object that
stores MDSet s that have the given number of components. |
MDFileWriter(java.lang.String[] descrNames,
java.lang.String[] types,
MDParameters[] settings)
Creates and initialises a new
MDFileWriter object that
stores MDSet s in the named text files component-wise. |
MDFileWriter(java.lang.String[] descrNames,
java.lang.String[] types,
java.lang.String[] settings)
Creates and initialises a new
MDFileWriter object that
stores MDSet s in the named text files component-wise. |
MDFileWriter(java.lang.String SDfileName,
int nComponents)
Creates and initializes a new
MDFileWriter object that
stores MDSet s in the named SDfile. |
MDFileWriter(java.lang.String SDfileName,
java.lang.String[] descrNames,
java.lang.String[] types,
MDParameters[] settings)
Creates and initializes a new
MDFileWriter object that
stores MDSet s in the named SDfile. |
MDFileWriter(java.lang.String SDfileName,
java.lang.String[] descrNames,
java.lang.String[] types,
java.lang.String[] settings)
Creates and initializes a new
MDFileWriter object that
stores MDSet s in the named SDfile. |
MDFileWriter(java.lang.String descrName,
java.lang.String type,
MDParameters settings)
Creates and initializes a new
MDFileWriter object that
stores MDSet s in the named text file. |
MDFileWriter(java.lang.String descrName,
java.lang.String type,
java.lang.String settings)
Creates and initializes a new
MDFileWriter object that
stores MDSet s in the named text file. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the stream, after that no more operations are permitted.
|
MDParameters |
getMDParameters(int id)
Gets the actual parameter settings of the specified component.
|
MDSet |
getMDSet()
Gets the last molecular descriptor set generated and put into the output
file.
|
void |
put(MDSet ds)
Writes the given
MDSet object into the output files as
readable text. |
void |
put(Molecule mol,
int id)
Generates the
MDSet object from the given molecular
structure and writes result. |
void |
put(Molecule mol,
java.lang.String naturalId)
Generates the
MDSet for the given Molecule
and writes the descriptors into the output with the given identifier. |
void |
setBinaryOutputFormat(boolean binaryOutputFormat)
Sets binary output format.
|
void |
setComponent(int index,
java.lang.String descrName,
java.lang.String type,
MDParameters settings)
Sets an individual
MDSet component's type and corresponding
parameters. |
void |
setComponent(int index,
java.lang.String descrName,
java.lang.String type,
java.lang.String settings)
Sets an individual
MDSet component's type and corresponding
parameters. |
void |
setDecimalOutputFormat(boolean decimalOutputFormat)
Sets decimal output format.
|
void |
setPrintId(boolean printId)
Sets whether unique internal ID-s of structures have to be printed into
the output table.
|
public MDFileWriter(java.lang.String[] descrNames, java.lang.String[] types, MDParameters[] settings) throws MDWriterException
MDFileWriter
object that
stores MDSet
s in the named text files component-wise.
With this constructor the client of this class can feed in
Molecule
s without dealing with details of generating
descriptors.descrNames
- output file namestypes
- class names of componentssettings
- parameter setting of componentMDWriterException
- in case of any failurespublic MDFileWriter(java.lang.String[] descrNames, java.lang.String[] types, java.lang.String[] settings) throws MDWriterException
MDFileWriter
object that
stores MDSet
s in the named text files component-wise.
With this constructor the client of this class can feed in
Molecule
s without dealing with details of generating
descriptors.descrNames
- output file namestypes
- class names of componentssettings
- parameter setting of componentMDWriterException
- in case of any failurespublic MDFileWriter(int nComponents)
MDFileWriter
object that
stores MDSet
s that have the given number of components.
Components have to be specified by calling setComponent()
.nComponents
- number of components of the MDSet
to be writtenpublic MDFileWriter(java.lang.String descrName, java.lang.String type, MDParameters settings) throws MDWriterException
MDFileWriter
object that
stores MDSet
s in the named text file. Use this
constructor when the MDSet
has one component only.descrName
- output file nametype
- class name of the descriptorsettings
- parameter settingMDWriterException
- in case of any failurespublic MDFileWriter(java.lang.String descrName, java.lang.String type, java.lang.String settings) throws MDWriterException
MDFileWriter
object that
stores MDSet
s in the named text file. Use this
constructor when the MDSet
has one component only.descrName
- output file nametype
- class name of the descriptorsettings
- parameter settingMDWriterException
- in case of any failurespublic MDFileWriter(java.lang.String SDfileName, int nComponents)
MDFileWriter
object that
stores MDSet
s in the named SDfile. Descriptors generated
are also stored as readable strings in custom SDf tags.
Components have to be specified by calling setComponent()
.SDfileName
- the name of the output SDFilenComponents
- number of components of the MDSet
public MDFileWriter(java.lang.String SDfileName, java.lang.String[] descrNames, java.lang.String[] types, MDParameters[] settings)
MDFileWriter
object that
stores MDSet
s in the named SDfile. Descriptors generated
are also stored as readable strings in custom SDf tags. All components
of the descriptor set is specified by type and parameter settings.SDfileName
- the name of the output SDFiledescrNames
- output file namestypes
- class names of componentssettings
- parameter setting of componentpublic MDFileWriter(java.lang.String SDfileName, java.lang.String[] descrNames, java.lang.String[] types, java.lang.String[] settings)
MDFileWriter
object that
stores MDSet
s in the named SDfile. Descriptors generated
are also stored as readable strings in custom SDf tags. All components
of the descriptor set is specified by type and parameter settings.SDfileName
- the name of the output SDFiledescrNames
- output file namestypes
- class names of componentssettings
- parameter settings stringspublic void setDecimalOutputFormat(boolean decimalOutputFormat)
decimalOutputFormat
- indicates if decimal format is writtenpublic void setBinaryOutputFormat(boolean binaryOutputFormat)
binaryOutputFormat
- indicates if binary format is writtenpublic void setComponent(int index, java.lang.String descrName, java.lang.String type, MDParameters settings)
MDSet
component's type and corresponding
parameters. Use this method, when descriptor tytpe have not been
specified in the constructor.index
- index of the MDSet
componentdescrName
- output file nametype
- class name of the descriptorsettings
- parameter settingpublic void setComponent(int index, java.lang.String descrName, java.lang.String type, java.lang.String settings)
MDSet
component's type and corresponding
parameters. Use this method, when descriptor tytpe have not been
specified in the constructor.index
- index of the MDSet
componentdescrName
- output file nametype
- class name of the descriptorsettings
- parameters stringpublic void setPrintId(boolean printId)
printId
- unique id-s are printed or notpublic MDParameters getMDParameters(int id)
getMDParameters
in class MDWriter
id
- component indexpublic MDSet getMDSet()
MDSet
public void put(MDSet ds) throws MDWriterException
MDSet
object into the output files as
readable text.ds
- MDSet
to be printedMDWriterException
- inherited, never thrownpublic void put(Molecule mol, int id) throws MDWriterException
MDSet
object from the given molecular
structure and writes result. The descriptors are either written into
the descriptor output file (as readable text) or into an SDfile as tags.
these two modes of operation depend on how the MDFileWriter
object was created.put
in class MDWriter
mol
- generate MDSet
for this structureid
- the id of the descriptors in the outputMDWriterException
- inherited, never thrownpublic void put(Molecule mol, java.lang.String naturalId) throws MDWriterException
MDSet
for the given Molecule
and writes the descriptors into the output with the given identifier.
Note, that the mol
parameter is not final, because
descriptors generated are stored in this object (as properties).mol
- the Molecule
object to be writtennaturalId
- unique identifier of the molecule as given on inputMDWriterException
- all exceptions (mainly io) are reinterpretedpublic void close() throws MDWriterException
close
in class MDWriter
MDWriterException
- all exceptions (mainly io) are reinterpreted