chemaxon.util
Class HitDisplayTool

java.lang.Object
  extended by chemaxon.util.HitDisplayTool
All Implemented Interfaces:
chemaxon.license.Licensable, SearchConstants

public class HitDisplayTool
extends java.lang.Object
implements SearchConstants, chemaxon.license.Licensable

Class for displaying hit results with hit coloring, alignment, partial clean, etc. E.g.

  HitColoringAndAlignmentOptions hco = new HitColoringAndAlignmentOptions();
  hco.coloring = true;
  hco.alignmentMode = align;
  hco.markushDisplayMode = //set the desired markush display mode
  MolSearchOptions mso = ... //get you search options
  Molecule query = ... //get your query
  HitDisplayTool hdt = new HitDisplayTool(hco, mso, null, query);
  
  //retrieve all hits:
  Molecule[] hits = hdt.getHits(m, (Molecule) null, 0);
  
  //or retrieve the hits one-by-one:
  HitDisplayTool hdt2 = new HitDisplayTool(hco, mso, null, query);
  hdt2.setTarget(m);
  ArrayList hitList = new ArrayList();
  Molecule hit = hdt2.getNextHit();
  while(hit!=null) {
        hitList.add(hit);
        hit = hdt2.getNextHit();
  }
  
  

Since:
JChem 5.0
Author:
Szilard Dorant, Vencel Bors Date: Nov 04, 2010
See Also:
VisualizationExample.java

Field Summary
static int HIT_ATOM_SET
          Set identifier for hit atoms
static int HIT_BOND_SET
          Set identifier for hit bonds
static int NON_HIT_ATOM_SET
          Set identifier for non-hit atoms
static int NON_HIT_BOND_SET
          Set identifier for non hit bonds
 
Fields inherited from interface chemaxon.sss.SearchConstants
ABS_STEREO_ALWAYS_ON, ABS_STEREO_CHIRAL_FLAG, ABS_STEREO_TABLE_OPTION, ATTACHED_DATA_MATCH_EXACT, ATTACHED_DATA_MATCH_GENERAL, ATTACHED_DATA_MATCH_IGNORE, CHARGE_MATCHING_DEFAULT, CHARGE_MATCHING_EXACT, CHARGE_MATCHING_IGNORE, DEFAULT_DISSIMILARITY_THRESHOLD, DEFAULT_SEARCHTYPE, DISSIMILARITY_PROPERTY_NAME, DUPLICATE, FULL, FULL_FRAGMENT, HCOUNT_MATCHING_AUTO, HCOUNT_MATCHING_EQUAL, HCOUNT_MATCHING_GREATER_OR_EQUAL, HIT_EXCLUDEDQ, HIT_LP, HIT_MULTICENTER, HIT_NON_R, HIT_ORDERING_NONE, HIT_ORDERING_UNDEF_R_MATCHING_GROUP_FIRST, HIT_R, HIT_R_EMPTY_MATCH, HIT_UNMAPABLE, IMPLICIT_H_MATCHING_DEFAULT, IMPLICIT_H_MATCHING_DISABLED, IMPLICIT_H_MATCHING_ENABLED, IMPLICIT_H_MATCHING_IGNORE, ISOTOPE_MATCHING_DEFAULT, ISOTOPE_MATCHING_EXACT, ISOTOPE_MATCHING_IGNORE, MARKUSH_AROM_FINAL_CHECK, MARKUSH_AROM_NO_FINAL_CHECK, MARKUSH_AROM_OFF, MARKUSH_HIT_INNER, MARKUSH_HIT_ORIGINAL, MARKUSH_MCS, MATCH_COUNT_BETWEEN, MATCH_COUNT_RELATION, NO_ABAS, NO_SCREEN, RADICAL_MATCHING_DEFAULT, RADICAL_MATCHING_EXACT, RADICAL_MATCHING_IGNORE, SEARCH_MODE_NAMES, SEARCH_OPTIONS_LENGTH, SIMILARITY, STEREO_DIASTEREOMER, STEREO_ENANTIOMER, STEREO_EXACT, STEREO_IGNORE, STEREO_MODEL_COMPREHENSIVE, STEREO_MODEL_DEFAULT, STEREO_MODEL_GLOBAL, STEREO_MODEL_LOCAL, STEREO_SPECIFIC, SUBSTRUCTURE, SUPERSTRUCTURE, TAUTOMER_SEARCH_DEFAULT, TAUTOMER_SEARCH_OFF, TAUTOMER_SEARCH_ON, UNDEF_R_MATCHING_ALL, UNDEF_R_MATCHING_GROUP, UNDEF_R_MATCHING_GROUP_H, UNDEF_R_MATCHING_GROUP_H_EMPTY, UNDEF_R_MATCHING_UNDEF_R, VAGUE_BOND_DEFAULT, VAGUE_BOND_LEVEL_HALF, VAGUE_BOND_LEVEL1, VAGUE_BOND_LEVEL2, VAGUE_BOND_LEVEL3, VAGUE_BOND_LEVEL4, VAGUE_BOND_OFF
 
Constructor Summary
HitDisplayTool(HitColoringAndAlignmentOptions options, MolSearchOptions searchOptions, Standardizer standardizer, Molecule query)
          Constructor.
 
Method Summary
 Molecule getHit(Molecule targetMol)
          Processes the next target structure.
 java.util.ArrayList<int[]> getHitIndexes()
          Returns the hit indexes for the last target.
 Molecule[] getHits(int maxHitCountIn)
          Processes the next target structure.
 Molecule[] getHits(Molecule targetMol, byte[] markushSource, int maxHitCount)
          Processes the next target structure.
 Molecule[] getHits(Molecule targetMol, Molecule markush, int maxHitCount)
          Processes the next target structure.
 Molecule getNextHit()
          Gets the next hit.
 boolean isLicensed()
           
 void setLicenseEnvironment(java.lang.String env)
           
 void setMoleculeMarkushSourceTarget(Molecule targetMol, byte[] markushSource)
          Sets the target structure.
 void setTarget(Molecule targetMol)
          Sets the target structure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HIT_ATOM_SET

public static final int HIT_ATOM_SET
Set identifier for hit atoms

See Also:
Constant Field Values

NON_HIT_ATOM_SET

public static final int NON_HIT_ATOM_SET
Set identifier for non-hit atoms

See Also:
Constant Field Values

HIT_BOND_SET

public static final int HIT_BOND_SET
Set identifier for hit bonds

See Also:
Constant Field Values

NON_HIT_BOND_SET

public static final int NON_HIT_BOND_SET
Set identifier for non hit bonds

See Also:
Constant Field Values
Constructor Detail

HitDisplayTool

public HitDisplayTool(HitColoringAndAlignmentOptions options,
                      MolSearchOptions searchOptions,
                      Standardizer standardizer,
                      Molecule query)
Constructor.

Parameters:
options - options for coloring and alignment
searchOptions - search options
standardizer - this Standardizer will be used during the search process, or null for only aromatization.
query - the query structure
Method Detail

getHit

public Molecule getHit(Molecule targetMol)
                throws chemaxon.sss.search.SearchException,
                       chemaxon.enumeration.supergraph.SupergraphException
Processes the next target structure.

Parameters:
targetMol - the target
Returns:
the structure to be displayed, or null if there was no hit
Throws:
chemaxon.sss.search.SearchException - error during searching
chemaxon.enumeration.supergraph.SupergraphException - if target is a markush structure but is erroneous

getHits

public Molecule[] getHits(Molecule targetMol,
                          byte[] markushSource,
                          int maxHitCount)
                   throws MolFormatException,
                          chemaxon.enumeration.supergraph.SupergraphException,
                          chemaxon.sss.search.SearchException
Processes the next target structure.

Parameters:
targetMol - the target
markushSource - a markush structure can be specified here, or null. The proper byte[] can be obtained from the database cd_markush field.
maxHitCount - specify 0 to get back all the hits found, or an arbitrary limit.
Specify -1 to get back only a single hit, the best fitting is returned in case of alignment (default).
Returns:
the structures to be displayed, or a zero sized array if there were no hits
Throws:
MolFormatException
chemaxon.enumeration.supergraph.SupergraphException
chemaxon.sss.search.SearchException

getHits

public Molecule[] getHits(Molecule targetMol,
                          Molecule markush,
                          int maxHitCount)
                   throws chemaxon.enumeration.supergraph.SupergraphException,
                          chemaxon.sss.search.SearchException
Processes the next target structure.

Parameters:
targetMol - the target
markush - a markush structure can be specified here, or null
maxHitCount - specify 0 to get back all the hits found, or an arbitrary limit.
Specify -1 to get back only a single hit, the best fitting is returned in case of alignment (default).
Returns:
the structures to be displayed, or a zero sized array if there were no hits
Throws:
chemaxon.enumeration.supergraph.SupergraphException
chemaxon.sss.search.SearchException

setTarget

public void setTarget(Molecule targetMol)
Sets the target structure.

Parameters:
targetMol - the target

setMoleculeMarkushSourceTarget

public void setMoleculeMarkushSourceTarget(Molecule targetMol,
                                           byte[] markushSource)
                                    throws MolFormatException,
                                           java.util.ServiceConfigurationError
Sets the target structure.

Parameters:
targetMol - the target
markushSource - a markush structure can be specified here, or null. The proper byte[] can be obtained from the database cd_markush field.
Throws:
MolFormatException - markushSource is not of a suitable format
Ille - the markush structure read from the byte array has bad structure.
java.util.ServiceConfigurationError

getHits

public Molecule[] getHits(int maxHitCountIn)
                   throws chemaxon.sss.search.SearchException,
                          chemaxon.enumeration.supergraph.SupergraphException
Processes the next target structure. Before calling this function the target has to be set.

Parameters:
maxHitCountIn - specify 0 to get back all the hits found, or an arbitrary limit.
Specify -1 to get back only a single hit, the best fitting is returned in case of alignment (default).
Returns:
the structures to be displayed, or a zero sized array if there were no hits
Throws:
chemaxon.sss.search.SearchException
chemaxon.enumeration.supergraph.SupergraphException
See Also:
setTarget(Molecule), setMoleculeMarkushSourceTarget(Molecule, byte[])

getNextHit

public Molecule getNextHit()
                    throws chemaxon.sss.search.SearchException,
                           chemaxon.enumeration.supergraph.SupergraphException
Gets the next hit. Before calling this method the target has to be set.

Returns:
the next colored hit or null if no more hits are present
Throws:
chemaxon.sss.search.SearchException
chemaxon.enumeration.supergraph.SupergraphException
See Also:
setTarget(Molecule), setMoleculeMarkushSourceTarget(Molecule, byte[])

getHitIndexes

public java.util.ArrayList<int[]> getHitIndexes()
Returns the hit indexes for the last target. Can be called after getHit(Molecule), getHits(int) or getNextHit()

Returns:
the hit indexes in an ArrayList, containing int[] elements.

isLicensed

public boolean isLicensed()
Specified by:
isLicensed in interface chemaxon.license.Licensable

setLicenseEnvironment

public void setLicenseEnvironment(java.lang.String env)
Specified by:
setLicenseEnvironment in interface chemaxon.license.Licensable