use of ambit2.descriptors.PKANode in project ambit-mirror by ideaconsult.
the class PKASmartsDescriptor method calculate.
public DescriptorValue calculate(IAtomContainer arg0) {
try {
ArrayList<String> trace = new ArrayList<String>();
PKANode node = traverse(arg0, root, trace);
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new VerboseDescriptorResult<String, DoubleResult>(new DoubleResult(node.getPka()), trace.toString()), title);
} catch (Exception x) {
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), null, title, x);
}
}
use of ambit2.descriptors.PKANode in project ambit-mirror by ideaconsult.
the class PKASmartsDescriptorTest method test.
@Test
public void test() throws Exception {
Hashtable<Integer, PKANode> tree = pka.getTree();
Enumeration<Integer> k = tree.keys();
SmartsPatternAmbit pattern = new SmartsPatternAmbit(SilentChemObjectBuilder.getInstance());
ArrayList<String> smarts = new ArrayList<String>();
int failedNodes = 0;
int failedSmarts = 0;
int nullSmarts = 0;
int allnodes = 0;
while (k.hasMoreElements()) {
PKANode node = tree.get(k.nextElement());
allnodes++;
try {
if (node.getSmarts() == null) {
nullSmarts++;
} else
pattern.setSmarts(node.getSmarts());
} catch (Exception x) {
failedNodes++;
if (smarts.indexOf(node.getSmarts()) < 0) {
smarts.add(node.getSmarts());
failedSmarts++;
}
}
}
if (smarts.size() > 0) {
/*
System.out.println("Failed nodes "+failedNodes);
System.out.println("Failed smarts "+failedSmarts);
for (int i=0; i < smarts.size();i++)
System.out.println('\''+smarts.get(i)+'\'');
*/
}
// root smarts
Assert.assertEquals(1, nullSmarts);
Assert.assertTrue(failedNodes == 0);
Assert.assertEquals(1527, allnodes);
}
use of ambit2.descriptors.PKANode in project ambit-mirror by ideaconsult.
the class PKASmartsDescriptorTest method test462.
@Test
public void test462() throws Exception {
IAtomContainer mol = SmartsHelper.getMoleculeFromSmiles("O[N+](=O)[O-]");
HydrogenAdderProcessor ha = new HydrogenAdderProcessor();
ha.setAddEexplicitHydrogens(true);
mol = ha.process(mol);
CDKHueckelAromaticityDetector.detectAromaticity(mol);
AtomConfigurator cfg = new AtomConfigurator();
cfg.process(mol);
PKANode node = new PKANode();
node.setSmarts("[i][#G6v2]");
Assert.assertFalse(node.find(mol));
}
use of ambit2.descriptors.PKANode in project ambit-mirror by ideaconsult.
the class PKASmartsDescriptorTest method testAcidPkaNode.
@Test
public void testAcidPkaNode() throws Exception {
IAtomContainer mol = SmartsHelper.getMoleculeFromSmiles("O[N+](=O)[O-]");
HydrogenAdderProcessor ha = new HydrogenAdderProcessor();
ha.setAddEexplicitHydrogens(true);
mol = ha.process(mol);
CDKHueckelAromaticityDetector.detectAromaticity(mol);
AtomConfigurator cfg = new AtomConfigurator();
cfg.process(mol);
PKANode node = new PKANode();
node.setSmarts("[#G6;H][i]");
Assert.assertTrue(node.find(mol));
}
Aggregations