/** * Set up the fingerprinter to use the fragments from * {@link org.openscience.cdk.fingerprint.StandardSubstructureSets}. */ public SubstructureFingerprinter() { try { setSmarts(StandardSubstructureSets.getFunctionalGroupSMARTS()); } catch (Exception ex) { throw new IllegalStateException("Could not load SMARTS patterns", ex); } }
/** * The functional groups. * * @return A set of the functional groups. * @throws Exception if there is an error parsing SMILES for the functional groups */ public static String[] getFunctionalGroupSMARTS() throws Exception { return readSMARTSPattern("org/openscience/cdk/fingerprint/data/SMARTS_InteLigand.txt"); }
@Test public void testSize() throws Exception { SubstructureFingerprinter fp = new SubstructureFingerprinter(); Assert.assertEquals(307, fp.getSize()); fp = new SubstructureFingerprinter(StandardSubstructureSets.getFunctionalGroupSMARTS()); Assert.assertEquals(307, fp.getSize()); fp = new SubstructureFingerprinter(StandardSubstructureSets.getCountableMACCSSMARTS()); Assert.assertEquals(142, fp.getSize()); }
@Test public void testGetCountableMACCSSMARTSSubstructureSet() throws Exception { String[] smarts = null; smarts = StandardSubstructureSets.getCountableMACCSSMARTS(); Assert.assertNotNull(smarts); Assert.assertEquals(142, smarts.length); // currently fragment pattern is ignored }
@Test public void testCountableMACCSBinary2() throws Exception { SmilesParser parser = new SmilesParser(SilentChemObjectBuilder.getInstance()); IFingerprinter printer = new SubstructureFingerprinter(StandardSubstructureSets.getCountableMACCSSMARTS()); IAtomContainer mol; BitSet bs;
@Test public void testGetFunctionalGroupSubstructureSet() throws Exception { String[] smarts = null; smarts = StandardSubstructureSets.getFunctionalGroupSMARTS(); Assert.assertNotNull(smarts); Assert.assertEquals(307, smarts.length); }
@Test public void testCountableMACCSBinary_Rings() throws Exception { SmilesParser parser = new SmilesParser(SilentChemObjectBuilder.getInstance()); IFingerprinter printer = new SubstructureFingerprinter(StandardSubstructureSets.getCountableMACCSSMARTS()); IAtomContainer mol; BitSet bs;
/** * Subset of the MACCS fingerprint definitions. The subset encompasses the pattern * that are countable: * <ul> * <li>Patterns have obvious counting nature, <i>e.g., 6-Ring, C=O, etc.</i></li> * <li>Patterns like <i>"Is there at least 1 of this and that?", "Are there at least 2 ..."</i> etc. are merged</li> * <li>Patterns clearly corresponding to binary properties, <i>e.g., actinide group ([Ac,Th,Pa,...]), isotope, etc.,</i> have been removed.</li> * </ul> * * * @return Countable subset of the MACCS fingerprint definition * @throws Exception if there is an error parsing SMILES patterns */ public static String[] getCountableMACCSSMARTS() throws Exception { return readSMARTSPattern("org/openscience/cdk/fingerprint/data/SMARTS_countable_MACCS_keys.txt"); }
IFingerprinter printer = new SubstructureFingerprinter(StandardSubstructureSets.getCountableMACCSSMARTS()); Assert.assertEquals(142, printer.getSize());
@Test public void testCountableMACCSCount2() throws Exception { SmilesParser parser = new SmilesParser(SilentChemObjectBuilder.getInstance()); IFingerprinter printer = new SubstructureFingerprinter(StandardSubstructureSets.getCountableMACCSSMARTS()); IAtomContainer mol; ICountFingerprint cfp;
@Test public void testCountableMACCSCount_Rings() throws Exception { SmilesParser parser = new SmilesParser(SilentChemObjectBuilder.getInstance()); IFingerprinter printer = new SubstructureFingerprinter(StandardSubstructureSets.getCountableMACCSSMARTS()); IAtomContainer mol; ICountFingerprint cfp;