use of ambit2.db.processors.DbDescriptorWriter in project ambit-mirror by ideaconsult.
the class DbDescriptorWriterTest method testWriteAllDescriptors.
@Test
public void testWriteAllDescriptors() throws Exception {
setUpDatabaseFromResource("ambit2/db/processors/test/descriptors-datasets.xml");
DbDescriptorWriter writer = new DbDescriptorWriter();
IDatabaseConnection c = getConnection();
ITable names = c.createQueryTable("EXPECTED_NAMES", "SELECT * FROM properties");
Assert.assertEquals(5, names.getRowCount());
writer.setConnection(c.getConnection());
writer.open();
XLogPDescriptor xlogp = new XLogPDescriptor();
writer.write(xlogp.calculate(MoleculeFactory.makeAlkane(10)));
DescriptorValue v = new DescriptorValue(new DescriptorSpecification("XLogPReference", "XLogPTitle", "XLogPIdentifier", "XLogPVendor"), new String[] {}, new Object[] {}, new DoubleResult(5), new String[] { "XLogP" });
writer.write(xlogp.calculate(MoleculeFactory.makeAlkane(10)));
writer.write(v);
c.close();
c = getConnection();
names = c.createQueryTable("EXPECTED_NAMES", "SELECT * FROM properties");
Assert.assertEquals(7, names.getRowCount());
ITable values = c.createQueryTable("EXPECTED_VALUES", "SELECT * FROM property_values");
Assert.assertEquals(2, values.getRowCount());
c.close();
}
use of ambit2.db.processors.DbDescriptorWriter in project ambit-mirror by ideaconsult.
the class DbDescriptorWriterTest method testWriteFunctionalGroups.
@Test
public void testWriteFunctionalGroups() throws Exception {
setUpDatabaseFromResource("ambit2/db/processors/test/descriptors-datasets.xml");
DbDescriptorWriter writer = new DbDescriptorWriter();
IDatabaseConnection c = getConnection();
ITable names = c.createQueryTable("EXPECTED_NAMES", "SELECT * FROM properties");
Assert.assertEquals(5, names.getRowCount());
writer.setConnection(c.getConnection());
writer.open();
FunctionalGroupDescriptor d = new FunctionalGroupDescriptor();
Assert.assertEquals(84, ((List) d.getParameters()[0]).size());
DescriptorValue v = d.calculate(MoleculeFactory.makePhenylAmine());
Assert.assertEquals(84, v.getNames().length);
writer.write(v);
c.close();
c = getConnection();
names = c.createQueryTable("EXPECTED_NAMES", "SELECT * FROM properties");
Assert.assertEquals(89, names.getRowCount());
ITable values = c.createQueryTable("EXPECTED_VALUES", "SELECT * FROM property_values");
Assert.assertEquals(2, values.getRowCount());
ITable templates = c.createQueryTable("EXPECTED_TEMPLATES", "SELECT * FROM properties join catalog_references using(idreference) where title=\"" + d.getClass().getName() + "\"");
Assert.assertEquals(84, templates.getRowCount());
c.close();
}
use of ambit2.db.processors.DbDescriptorWriter in project ambit-mirror by ideaconsult.
the class DbDescriptorWriterTest method test.
@Test
public void test() throws Exception {
setUpDatabaseFromResource("ambit2/db/processors/test/descriptors-datasets.xml");
DbDescriptorWriter writer = new DbDescriptorWriter();
IDatabaseConnection c = getConnection();
ITable names = c.createQueryTable("EXPECTED_NAMES", "SELECT * FROM properties");
Assert.assertEquals(5, names.getRowCount());
writer.setConnection(c.getConnection());
writer.open();
XLogPDescriptor xlogp = new XLogPDescriptor();
writer.write(xlogp.calculate(MoleculeFactory.makeAlkane(10)));
DescriptorValue v = new DescriptorValue(new DescriptorSpecification("XLogPReference", "XLogPTitle", "XLogPIdentifier", "XLogPVendor"), new String[] {}, new Object[] {}, new DoubleResult(5), new String[] { "XLogP" });
writer.write(xlogp.calculate(MoleculeFactory.makeAlkane(10)));
writer.write(v);
c.close();
c = getConnection();
names = c.createQueryTable("EXPECTED_NAMES", "SELECT * FROM properties");
Assert.assertEquals(7, names.getRowCount());
ITable values = c.createQueryTable("EXPECTED_VALUES", "SELECT * FROM property_values");
Assert.assertEquals(2, values.getRowCount());
c.close();
}
Aggregations