private synchronized int[] getCircularFP(IAtomContainer mol) throws CDKException { CircularFingerprinter circularFingerprinter = new CircularFingerprinter(6, 1024); circularFingerprinter.setPerceiveStereo(true); IBitFingerprint bitFingerprint = circularFingerprinter.getBitFingerprint(mol); return bitFingerprint.getSetbits(); }
private synchronized int[] getCircularFP(IAtomContainer mol) throws CDKException { CircularFingerprinter circularFingerprinter = new CircularFingerprinter(6, 1024); circularFingerprinter.setPerceiveStereo(true); IBitFingerprint bitFingerprint = circularFingerprinter.getBitFingerprint(mol); return bitFingerprint.getSetbits(); }
circ.setPerceiveStereo(optPerceiveStereo); circ.calculate(mol);
/** * For a given molecule, determines its fingerprints and uses them to calculate a Bayesian prediction. Note that this * value is unscaled, and so it only has relative meaning within the confines of the model, i.e. higher is more likely to * be active. * * @param mol molecular structure which cannot be blank or null * @return predictor value */ public double predict(IAtomContainer mol) throws CDKException { if (mol == null || mol.getAtomCount() == 0) throw new CDKException("Molecule cannot be blank or null."); CircularFingerprinter circ = new CircularFingerprinter(classType); circ.setPerceiveStereo(optPerceiveStereo); circ.calculate(mol); // gather all of the (folded) fingerprints (eliminating duplicates) final int AND_BITS = folding - 1; // e.g. 1024/0x400 -> 1023/0x3FF: chop off higher order bits Set<Integer> hashset = new HashSet<Integer>(); for (int n = circ.getFPCount() - 1; n >= 0; n--) { int code = circ.getFP(n).hashCode; if (folding > 0) code &= AND_BITS; hashset.add(code); } // sums the corresponding contributor for each hash code generated from the molecule; note that if the // molecule generates hash codes not originally in the model, they are discarded (i.e. 0 contribution) double val = 0; for (int h : hashset) { Double c = contribs.get(h); if (c != null) val += c; } return val; }
fpr.setPerceiveStereo(true); Assert.assertThat(fpr.getFingerprint(mol1), is(fpr.getFingerprint(mol2))); Assert.assertThat(fpr.getFingerprint(mol2), is(not(fpr.getFingerprint(mol3)))); fpr.setPerceiveStereo(false); Assert.assertThat(fpr.getFingerprint(mol1), is(fpr.getFingerprint(mol2))); Assert.assertThat(fpr.getFingerprint(mol2), is(fpr.getFingerprint(mol3)));
circ.setPerceiveStereo(true); IBitFingerprint fp0 = circ.getBitFingerprint(mol);