use of org.openscience.cdk.fingerprint.MACCSFingerprinter in project MetFragRelaunched by ipb-halle.
the class MoleculeFunctions method getNormalizedFingerprint.
public static String getNormalizedFingerprint(IMolecularStructure precursorMolecule, IFragment frag) throws CDKException {
String preSmiles = frag.getSmiles(precursorMolecule);
String inchi1 = MoleculeFunctions.getInChIFromSmiles(preSmiles);
IAtomContainer con = null;
try {
con = getAtomContainerFromInChI(inchi1);
} catch (Exception e) {
e.printStackTrace();
}
MACCSFingerprinter fingerprinter = new MACCSFingerprinter();
IBitFingerprint f1 = null;
try {
f1 = fingerprinter.getBitFingerprint(con);
} catch (CDKException e) {
f1 = null;
}
String fpString = MoleculeFunctions.fingerPrintToString(f1);
return fpString;
}
use of org.openscience.cdk.fingerprint.MACCSFingerprinter in project ambit-mirror by ideaconsult.
the class FingerPrintGeneratorTest method testPolyAromatics.
@Test
public void testPolyAromatics() throws Exception {
MoleculeReader molreader = new MoleculeReader();
FingerprintGenerator gen = new FingerprintGenerator(new Fingerprinter());
InputStream in = FingerPrintGeneratorTest.class.getClassLoader().getResourceAsStream("ambit2/core/data/fp/polyaromatics.sdf");
RawIteratingSDFReader reader = new RawIteratingSDFReader(new InputStreamReader(in));
while (reader.hasNext()) {
IStructureRecord record = reader.nextRecord();
IAtomContainer mol = molreader.process(record);
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol);
CDKHydrogenAdder.getInstance(SilentChemObjectBuilder.getInstance()).addImplicitHydrogens(mol);
CDKHueckelAromaticityDetector.detectAromaticity(mol);
gen.setHydrogens(false);
mol = AtomContainerManipulator.removeHydrogensPreserveMultiplyBonded(mol);
BitSet bs1 = gen.process(mol);
System.out.println(bs1);
ExtendedFingerprinter efp = new ExtendedFingerprinter();
System.out.println(efp.getClass().getName());
System.out.println(efp.getBitFingerprint(mol).asBitSet());
PubchemFingerprinter pfp = new PubchemFingerprinter(SilentChemObjectBuilder.getInstance());
System.out.println(pfp.getClass().getName());
System.out.println(pfp.getBitFingerprint(mol).asBitSet());
EStateFingerprinter esfp = new EStateFingerprinter();
System.out.println(esfp.getClass().getName());
System.out.println(esfp.getBitFingerprint(mol).asBitSet());
MACCSFingerprinter mfp = new MACCSFingerprinter();
System.out.println(mfp.getClass().getName());
System.out.println(mfp.getBitFingerprint(mol).asBitSet());
SubstructureFingerprinter sfp = new SubstructureFingerprinter();
System.out.println(sfp.getClass().getName());
System.out.println(sfp.getBitFingerprint(mol).asBitSet());
HybridizationFingerprinter hfp = new HybridizationFingerprinter();
System.out.println(hfp.getClass().getName());
System.out.println(hfp.getBitFingerprint(mol).asBitSet());
/*
BigInteger[] h16 = new BigInteger[16];
MoleculeTools.bitset2bigint16(bs1,64,h16);
new Random(10000);
BitSet bs2 = gen.process(molreader.process(record));
Assert.assertEquals(bs1,bs2);
MoleculeTools.bitset2bigint16(bs2,64,h16);
for (int i=0; i <16;i++) {
Assert.assertEquals(expected[i], h16[i]);
}
*/
}
/*
IStructureRecord record = new StructureRecord();
record.setContent();
MoleculeReader reader = new MoleculeReader();
reader.process(target)
*/
reader.close();
}
Aggregations