Package chemaxon.util

Class HitDisplayTool

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

@PublicAPI public class HitDisplayTool extends Object implements SearchConstants, chemaxon.license.Licensable
Class for displaying hit results with hit coloring, alignment, partial clean, etc.

E.g.

  HitColoringAndAlignmentOptions displayOpts = new HitColoringAndAlignmentOptions();
  displayOpts.setColoringEnabled(true);
  displayOpts.setAlignmentMode(align);
  // ...
  MolSearchOptions searchOpts = ... // set search options
  Molecule query = ... // set your query
  HitDisplayTool hdt = new HitDisplayTool(displayOpts, searchOpts, query);

  // Retrieve all hits
  Molecule[] hits = hdt.getHits(m, (Molecule) null, 0);

  // Or retrieve the hits one-by-one
  HitDisplayTool hdt2 = new HitDisplayTool(displayOpts, searchOpts, query);
  hdt2.setTarget(m);
  List<Molecule> hitList = new ArrayList<Molecule>();
  Molecule hit = hdt2.getNextHit();
  while (hit != null) {
      hitList.add(hit);
      hit = hdt2.getNextHit();
  }
 
Since:
JChem 5.0
  • Field Details

    • HIT_ATOM_SET

      public static final int HIT_ATOM_SET
      Set identifier for hit atoms
      See Also:
    • NON_HIT_ATOM_SET

      public static final int NON_HIT_ATOM_SET
      Set identifier for non-hit atoms
      See Also:
    • HIT_BOND_SET

      public static final int HIT_BOND_SET
      Set identifier for hit bonds
      See Also:
    • NON_HIT_BOND_SET

      public static final int NON_HIT_BOND_SET
      Set identifier for non hit bonds
      See Also:
  • Constructor Details

    • HitDisplayTool

      public HitDisplayTool(HitColoringAndAlignmentOptions options, MolSearchOptions searchOptions, Molecule query, Standardizer standardizer)
      Constructor.
      Parameters:
      options - options for coloring and alignment
      searchOptions - search options
      query - the query structure
      standardizer - the Standardizer which will be used during the search process, or null for only aromatization.
    • HitDisplayTool

      public HitDisplayTool(HitColoringAndAlignmentOptions options, MolSearchOptions searchOptions, Molecule query)
      Creates a new instance with the specified parameters, with using a default standardization method which applies only aromatization during the search process.
      Parameters:
      options - options for coloring and alignment
      searchOptions - search options
      query - the query structure
    • HitDisplayTool

      @Beta public HitDisplayTool(HitColoringAndAlignmentOptions hco, chemaxon.sss.search.pipeline.SearchSettings settings, Molecule query, Standardizer standardizer)
      Constructor. For internal use only!
      Parameters:
      hco - options for coloring and alignment
      settings - search settings containing search options among others
      query - the query structure
      standardizer - the Standardizer which will be used during the search process, or null for only aromatization.
  • Method Details

    • getHit

      public Molecule getHit(Molecule targetMol) throws 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:
      SearchException - error during searching
      chemaxon.enumeration.supergraph.SupergraphException - if target is a markush structure but is erroneous
    • getHits

      public Molecule[] getHits(Molecule targetMol, Molecule markush, int maxHitCount) throws chemaxon.enumeration.supergraph.SupergraphException, 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 - in case of search failure
      SearchException - in case of search failure
    • setTarget

      public void setTarget(Molecule targetMol)
      Sets the target structure.
      Parameters:
      targetMol - the target
    • setMoleculeAndMarkushTarget

      @Beta public void setMoleculeAndMarkushTarget(Molecule targetMol, Molecule markushInnerRepresentation) throws chemaxon.enumeration.supergraph.SupergraphException
      Sets the target structure.
      Parameters:
      targetMol - the target
      markushInnerRepresentation - if the target molecule is a markush molecule and its inner representation is known it can be specified here, otherwise this parameter should be set to null.
      Throws:
      chemaxon.enumeration.supergraph.SupergraphException - in case of search failure
    • getHits

      public Molecule[] getHits(int maxHitCountIn) throws 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.enumeration.supergraph.SupergraphException - in case of search failure
      SearchException - in case of search failure
      See Also:
    • getNextHit

      public Molecule getNextHit() throws 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.enumeration.supergraph.SupergraphException - in case of search failure
      SearchException - in case of search failure
      See Also:
    • getHitIndexes

      public 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(String env)
      Specified by:
      setLicenseEnvironment in interface chemaxon.license.Licensable