use of net.sf.jniinchi.INCHI_OPTION in project ambit-mirror by ideaconsult.
the class InchiProcessorTest method testProcessExplicitH.
@Test
public void testProcessExplicitH() throws Exception {
List<INCHI_OPTION> options = new ArrayList<INCHI_OPTION>();
options.add(INCHI_OPTION.FixedH);
options.add(INCHI_OPTION.SAbs);
options.add(INCHI_OPTION.SAsXYZ);
options.add(INCHI_OPTION.SPXYZ);
options.add(INCHI_OPTION.FixSp3Bug);
options.add(INCHI_OPTION.AuxNone);
SmilesParser p = new SmilesParser(SilentChemObjectBuilder.getInstance());
IAtomContainer mol = p.parseSmiles("CN1C=NC2=C1C(=O)N(C(=O)N2C)C");
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol);
CDKHydrogenAdder.getInstance(mol.getBuilder()).addImplicitHydrogens(mol);
IAtomContainer molH = mol.clone();
MoleculeTools.convertImplicitToExplicitHydrogens(molH);
InChIGeneratorFactory factory = InChIGeneratorFactory.getInstance();
InChIGenerator gen = factory.getInChIGenerator(mol, options);
Assert.assertEquals(INCHI_RET.OKAY, gen.getReturnStatus());
InChIGenerator genH = factory.getInChIGenerator(mol, options);
Assert.assertEquals(INCHI_RET.OKAY, genH.getReturnStatus());
Assert.assertEquals(gen.getInchi(), genH.getInchi());
}
use of net.sf.jniinchi.INCHI_OPTION in project ambit-mirror by ideaconsult.
the class InchiProcessorTest method testEquals.
@Test
public void testEquals() throws Exception {
List<INCHI_OPTION> options = new ArrayList<INCHI_OPTION>();
options.add(INCHI_OPTION.FixedH);
options.add(INCHI_OPTION.SAbs);
options.add(INCHI_OPTION.SAsXYZ);
options.add(INCHI_OPTION.SPXYZ);
options.add(INCHI_OPTION.FixSp3Bug);
options.add(INCHI_OPTION.AuxNone);
SmilesParser p = new SmilesParser(SilentChemObjectBuilder.getInstance());
IAtomContainer mol = p.parseSmiles("CN1C=NC2=C1C(=O)N(C(=O)N2C)C");
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol);
CDKHydrogenAdder.getInstance(mol.getBuilder()).addImplicitHydrogens(mol);
IAtomContainer molH = mol.clone();
MoleculeTools.convertImplicitToExplicitHydrogens(molH);
InChIGeneratorFactory factory = InChIGeneratorFactory.getInstance();
InChIGenerator gen = factory.getInChIGenerator(mol, options);
Assert.assertEquals(INCHI_RET.OKAY, gen.getReturnStatus());
InChIGenerator genH = factory.getInChIGenerator(mol, options);
Assert.assertEquals(INCHI_RET.OKAY, genH.getReturnStatus());
Assert.assertEquals(gen.getInchi(), genH.getInchi());
}
use of net.sf.jniinchi.INCHI_OPTION in project ambit-mirror by ideaconsult.
the class InchiProcessorTest method testTautomers.
@Test
public void testTautomers() throws Exception {
List<INCHI_OPTION> options = new ArrayList<INCHI_OPTION>();
options.add(INCHI_OPTION.FixedH);
options.add(INCHI_OPTION.SAbs);
options.add(INCHI_OPTION.SAsXYZ);
options.add(INCHI_OPTION.SPXYZ);
options.add(INCHI_OPTION.FixSp3Bug);
options.add(INCHI_OPTION.AuxNone);
SmilesParser p = new SmilesParser(SilentChemObjectBuilder.getInstance());
IAtomContainer mol1 = p.parseSmiles("S=NNCC");
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol1);
CDKHydrogenAdder.getInstance(mol1.getBuilder()).addImplicitHydrogens(mol1);
IAtomContainer mol2 = p.parseSmiles("SN=NCC");
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol2);
CDKHydrogenAdder.getInstance(mol2.getBuilder()).addImplicitHydrogens(mol2);
InChIGeneratorFactory factory = InChIGeneratorFactory.getInstance();
InChIGenerator gen1 = factory.getInChIGenerator(mol1, options);
System.out.println(gen1.getReturnStatus());
System.out.println(gen1.getMessage());
// Assert.assertEquals(INCHI_RET.OKAY, gen1.getReturnStatus());
InChIGenerator gen2 = factory.getInChIGenerator(mol2, options);
// Assert.assertEquals(INCHI_RET.OKAY, gen2.getReturnStatus());
System.out.println(gen2.getReturnStatus());
System.out.println(gen2.getMessage());
Assert.assertEquals("InChI=1/C2H6N2S/c1-2-3-4-5/h2H2,1H3,(H,3,5)/f/h3H", gen1.getInchi());
Assert.assertEquals("HLBPZSLHBUKVDX-TULZNQERNA-N", gen1.getInchiKey());
Assert.assertEquals("InChI=1/C2H6N2S/c1-2-3-4-5/h2H2,1H3,(H,3,5)/f/h5H", gen2.getInchi());
Assert.assertEquals("HLBPZSLHBUKVDX-JSWHHWTPNA-N", gen2.getInchiKey());
Assert.assertTrue(!gen1.getInchi().equals(gen2.getInchi()));
Assert.assertTrue(!gen1.getInchiKey().equals(gen2.getInchiKey()));
}
use of net.sf.jniinchi.INCHI_OPTION in project ambit-mirror by ideaconsult.
the class ReactorStrategy method readReactorStrategyFromJsonNode.
public static ReactorStrategy readReactorStrategyFromJsonNode(JsonNode node, ReactorStrategy reactorStrategy) throws Exception {
ReactorStrategy strategy = reactorStrategy;
if (strategy == null)
strategy = new ReactorStrategy();
strategy.maxNumOfReactions = JSONParsingUtils.extractIntKeyword(node, "MAX_NUM_OF_REACTIONS", true);
strategy.maxLevel = JSONParsingUtils.extractIntKeyword(node, "MAX_LEVEL", true);
strategy.allowedProducts = JSONParsingUtils.getStructureRecords(node, "ALLOWED_PRODUCTS_SMILES", STRUCTURE_RECORD_INPUT_INFO.smiles, false);
strategy.forbiddenProducts = JSONParsingUtils.getStructureRecords(node, "FORBIDDEN_PRODUCTS_SMILES", STRUCTURE_RECORD_INPUT_INFO.smiles, false);
List<INCHI_OPTION> options = new ArrayList<INCHI_OPTION>();
options.add(INCHI_OPTION.FixedH);
options.add(INCHI_OPTION.SAbs);
options.add(INCHI_OPTION.SAsXYZ);
options.add(INCHI_OPTION.SPXYZ);
options.add(INCHI_OPTION.FixSp3Bug);
InChIGeneratorFactory igf = InChIGeneratorFactory.getInstance();
// Configure products
if (strategy.allowedProducts != null)
for (StructureRecord sr : strategy.allowedProducts) configureStructureRecord(sr, igf, options);
if (strategy.forbiddenProducts != null)
for (StructureRecord sr : strategy.forbiddenProducts) configureStructureRecord(sr, igf, options);
return strategy;
}
use of net.sf.jniinchi.INCHI_OPTION in project cdk by cdk.
the class InChIGeneratorFactoryTest method testGetInChIGenerator_IAtomContainer_List.
/**
* Because we are setting an options, we get a non-standard InChI.
*/
@Test
public void testGetInChIGenerator_IAtomContainer_List() throws Exception {
IAtomContainer ac = new AtomContainer();
IAtom a = new Atom("Cl");
a.setImplicitHydrogenCount(1);
ac.addAtom(a);
List<INCHI_OPTION> options = new ArrayList<>();
options.add(INCHI_OPTION.FixedH);
InChIGenerator gen = InChIGeneratorFactory.getInstance().getInChIGenerator(ac, options);
Assert.assertEquals(gen.getReturnStatus(), INCHI_RET.OKAY);
Assert.assertEquals("InChI=1/ClH/h1H", gen.getInchi());
}
Aggregations