chemaxon.reaction
Class Fragmenter

java.lang.Object
  extended by chemaxon.reaction.Fragmenter
All Implemented Interfaces:
chemaxon.license.Licensable
Direct Known Subclasses:
ExhaustiveFragmenter

public abstract class Fragmenter
extends java.lang.Object
implements chemaxon.license.Licensable

Molecule fragmenter. Common base class for fragmentation implementations.

This class can be used from command-line or from the API.
See the documentation for details.

For an API usage example, see ExhaustiveFragmenter.

Since:
JChem 2.0
Author:
Nora Mate
See Also:
ExhaustiveFragmenter

Field Summary
protected  chemaxon.reaction.Fragmenter.CutBondSearch[] cbs
          The CutBondSearch objects corresponding to the reactions.
protected  chemaxon.util.BondClassifier classifier
          The classifier object that performs the DFS algorithm and stores ring-bond data.
protected  java.lang.String licenseEnvironment
           
protected  int maxfragmentcount
          Stores the maximum number of fragments per fragment set.
protected  CutBondReviser reviser
          The reviser object that accepts or rejects the cut-bonds.
 
Constructor Summary
Fragmenter()
          Default constructor, does nothing.
Fragmenter(RxnMolecule[] reactions)
          Constructor with no standardizer and no reviser (accepts all cut-bonds).
Fragmenter(RxnMolecule[] reactions, Standardizer standardizer)
          Constructor with no reviser (accepts all cut-bonds).
Fragmenter(RxnMolecule[] reactions, Standardizer standardizer, CutBondReviser reviser)
          Constructor.
 
Method Summary
protected  void clearCutBond(int i, int j)
          Clears the i - j cut-bond.
protected  void clearCutBonds()
          Clears the 'cutbond' array.
 void collect(java.lang.String uidTag, java.lang.String cutidsTag, java.lang.String cutcountsTag, java.lang.String cutsumTag, java.lang.String[] reactionIDs)
          Initiates cleavage reaction data collecting.
 void collect(java.lang.String uidTag, java.lang.String cutidsTag, java.lang.String cutcountsTag, java.lang.String cutsumTag, java.lang.String[] reactionIDs, boolean dataInLabel)
          Initiates cleavage reaction data collecting.
 void create(java.util.List coll)
          Creates the molecule fragments by removing the previously found cut-bonds and fragmenting the input molecule.
protected abstract  void find()
          The main fragmentation finder method: sets the cut-bonds.
 void find(Molecule mol)
          The main fragmenter algorithm: stores the accepted bond cuts.
 void fragment(java.util.List coll, Molecule mol)
          Runs the fragmenter on the given input molecule.
protected  chemaxon.util.BondClassifier getClassifier()
          Returns the classifier object.
 int getCutBond(int i, int j)
          Return the cut-reaction index if i - j is a cut-bond, -1 otherwise.
static java.lang.String getData(Molecule fragment, int index)
          Returns fragment data from atom alias.
protected  void init(RxnMolecule[] reactions, Standardizer standardizer, CutBondReviser reviser)
          Initializes Fragmenter.
 boolean isCutBond(int i, int j)
          Return true if bond i - j is stored as cut-bond.
 boolean isLicensed()
          Returns information about the licensing of the product.
static void main(java.lang.String[] args)
          The command line invokation of the Fragmenter.
 void setCountTag(java.lang.String countTag)
          Sets the Count tag storing the fragment count (multiplicity).
protected  void setCutBond(int i, int j, int r)
          Store bond i - j as cut-bond.
protected  void setCutBond(int i, int j, int r, int mi, int mj)
          Store bond i - j as cut-bond.
 void setLicenseEnvironment(java.lang.String env)
          Every license can have a modifier environment that's tipically an integration environment.
 void setMaxFragmentCount(int maxfragmentcount)
          Sets the maximum number of fragments per fragment set to be created.
protected  void setTags(Molecule frag)
          Increases the fragment count tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

licenseEnvironment

protected java.lang.String licenseEnvironment

cbs

protected chemaxon.reaction.Fragmenter.CutBondSearch[] cbs
The CutBondSearch objects corresponding to the reactions.


reviser

protected CutBondReviser reviser
The reviser object that accepts or rejects the cut-bonds.


classifier

protected chemaxon.util.BondClassifier classifier
The classifier object that performs the DFS algorithm and stores ring-bond data.


maxfragmentcount

protected int maxfragmentcount
Stores the maximum number of fragments per fragment set.

Constructor Detail

Fragmenter

public Fragmenter()
Default constructor, does nothing.


Fragmenter

public Fragmenter(RxnMolecule[] reactions)
           throws chemaxon.sss.search.SearchException
Constructor with no standardizer and no reviser (accepts all cut-bonds). Sets the CutBondSearch objects according to the given reactions. Allocates arrays with default sizes.

Parameters:
reactions - is the reaction molecule array
Throws:
chemaxon.sss.search.SearchException - if reaction check fails (e.g. inconsistent atom maps or multiple reactants)

Fragmenter

public Fragmenter(RxnMolecule[] reactions,
                  Standardizer standardizer)
           throws chemaxon.sss.search.SearchException
Constructor with no reviser (accepts all cut-bonds). Sets the CutBondSearch objects according to the given reactions. Allocates arrays with default sizes.

Parameters:
reactions - is the reaction molecule array
standardizer - is the standardizer object
Throws:
chemaxon.sss.search.SearchException - if reaction check fails (e.g. inconsistent atom maps or multiple reactants)

Fragmenter

public Fragmenter(RxnMolecule[] reactions,
                  Standardizer standardizer,
                  CutBondReviser reviser)
           throws chemaxon.sss.search.SearchException
Constructor.

Parameters:
reactions - is the reaction molecule array
standardizer - is the standardizer object
reviser - is the cut-bond reviser object
Throws:
chemaxon.sss.search.SearchException - if reaction check fails (e.g. inconsistent atom maps or multiple reactants)
Method Detail

getData

public static java.lang.String getData(Molecule fragment,
                                       int index)
Returns fragment data from atom alias. The fragment is supposed to have been created by Fragmenter, otherwise the result is unpredictable. The fragment data is in the form of
 rid1:m1,rid2:m2,...,ridN:mN
 
where rid1, ... ridN are the reaction IDs from the configuration XML and m1, ... mN are the corresponding atom maps. The empty string is returned if there was no cleavage at the specified atom.

Parameters:
fragment - is the fragment molecule generated by Fragmenter
index - is the atom index
Returns:
the fragment data for the specified atom

init

protected void init(RxnMolecule[] reactions,
                    Standardizer standardizer,
                    CutBondReviser reviser)
             throws chemaxon.sss.search.SearchException
Initializes Fragmenter. Sets the CutBondSearch objects according to the given reactions. Sets the CutBondReviser object. Allocates arrays with default sizes.

Parameters:
reactions - is the reaction molecule array
standardizer - is the standardizer object
reviser - is the cut-bond reviser object
Throws:
chemaxon.sss.search.SearchException - if reaction check fails (e.g. inconsistent atom maps or multiple reactants)

getClassifier

protected chemaxon.util.BondClassifier getClassifier()
Returns the classifier object.

Returns:
the classifier object

setMaxFragmentCount

public void setMaxFragmentCount(int maxfragmentcount)
Sets the maximum number of fragments per fragment set to be created.

Parameters:
maxfragmentcount - is the maximum number of fragments per fragment set

setCountTag

public void setCountTag(java.lang.String countTag)
Sets the Count tag storing the fragment count (multiplicity).

Parameters:
countTag - is the Count tag name

collect

public void collect(java.lang.String uidTag,
                    java.lang.String cutidsTag,
                    java.lang.String cutcountsTag,
                    java.lang.String cutsumTag,
                    java.lang.String[] reactionIDs)
Initiates cleavage reaction data collecting. Cleavage data is stored in atom labels. The different data is set with the given tag names as property names in the fragment Molecule objects and will be written to the SDF file with these tag names upon SDF output. If any of the tags is null then that data is not set.

Parameters:
uidTag - is the SDF tag storing the fragment UID
cutidsTag - is the SDF tag name for the ';' separated list of the ',' separated lists of cut-reaction ids for the atoms
cutcountsTag - is the SDF tag name for the ';' separated list of the attachment point counts for the atoms
cutsumTag - is the SDF tag name for the number of cut-bonds for the whole fragment (the sum of the attachment point counts)
reactionIDs - is the reaction ID array

collect

public void collect(java.lang.String uidTag,
                    java.lang.String cutidsTag,
                    java.lang.String cutcountsTag,
                    java.lang.String cutsumTag,
                    java.lang.String[] reactionIDs,
                    boolean dataInLabel)
Initiates cleavage reaction data collecting. Cleavage data is stored in atom labels depending on the value of the dataInLabel parameter. The different data is set with the given tag names as property names in the fragment Molecule objects and will be written to the SDF file with these tag names upon SDF output. If any of the tags is null then that data is not set.

Parameters:
uidTag - is the SDF tag storing the fragment UID
cutidsTag - is the SDF tag name for the ';' separated list of the ',' separated lists of cut-reaction ids for the atoms
cutcountsTag - is the SDF tag name for the ';' separated list of the attachment point counts for the atoms
cutsumTag - is the SDF tag name for the number of cut-bonds for the whole fragment (the sum of the attachment point counts)
reactionIDs - is the reaction ID array
dataInLabel - is true if cleavage data should be stored in atom labels

find

public void find(Molecule mol)
          throws chemaxon.sss.search.SearchException,
                 chemaxon.license.LicenseException
The main fragmenter algorithm: stores the accepted bond cuts. For each reaction find all reactant hits in the input molecule. For all hits take the cut bond set determined by the reaction. Store those cuts that are accepted by the reviser.

Parameters:
mol - is the input molecule
Throws:
chemaxon.sss.search.SearchException - on search error
chemaxon.license.LicenseException - if no license found

find

protected abstract void find()
                      throws chemaxon.sss.search.SearchException
The main fragmentation finder method: sets the cut-bonds.

Throws:
chemaxon.sss.search.SearchException - on search error

create

public void create(java.util.List coll)
Creates the molecule fragments by removing the previously found cut-bonds and fragmenting the input molecule. Call find(Molecule) beforehand to set the cut-bonds!

Parameters:
coll - is the list which the fragments will be added to

setTags

protected void setTags(Molecule frag)
Increases the fragment count tag.

Parameters:
frag - is the fragment

fragment

public void fragment(java.util.List coll,
                     Molecule mol)
              throws chemaxon.sss.search.SearchException
Runs the fragmenter on the given input molecule. Calls find(Molecule) and create(List).

Parameters:
coll - is the list which the fragments will be added to
mol - is the input molecule
Throws:
chemaxon.sss.search.SearchException - on search error

isCutBond

public boolean isCutBond(int i,
                         int j)
Return true if bond i - j is stored as cut-bond.

Parameters:
i - is a node index
j - is another node index
Returns:
true if bond i - j is stored as cut-bond.

getCutBond

public int getCutBond(int i,
                      int j)
Return the cut-reaction index if i - j is a cut-bond, -1 otherwise.

Returns:
the cut-reaction index if i - j is a cut-bond, -1 otherwise

setCutBond

protected final void setCutBond(int i,
                                int j,
                                int r,
                                int mi,
                                int mj)
Store bond i - j as cut-bond.

Parameters:
i - is a node index
j - is another node index
r - is the reaction index
mi - is the first atom map
mj - is the second atom map

setCutBond

protected final void setCutBond(int i,
                                int j,
                                int r)
Store bond i - j as cut-bond.

Parameters:
i - is a node index
j - is another node index
r - is the reaction index

clearCutBond

protected final void clearCutBond(int i,
                                  int j)
Clears the i - j cut-bond.

Parameters:
i - is a node index
j - is another node index

clearCutBonds

protected final void clearCutBonds()
Clears the 'cutbond' array.


isLicensed

public boolean isLicensed()
Description copied from interface: chemaxon.license.Licensable
Returns information about the licensing of the product. Example implementation: return LicenseHandler.isLicensed( LicenseHandler.MY_IDENTIFIER, licenseEnvironment );

Specified by:
isLicensed in interface chemaxon.license.Licensable
Returns:
true if the product is correctly licensed

setLicenseEnvironment

public void setLicenseEnvironment(java.lang.String env)
Description copied from interface: chemaxon.license.Licensable
Every license can have a modifier environment that's tipically an integration environment. All being Licensable should be prepared to store and show a set environment to the LicenseHandler. Example implementation:
 private String licenseEnvironment = "";
 public void setLicenseEnvironment(String env) {
     licenseEnvironment = env;
 }
 

Specified by:
setLicenseEnvironment in interface chemaxon.license.Licensable
Parameters:
env - environment String to be stored and passed to the LicenseHandler in the isLicensed method

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
The command line invokation of the Fragmenter.

Parameters:
args - the command line parameters
Throws:
java.lang.Exception