public boolean matches ( IAtomContainer atomContainer , boolean initializeTarget ) throws CDKException { if ( ! GeometryUtil . has3DCoordinates ( atomContainer ) ) throw new CDKException ( "Molecule must have 3D coordinates" ) ; if ( pharmacophoreQuery == null ) throw new CDKException ( "Must set the query pharmacophore before matching" ) ; if ( ! checkQuery ( pharmacophoreQuery ) ) throw new CDKException ( "A problem in the query. Make sure all pharmacophore groups of the same symbol have the same same SMARTS" ) ; String title = ( String ) atomContainer . getTitle ( ) ; if ( initializeTarget ) pharmacophoreMolecule = getPharmacophoreMolecule ( atomContainer ) ; else { // even though the atoms comprising the pcore groups are // constant, their coords will differ, so we need to make // sure we get the latest set of effective coordinates for ( IAtom iAtom : pharmacophoreMolecule . atoms ( ) ) { PharmacophoreAtom patom = PharmacophoreAtom . get ( iAtom ) ; List < Integer > tmpList = new ArrayList < Integer > ( ) ; for ( int idx : patom . getMatchingAtoms ( ) ) tmpList . ( idx ) ; Point3d coords = getEffectiveCoordinates ( atomContainer , tmpList ) ; patom . setPoint3d ( coords ) ; } } if ( pharmacophoreMolecule . getAtomCount ( ) < pharmacophoreQuery . getAtomCount ( ) ) { logger . debug ( "Target [" + title + "] did not match the query SMARTS. Skipping constraints" ) ; return false ; } mappings = Pattern . findSubstructure ( pharmacophoreQuery ) . matchAll ( pharmacophoreMolecule ) ; // XXX: doing one search then discarding return mappings . atLeast ( 1 ) ; }
Performs the pharmacophore matching .