use of org.openscience.cdk.Bond in project Smiles2Monomers by yoann-dufresne.
the class BlocsTests method setUp.
@Before
public void setUp() throws Exception {
this.sc = SmilesConverter.conv;
// String smiles = "C(C(=O)O)C(=O)N";
IAtom a1;
IAtom a2;
a1 = new Atom("C");
a1.setFlag(CDKConstants.ISAROMATIC, true);
a2 = new Atom("N");
a2.setFlag(CDKConstants.ISAROMATIC, true);
// NC
this.ext1 = new Extension(new Bond(a1, a2, Order.SINGLE));
a2 = new Atom("O");
// NC=O
this.ext2 = new Extension(new Bond(a1, a2, Order.DOUBLE));
a2 = new Atom("C");
a2.setFlag(CDKConstants.ISAROMATIC, true);
// NC(C)=O
this.ext3 = new Extension(new Bond(a1, a2, Order.SINGLE));
a1 = new Atom("C");
a1.setFlag(CDKConstants.ISAROMATIC, true);
// NC(CC)=O
this.ext4 = new Extension(new Bond(a1, a2, Order.SINGLE));
a2 = new Atom("C");
a2.setFlag(CDKConstants.ISAROMATIC, true);
// NC(CCC)=O
this.ext5 = new Extension(new Bond(a1, a2, Order.SINGLE));
a1 = new Atom("C");
a1.setFlag(CDKConstants.ISAROMATIC, true);
a2 = new Atom("N");
a2.setFlag(CDKConstants.ISAROMATIC, true);
// N1C(CCC1)=O
this.ext6 = new Extension(new Bond(a1, a2, Order.SINGLE));
// NC
this.blc1 = new Chain(null, ext1, -1, -1);
// NC=O
this.blc2 = new Chain(blc1, ext2, -1, 0);
// NC(C)=O
this.blc3 = new Chain(blc2, ext3, 0, -1);
// NC(CC)=O
this.blc4 = new Chain(blc3, ext4, 3, -1);
// NC(CCC)=O
this.blc5 = new Chain(blc4, ext5, 4, -1);
// N1C(CC1)=O
this.blc6 = new Chain(blc5, ext6, 5, 1);
}
use of org.openscience.cdk.Bond in project Smiles2Monomers by yoann-dufresne.
the class BonbMatchingTests method setUp.
@Before
public void setUp() throws Exception {
// cNH
IAtom a2 = new Atom("C");
a2.setImplicitHydrogenCount(0);
a2.setFlag(CDKConstants.ISAROMATIC, true);
IAtom a1 = new Atom("N");
a1.setImplicitHydrogenCount(1);
this.bond1 = new Bond(a1, a2, Order.DOUBLE);
}
use of org.openscience.cdk.Bond in project Smiles2Monomers by yoann-dufresne.
the class IsomorphismTests method setUp.
@Before
public void setUp() throws Exception {
// Database
Monomer[] monos = new Monomer[1];
Polymer pepTest = new Polymer(0, "malformin A1", "O=C1NC2C(=O)NC(C(=O)NC(C(=O)NC(C(=O)NC1CSSC2)C(C)CC)CC(C)C)C(C)C", monos);
// Extensions
IAtom a = new Atom("C");
IBond b1 = new Bond(new Atom("S"), a, Order.SINGLE);
this.ext1 = new Extension(b1);
a = new Atom("C");
IAtom a2 = new Atom("C");
IBond b2 = new Bond(a, a2, Order.SINGLE);
this.ext2 = new Extension(b2);
// Mapped blocs
this.mb0 = new MappedChain(pepTest, null, new ArrayList<Integer>(), new ArrayList<Integer>(), new ArrayList<MatchingType>(), new HashMap<Integer, Integer>());
// For blocs Tests
this.bloc = new Chain("S,0,c,0,0,-1,-1;c,0,c,0,0,-1,1");
}
use of org.openscience.cdk.Bond in project Smiles2Monomers by yoann-dufresne.
the class Extension method createBond.
private void createBond(String name0, int h0, boolean arom0, String name1, int h1, boolean arom1, Order ord) {
if (arom0)
name0 = name0.toLowerCase();
if (arom1)
name1 = name1.toLowerCase();
List<String> names = new ArrayList<>();
names.add(name0 + ":" + h0);
names.add(name1 + ":" + h1);
Collections.sort(names);
// this.inverted = !names.get(0).equals(name0 + ":" + h0);
IAtom c0 = null;
String n0 = names.get(0);
if (Extension.savedAtoms.containsKey(n0))
c0 = Extension.savedAtoms.get(n0);
else {
String[] split = n0.split(":");
char first = Character.toUpperCase(split[0].charAt(0));
String name = first + split[0].substring(1);
c0 = new Atom(name);
c0.setFlag(CDKConstants.ISAROMATIC, Character.isLowerCase(split[0].charAt(0)));
c0.setImplicitHydrogenCount(new Integer(split[1]));
Extension.savedAtoms.put(n0, c0);
}
IAtom c1 = null;
String n1 = names.get(1);
if (Extension.savedAtoms.containsKey(n1))
c1 = Extension.savedAtoms.get(n1);
else {
String[] split = n1.split(":");
char first = Character.toUpperCase(split[0].charAt(0));
String name = first + split[0].substring(1);
c1 = new Atom(name);
c1.setFlag(CDKConstants.ISAROMATIC, Character.isLowerCase(split[0].charAt(0)));
c1.setImplicitHydrogenCount(new Integer(split[1]));
Extension.savedAtoms.put(n1, c1);
}
String key = names.get(0) + ord + names.get(1);
if (Extension.savedBonds.containsKey(key)) {
this.bond = Extension.savedBonds.get(key);
} else {
this.bond = new Bond(c0, c1, ord);
Extension.savedBonds.put(key, this.bond);
}
}
use of org.openscience.cdk.Bond in project Smiles2Monomers by yoann-dufresne.
the class Extension method clone.
public Extension clone() {
Extension ext = new Extension();
IAtom a0 = null, a1 = null;
try {
a0 = (IAtom) this.bond.getAtom(0).clone();
a1 = (IAtom) this.bond.getAtom(1).clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
ext.bond = new Bond(a0, a1, this.bond.getOrder());
return ext;
}
Aggregations