use of ambit2.db.processors.ProcessorStructureRetrieval in project ambit-mirror by ideaconsult.
the class CallableFingerprintsModelCreator method createProcessors.
protected ProcessorsChain<IStructureRecord, IBatchStatistics, IProcessor> createProcessors() throws Exception {
ProcessorsChain<IStructureRecord, IBatchStatistics, IProcessor> p1 = new ProcessorsChain<IStructureRecord, IBatchStatistics, IProcessor>();
p1.add(new ProcessorStructureRetrieval());
p1.add(new MoleculeReader());
p1.add(new FingerprintGenerator(new Fingerprinter()));
p1.add(new DefaultAmbitProcessor<BitSet, BitSet>() {
/**
*/
private static final long serialVersionUID = -2978697147490545478L;
public BitSet process(BitSet target) throws AmbitException {
builder.getTrainingData().add(target);
return target;
}
});
p1.setAbortOnError(true);
return p1;
}
use of ambit2.db.processors.ProcessorStructureRetrieval in project ambit-mirror by ideaconsult.
the class CSVReporter method configurePropertyProcessors.
@Override
protected void configurePropertyProcessors() {
super.configurePropertyProcessors();
getProcessors().add(new ProcessorStructureRetrieval(new ReadChemicalIds()) {
@Override
public IStructureRecord process(IStructureRecord target) throws AmbitException {
((ReadChemicalIds) getQuery()).setValue(target);
return super.process(target);
}
});
}
use of ambit2.db.processors.ProcessorStructureRetrieval in project ambit-mirror by ideaconsult.
the class DbReaderTest method testProcess.
@Test
public void testProcess() throws Exception {
setUpDatabaseFromResource("ambit2/db/processors/test/descriptors-datasets.xml");
IDatabaseConnection c = getConnection();
ITable names = c.createQueryTable("EXPECTED_NAMES", "SELECT * FROM properties");
Assert.assertEquals(5, names.getRowCount());
ITable values = c.createQueryTable("EXPECTED_VALUES", "SELECT * FROM property_values");
Assert.assertEquals(2, values.getRowCount());
ProcessorsChain<IStructureRecord, IBatchStatistics, IProcessor> p = new ProcessorsChain<IStructureRecord, IBatchStatistics, IProcessor>();
p.add(new ProcessorStructureRetrieval());
p.add(new IProcessor<IStructureRecord, IStructureRecord>() {
public boolean isEnabled() {
return true;
}
public IStructureRecord process(IStructureRecord target) throws AmbitException {
// System.out.println(target.getContent());
return target;
}
public void setEnabled(boolean value) {
}
public long getID() {
return 0;
}
@Override
public void open() throws Exception {
}
@Override
public void close() throws Exception {
}
});
p.add(new MoleculeReader());
p.add(new AtomConfigurator());
p.add(new FunctionalGroup("Test", "P", "Test"));
p.add(new IProcessor<VerboseDescriptorResult, String>() {
/**
*/
private static final long serialVersionUID = -3923864774580483348L;
public String process(VerboseDescriptorResult target) throws AmbitException {
Assert.assertEquals("1", target.getResult().toString());
return target.toString();
}
public boolean isEnabled() {
return true;
}
public void setEnabled(boolean value) {
}
public long getID() {
return 0;
}
@Override
public void open() throws Exception {
}
@Override
public void close() throws Exception {
}
});
batch.setProcessorChain(p);
QueryStructureByID query = new QueryStructureByID(100215);
batch.setConnection(c.getConnection());
batch.open();
IBatchStatistics stats = batch.process(query);
Assert.assertEquals(1, stats.getRecords(IBatchStatistics.RECORDS_STATS.RECORDS_READ));
Assert.assertEquals(1, stats.getRecords(IBatchStatistics.RECORDS_STATS.RECORDS_PROCESSED));
// C20H20BrP
}
use of ambit2.db.processors.ProcessorStructureRetrieval in project ambit-mirror by ideaconsult.
the class FingerprintStructure_crud_test method createQuery.
@Override
protected IQueryUpdate<IStructureRecord, BitSet> createQuery() throws Exception {
CreateFingerprintStructure q = new CreateFingerprintStructure();
IStructureRecord record = new StructureRecord(7, 100211, null, null);
IDatabaseConnection c = getConnection();
ProcessorStructureRetrieval p = new ProcessorStructureRetrieval();
p.setConnection(c.getConnection());
MoleculeReader molReader = new MoleculeReader();
FingerprintGenerator g = new FingerprintGenerator(new Fingerprinter());
q.setObject(g.process(molReader.process(p.process(record))));
q.setGroup(record);
c.close();
return q;
}
use of ambit2.db.processors.ProcessorStructureRetrieval in project ambit-mirror by ideaconsult.
the class FPAtomEnvironmentCrudTest method createQuery.
@Override
protected IQueryUpdate<IStructureRecord, IStructureRecord> createQuery() throws Exception {
CreateAtomEnvironmentMatrix q = new CreateAtomEnvironmentMatrix();
IStructureRecord record = new StructureRecord(7, 100211, null, null);
IDatabaseConnection c = getConnection();
ProcessorStructureRetrieval p = new ProcessorStructureRetrieval();
p.setConnection(c.getConnection());
AtomEnvironmentMatrixGenerator gen = new AtomEnvironmentMatrixGenerator(3);
record = gen.process(p.process(record));
q.setObject(record);
q.setGroup(record);
c.close();
return q;
}
Aggregations