diff --git a/src/main/org/openscience/cdk/dict/data/descriptor-algorithms.owl b/src/main/org/openscience/cdk/dict/data/descriptor-algorithms.owl index 02f1289c7e8..8320ab2c4ee 100644 --- a/src/main/org/openscience/cdk/dict/data/descriptor-algorithms.owl +++ b/src/main/org/openscience/cdk/dict/data/descriptor-algorithms.owl @@ -2493,7 +2493,7 @@ 2010-08-31 - Characterizes molecular complexity in terms of carbon hybridization states + Characterizes molecular complexity in terms of carbon hybridization states. This descriptor is designed to give a simple characterization of molecular diff --git a/src/main/org/openscience/cdk/qsar/descriptors/molecular/HybridizationRatioDescriptor.java b/src/main/org/openscience/cdk/qsar/descriptors/molecular/HybridizationRatioDescriptor.java index d4e7f78c540..5817dab9368 100644 --- a/src/main/org/openscience/cdk/qsar/descriptors/molecular/HybridizationRatioDescriptor.java +++ b/src/main/org/openscience/cdk/qsar/descriptors/molecular/HybridizationRatioDescriptor.java @@ -1,10 +1,7 @@ /* - * $RCSfile$ - * $Author$ - * $Date$ - * $Revision$ * - * Copyright (C) 2004-2007 The Chemistry Development Kit (CDK) project + * + * Copyright (C) 2010 Rajarshi Guha * * Contact: cdk-devel@lists.sourceforge.net * @@ -38,7 +35,7 @@ import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; /** - * IDescriptor that reports the fraction of sp3 carbons to sp2 carbons. + * {@link IDescriptor} that reports the fraction of sp3 carbons to sp2 carbons. *

* Note that it only considers carbon atoms and rather than use a simple ratio * it reports the value of Nsp3/ (Nsp3 + Nsp2). @@ -56,23 +53,15 @@ public class HybridizationRatioDescriptor implements IMolecularDescriptor { /** - * Constructor for the WeightDescriptor object. + * Constructor for the HybridizationRatioDescriptor object. */ public HybridizationRatioDescriptor() { } /** - * Returns a Map which specifies which descriptor is implemented by this class. - *

- * These fields are used in the map: - *

    - *
  • Specification-Reference: refers to an entry in a unique dictionary - *
  • Implementation-Title: anything - *
  • Implementation-Identifier: a unique identifier for this version of - * this class - *
  • Implementation-Vendor: CDK, JOELib, or anything else - *
+ * Returns a {@link Map} which specifies which descriptor is implemented by this class. * + * @inheritDoc * @return An object containing the descriptor specification */ @TestMethod("testGetSpecification") @@ -85,7 +74,7 @@ public DescriptorSpecification getSpecification() { } /** - * Sets the parameters attribute of the WeightDescriptor object. + * Sets the parameters attribute of the HybridizationRatioDescriptor object. * * @param params The new parameters value * @throws org.openscience.cdk.exception.CDKException @@ -99,7 +88,9 @@ public void setParameters(Object[] params) throws CDKException { /** - * Gets the parameters attribute of the WeightDescriptor object. + * Gets the parameters attribute of the HybridizationRatioDescriptor object. + * + * This descriptor takes no parameters * * @return The parameters value * @see #setParameters @@ -114,6 +105,12 @@ public String[] getDescriptorNames() { return new String[]{"HybRatio"}; } + /** + * @inheritDoc + * + * @param e + * @return + */ private DescriptorValue getDummyDescriptorValue(Exception e) { return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(Double.NaN), getDescriptorNames(), e); @@ -121,10 +118,10 @@ private DescriptorValue getDummyDescriptorValue(Exception e) { /** - * Calculate the weight of specified element type in the supplied {@link org.openscience.cdk.interfaces.IAtomContainer}. + * Calculate sp3/sp2 hybridization ratio in the supplied {@link org.openscience.cdk.interfaces.IAtomContainer}. * * @param container The AtomContainer for which this descriptor is to be calculated. - * @return The total weight of atoms of the specified element type + * @return The ratio of sp3 to sp2 carbons */ @TestMethod("testCalculate_IAtomContainer") public DescriptorValue calculate(IAtomContainer container) { @@ -166,7 +163,9 @@ public IDescriptorResult getDescriptorResultType() { /** - * Gets the parameterNames attribute of the WeightDescriptor object. + * Gets the parameterNames attribute of the HybridizationRatioDescriptor object. + * + * This descriptor takes no parameters * * @return The parameterNames value */ @@ -179,7 +178,9 @@ public String[] getParameterNames() { /** * Gets the parameterType attribute of the HybridizationRatioDescriptor object. * - * @param name Description of the Parameter + * This descriptor takes no parameters + * + * @param name the parameter name * @return An Object whose class is that of the parameter requested */ @TestMethod("testGetParameterType_String") diff --git a/src/test/org/openscience/cdk/qsar/descriptors/molecular/HybridizationRatioDescriptorTest.java b/src/test/org/openscience/cdk/qsar/descriptors/molecular/HybridizationRatioDescriptorTest.java index ef6f587dce8..4160e0f3da4 100644 --- a/src/test/org/openscience/cdk/qsar/descriptors/molecular/HybridizationRatioDescriptorTest.java +++ b/src/test/org/openscience/cdk/qsar/descriptors/molecular/HybridizationRatioDescriptorTest.java @@ -1,9 +1,5 @@ -/* $RCSfile$ - * $Author$ - * $Date$ - * $Revision$ - * - * Copyright (C) 2004-2007 The Chemistry Development Kit (CDK) project +/* + * Copyright (C) 2010 Rajarshi Guha * * Contact: cdk-devel@lists.sourceforge.net * @@ -32,7 +28,7 @@ import org.openscience.cdk.smiles.SmilesParser; /** - * TestSuite that runs a test for the HybridizationRatioDescriptor. + * TestSuite that runs a test for the {@link HybridizationRatioDescriptor}. * * @cdk.module test-qsarmolecular */ @@ -59,4 +55,11 @@ public void testHybRatioDescriptor2() throws Exception { IAtomContainer mol = sp.parseSmiles("c1ccccc1"); Assert.assertEquals(0.0, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 0.1); } + + @Test + public void testHybRatioDescriptor3() throws Exception { + SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); + IAtomContainer mol = sp.parseSmiles("[H]C#N"); + Assert.assertEquals(Double.NaN, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 0.1); + } } \ No newline at end of file