Package chemaxon.descriptors
Class MDSimilarityResultWriter
- java.lang.Object
-
- chemaxon.descriptors.MDSimilarityResultWriter
-
@PublicAPI public abstract class MDSimilarityResultWriter extends Object
Base class for prointing results produced byMDSimilarity
.- Since:
- JChem 2.0
-
-
Field Summary
Fields Modifier and Type Field Description protected List<String>
labels
labels are either SDfile tagnames or table column headers depending on oututprotected Molecule
mol
the molecular structureprotected PrintStream
output
the output stream where results are written toprotected List<String>
queryNames
protected MDSimilarity
similarity
the similarity object which the MDSimilarityResultWriter belongs toprotected boolean
verbose
verbose modeprotected boolean
writesMolecules
indicates if the result writer is able to output molecular structures
-
Constructor Summary
Constructors Constructor Description MDSimilarityResultWriter()
Creates aMDSimilarityResultWriter
object.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
Closes output.protected void
count()
Increments the counter of the results processed.protected void
createLabels(MDSet cds)
Creates labels.String
getQueryName(int queryIndex)
Gets the name of the specified query.void
open(MDSimilarity similarity)
Initializes the object.void
setMolecule(Molecule m)
Sets the molecular structure to be written into the output stream.void
setQueryName(int queryIndex, String queryName)
Sets the name of the specified query compound.void
setVerboseFrequency(int verboseFreq)
Specifies how frequently the status report is printed.void
setVerbosity(boolean verbose)
Sets or clears verbose mode.protected void
verboseMsg(String msg)
Prints the given message if verbosity is on.abstract void
write(MDSet descr, boolean passed)
Processes results of the similarity search.boolean
writesMolecules()
Gets if the object is a sort that printsMolecule
s or not.
-
-
-
Field Detail
-
similarity
protected MDSimilarity similarity
the similarity object which the MDSimilarityResultWriter belongs to
-
output
protected PrintStream output
the output stream where results are written to
-
verbose
protected boolean verbose
verbose mode
-
writesMolecules
protected boolean writesMolecules
indicates if the result writer is able to output molecular structures
-
mol
protected Molecule mol
the molecular structure
-
-
Method Detail
-
setVerbosity
public void setVerbosity(boolean verbose)
Sets or clears verbose mode.- Parameters:
verbose
- indicates if status report messages are printed or not
-
setVerboseFrequency
public void setVerboseFrequency(int verboseFreq)
Specifies how frequently the status report is printed.- Parameters:
verboseFreq
- after eachverboseFreq
line processed, a status report is printed
-
setQueryName
public void setQueryName(int queryIndex, String queryName)
Sets the name of the specified query compound. This name is printed as label to mark the query molecule in ouputs (for instance in table headers).- Parameters:
queryIndex
- index of the query moleculequeryName
- name of the query molecule
-
writesMolecules
public boolean writesMolecules()
Gets if the object is a sort that printsMolecule
s or not.- Returns:
- true if the writer prints
Molecule
s
-
getQueryName
public String getQueryName(int queryIndex)
Gets the name of the specified query.- Parameters:
queryIndex
- index of the query molecule in interest- Returns:
- name of the query molecule
-
open
public void open(MDSimilarity similarity)
Initializes the object. This can be used in derived classes to open output files, write headers etc.- Parameters:
similarity
- object performing the similarity comparisons
-
setMolecule
public void setMolecule(Molecule m) throws RuntimeException
Sets the molecular structure to be written into the output stream. Calling this function will not change the output.- Parameters:
m
- the molecular structure to be written into the SDfile- Throws:
RuntimeException
- if writer is not capable of writing molecules into its output
-
write
public abstract void write(MDSet descr, boolean passed)
Processes results of the similarity search. Writes into a table, file, calculates statistics, performs further processing of filtered descriptors etc. depending on the sub-class.- Parameters:
descr
- descriptor processed by theMDSimilarity
objectpassed
- flag telling whether the descriptor is filetered out or not
-
close
public void close()
Closes output. This can be overriden when footer lines have to be written too.
-
count
protected void count()
Increments the counter of the results processed. If the verbosity frequency limit is reached, a predefined status line is written.
-
verboseMsg
protected void verboseMsg(String msg)
Prints the given message if verbosity is on.- Parameters:
msg
- arbitrary message to be printed
-
createLabels
protected void createLabels(MDSet cds)
Creates labels. A label consists of three part: the name of the query molecule, the name of the descriptor, the name of the metric applied. These three fields are joined with an underscore character.- Parameters:
cds
- a sampleMDSet
to provide descriptor types
-
-