Search in sources :

Example 1 with IPDBAtom

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;
}
Also used : IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) IPDBAtom(org.openscience.cdk.interfaces.IPDBAtom) DescriptorValue2Property(ambit2.descriptors.processors.DescriptorValue2Property) Property(ambit2.base.data.Property) IAtom(org.openscience.cdk.interfaces.IAtom) AmbitException(net.idea.modbcum.i.exceptions.AmbitException) DbAmbitException(net.idea.modbcum.i.exceptions.DbAmbitException)

Example 2 with IPDBAtom

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());
}
Also used : IPDBPolymer(org.openscience.cdk.interfaces.IPDBPolymer) IPDBAtom(org.openscience.cdk.interfaces.IPDBAtom) IStrand(org.openscience.cdk.interfaces.IStrand) IMonomer(org.openscience.cdk.interfaces.IMonomer) AbstractPDBPolymerTest(org.openscience.cdk.test.interfaces.AbstractPDBPolymerTest) Test(org.junit.Test)

Example 3 with IPDBAtom

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());
}
Also used : IPDBAtom(org.openscience.cdk.interfaces.IPDBAtom) Test(org.junit.Test) AbstractPDBAtomTest(org.openscience.cdk.test.interfaces.AbstractPDBAtomTest)

Example 4 with IPDBAtom

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());
}
Also used : IPDBAtom(org.openscience.cdk.interfaces.IPDBAtom) IPDBAtom(org.openscience.cdk.interfaces.IPDBAtom) Test(org.junit.Test) AbstractPDBAtomTest(org.openscience.cdk.test.interfaces.AbstractPDBAtomTest)

Example 5 with IPDBAtom

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"));
}
Also used : IPDBPolymer(org.openscience.cdk.interfaces.IPDBPolymer) IPDBAtom(org.openscience.cdk.interfaces.IPDBAtom) IStrand(org.openscience.cdk.interfaces.IStrand) IMonomer(org.openscience.cdk.interfaces.IMonomer) AbstractPDBPolymerTest(org.openscience.cdk.test.interfaces.AbstractPDBPolymerTest) Test(org.junit.Test)

Aggregations

IPDBAtom (org.openscience.cdk.interfaces.IPDBAtom)55 Test (org.junit.Test)52 IPDBPolymer (org.openscience.cdk.interfaces.IPDBPolymer)18 IStrand (org.openscience.cdk.interfaces.IStrand)16 IMonomer (org.openscience.cdk.interfaces.IMonomer)13 Point3d (javax.vecmath.Point3d)11 IAtom (org.openscience.cdk.interfaces.IAtom)7 AbstractPDBAtomTest (org.openscience.cdk.test.interfaces.AbstractPDBAtomTest)7 AbstractPDBPolymerTest (org.openscience.cdk.test.interfaces.AbstractPDBPolymerTest)5 IAtomContainer (org.openscience.cdk.interfaces.IAtomContainer)4 IChemObjectBuilder (org.openscience.cdk.interfaces.IChemObjectBuilder)4 IPDBMonomer (org.openscience.cdk.interfaces.IPDBMonomer)4 InputStream (java.io.InputStream)2 Hashtable (java.util.Hashtable)2 Property (ambit2.base.data.Property)1 DescriptorValue2Property (ambit2.descriptors.processors.DescriptorValue2Property)1 StringWriter (java.io.StringWriter)1 Point2d (javax.vecmath.Point2d)1 AmbitException (net.idea.modbcum.i.exceptions.AmbitException)1 DbAmbitException (net.idea.modbcum.i.exceptions.DbAmbitException)1