@PublicAPI public final class McsSearchResult extends java.lang.Object
MaxCommonSubstructure
(MCS) search. It stores a mapping between common
substructures of two molecules.
The search result objects returned by an instance of MaxCommonSubstructure
class can be considered immutable
as the underlying molecules are copies of the original ones and they can never be changed.
Constructor and Description |
---|
McsSearchResult(Molecule target,
int[] atomMap,
int[] bondMap,
int fragmentCount)
Creates a SearchResult object representing a common substructure of two molecules.
|
Modifier and Type | Method and Description |
---|---|
Molecule |
getAsMolecule()
Gets the found common substructure as a
Molecule object. |
int |
getAtomCount()
Gets the number of atoms in the found common substructure.
|
int[] |
getAtomMapping()
Gets the atom mapping of the found common substructure.
|
int[] |
getAtomReverseMapping()
Gets the reverse atom mapping of the found common substructure.
|
int |
getBondCount()
Gets the number of bonds in the found common substructure.
|
int[] |
getBondMapping()
Gets the bond mapping of the found common substructure.
|
int[] |
getBondReverseMapping()
Gets the reverse bond mapping of the found common substructure.
|
float |
getDissimilarity()
Returns a Tanimoto-like dissimilarity metric score of the input molecules based on the found maximum common
substructure.
|
int |
getFragmentCount()
Gets the number of fragments in the found common substructure.
|
java.util.List<java.lang.Integer> |
getMatchedQueryAtoms()
Gets the indexes of the query atoms that are part of the found common substructure.
|
java.util.List<java.lang.Integer> |
getMatchedQueryBonds()
Gets the indexes of the query bonds that are part of the found common substructure.
|
java.util.List<java.lang.Integer> |
getMatchedTargetAtoms()
Gets the indexes of the target atoms that are part of the found common substructure.
|
java.util.List<java.lang.Integer> |
getMatchedTargetBonds()
Gets the indexes of the target bonds that are part of the found common substructure.
|
float |
getSimilarity()
Returns a Tanimoto-like similarity score of the input molecules based on the found maximum common substructure.
|
boolean |
isEmpty()
Checks whether the common substructure contains any bonds or is empty.
|
public McsSearchResult(Molecule target, int[] atomMap, int[] bondMap, int fragmentCount)
The constructor does not check for validity of its parameters! Furthermore, the Molecule
object is NOT
cloned, so it should not be modified after the construction of this object.
target
- the target molecule.atomMap
- atom mapping, see getAtomMapping()
bondMap
- bond mapping, see getBondMapping()
fragmentCount
- number of fragments in the common substructurepublic boolean isEmpty()
public int getAtomCount()
public int getBondCount()
public int getFragmentCount()
public int[] getAtomMapping()
This method returns a clone copy of the internally stored array. Its result should be stored instead of multiple calls.
public int[] getAtomReverseMapping()
This method returns a clone copy of the internally stored array. Its result should be stored instead of multiple calls.
public int[] getBondMapping()
This method returns a clone copy of the internally stored array. Its result should be stored instead of multiple calls.
public int[] getBondReverseMapping()
This method returns a clone copy of the internally stored array. Its result should be stored instead of multiple calls.
public java.util.List<java.lang.Integer> getMatchedQueryAtoms()
i
, the i-th element of getMatchedQueryAtoms()
corresponds to the i-th element of
getMatchedTargetAtoms()
.public java.util.List<java.lang.Integer> getMatchedQueryBonds()
j
, the j-th element of getMatchedQueryBonds()
corresponds to the j-th element of
getMatchedTargetBonds()
.public java.util.List<java.lang.Integer> getMatchedTargetAtoms()
i
, the i-th element of getMatchedQueryAtoms()
corresponds to
the i-th element of getMatchedTargetAtoms()
.public java.util.List<java.lang.Integer> getMatchedTargetBonds()
j
, the j-th element of getMatchedQueryBonds()
corresponds to
the j-th element of getMatchedTargetBonds()
.public Molecule getAsMolecule()
Molecule
object.
The returned molecule is originated from the target structure, since the query might contain special non-specific atoms or bonds (e.g., any atom, list atom, any bond, etc.). As a result, the substructure has the same properties (atom types, bond types, coordinates, charges, isotopes, etc.) as the corresponding substructure of the target molecule. Those properties that are not considered during the search, however, could differ from the corresponding substructure of the query molecule.
This method builds a new Molecule
object each time it is called. Its result should be stored instead
of multiple calls.
Molecule
objectpublic float getSimilarity()
mcsBondCount / (queryBondCount + targetBondCount - mcsBondCount)
.
If neither molecules contain bonds, 0 is returned.
1 - getDissimilarity()
.public float getDissimilarity()
1 - mcsBondCount / (queryBondCount + targetBondCount - mcsBondCount)
.
If neither molecules contain bonds, 1 is returned.
1 - getSimilarity()
.