chemaxon.descriptors
Class MDSimilarityResultWriter

java.lang.Object
  extended by chemaxon.descriptors.MDSimilarityResultWriter

public abstract class MDSimilarityResultWriter
extends java.lang.Object

Base class for prointing results produced by MDSimilarity.

Since:
JChem 2.0
Author:
Zsuzsanna Szabo

Field Summary
protected  java.util.ArrayList labels
          labels are either SDfile tagnames or table column headers depending on outut
protected  Molecule mol
          the molecular structure
protected  java.io.PrintStream output
          the output stream where results are written to
protected  java.util.ArrayList queryNames
           
protected  MDSimilarity similarity
          the similarity object which the MDSimilarityResultWriter belongs to
protected  boolean verbose
          verbose mode
protected  boolean writesMolecules
          indicates if the result writer is able to output molecular structures
 
Constructor Summary
MDSimilarityResultWriter()
          Creates a MDSimilarityResultWriter object.
 
Method Summary
 void close()
          Closes output.
protected  void count()
          Increments the counter of the results processed.
protected  void createLabels(MDSet cds)
          Creates labels.
 java.lang.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, java.lang.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(java.lang.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 prints Molecules or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

similarity

protected MDSimilarity similarity
the similarity object which the MDSimilarityResultWriter belongs to


output

protected java.io.PrintStream output
the output stream where results are written to


queryNames

protected java.util.ArrayList queryNames

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


labels

protected java.util.ArrayList labels
labels are either SDfile tagnames or table column headers depending on outut

Constructor Detail

MDSimilarityResultWriter

public MDSimilarityResultWriter()
Creates a MDSimilarityResultWriter object.

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 each verboseFreq line processed, a status report is printed

setQueryName

public void setQueryName(int queryIndex,
                         java.lang.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 molecule
queryName - name of the query molecule

writesMolecules

public boolean writesMolecules()
Gets if the object is a sort that prints Molecules or not.

Returns:
true if the writer prints Molecules

getQueryName

public java.lang.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 java.lang.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:
java.lang.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 the MDSimilarity object
passed - 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(java.lang.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 sample MDSet to provide descriptor types