use of org.openscience.cdk.aromaticity.Aromaticity in project cdk by cdk.
the class RecursiveTest method testRecursiveSmarts27_cdkAromaticModel.
@Test
public void testRecursiveSmarts27_cdkAromaticModel() throws Exception {
SMARTSQueryTool sqt = smarts("[NX3;H2,H1;!$(NC=O)]");
IAtomContainer smi = smiles("CCCc1nc(c2n1[nH]c(nc2=O)c1cc(ccc1OCC)S(=O)(=O)N1CCN(CC1)CC)C");
sqt.setAromaticity(new Aromaticity(ElectronDonation.cdk(), Cycles.cdkAromaticSet()));
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(smi);
int[] result = SMARTSSearchTest.match(sqt, smi);
Assert.assertEquals(1, result[0]);
Assert.assertEquals(1, result[1]);
}
use of org.openscience.cdk.aromaticity.Aromaticity in project cdk by cdk.
the class RecursiveTest method testRecursiveSmarts26_cdkAromaticModel.
@Test
public void testRecursiveSmarts26_cdkAromaticModel() throws Exception {
SMARTSQueryTool sqt = smarts("[NX3;H2,H1;!$(NC=O)]");
IAtomContainer smi = smiles("CCCc1cc(=O)nc([nH]1)S");
sqt.setAromaticity(new Aromaticity(ElectronDonation.cdk(), Cycles.cdkAromaticSet()));
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(smi);
int[] result = SMARTSSearchTest.match(sqt, smi);
Assert.assertEquals(1, result[0]);
Assert.assertEquals(1, result[1]);
}
use of org.openscience.cdk.aromaticity.Aromaticity in project cdk by cdk.
the class RecursiveTest method testRecursive29_cdkAromaticModel.
@Test
public void testRecursive29_cdkAromaticModel() throws Exception {
SMARTSQueryTool sqt = smarts("[NX3;H2,H1;!$(NC=O)]");
IAtomContainer smi = smiles("Cc1cc(=O)c(c[nH]1)C(=O)NC(c1ccc(cc1)O)C(=O)NC1C(=O)N2C1SCC(=C2C(=O)O)CSc1nnnn1C");
sqt.setAromaticity(new Aromaticity(ElectronDonation.cdk(), Cycles.cdkAromaticSet()));
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(smi);
int[] result = SMARTSSearchTest.match(sqt, smi);
Assert.assertEquals(1, result[0]);
Assert.assertEquals(1, result[1]);
}
use of org.openscience.cdk.aromaticity.Aromaticity in project cdk by cdk.
the class AminoAcids method createAAs.
/**
* Creates amino acid AminoAcid objects.
*
* @return aminoAcids, a HashMap containing the amino acids as AminoAcids.
*/
public static synchronized AminoAcid[] createAAs() {
if (aminoAcids != null) {
return aminoAcids;
}
// amino-acids only have benzene aromaticity so we can run a simple
// alternating pi-bond arom model to keep things in a consistent state
Aromaticity arom = new Aromaticity(ElectronDonation.cdk(), Cycles.all(6));
// Create set of AtomContainers
aminoAcids = new AminoAcid[20];
IChemFile list = new ChemFile();
CMLReader reader = new CMLReader(AminoAcids.class.getClassLoader().getResourceAsStream("org/openscience/cdk/templates/data/list_aminoacids.cml"));
try {
list = reader.read(list);
List<IAtomContainer> containersList = ChemFileManipulator.getAllAtomContainers(list);
Iterator<IAtomContainer> iterator = containersList.iterator();
int counter = 0;
while (iterator.hasNext()) {
IAtomContainer ac = iterator.next();
LOGGER.debug("Adding AA: ", ac);
// convert into an AminoAcid
AminoAcid aminoAcid = new AminoAcid();
Iterator<IAtom> atoms = ac.atoms().iterator();
for (Object next : ac.getProperties().keySet()) {
LOGGER.debug("Prop class: " + next.getClass().getName());
LOGGER.debug("Prop: " + next);
if (next instanceof DictRef) {
DictRef dictRef = (DictRef) next;
// logger.debug("DictRef type: " + dictRef.getType());
if (dictRef.getType().equals("pdb:residueName")) {
aminoAcid.setProperty(RESIDUE_NAME, ac.getProperty(dictRef).toString().toUpperCase());
aminoAcid.setMonomerName(ac.getProperty(dictRef).toString());
} else if (dictRef.getType().equals("pdb:oneLetterCode")) {
aminoAcid.setProperty(RESIDUE_NAME_SHORT, ac.getProperty(dictRef));
} else if (dictRef.getType().equals("pdb:id")) {
aminoAcid.setProperty(ID, ac.getProperty(dictRef));
LOGGER.debug("Set AA ID to: " + ac.getProperty(dictRef));
} else {
LOGGER.error("Cannot deal with dictRef!");
}
}
}
while (atoms.hasNext()) {
IAtom atom = atoms.next();
String dictRef = atom.getProperty("org.openscience.cdk.dict");
if (dictRef != null && dictRef.equals("pdb:nTerminus")) {
aminoAcid.addNTerminus(atom);
} else if (dictRef != null && dictRef.equals("pdb:cTerminus")) {
aminoAcid.addCTerminus(atom);
} else {
aminoAcid.addAtom(atom);
}
}
for (IBond bond : ac.bonds()) {
aminoAcid.addBond(bond);
}
AminoAcidManipulator.removeAcidicOxygen(aminoAcid);
aminoAcid.setProperty(NO_ATOMS, "" + aminoAcid.getAtomCount());
aminoAcid.setProperty(NO_BONDS, "" + aminoAcid.getBondCount());
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(aminoAcid);
arom.apply(aminoAcid);
if (counter < aminoAcids.length) {
aminoAcids[counter] = aminoAcid;
} else {
LOGGER.error("Could not store AminoAcid! Array too short!");
}
counter++;
}
reader.close();
} catch (CDKException | IOException exception) {
LOGGER.error("Failed reading file: ", exception.getMessage());
LOGGER.debug(exception);
}
return aminoAcids;
}
use of org.openscience.cdk.aromaticity.Aromaticity in project MetFragRelaunched by ipb-halle.
the class MoleculeFunctions method getAtomContainerFromSMILES.
public static IAtomContainer getAtomContainerFromSMILES(String smiles) throws Exception {
SmilesParser sp = new SmilesParser(SilentChemObjectBuilder.getInstance());
IAtomContainer molecule = sp.parseSmiles(smiles);
for (int i = 0; i < molecule.getAtomCount(); i++) {
if (molecule.getAtom(i).getSymbol().equals("H"))
continue;
else {
java.util.List<IAtom> atoms = molecule.getConnectedAtomsList(molecule.getAtom(i));
short numDs = 0;
for (IAtom atom : atoms) if (atom.getSymbol().equals("H") && (atom.getMassNumber() != null && atom.getMassNumber() == 2))
numDs++;
molecule.getAtom(i).setProperty(VariableNames.DEUTERIUM_COUNT_NAME, numDs);
}
}
try {
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule);
Aromaticity arom = new Aromaticity(ElectronDonation.cdk(), Cycles.cdkAromaticSet());
arom.apply(molecule);
} catch (CDKException e) {
e.printStackTrace();
}
return molecule;
}
Aggregations