use of org.openscience.cdk.interfaces.IPDBAtom in project ambit-mirror by ideaconsult.
the class DescriptorsCalculator method preprocess.
@Override
public IAtomContainer preprocess(IStructureRecord target) throws AmbitException {
IAtomContainer a = reader.process(target);
boolean preprocess = ((a != null) && (a.getAtomCount() > 0));
for (IAtom atom : a.atoms()) if (atom instanceof IPDBAtom) {
preprocess = false;
break;
}
// necessary for some calculations
for (Property p : target.getRecordProperties()) try {
a.setProperty(p.getName(), target.getRecordProperty(p));
} catch (Exception x) {
x.printStackTrace();
}
writer.setStructure(target);
selfwriter.setStructure(target);
if (preprocess) {
try {
cfg.process(a);
} catch (Exception x) {
// logger.warn(x);
}
try {
ha.process(a);
} catch (Exception x) {
// logger.warn(x);
}
try {
CDKHueckelAromaticityDetector.detectAromaticity(a);
} catch (Exception x) {
// logger.warn(x);
}
} else {
}
return a;
}
use of org.openscience.cdk.interfaces.IPDBAtom in project cdk by cdk.
the class PDBPolymerTest method testGetMonomerNamesInSequentialOrder.
@Test
public void testGetMonomerNamesInSequentialOrder() {
PDBPolymer pdbPolymer = new PDBPolymer();
Assert.assertEquals(0, pdbPolymer.getMonomerNames().size());
IStrand oStrand1 = pdbPolymer.getBuilder().newInstance(IStrand.class);
oStrand1.setStrandName("A");
IMonomer oMono1 = pdbPolymer.getBuilder().newInstance(IMonomer.class);
oMono1.setMonomerName("TRP279");
IMonomer oMono2 = pdbPolymer.getBuilder().newInstance(IMonomer.class);
oMono2.setMonomerName("CYS280");
IPDBAtom oPDBAtom2 = pdbPolymer.getBuilder().newInstance(IPDBAtom.class, "C");
IPDBAtom oPDBAtom3 = pdbPolymer.getBuilder().newInstance(IPDBAtom.class, "C");
pdbPolymer.addAtom(oPDBAtom2, oMono1, oStrand1);
pdbPolymer.addAtom(oPDBAtom3, oMono2, oStrand1);
Assert.assertNotNull(pdbPolymer.getAtom(0));
Assert.assertNotNull(pdbPolymer.getAtom(1));
Assert.assertEquals(oPDBAtom2, pdbPolymer.getAtom(0));
Assert.assertEquals(oPDBAtom3, pdbPolymer.getAtom(1));
Iterator<String> monomers = pdbPolymer.getMonomerNamesInSequentialOrder().iterator();
Assert.assertEquals("TRP279", monomers.next());
Assert.assertEquals("CYS280", monomers.next());
}
use of org.openscience.cdk.interfaces.IPDBAtom in project cdk by cdk.
the class DebugPDBAtomTest method testDebugPDBAtom_String.
/**
* Method to test the Atom(String symbol) method.
*/
@Test
public void testDebugPDBAtom_String() {
IPDBAtom a = new DebugPDBAtom("C");
Assert.assertEquals("C", a.getSymbol());
Assert.assertNull(a.getPoint2d());
Assert.assertNull(a.getPoint3d());
Assert.assertNull(a.getFractionalPoint3d());
}
use of org.openscience.cdk.interfaces.IPDBAtom in project cdk by cdk.
the class PDBAtomTest method testPDBAtom_String.
/**
* Method to test the Atom(String symbol) method.
*/
@Test
public void testPDBAtom_String() {
IPDBAtom a = new PDBAtom("C");
Assert.assertEquals("C", a.getSymbol());
Assert.assertNull(a.getPoint2d());
Assert.assertNull(a.getPoint3d());
Assert.assertNull(a.getFractionalPoint3d());
}
use of org.openscience.cdk.interfaces.IPDBAtom in project cdk by cdk.
the class DebugPDBPolymerTest method testDebugPDBPolymer.
@Test
public void testDebugPDBPolymer() {
IPDBPolymer pdbPolymer = new DebugPDBPolymer();
Assert.assertNotNull(pdbPolymer);
Assert.assertEquals(pdbPolymer.getMonomerCount(), 0);
IStrand oStrand1 = pdbPolymer.getBuilder().newInstance(IStrand.class);
oStrand1.setStrandName("A");
IStrand oStrand2 = pdbPolymer.getBuilder().newInstance(IStrand.class);
oStrand2.setStrandName("B");
IMonomer oMono1 = pdbPolymer.getBuilder().newInstance(IMonomer.class);
oMono1.setMonomerName("TRP279");
IMonomer oMono2 = pdbPolymer.getBuilder().newInstance(IMonomer.class);
oMono2.setMonomerName("HOH");
IMonomer oMono3 = pdbPolymer.getBuilder().newInstance(IMonomer.class);
oMono3.setMonomerName("GLYA16");
IPDBAtom oPDBAtom1 = pdbPolymer.getBuilder().newInstance(IPDBAtom.class, "C");
IPDBAtom oPDBAtom2 = pdbPolymer.getBuilder().newInstance(IPDBAtom.class, "C");
IPDBAtom oPDBAtom3 = pdbPolymer.getBuilder().newInstance(IPDBAtom.class, "C");
IPDBAtom oPDBAtom4 = pdbPolymer.getBuilder().newInstance(IPDBAtom.class, "C");
IPDBAtom oPDBAtom5 = pdbPolymer.getBuilder().newInstance(IPDBAtom.class, "C");
pdbPolymer.addAtom(oPDBAtom1);
pdbPolymer.addAtom(oPDBAtom2, oStrand1);
pdbPolymer.addAtom(oPDBAtom3, oMono1, oStrand1);
pdbPolymer.addAtom(oPDBAtom4, oMono2, oStrand2);
pdbPolymer.addAtom(oPDBAtom5, oMono3, oStrand2);
Assert.assertNotNull(pdbPolymer.getAtom(0));
Assert.assertNotNull(pdbPolymer.getAtom(1));
Assert.assertNotNull(pdbPolymer.getAtom(2));
Assert.assertNotNull(pdbPolymer.getAtom(3));
Assert.assertNotNull(pdbPolymer.getAtom(4));
Assert.assertEquals(oPDBAtom1, pdbPolymer.getAtom(0));
Assert.assertEquals(oPDBAtom2, pdbPolymer.getAtom(1));
Assert.assertEquals(oPDBAtom3, pdbPolymer.getAtom(2));
Assert.assertEquals(oPDBAtom4, pdbPolymer.getAtom(3));
Assert.assertEquals(oPDBAtom5, pdbPolymer.getAtom(4));
Assert.assertNull(pdbPolymer.getMonomer("0815", "A"));
Assert.assertNull(pdbPolymer.getMonomer("0815", "B"));
Assert.assertNull(pdbPolymer.getMonomer("0815", ""));
Assert.assertNull(pdbPolymer.getStrand(""));
Assert.assertNotNull(pdbPolymer.getMonomer("TRP279", "A"));
Assert.assertEquals(oMono1, pdbPolymer.getMonomer("TRP279", "A"));
Assert.assertEquals(pdbPolymer.getMonomer("TRP279", "A").getAtomCount(), 1);
Assert.assertNotNull(pdbPolymer.getMonomer("HOH", "B"));
Assert.assertEquals(oMono2, pdbPolymer.getMonomer("HOH", "B"));
Assert.assertEquals(pdbPolymer.getMonomer("HOH", "B").getAtomCount(), 1);
Assert.assertEquals(pdbPolymer.getStrand("B").getAtomCount(), 2);
Assert.assertEquals(pdbPolymer.getStrand("B").getMonomerCount(), 2);
Assert.assertNull(pdbPolymer.getStrand("C"));
Assert.assertNotNull(pdbPolymer.getStrand("B"));
}
Aggregations