use of ambit2.descriptors.AtomEnvironmentMatrixDescriptor in project ambit-mirror by ideaconsult.
the class AtomEnvironmentGeneratorTest method testAtomTypeMatrix.
@Test
public void testAtomTypeMatrix() throws Exception {
AtomEnvironmentMatrixDescriptor gen = new AtomEnvironmentMatrixDescriptor();
InputStream in = AtomEnvironmentGeneratorTest.class.getClassLoader().getResourceAsStream("ambit2/descriptors/3d/test.sdf");
IIteratingChemObjectReader<IAtomContainer> reader = new IteratingSDFReader(new InputStreamReader(in), SilentChemObjectBuilder.getInstance());
while (reader.hasNext()) {
IAtomContainer mol = reader.next();
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol);
// atom list - bug?
try {
if (hAdder == null)
hAdder = CDKHydrogenAdder.getInstance(SilentChemObjectBuilder.getInstance());
hAdder.addImplicitHydrogens(mol);
} catch (Exception x) {
}
CDKHueckelAromaticityDetector.detectAromaticity(mol);
HashIntDescriptorResult sparseMatrix = gen.doCalculation(mol);
System.out.println("Sparse Matrix");
System.out.println(sparseMatrix);
System.out.println("End Sparse Matrix");
}
reader.close();
}
use of ambit2.descriptors.AtomEnvironmentMatrixDescriptor in project ambit-mirror by ideaconsult.
the class AtomEnvironmentGeneratorTest method testAtomTypeMatrixDescriptor.
public void testAtomTypeMatrixDescriptor() throws Exception {
FileWriter w = new FileWriter(new File("F:/nina/Ideaconsult/Proposals/2014-columndb/ae.txt"));
AtomEnvironmentMatrixDescriptor gen = new AtomEnvironmentMatrixDescriptor();
InputStream in = AtomEnvironmentGeneratorTest.class.getClassLoader().getResourceAsStream("ambit2/descriptors/3d/test.sdf");
IIteratingChemObjectReader<IAtomContainer> reader = new IteratingSDFReader(new InputStreamReader(in), SilentChemObjectBuilder.getInstance());
while (reader.hasNext()) {
IAtomContainer mol = reader.next();
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol);
// atom list - bug?
try {
if (hAdder == null)
hAdder = CDKHydrogenAdder.getInstance(SilentChemObjectBuilder.getInstance());
hAdder.addImplicitHydrogens(mol);
} catch (Exception x) {
}
CDKHueckelAromaticityDetector.detectAromaticity(mol);
DescriptorValue value = gen.calculate(mol);
System.out.println("Value");
for (int i = 0; i < value.getNames().length; i++) {
if (((IntegerArrayResult) value.getValue()).get(i) > 0) {
System.out.println(value.getNames()[i] + " = " + ((IntegerArrayResult) value.getValue()).get(i));
}
String[] split = value.getNames()[i].split("_");
w.append(String.format("%d\t%s\t%s\t%s\n", (i + 1), split[0].replace("L", ""), split[1], split.length < 3 ? "" : split[2]));
}
System.out.println("End Value");
w.flush();
}
w.close();
reader.close();
}
Aggregations