@Override public IChemObjectBuilder getBuilder() { return SilentChemObjectBuilder.getInstance(); } }
@Override public IChemObjectBuilder getBuilder() { return SilentChemObjectBuilder.getInstance(); } }
private HijackedSmarts(String orig) { this.originalSmarts = orig; this.hijackedSmarts = flaggify(originalSmarts); this.query = SMARTSParser.parse(hijackedSmarts, SilentChemObjectBuilder.getInstance()); this.atomid2occurence = makeMapping(); }
private static void initializeMolecule(IAtomContainer molecule) throws CDKException { CDKHydrogenAdder adder = CDKHydrogenAdder.getInstance(SilentChemObjectBuilder.getInstance()); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); adder.addImplicitHydrogens(molecule); removeStrangeImidoSubstructure(molecule); }
@BeforeClass public static void setup() { smilesParser = new SmilesParser(SilentChemObjectBuilder.getInstance()); atomTypeMatcher = CDKAtomTypeMatcher.getInstance(SilentChemObjectBuilder.getInstance()); }
static void test(String... inputs) throws Exception { SmilesParser sp = new SmilesParser(SilentChemObjectBuilder.getInstance()); SmilesGenerator sg = SmilesGenerator.absolute(); Set<String> output = new HashSet<String>(); for (String input : inputs) output.add(sg.create(sp.parseSmiles(input))); Assert.assertThat(Joiner.on(".").join(inputs) + " were not canonicalised, outputs were " + output, output.size(), is(1)); }
@Test public void testRoundTripCharge() { String f = "[C3H7]+"; IMolecularFormula m = MolecularFormulaManipulator.getMolecularFormula(f, SilentChemObjectBuilder.getInstance()); assertThat(MolecularFormulaManipulator.getString(m), is("[C3H7]+")); } }
@BeforeClass public static void setup() { builder = SilentChemObjectBuilder.getInstance(); lpcheck = new LonePairElectronChecker(); }
public InChITautomerGeneratorTest() throws CDKException { super(); smilesParser = new SmilesParser(SilentChemObjectBuilder.getInstance()); tautomerGenerator = new InChITautomerGenerator(); }
@Test public void acceptMinusAsInput() throws Exception { IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance(); IMolecularFormula mf = MolecularFormulaManipulator.getMolecularFormula("[PO4]3–", bldr); assertThat(mf.getCharge(), is(-3)); }
@Test public void parseMFMass() throws Exception { String str = "C7H3[81]BrBrO3"; IChemObjectBuilder builder = SilentChemObjectBuilder.getInstance(); IMolecularFormula mf = MolecularFormulaManipulator.getMolecularFormula(str, builder); assertThat(MolecularFormulaManipulator.getString(mf, false, true), is("C7H3Br[81]BrO3")); }
@BeforeClass public static void loadConformerData() { String filename = "data/mdl/pcoretest1.sdf"; InputStream ins = PharmacophoreMatcherTest.class.getClassLoader().getResourceAsStream(filename); IteratingMDLConformerReader reader = new IteratingMDLConformerReader(ins, SilentChemObjectBuilder.getInstance()); if (reader.hasNext()) conformers = (ConformerContainer) reader.next(); }
@Test public void favorCarbonyl() throws Exception { IAtomContainer container = new SmilesParser(SilentChemObjectBuilder.getInstance()).parseSmiles("P([O-])=O"); assertThat(InChINumbersTools.getUSmilesNumbers(container), is(new long[]{3, 2, 1})); }
@Test public void deprontateHCl() throws Exception { IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance(); IMolecularFormula mf = MolecularFormulaManipulator.getMolecularFormula("HCl", bldr); assertTrue(MolecularFormulaManipulator.adjustProtonation(mf, -1)); assertThat(MolecularFormulaManipulator.getString(mf), is("[Cl]-")); assertThat(mf.getCharge(), is(-1)); assertThat(mf.getIsotopeCount(), is(1)); }
@Test public void protonatePhenolate() throws Exception { IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance(); IMolecularFormula mf = MolecularFormulaManipulator.getMolecularFormula("[C6H5O]-", bldr); assertTrue(MolecularFormulaManipulator.adjustProtonation(mf, +1)); assertThat(MolecularFormulaManipulator.getString(mf), is("C6H6O")); assertThat(mf.getCharge(), is(0)); assertThat(mf.getIsotopeCount(), is(3)); }
@Test public void protons() throws Exception { IAtomContainer container = new SmilesParser(SilentChemObjectBuilder.getInstance()) .parseSmiles("[H+].[H+].F[Si-2](F)(F)(F)(F)F"); assertThat(InChINumbersTools.getUSmilesNumbers(container), is(new long[]{8, 9, 1, 7, 2, 3, 4, 5, 6})); }
@Test public void deprotonatePhenol() throws Exception { IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance(); IMolecularFormula mf = MolecularFormulaManipulator.getMolecularFormula("C6H6O", bldr); assertTrue(MolecularFormulaManipulator.adjustProtonation(mf, -1)); assertThat(MolecularFormulaManipulator.getString(mf), is("[C6H5O]-")); assertThat(mf.getCharge(), is(-1)); }
@Test public void strictIsotopes() throws CDKException { SmilesParser smipar = new SmilesParser(SilentChemObjectBuilder.getInstance()); IAtomContainer mol = smipar.parseSmiles("[12CH3]C"); assertThat(new SmilesGenerator(SmiFlavor.AtomicMassStrict).create(mol), is("[12CH3]C")); }
@Test public void testToString() throws NoSuchAtomTypeException { AtomTypeFactory factory = AtomTypeFactory.getInstance( "org/openscience/cdk/dict/data/cdk-atom-types.owl", SilentChemObjectBuilder.getInstance() ); IAtomType type = factory.getAtomType("C.sp3"); Assert.assertTrue(type instanceof ImmutableAtomType); String output = type.toString(); Assert.assertTrue(output.contains("ImmutableAtomType(")); Assert.assertTrue(output.contains("MBO:")); }
@Test public void testSgroupSuppressionSRUUpdated() throws Exception { SmilesParser smipar = new SmilesParser(SilentChemObjectBuilder.getInstance()); IAtomContainer mol = smipar.parseSmiles("CCC([H])CC |Sg:n:1,2,3,4:n:ht|"); AtomContainerManipulator.suppressHydrogens(mol); Collection<Sgroup> sgroups = mol.getProperty(CDKConstants.CTAB_SGROUPS); assertNotNull(sgroups); assertThat(sgroups.size(), is(1)); Sgroup sgroup = sgroups.iterator().next(); assertThat(sgroup.getAtoms().size(), is(3)); }