Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 2 contributors
Commits on Apr 19, 2012
@rajarshi rajarshi Updated TPSA descriptor to properly cast to IRing rather than differe…
…nt Ring implementations. Added unit test

Change-Id: I613cdf7728b2f9f9f9ece9a2742104d0c012fa6b
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
090afa9
@egonw egonw Backport patch for 'Updated TPSA descriptor to properly cast to IRing…
… rather than different Ring implementations. Added unit test'

Change-Id: I152fa5d5efb3b9702ae25c31af5d4e850f2c3faf
d5948c7
View
1  src/META-INF/test-qsarmolecular.cdkdepends
@@ -30,3 +30,4 @@ cdk-builder3d.jar
cdk-forcefield.jar
cdk-sdg.jar
cdk-ioformats.jar
+cdk-silent.jar
View
8 src/main/org/openscience/cdk/qsar/descriptors/molecular/TPSADescriptor.java
@@ -24,7 +24,6 @@
package org.openscience.cdk.qsar.descriptors.molecular;
import org.openscience.cdk.CDKConstants;
-import org.openscience.cdk.Ring;
import org.openscience.cdk.annotations.TestClass;
import org.openscience.cdk.annotations.TestMethod;
import org.openscience.cdk.aromaticity.CDKHueckelAromaticityDetector;
@@ -32,6 +31,7 @@
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IBond;
+import org.openscience.cdk.interfaces.IRing;
import org.openscience.cdk.interfaces.IRingSet;
import org.openscience.cdk.qsar.DescriptorSpecification;
import org.openscience.cdk.qsar.DescriptorValue;
@@ -257,9 +257,7 @@ public DescriptorValue calculate(IAtomContainer atomContainer) {
}
// iterate over all atoms of ac
- java.util.Iterator atoms = ac.atoms().iterator();
- while (atoms.hasNext()) {
- IAtom atom = (IAtom) atoms.next();
+ for (IAtom atom : ac.atoms()) {
if (atom.getSymbol().equals("N") || atom.getSymbol().equals("O") ||
atom.getSymbol().equals("S") || atom.getSymbol().equals("P")) {
int singleBondCount = 0;
@@ -321,7 +319,7 @@ else if (connectedBond.getOrder() == CDKConstants.BONDORDER_TRIPLE)
if (rs.contains(atom)) {
IRingSet rsAtom = rs.getRings(atom);
for (int ringSetIndex = 0; ringSetIndex < rsAtom.getAtomContainerCount(); ringSetIndex++) {
- Ring ring = (Ring) rsAtom.getAtomContainer(ringSetIndex);
+ IRing ring = (IRing) rsAtom.getAtomContainer(ringSetIndex);
if (ring.getRingSize() == 3)
isIn3MemberRing = 1;
}
View
12 src/test/org/openscience/cdk/qsar/descriptors/molecular/TPSADescriptorTest.java
@@ -27,8 +27,11 @@
import org.junit.Before;
import org.junit.Test;
import org.openscience.cdk.DefaultChemObjectBuilder;
+import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IMolecule;
+import org.openscience.cdk.qsar.DescriptorValue;
import org.openscience.cdk.qsar.result.DoubleResult;
+import org.openscience.cdk.silent.SilentChemObjectBuilder;
import org.openscience.cdk.smiles.SmilesParser;
/**
@@ -103,6 +106,15 @@ public void testTPSA2() throws Exception {
Assert.assertEquals(40.45, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 0.1); //at: 16
}
+ @Test
+ public void testRing() throws Exception {
+ sp = new SmilesParser(SilentChemObjectBuilder.getInstance());
+ IAtomContainer mol = sp.parseSmiles("C1CCCC1CCC2CCCNC2");
+ addExplicitHydrogens(mol);
+ DescriptorValue dv = descriptor.calculate(mol);
+ Assert.assertNotNull(dv);
+ }
+
}

No commit comments for this range

Something went wrong with that request. Please try again.