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.
...
  • 5 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jun 27, 2011
@egonw egonw Code clean up: use IMolecule interface, and properly typed List
Signed-off-by: Rajarshi  Guha <rajarshi.guha@gmail.com>
6ae652f
@egonw egonw Added missing test annotation
Signed-off-by: Rajarshi  Guha <rajarshi.guha@gmail.com>
4601c4b
@egonw egonw Extend the MolecularDescriptorTest
Signed-off-by: Rajarshi  Guha <rajarshi.guha@gmail.com>
ac02901
@egonw egonw Fixed returning of the descriptor result type: actual length
Signed-off-by: Rajarshi  Guha <rajarshi.guha@gmail.com>
5049178
@egonw egonw Typo fix
Signed-off-by: Rajarshi  Guha <rajarshi.guha@gmail.com>
8eba14e
View
1  src/META-INF/qsar.cdkdepends
@@ -1,6 +1,5 @@
cdk-annotation.jar
cdk-interfaces.jar
-cdk-data.jar
cdk-core.jar
cdk-standard.jar
cdk-valencycheck.jar
View
17 src/main/org/openscience/cdk/qsar/descriptors/atompair/PiContactDetectionDescriptor.java
@@ -1,6 +1,5 @@
-/* $Revision$ $Author$ $Date$
- *
- * Copyright (C) 2004-2007 The Chemistry Development Kit (CDK) project
+/* Copyright (C) 2004-2007 The Chemistry Development Kit (CDK) project
+ * 2011 Egon Willighagen <egonw@users.sf.net>
*
* Contact: cdk-devel@lists.sourceforge.net
*
@@ -20,7 +19,8 @@
*/
package org.openscience.cdk.qsar.descriptors.atompair;
-import org.openscience.cdk.Molecule;
+import java.util.List;
+
import org.openscience.cdk.annotations.TestMethod;
import org.openscience.cdk.aromaticity.CDKHueckelAromaticityDetector;
import org.openscience.cdk.exception.CDKException;
@@ -28,6 +28,7 @@
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IAtomContainerSet;
+import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.qsar.DescriptorSpecification;
import org.openscience.cdk.qsar.DescriptorValue;
import org.openscience.cdk.qsar.IAtomPairDescriptor;
@@ -155,7 +156,7 @@ public DescriptorValue calculate(IAtom first, IAtom second, IAtomContainer atomC
IAtom clonedFirst = ac.getAtom(atomContainer.getAtomNumber(first));
IAtom clonedSecond = ac.getAtom(atomContainer.getAtomNumber(first));
- Molecule mol = new Molecule(ac);
+ IMolecule mol = ac.getBuilder().newInstance(IMolecule.class, ac);
if (checkAromaticity) {
try {
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol);
@@ -203,11 +204,11 @@ public DescriptorValue calculate(IAtom first, IAtom second, IAtomContainer atomC
* @param ac AtomContainer
* @return The boolean result
*/
- private boolean isANeighboorsInAnAtomContainer(java.util.List neighs, IAtomContainer ac) {
+ private boolean isANeighboorsInAnAtomContainer(List<IAtom> neighs, IAtomContainer ac) {
boolean isIn = false;
int count = 0;
- for (Object neigh : neighs) {
- if (ac.contains((IAtom) neigh)) {
+ for (IAtom neigh : neighs) {
+ if (ac.contains(neigh)) {
count += 1;
}
}
View
15 src/main/org/openscience/cdk/qsar/descriptors/protein/TaeAminoAcidDescriptor.java
@@ -37,6 +37,7 @@
import org.openscience.cdk.Monomer;
import org.openscience.cdk.Strand;
+import org.openscience.cdk.annotations.TestClass;
import org.openscience.cdk.annotations.TestMethod;
import org.openscience.cdk.exception.CDKException;
import org.openscience.cdk.interfaces.IAtomContainer;
@@ -45,6 +46,7 @@
import org.openscience.cdk.qsar.DescriptorValue;
import org.openscience.cdk.qsar.IMolecularDescriptor;
import org.openscience.cdk.qsar.result.DoubleArrayResult;
+import org.openscience.cdk.qsar.result.DoubleArrayResultType;
import org.openscience.cdk.qsar.result.IDescriptorResult;
import org.openscience.cdk.tools.ILoggingTool;
import org.openscience.cdk.tools.LoggingToolFactory;
@@ -55,7 +57,7 @@
* <p/>
* The TAE descriptors ({@cdk.cite BREN1995} {@cdk.cite BREN1997} {@cdk.cite WHITE2003})
* are derived from pre-calculated quantum mechanical parameters. This class
- * uses the paramaters for amino acids and thus evaluates a set of 147 descriptors for peptide
+ * uses the parameters for amino acids and thus evaluates a set of 147 descriptors for peptide
* sequences.
* <p/>
* The class expects that it will be supplied an object which implements the {@link IBioPolymer}. Thus ordinary
@@ -119,6 +121,7 @@
* @cdk.dictref qsar-descriptors:taeAminoAcid
* @see IBioPolymer
*/
+@TestClass("org.openscience.cdk.qsar.descriptors.protein.TaeAminoAcidDescriptorTest")
public class TaeAminoAcidDescriptor implements IMolecularDescriptor {
private static ILoggingTool logger =
LoggingToolFactory.createLoggingTool(TaeAminoAcidDescriptor.class);
@@ -207,6 +210,7 @@ public TaeAminoAcidDescriptor() {
loadTAEParams();
}
+ @TestMethod("testGetSpecification")
public DescriptorSpecification getSpecification() {
return new DescriptorSpecification(
"http://www.blueobelisk.org/ontologies/chemoinformatics-algorithms/#taeAminoAcid",
@@ -223,6 +227,7 @@ public DescriptorSpecification getSpecification() {
* @throws org.openscience.cdk.exception.CDKException
* Description of the Exception
*/
+ @TestMethod("testSetParameters_arrayObject")
public void setParameters(Object[] params) throws CDKException {
// no parameters for this descriptor
}
@@ -232,6 +237,7 @@ public void setParameters(Object[] params) throws CDKException {
*
* @return The parameters value
*/
+ @TestMethod("testGetParameters")
public Object[] getParameters() {
// no parameters to return
return (null);
@@ -249,6 +255,7 @@ public void setParameters(Object[] params) throws CDKException {
*
* @return The parameterNames value
*/
+ @TestMethod("testGetParameterNames")
public String[] getParameterNames() {
// no param names to return
return (null);
@@ -261,6 +268,7 @@ public void setParameters(Object[] params) throws CDKException {
* @param name Description of the Parameter
* @return The parameterType value
*/
+ @TestMethod("testGetParameterType_String")
public Object getParameterType(String name) {
return (null);
}
@@ -279,7 +287,7 @@ private DescriptorValue getDummyDescriptorValue(Exception e) {
* @param container Parameter is the atom container which should implement {@link IBioPolymer}.
* @return A DoubleArrayResult value representing the 147 TAE descriptors
*/
-
+ @TestMethod("testTaeAminoAcidDescriptor")
public DescriptorValue calculate(IAtomContainer container) {
if (TAEParams == null) return getDummyDescriptorValue(new CDKException("TAE parameters were not initialized"));
if (!(container instanceof IBioPolymer)) return getDummyDescriptorValue(new CDKException("The molecule should be of type IBioPolymer"));
@@ -331,8 +339,9 @@ public DescriptorValue calculate(IAtomContainer container) {
* @return an object that implements the {@link org.openscience.cdk.qsar.result.IDescriptorResult} interface indicating
* the actual type of values returned by the descriptor in the {@link org.openscience.cdk.qsar.DescriptorValue} object
*/
+ @TestMethod("testGetDescriptorResultType")
public IDescriptorResult getDescriptorResultType() {
- return new DoubleArrayResult();
+ return new DoubleArrayResultType(147);
}
}
View
11 src/test/org/openscience/cdk/qsar/descriptors/protein/TaeAminoAcidDescriptorTest.java
@@ -25,14 +25,14 @@
package org.openscience.cdk.qsar.descriptors.protein;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.openscience.cdk.BioPolymer;
-import org.openscience.cdk.CDKTestCase;
import org.openscience.cdk.exception.CDKException;
import org.openscience.cdk.interfaces.IBioPolymer;
import org.openscience.cdk.qsar.DescriptorValue;
import org.openscience.cdk.qsar.IMolecularDescriptor;
+import org.openscience.cdk.qsar.descriptors.molecular.MolecularDescriptorTest;
import org.openscience.cdk.qsar.result.DoubleArrayResult;
import org.openscience.cdk.tools.ProteinBuilderTool;
@@ -42,7 +42,7 @@
* @cdk.module test-qsarprotein
*
*/
-public class TaeAminoAcidDescriptorTest extends CDKTestCase {
+public class TaeAminoAcidDescriptorTest extends MolecularDescriptorTest {
private static IMolecularDescriptor descriptor;
@@ -50,6 +50,11 @@
descriptor = new TaeAminoAcidDescriptor();
}
+ @Before
+ public void setDescriptor() throws Exception {
+ super.setDescriptor(TaeAminoAcidDescriptor.class);
+ }
+
@Test public void testTaeAminoAcidDescriptor() throws ClassNotFoundException, CDKException, Exception {
IBioPolymer pepseq = ProteinBuilderTool.createProtein("ACDEFGH");
DescriptorValue result = descriptor.calculate(pepseq);

No commit comments for this range

Something went wrong with that request. Please try again.