chemaxon.sss.search
Class RgDecompResults

java.lang.Object
  extended by chemaxon.sss.search.RgDecompResults

public class RgDecompResults
extends java.lang.Object

Convenience class for generating, storing and returning results of a search in different forms: as r-group decomposition or Markush molecule. Used as return class of JChemSearch.getHitsAsRgDecomp(int[], int).

When RgDecompResults is used only for storing results use the constructor designed for that purpose. When generating the results, set the parameters (query, targets (and optionally their original identifiers), search options, attachment type) using the appropriate constructor or setters then call run() method.

Available setters:

If a query does not contain undefined r-atoms (r-atom without corresponding r-group definition) then implicit Hydrogens are exchanged to undefined r-atoms and results are obtained using this new query.

hasResults() shows whether the class can actually provide valid results. Results can be achieved by calling different methods:

More details about r-group decomposition can be found here.

For more sophisticated usages (e.g. all hits of query in a specific target) see our RGroupDecomposition API documentation.

Since:
JChem 5.3 Date 1-Oct-2009
Author:
Tamas Csizmazia

Constructor Summary
RgDecompResults(Molecule scaffold, int noLigands, Molecule[][] rgDecomps, RgMolecule markush, int[] skippedIds)
          This constructor is used only for storing results.
RgDecompResults(Molecule scaffold, int noLigands, Molecule[][] rgDecomps, RgMolecule markush, int[] skippedIds, int[] originalIds)
          This constructor is used only for storing results.
RgDecompResults(Molecule query, Molecule[] targets, SearchOptions options, int attachmentType)
          Constructor used for generating results.
RgDecompResults(Molecule query, Molecule[] targets, SearchOptions options, int attachmentType, int[] originalIds)
          Constructor used for generating results.
 
Method Summary
 RgMolecule getHitsAsMarkush()
          Returns a single RgMolecule that consists of the scaffold and all the possible ligands as rgroup-definitions.
 Molecule[][] getHitsAsRgDecomp()
          Returns All ligands of all targets.
 Molecule[][] getHitsAsTable()
          Returns the table elements in Molecule[][] format.
 int[] getIncludedIds()
          Returns indexes of those targets that are matched by query.
 int getLigandsNumber()
          Returns the number of ligands in one target structure.
 Molecule getScaffold()
          Returns scaffold of the query (r-groups are added automatically if needed).
 int[] getSkippedIds()
          Returns indexes of those targets that are not matched by query.
 boolean hasResults()
           
 void run()
          Generates the results if no valid results are available (see hasResults())
 void setAttachmentType(int attachmentType)
           
 void setOriginalIds(int[] originalIds)
           
 void setQuery(Molecule query)
           
 void setSearchOptions(SearchOptions options)
           
 void setTargets(Molecule[] targets)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RgDecompResults

public RgDecompResults(Molecule scaffold,
                       int noLigands,
                       Molecule[][] rgDecomps,
                       RgMolecule markush,
                       int[] skippedIds)
This constructor is used only for storing results. For retrieving stored results see getScaffold(), getLigandsNumber(), getHitsAsRgDecomp(), getHitsAsMarkush(), getHitsAsTable(), getIncludedIds() and getSkippedIds().

Parameters:
scaffold - Scaffold of the query with added rgroups.
noLigands - Number of ligands in a decomposition.
rgDecomps - Ligands of decomposition for all targets.
markush - Scaffold and ligands collected in one Markush structure
skippedIds - Indexes of those targets that are not matched by query.

RgDecompResults

public RgDecompResults(Molecule scaffold,
                       int noLigands,
                       Molecule[][] rgDecomps,
                       RgMolecule markush,
                       int[] skippedIds,
                       int[] originalIds)
This constructor is used only for storing results. For retrieving stored results see getScaffold(), getLigandsNumber(), getHitsAsRgDecomp(), getHitsAsMarkush(), getHitsAsTable(), getIncludedIds() and getSkippedIds().

Parameters:
scaffold - Scaffold of the query with added r-groups.
noLigands - Number of ligands in a decomposition.
rgDecomps - Ligands of decomposition for all targets.
markush - Scaffold and ligands collected in one Markush structure
skippedIds - Indexes of those targets that are not matched by query.
originalIds - Target identifiers to be returned by getSkippedIds() and getIncludedIds() instead of indexes of targets.

RgDecompResults

public RgDecompResults(Molecule query,
                       Molecule[] targets,
                       SearchOptions options,
                       int attachmentType)
Constructor used for generating results.

Parameters:
query - The query structure that is looked for in targets.
targets - The target structures.
options - Search options used in search.
attachmentType - Type of attachment point representation in ligands. When creating Markush structure from results, this parameter is ignored and Decomposition#ATTACHMENT_POINT (default) is used instead.
See Also:
Decomposition.ATTACHMENT_NONE, Decomposition.ATTACHMENT_POINT, Decomposition.ATTACHMENT_MAP, Decomposition.ATTACHMENT_LABEL, Decomposition.ATTACHMENT_ATOM, Decomposition.ATTACHMENT_RLABEL

RgDecompResults

public RgDecompResults(Molecule query,
                       Molecule[] targets,
                       SearchOptions options,
                       int attachmentType,
                       int[] originalIds)
Constructor used for generating results.

Parameters:
query - The query structure that is looked for in targets.
targets - The target structures.
options - Search options used in search.
attachmentType - Type of attachment point representation in ligands. When creating Markush structure from results, this parameter is ignored and Decomposition#ATTACHMENT_POINT (default) is used instead.
originalIds - Target identifiers to be returned by getSkippedIds() and getIncludedIds() instead of indexes of targets.
See Also:
Decomposition.ATTACHMENT_NONE, Decomposition.ATTACHMENT_POINT, Decomposition.ATTACHMENT_MAP, Decomposition.ATTACHMENT_LABEL, Decomposition.ATTACHMENT_ATOM, Decomposition.ATTACHMENT_RLABEL
Method Detail

getScaffold

public Molecule getScaffold()
Returns scaffold of the query (r-groups are added automatically if needed).

Returns:
Scaffold if valid results are available otherwise null.

getLigandsNumber

public int getLigandsNumber()
Returns the number of ligands in one target structure.

Returns:
Number of ligands in a target structure if valid results are available, otherwise Integer.MIN_VALUE.

getHitsAsRgDecomp

public Molecule[][] getHitsAsRgDecomp()
Returns All ligands of all targets. When a target does not contain the query structure the array contains null instead of array of ligands.

Returns:
Array of array of ligands for all target structures if valid results are available, otherwise null. The returned array contains ligands for all query atoms. If a query atom is not an r-atom the ligand is null.

getHitsAsTable

public Molecule[][] getHitsAsTable()
Returns the table elements in Molecule[][] format. As an example see decomposition table

Returns:
A colored molecule table if valid results are available and there were matching targets for the query, otherwise null. Format of the table (first row is header row, following rows contain targets, 1 hit/target):
 [query]:     molecule        R1         R2         R3    ...
 ---------------------------------------------------------
 [target1]:   molecule1    ligand1.1  ligand1.2  ligand1.3
 [target2]:   molecule2    ligand2.1  ligand2.2  ligand2.3
 

getHitsAsMarkush

public RgMolecule getHitsAsMarkush()
Returns a single RgMolecule that consists of the scaffold and all the possible ligands as rgroup-definitions.

Returns:
An RgMolecule if valid results are available, otherwise null.

getSkippedIds

public int[] getSkippedIds()
Returns indexes of those targets that are not matched by query.

Returns:
Array of skipped indexes if valid results are available, otherwise null. If original identifiers of targets are set then those are returned instead of array indexes.

getIncludedIds

public int[] getIncludedIds()
Returns indexes of those targets that are matched by query.

Returns:
Array of included indexes if valid results are available, otherwise null. If original identifiers of targets are set then those are returned instead of array indexes.

run

public void run()
         throws chemaxon.sss.search.SearchException
Generates the results if no valid results are available (see hasResults())

Throws:
chemaxon.sss.search.SearchException

setQuery

public void setQuery(Molecule query)
Parameters:
query - The query to set

setTargets

public void setTargets(Molecule[] targets)
Parameters:
targets - The targets to set

setSearchOptions

public void setSearchOptions(SearchOptions options)
Parameters:
options - The search options to set

setAttachmentType

public void setAttachmentType(int attachmentType)
Parameters:
attachmentType - The attachment type to set

setOriginalIds

public void setOriginalIds(int[] originalIds)
Parameters:
originalIds - Original identifiers of targets to set

hasResults

public boolean hasResults()
Returns:
true, if valid results are available