Search in sources :

Example 1 with PseudoAtom

use of org.openscience.cdk.silent.PseudoAtom in project cdk by cdk.

the class AtomContainerManipulatorTest method dontSuppressHydrogensOnPseudoAtoms.

@Test
public void dontSuppressHydrogensOnPseudoAtoms() throws Exception {
    // *[H]
    IAtomContainer mol = new AtomContainer();
    mol.addAtom(new PseudoAtom("*"));
    mol.addAtom(new Atom("H"));
    mol.getAtom(0).setImplicitHydrogenCount(0);
    mol.getAtom(1).setImplicitHydrogenCount(1);
    mol.addBond(0, 1, Order.SINGLE);
    Assert.assertEquals(2, mol.getAtomCount());
    IAtomContainer ac = AtomContainerManipulator.removeHydrogens(mol);
    Assert.assertEquals(2, ac.getAtomCount());
}
Also used : IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) AtomContainer(org.openscience.cdk.AtomContainer) PseudoAtom(org.openscience.cdk.silent.PseudoAtom) PseudoAtom(org.openscience.cdk.silent.PseudoAtom) IAtom(org.openscience.cdk.interfaces.IAtom) Atom(org.openscience.cdk.Atom) Test(org.junit.Test)

Example 2 with PseudoAtom

use of org.openscience.cdk.silent.PseudoAtom in project cdk by cdk.

the class CDKToBeamTest method unknownSymbol.

@Test
public void unknownSymbol() throws Exception {
    IAtom a = new PseudoAtom("ALA");
    a.setImplicitHydrogenCount(0);
    assertThat(new CDKToBeam().toBeamAtom(a).element(), is(Element.Unknown));
}
Also used : IAtom(org.openscience.cdk.interfaces.IAtom) PseudoAtom(org.openscience.cdk.silent.PseudoAtom) Test(org.junit.Test)

Example 3 with PseudoAtom

use of org.openscience.cdk.silent.PseudoAtom in project cdk by cdk.

the class CDKToBeamTest method unknownSymbol_Pseudo.

@Test
public void unknownSymbol_Pseudo() throws Exception {
    IAtom a = new PseudoAtom("R1");
    a.setImplicitHydrogenCount(0);
    assertThat(new CDKToBeam().toBeamAtom(a).element(), is(Element.Unknown));
}
Also used : IAtom(org.openscience.cdk.interfaces.IAtom) PseudoAtom(org.openscience.cdk.silent.PseudoAtom) Test(org.junit.Test)

Example 4 with PseudoAtom

use of org.openscience.cdk.silent.PseudoAtom in project cdk by cdk.

the class CxSmilesTest method generateLabelledSmiles.

@Test
public void generateLabelledSmiles() throws CDKException {
    IAtomContainer mol = new AtomContainer();
    mol.addAtom(new Atom("C"));
    mol.getAtom(0).setImplicitHydrogenCount(3);
    mol.addAtom(new Atom("C"));
    mol.getAtom(1).setImplicitHydrogenCount(2);
    mol.addAtom(new PseudoAtom("R1"));
    mol.getAtom(2).setImplicitHydrogenCount(0);
    mol.addBond(0, 1, IBond.Order.SINGLE);
    mol.addBond(1, 2, IBond.Order.SINGLE);
    SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.CxAtomLabel);
    String smi = smigen.create(mol);
    assertThat(smi, is("CC* |$;;R1$|"));
}
Also used : IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) AtomContainer(org.openscience.cdk.silent.AtomContainer) PseudoAtom(org.openscience.cdk.silent.PseudoAtom) IPseudoAtom(org.openscience.cdk.interfaces.IPseudoAtom) Atom(org.openscience.cdk.silent.Atom) PseudoAtom(org.openscience.cdk.silent.PseudoAtom) IPseudoAtom(org.openscience.cdk.interfaces.IPseudoAtom) Test(org.junit.Test)

Example 5 with PseudoAtom

use of org.openscience.cdk.silent.PseudoAtom in project ambit-mirror by ideaconsult.

the class MarkushHelpers method toStringExhaustive.

public static String toStringExhaustive(SuppleAtomContainer sac) {
    StringBuffer sb = new StringBuffer();
    sb.append("Atom List" + endLine);
    sb.append("--------------" + endLine);
    for (int i = 0; i < sac.getAtomCount(); i++) {
        IAtom at = sac.getAtom(i);
        sb.append("  " + i + "  ");
        if (at instanceof PseudoAtom) {
            sb.append("PseudoAtom: " + at.getClass().getName() + endLine);
            // PseudoAtom pat = (PseudoAtom) at;
            continue;
        }
        sb.append(at.getSymbol() + endLine);
    }
    return (sb.toString());
}
Also used : IAtom(org.openscience.cdk.interfaces.IAtom) PseudoAtom(org.openscience.cdk.silent.PseudoAtom)

Aggregations

PseudoAtom (org.openscience.cdk.silent.PseudoAtom)7 Test (org.junit.Test)6 IAtom (org.openscience.cdk.interfaces.IAtom)4 IAtomContainer (org.openscience.cdk.interfaces.IAtomContainer)3 IPseudoAtom (org.openscience.cdk.interfaces.IPseudoAtom)2 Atom (org.openscience.cdk.silent.Atom)2 AtomContainer (org.openscience.cdk.silent.AtomContainer)2 Atom (org.openscience.cdk.Atom)1 AtomContainer (org.openscience.cdk.AtomContainer)1