Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: <egonw@us...> - 2006-05-04 19:33:08
|
Revision: 6171 Author: egonw Date: 2006-05-04 12:29:58 -0700 (Thu, 04 May 2006) ViewCVS: http://svn.sourceforge.net/cdk/?rev=6171&view=rev Log Message: ----------- Added the new IAtomicDescriptor, IBondDescriptor and IMolecularDescriptor interfaces, and updated code accordingly Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/modeling/forcefield/ElectrostaticInteractions.java trunk/cdk/src/org/openscience/cdk/modeling/forcefield/VanDerWaalsInteractions.java trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java trunk/cdk/src/org/openscience/cdk/qsar/IDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/AtomCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/AtomDegreeDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/AtomHybridizationDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/AtomHybridizationVSEPRDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/AtomValenceDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/BondsToAtomDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/DistanceToAtomDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/EffectiveAtomPolarizabilityDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/InductiveAtomicHardnessDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/InductiveAtomicSoftnessDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/IsProtonInAromaticSystemDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/IsProtonInConjugatedPiSystemDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/PartialSigmaChargeDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/PartialTotalChargeDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/PeriodicTablePositionDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/PiContactDetectionDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/ProtonTotalPartialChargeDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/SigmaElectronegativityDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/VdWRadiusDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/WeightDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/bond/BondCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/APolDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AminoAcidCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticAtomsCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticBondsCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BPolDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CPSADescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderOneDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderZeroDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ConnectivityOrderOneDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ConnectivityOrderZeroDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/EccentricConnectivityIndexDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/GravitationalIndexDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondAcceptorCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondDonorCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/KappaShapeIndicesDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestChainDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestPiSystemDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LongestAliphaticChainDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/MomentOfInertiaDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanNumberDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanShapeIndexDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/RotatableBondsCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/RuleOfFiveDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/TPSADescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/VAdjMaDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ValenceCarbonConnectivityOrderOneDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ValenceCarbonConnectivityOrderZeroDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ValenceConnectivityOrderOneDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ValenceConnectivityOrderZeroDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WHIMDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WeightedPathDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WienerNumbersDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ZagrebIndexDescriptor.java trunk/cdk/src/org/openscience/cdk/test/io/cml/CML2WriterTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/AtomCountDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/AtomDegreeDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/AtomHybridizationDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/AtomHybridizationVSEPRDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/AtomValenceDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/BondsToAtomDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/DistanceToAtomDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/EffectiveAtomPolarizabilityDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/InductiveAtomicHardnessDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/InductiveAtomicSoftnessDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/IsProtonInAromaticSystemDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/IsProtonInConjugatedPiSystemDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/PartialSigmaChargeDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/PartialTotalChargeDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/PeriodicTablePositionDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/PiContactDetectionDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/ProtonTotalPartialChargeDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/RDFProtonDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/SigmaElectronegativityDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/VdWRadiusDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/WeightDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/bond/BondCountDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/APolDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/AminoAcidCountDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/AromaticAtomsCountDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/AromaticBondsCountDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/BCUTDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/BPolDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/CPSADescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/CarbonConnectivityOrderOneDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/CarbonConnectivityOrderZeroDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/ConnectivityOrderOneDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/ConnectivityOrderZeroDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/EccentricConnectivityIndexDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/GravitationalIndexDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/HBondAcceptorCountDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/HBondDonorCountDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/KappaShapeIndicesDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/LargestChainDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/LargestPiSystemDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/LongestAliphaticChainDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/MomentOfInertiaDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/PetitjeanNumberDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/PetitjeanShapeIndexDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/RotatableBondsCountDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/RuleOfFiveDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/TPSADescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/ValenceCarbonConnectivityOrderOneDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/ValenceCarbonConnectivityOrderZeroDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/ValenceConnectivityOrderOneDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/ValenceConnectivityOrderZeroDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/WHIMDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/WeightedPathDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/WienerNumbersDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/XLogPDescriptorTest.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/molecular/ZagrebIndexDescriptorTest.java Added Paths: ----------- trunk/cdk/src/org/openscience/cdk/qsar/IAtomicDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/IBondDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/IMolecularDescriptor.java Modified: trunk/cdk/src/org/openscience/cdk/modeling/forcefield/ElectrostaticInteractions.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/modeling/forcefield/ElectrostaticInteractions.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/modeling/forcefield/ElectrostaticInteractions.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -6,8 +6,8 @@ import javax.vecmath.GVector; import org.openscience.cdk.AtomContainer; +import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.descriptors.atomic.BondsToAtomDescriptor; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.tools.LoggingTool; @@ -33,7 +33,7 @@ double[][] dR = null; // internuclear separation first order derivative respect to atoms coordinates double[][][] ddR = null; // internuclear separation second order derivative respect to atoms coordinates - IDescriptor shortestPathBetweenTwoAtoms = new BondsToAtomDescriptor(); + IMolecularDescriptor shortestPathBetweenTwoAtoms = new BondsToAtomDescriptor(); Object[] params = {new Integer(0), new Integer(0)}; int electrostaticInteractionNumber; Modified: trunk/cdk/src/org/openscience/cdk/modeling/forcefield/VanDerWaalsInteractions.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/modeling/forcefield/VanDerWaalsInteractions.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/modeling/forcefield/VanDerWaalsInteractions.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -7,8 +7,8 @@ import javax.vecmath.GVector; import org.openscience.cdk.AtomContainer; +import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.descriptors.atomic.BondsToAtomDescriptor; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.tools.LoggingTool; @@ -50,7 +50,7 @@ GVector dIvdw = null; //int[][] distances = null; //Better check common atom connected - IDescriptor shortestPathBetweenToAtoms=new BondsToAtomDescriptor(); + IMolecularDescriptor shortestPathBetweenToAtoms=new BondsToAtomDescriptor(); Object[] params = {new Integer(0), new Integer(0)}; int vdwInteractionNumber; Modified: trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -153,7 +153,7 @@ public void process(IAtomContainer molecule) throws CDKException { for (int i = 0; i < descriptors.size(); i++) { - IDescriptor descriptor = (IDescriptor) descriptors.get(i); + IMolecularDescriptor descriptor = (IMolecularDescriptor) descriptors.get(i); try { DescriptorValue value = descriptor.calculate(molecule); molecule.setProperty(speclist.get(i), value); Added: trunk/cdk/src/org/openscience/cdk/qsar/IAtomicDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/IAtomicDescriptor.java (rev 0) +++ trunk/cdk/src/org/openscience/cdk/qsar/IAtomicDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -0,0 +1,49 @@ +/* $RCSfile$ + * $Author: egonw $ + * $Date: 2006-03-29 10:27:08 +0200 (Wed, 29 Mar 2006) $ + * $Revision: 5855 $ + * + * Copyright (C) 2002-2006 The Chemistry Development Kit (CDK) project + * + * Contact: cdk-devel@... + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.openscience.cdk.qsar; + +import org.openscience.cdk.exception.CDKException; +import org.openscience.cdk.interfaces.IAtom; + +/** + * Classes that implement this interface are QSAR descriptor calculators. + * + * @cdk.module qsar + */ +public interface IAtomicDescriptor extends IDescriptor { + + /** + * Calculates the descriptor value for the given IAtom. + * + * @param atom An {@link IAtom} for which this descriptor should be + * calculated + * @return An object of {@link DescriptorValue} that contain the + * calculated value as well as specification details + * @throws CDKException if an error occurs during calculation. See + * documentation for individual descriptors + */ + public DescriptorValue calculate(IAtom atom) throws CDKException; + +} + Added: trunk/cdk/src/org/openscience/cdk/qsar/IBondDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/IBondDescriptor.java (rev 0) +++ trunk/cdk/src/org/openscience/cdk/qsar/IBondDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -0,0 +1,49 @@ +/* $RCSfile$ + * $Author: egonw $ + * $Date: 2006-03-29 10:27:08 +0200 (Wed, 29 Mar 2006) $ + * $Revision: 5855 $ + * + * Copyright (C) 2002-2006 The Chemistry Development Kit (CDK) project + * + * Contact: cdk-devel@... + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.openscience.cdk.qsar; + +import org.openscience.cdk.exception.CDKException; +import org.openscience.cdk.interfaces.IBond; + +/** + * Classes that implement this interface are QSAR descriptor calculators. + * + * @cdk.module qsar + */ +public interface IBondDescriptor extends IDescriptor { + + /** + * Calculates the descriptor value for the given IBond. + * + * @param bond A {@link IBond} for which this descriptor + * should be calculated + * @return An object of {@link DescriptorValue} that contain the + * calculated value as well as specification details + * @throws CDKException if an error occurs during calculation. See + * documentation for individual descriptors + */ + public DescriptorValue calculate(IBond bond) throws CDKException; + +} + Modified: trunk/cdk/src/org/openscience/cdk/qsar/IDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/IDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/IDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -85,20 +85,5 @@ * */ public Object[] getParameters(); - /** - * Calculates the descriptor value for the given AtomContainer. - * - * Optionally, parameters may be set which can affect the nature of the - * calculation. - * - * @param container An {@link IAtomContainer} for which this descriptor should be - * calculated - * @return An object of {@link DescriptorValue} that contain the calculated value - * as well as specification details - * @throws CDKException if an error occurs during calculation. See documentation for - * individual descriptors - */ - public DescriptorValue calculate(IAtomContainer container) throws CDKException; - } Added: trunk/cdk/src/org/openscience/cdk/qsar/IMolecularDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/IMolecularDescriptor.java (rev 0) +++ trunk/cdk/src/org/openscience/cdk/qsar/IMolecularDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -0,0 +1,49 @@ +/* $RCSfile$ + * $Author: egonw $ + * $Date: 2006-03-29 10:27:08 +0200 (Wed, 29 Mar 2006) $ + * $Revision: 5855 $ + * + * Copyright (C) 2002-2006 The Chemistry Development Kit (CDK) project + * + * Contact: cdk-devel@... + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.openscience.cdk.qsar; + +import org.openscience.cdk.exception.CDKException; +import org.openscience.cdk.interfaces.IAtomContainer; + +/** + * Classes that implement this interface are QSAR descriptor calculators. + * + * @cdk.module qsar + */ +public interface IMolecularDescriptor extends IDescriptor { + + /** + * Calculates the descriptor value for the given IAtomContainer. + * + * @param container An {@link IAtomContainer} for which this descriptor + * should be calculated + * @return An object of {@link DescriptorValue} that contain the + * calculated value as well as specification details + * @throws CDKException if an error occurs during calculation. See + * documentation for individual descriptors + */ + public DescriptorValue calculate(IAtomContainer container) throws CDKException; + +} + Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/AtomCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/AtomCountDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/AtomCountDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,12 +24,12 @@ */ package org.openscience.cdk.qsar.descriptors.atomic; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.IntegerResult; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IntegerResult; /** * IDescriptor based on the number of atoms of a certain element type. @@ -58,7 +58,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:atomCount */ -public class AtomCountDescriptor implements IDescriptor { +public class AtomCountDescriptor implements IMolecularDescriptor { private String elementName = "*"; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/AtomDegreeDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/AtomDegreeDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/AtomDegreeDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,12 +24,12 @@ */ package org.openscience.cdk.qsar.descriptors.atomic; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.IntegerResult; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IntegerResult; /** * This class returns the number of not-Hs substituents of an atom, also defined as "atom degree". @@ -54,7 +54,7 @@ *@cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:atomDegree */ -public class AtomDegreeDescriptor implements IDescriptor { +public class AtomDegreeDescriptor implements IMolecularDescriptor { private int targetPosition = 0; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/AtomHybridizationDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/AtomHybridizationDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/AtomHybridizationDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,14 +24,14 @@ */ package org.openscience.cdk.qsar.descriptors.atomic; +import org.openscience.cdk.atomtype.HybridizationStateATMatcher; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.interfaces.IAtomType; -import org.openscience.cdk.atomtype.HybridizationStateATMatcher; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.IntegerResult; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.tools.manipulator.AtomTypeManipulator; /** @@ -57,7 +57,7 @@ *@cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:atomHybridization */ -public class AtomHybridizationDescriptor implements IDescriptor { +public class AtomHybridizationDescriptor implements IMolecularDescriptor { private int targetPosition = 0; AtomTypeManipulator atman = null; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/AtomHybridizationVSEPRDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/AtomHybridizationVSEPRDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/AtomHybridizationVSEPRDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,15 +24,15 @@ */ package org.openscience.cdk.qsar.descriptors.atomic; -import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.interfaces.IAtomType; import org.openscience.cdk.CDKConstants; import org.openscience.cdk.config.AtomTypeFactory; import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.IntegerResult; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.interfaces.IAtomContainer; +import org.openscience.cdk.interfaces.IAtomType; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.tools.LoggingTool; /** @@ -86,7 +86,7 @@ *@cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:atomHybridization */ -public class AtomHybridizationVSEPRDescriptor implements IDescriptor { +public class AtomHybridizationVSEPRDescriptor implements IMolecularDescriptor { private int targetPosition = 0; org.openscience.cdk.interfaces.IAtom atom = null; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/AtomValenceDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/AtomValenceDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/AtomValenceDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,15 +24,15 @@ */ package org.openscience.cdk.qsar.descriptors.atomic; +import java.util.Hashtable; + import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.result.IntegerResult; -import java.util.Hashtable; - /** * This class returns the valence of an atom. * <p/> @@ -56,7 +56,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:atomValence */ -public class AtomValenceDescriptor implements IDescriptor { +public class AtomValenceDescriptor implements IMolecularDescriptor { private int targetPosition = 0; public Hashtable valencesTable; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/BondsToAtomDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/BondsToAtomDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/BondsToAtomDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -23,14 +23,14 @@ */ package org.openscience.cdk.qsar.descriptors.atomic; -import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.Molecule; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.graph.MoleculeGraphs; -import org.openscience.cdk.qsar.result.IntegerResult; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IntegerResult; /** * This class returns the number of bonds on the shortest path between two atoms. @@ -60,7 +60,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:bondsToAtom */ -public class BondsToAtomDescriptor implements IDescriptor { +public class BondsToAtomDescriptor implements IMolecularDescriptor { private int targetPosition = 0; private int focusPosition = 0; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/DistanceToAtomDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/DistanceToAtomDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/DistanceToAtomDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -26,12 +26,12 @@ import javax.vecmath.Point3d; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleResult; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleResult; /** * This class returns the 3D distance between two atoms. @@ -61,7 +61,7 @@ *@cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:distanceToAtom */ -public class DistanceToAtomDescriptor implements IDescriptor { +public class DistanceToAtomDescriptor implements IMolecularDescriptor { private int targetPosition = 0; private int focusPosition = 0; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/EffectiveAtomPolarizabilityDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/EffectiveAtomPolarizabilityDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/EffectiveAtomPolarizabilityDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,14 +24,14 @@ */ package org.openscience.cdk.qsar.descriptors.atomic; -import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.Molecule; import org.openscience.cdk.charges.Polarizability; import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleResult; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleResult; /** * Effective polarizability of an heavy atom @@ -57,7 +57,7 @@ * @cdk.dictref qsar-descriptors:sigmaElectronegativity * @see Polarizability */ -public class EffectiveAtomPolarizabilityDescriptor implements IDescriptor { +public class EffectiveAtomPolarizabilityDescriptor implements IMolecularDescriptor { private int atomPosition = 0; private Polarizability pol; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/InductiveAtomicHardnessDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/InductiveAtomicHardnessDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/InductiveAtomicHardnessDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -28,14 +28,14 @@ import javax.vecmath.Point3d; +import org.openscience.cdk.config.AtomTypeFactory; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.interfaces.IAtomType; -import org.openscience.cdk.config.AtomTypeFactory; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleResult; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleResult; import org.openscience.cdk.tools.LoggingTool; /** * Inductive atomic hardness of an atom in a polyatomic system can be defined @@ -85,7 +85,7 @@ *@cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:atomicHardness */ -public class InductiveAtomicHardnessDescriptor implements IDescriptor { +public class InductiveAtomicHardnessDescriptor implements IMolecularDescriptor { private int atomPosition = 0; private LoggingTool logger; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/InductiveAtomicSoftnessDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/InductiveAtomicSoftnessDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/InductiveAtomicSoftnessDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -28,14 +28,14 @@ import javax.vecmath.Point3d; +import org.openscience.cdk.config.AtomTypeFactory; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.interfaces.IAtomType; -import org.openscience.cdk.config.AtomTypeFactory; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleResult; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleResult; import org.openscience.cdk.tools.LoggingTool; /** * Inductive atomic softness of an atom in a polyatomic system can be defined @@ -85,7 +85,7 @@ *@cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:atomicSoftness */ -public class InductiveAtomicSoftnessDescriptor implements IDescriptor { +public class InductiveAtomicSoftnessDescriptor implements IMolecularDescriptor { private int atomPosition = 0; private LoggingTool logger; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/IsProtonInAromaticSystemDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/IsProtonInAromaticSystemDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/IsProtonInAromaticSystemDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,16 +24,16 @@ */ package org.openscience.cdk.qsar.descriptors.atomic; -import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.CDKConstants; import org.openscience.cdk.Molecule; -import org.openscience.cdk.interfaces.IRingSet; import org.openscience.cdk.aromaticity.HueckelAromaticityDetector; import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.IntegerResult; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.interfaces.IAtomContainer; +import org.openscience.cdk.interfaces.IRingSet; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.ringsearch.AllRingsFinder; /** @@ -66,7 +66,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:isProtonInAromaticSystem */ -public class IsProtonInAromaticSystemDescriptor implements IDescriptor { +public class IsProtonInAromaticSystemDescriptor implements IMolecularDescriptor { private int atomPosition = 0; private boolean checkAromaticity = false; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/IsProtonInConjugatedPiSystemDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/IsProtonInConjugatedPiSystemDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/IsProtonInConjugatedPiSystemDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,16 +24,16 @@ */ package org.openscience.cdk.qsar.descriptors.atomic; -import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.Molecule; import org.openscience.cdk.SetOfAtomContainers; import org.openscience.cdk.aromaticity.HueckelAromaticityDetector; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.graph.invariant.ConjugatedPiSystemsDetector; -import org.openscience.cdk.qsar.result.BooleanResult; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.BooleanResult; /** * This class evaluates if a proton is joined to a conjugated system. @@ -63,7 +63,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:isProtonInConjugatedPiSystem */ -public class IsProtonInConjugatedPiSystemDescriptor implements IDescriptor { +public class IsProtonInConjugatedPiSystemDescriptor implements IMolecularDescriptor { private int atomPosition = 0; private boolean checkAromaticity = false; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/PartialSigmaChargeDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/PartialSigmaChargeDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/PartialSigmaChargeDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,15 +24,15 @@ */ package org.openscience.cdk.qsar.descriptors.atomic; -import org.openscience.cdk.interfaces.IAtom; -import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.Molecule; import org.openscience.cdk.charges.GasteigerMarsiliPartialCharges; import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleResult; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.interfaces.IAtom; +import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleResult; /** * The calculation of sigma partial charges in sigma-bonded systems (PEOE) of an heavy atom is based on Gasteiger Marsili @@ -58,7 +58,7 @@ * @cdk.dictref qsar-descriptors:PartialCharge * @see GasteigerMarsiliPartialCharges */ -public class PartialSigmaChargeDescriptor implements IDescriptor { +public class PartialSigmaChargeDescriptor implements IMolecularDescriptor { private int atomPosition = 0; private GasteigerMarsiliPartialCharges peoe = null; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/PartialTotalChargeDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/PartialTotalChargeDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/PartialTotalChargeDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,15 +24,15 @@ */ package org.openscience.cdk.qsar.descriptors.atomic; -import org.openscience.cdk.interfaces.IAtom; -import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.Molecule; import org.openscience.cdk.charges.MMFF94PartialCharges; import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleResult; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.interfaces.IAtom; +import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleResult; /** * The calculation of partial charges of an heavy atom is based on MMFF94. @@ -60,7 +60,7 @@ * @x.dictref qsar-descriptors:PartialCharge * @see MMFF94PartialCharges */ -public class PartialTotalChargeDescriptor implements IDescriptor { +public class PartialTotalChargeDescriptor implements IMolecularDescriptor { private int atomPosition = 0; private MMFF94PartialCharges mmff; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/PeriodicTablePositionDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/PeriodicTablePositionDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/PeriodicTablePositionDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -26,12 +26,12 @@ import java.util.Hashtable; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.IntegerResult; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.tools.LoggingTool; /** @@ -57,7 +57,7 @@ *@cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:period */ -public class PeriodicTablePositionDescriptor implements IDescriptor { +public class PeriodicTablePositionDescriptor implements IMolecularDescriptor { private int targetPosition = 0; private LoggingTool logger; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/PiContactDetectionDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/PiContactDetectionDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/PiContactDetectionDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,16 +24,16 @@ */ package org.openscience.cdk.qsar.descriptors.atomic; -import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.Molecule; import org.openscience.cdk.SetOfAtomContainers; import org.openscience.cdk.aromaticity.HueckelAromaticityDetector; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.graph.invariant.ConjugatedPiSystemsDetector; -import org.openscience.cdk.qsar.result.BooleanResult; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.BooleanResult; /** * This class checks if two atoms have pi-contact (this is true when there is @@ -70,7 +70,7 @@ *@cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:piContact */ -public class PiContactDetectionDescriptor implements IDescriptor { +public class PiContactDetectionDescriptor implements IMolecularDescriptor { private int firstAtom = 0; private int secondAtom = 0; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/ProtonTotalPartialChargeDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/ProtonTotalPartialChargeDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/ProtonTotalPartialChargeDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,14 +24,14 @@ */ package org.openscience.cdk.qsar.descriptors.atomic; -import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.Molecule; import org.openscience.cdk.charges.GasteigerMarsiliPartialCharges; import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleArrayResult; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleArrayResult; /** * The calculation of partial charges of an heavy atom and its protons is based on Gasteiger Marsili (PEOE) @@ -56,7 +56,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:protonPartialCharge */ -public class ProtonTotalPartialChargeDescriptor implements IDescriptor { +public class ProtonTotalPartialChargeDescriptor implements IMolecularDescriptor { private int atomPosition = 0; private GasteigerMarsiliPartialCharges peoe = null; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -30,22 +30,22 @@ import javax.vecmath.Point3d; import javax.vecmath.Vector3d; -import org.openscience.cdk.interfaces.IAtom; -import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.CDKConstants; import org.openscience.cdk.Molecule; import org.openscience.cdk.Ring; -import org.openscience.cdk.interfaces.IRingSet; import org.openscience.cdk.SetOfAtomContainers; import org.openscience.cdk.aromaticity.HueckelAromaticityDetector; import org.openscience.cdk.charges.GasteigerMarsiliPartialCharges; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.graph.MoleculeGraphs; import org.openscience.cdk.graph.invariant.ConjugatedPiSystemsDetector; -import org.openscience.cdk.qsar.result.IntegerArrayResult; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.interfaces.IAtom; +import org.openscience.cdk.interfaces.IAtomContainer; +import org.openscience.cdk.interfaces.IRingSet; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IntegerArrayResult; import org.openscience.cdk.ringsearch.AllRingsFinder; /** @@ -75,7 +75,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:rdfProtonCalculatedValues */ -public class RDFProtonDescriptor implements IDescriptor { +public class RDFProtonDescriptor implements IMolecularDescriptor { private int atomPosition = 0; private boolean checkAromaticity = false; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/SigmaElectronegativityDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/SigmaElectronegativityDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/SigmaElectronegativityDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,14 +24,14 @@ */ package org.openscience.cdk.qsar.descriptors.atomic; -import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.Molecule; import org.openscience.cdk.charges.GasteigerMarsiliPartialCharges; import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleResult; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleResult; /** * Sigma electronegativity is given by X = a + bq + c(q*q) @@ -57,7 +57,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:sigmaElectronegativity */ -public class SigmaElectronegativityDescriptor implements IDescriptor { +public class SigmaElectronegativityDescriptor implements IMolecularDescriptor { private int atomPosition = 0; private int maxIterations = 0; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/VdWRadiusDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/VdWRadiusDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/VdWRadiusDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -26,14 +26,14 @@ import java.io.IOException; +import org.openscience.cdk.config.AtomTypeFactory; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.interfaces.IAtomType; -import org.openscience.cdk.config.AtomTypeFactory; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleResult; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleResult; import org.openscience.cdk.tools.LoggingTool; /** @@ -59,7 +59,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:vdwradius */ -public class VdWRadiusDescriptor implements IDescriptor { +public class VdWRadiusDescriptor implements IMolecularDescriptor { private int atomPosition = 0; private AtomTypeFactory factory = null; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/WeightDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/WeightDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/WeightDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,13 +24,13 @@ */ package org.openscience.cdk.qsar.descriptors.atomic; -import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.config.IsotopeFactory; import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleResult; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleResult; /** * IDescriptor based on the weight of atoms of a certain element type. @@ -61,7 +61,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:weight */ -public class WeightDescriptor implements IDescriptor { +public class WeightDescriptor implements IMolecularDescriptor { private String elementName = "*"; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/bond/BondCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/bond/BondCountDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/bond/BondCountDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,12 +24,12 @@ */ package org.openscience.cdk.qsar.descriptors.bond; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.IntegerResult; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IntegerResult; /** * IDescriptor based on the number of bonds of a certain bond order. @@ -54,7 +54,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:bondCount */ -public class BondCountDescriptor implements IDescriptor { +public class BondCountDescriptor implements IMolecularDescriptor { private double order = 1.0; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/APolDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/APolDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/APolDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,14 +24,14 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; +import org.openscience.cdk.config.IsotopeFactory; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.interfaces.IElement; -import org.openscience.cdk.config.IsotopeFactory; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleResult; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleResult; import org.openscience.cdk.tools.LoggingTool; /** @@ -48,7 +48,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:apol */ -public class APolDescriptor implements IDescriptor { +public class APolDescriptor implements IMolecularDescriptor { private LoggingTool logger; private IsotopeFactory ifac = null; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AminoAcidCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AminoAcidCountDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AminoAcidCountDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -23,6 +23,8 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; +import java.util.List; + import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAminoAcid; import org.openscience.cdk.interfaces.IAtomContainer; @@ -30,13 +32,11 @@ import org.openscience.cdk.isomorphism.UniversalIsomorphismTester; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.result.IntegerArrayResult; import org.openscience.cdk.templates.AminoAcids; -import java.util.List; - /** * Class that returns the number of amino acids in an atom container. * @@ -46,7 +46,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:aminoAcidsCount */ -public class AminoAcidCountDescriptor implements IDescriptor { +public class AminoAcidCountDescriptor implements IMolecularDescriptor { private ISetOfAtomContainers substructureSet; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticAtomsCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticAtomsCountDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticAtomsCountDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,15 +24,15 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; -import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.CDKConstants; -import org.openscience.cdk.interfaces.IRingSet; import org.openscience.cdk.aromaticity.HueckelAromaticityDetector; import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.IntegerResult; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.interfaces.IAtomContainer; +import org.openscience.cdk.interfaces.IRingSet; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.ringsearch.AllRingsFinder; /** @@ -58,7 +58,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:aromaticAtomsCount */ -public class AromaticAtomsCountDescriptor implements IDescriptor { +public class AromaticAtomsCountDescriptor implements IMolecularDescriptor { private boolean checkAromaticity = false; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticBondsCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticBondsCountDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticBondsCountDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,15 +24,15 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; -import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.CDKConstants; -import org.openscience.cdk.interfaces.IRingSet; import org.openscience.cdk.aromaticity.HueckelAromaticityDetector; import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.IntegerResult; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.interfaces.IAtomContainer; +import org.openscience.cdk.interfaces.IRingSet; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.ringsearch.AllRingsFinder; /** @@ -58,7 +58,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:aromaticBondsCount */ -public class AromaticBondsCountDescriptor implements IDescriptor { +public class AromaticBondsCountDescriptor implements IMolecularDescriptor { private boolean checkAromaticity = false; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -33,7 +33,7 @@ import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.result.DoubleArrayResult; import org.openscience.cdk.tools.HydrogenAdder; import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; @@ -92,7 +92,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:BCUT */ -public class BCUTDescriptor implements IDescriptor { +public class BCUTDescriptor implements IMolecularDescriptor { // the number of negative & positive eigenvalues // to return for each class of BCUT descriptor Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BPolDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BPolDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BPolDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,15 +24,15 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; +import org.openscience.cdk.config.IsotopeFactory; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.interfaces.IElement; -import org.openscience.cdk.config.IsotopeFactory; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleResult; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleResult; import org.openscience.cdk.tools.LoggingTool; /** @@ -47,7 +47,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:bpol */ -public class BPolDescriptor implements IDescriptor { +public class BPolDescriptor implements IMolecularDescriptor { private LoggingTool logger; private IsotopeFactory ifac = null; /* Atomic polarizabilities ordered by atomic number from 1 to 102. */ Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CPSADescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CPSADescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CPSADescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -19,15 +19,15 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; -import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.charges.GasteigerMarsiliPartialCharges; import org.openscience.cdk.config.IsotopeFactory; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.geometry.surface.NumericalSurface; -import org.openscience.cdk.qsar.result.DoubleArrayResult; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleArrayResult; import org.openscience.cdk.tools.LoggingTool; import org.openscience.cdk.tools.MFAnalyser; @@ -120,7 +120,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:CPSA */ -public class CPSADescriptor implements IDescriptor { +public class CPSADescriptor implements IMolecularDescriptor { private LoggingTool logger; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderOneDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderOneDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderOneDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -26,13 +26,13 @@ import java.util.ArrayList; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleResult; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleResult; /** * CarbonConnectivity index (order 1): @@ -47,7 +47,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:chi1C */ -public class CarbonConnectivityOrderOneDescriptor implements IDescriptor { +public class CarbonConnectivityOrderOneDescriptor implements IMolecularDescriptor { /** * Constructor for the CarbonConnectivityOrderOneDescriptor object Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderZeroDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderZeroDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderZeroDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,12 +24,12 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleResult; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleResult; /** * Carbon Connectivity index (order 0): @@ -44,7 +44,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:chi0C */ -public class CarbonConnectivityOrderZeroDescriptor implements IDescriptor { +public class CarbonConnectivityOrderZeroDescriptor implements IMolecularDescriptor { /** * Constructor for the CarbonConnectivityOrderZeroDescriptor object Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ConnectivityOrderOneDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ConnectivityOrderOneDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ConnectivityOrderOneDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -26,13 +26,13 @@ import java.util.ArrayList; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleResult; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleResult; /** * Connectivity index (order 1): @@ -47,7 +47,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:chi1 */ -public class ConnectivityOrderOneDescriptor implements IDescriptor { +public class ConnectivityOrderOneDescriptor implements IMolecularDescriptor { /** * Constructor for the ConnectivityOrderOneDescriptor object Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ConnectivityOrderZeroDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ConnectivityOrderZeroDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ConnectivityOrderZeroDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,12 +24,12 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleResult; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleResult; /** * Connectivity index (order 0): @@ -44,7 +44,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:chi0 */ -public class ConnectivityOrderZeroDescriptor implements IDescriptor { +public class ConnectivityOrderZeroDescriptor implements IMolecularDescriptor { /** * Constructor for the ConnectivityOrderZeroDescriptor object Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/EccentricConnectivityIndexDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/EccentricConnectivityIndexDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/EccentricConnectivityIndexDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -19,14 +19,14 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; -import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.graph.PathTools; import org.openscience.cdk.graph.matrix.AdjacencyMatrix; -import org.openscience.cdk.qsar.result.IntegerResult; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; @@ -51,7 +51,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:eccentricConnectivityIndex */ -public class EccentricConnectivityIndexDescriptor implements IDescriptor { +public class EccentricConnectivityIndexDescriptor implements IMolecularDescriptor { public EccentricConnectivityIndexDescriptor() {} Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/GravitationalIndexDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/GravitationalIndexDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/GravitationalIndexDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -26,13 +26,13 @@ import java.util.Vector; -import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.config.IsotopeFactory; import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleArrayResult; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleArrayResult; import org.openscience.cdk.tools.LoggingTool; @@ -62,7 +62,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:gravitationalIndex */ -public class GravitationalIndexDescriptor implements IDescriptor { +public class GravitationalIndexDescriptor implements IMolecularDescriptor { private LoggingTool logger; private class pair { Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondAcceptorCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondAcceptorCountDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondAcceptorCountDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,14 +24,14 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; -import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.CDKConstants; import org.openscience.cdk.aromaticity.HueckelAromaticityDetector; import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.IntegerResult; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IntegerResult; /** * This descriptor calculates the number of hydrogen bond acceptors using a slightly simplified version of the @@ -72,7 +72,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:hBondacceptors */ -public class HBondAcceptorCountDescriptor implements IDescriptor { +public class HBondAcceptorCountDescriptor implements IMolecularDescriptor { // only parameter of this descriptor; true if aromaticity has to be checked prior to descriptor calculation, false otherwise private boolean checkAromaticity = false; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondDonorCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondDonorCountDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondDonorCountDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,12 +24,12 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.IntegerResult; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IntegerResult; /** * This descriptor calculates the number of hydrogen bond donors using a slightly simplified version of the @@ -51,7 +51,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:hBondDonors */ -public class HBondDonorCountDescriptor implements IDescriptor { +public class HBondDonorCountDescriptor implements IMolecularDescriptor { /** * Constructor for the HBondDonorCountDescriptor object Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/KappaShapeIndicesDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/KappaShapeIndicesDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/KappaShapeIndicesDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -26,12 +26,12 @@ import java.util.ArrayList; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleArrayResult; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleArrayResult; /** * Kier and Hall kappa molecular shape indices compare the molecular graph with minimal and maximal molecular graphs; @@ -48,7 +48,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:kierValues */ -public class KappaShapeIndicesDescriptor implements IDescriptor { +public class KappaShapeIndicesDescriptor implements IMolecularDescriptor { private ArrayList singlePaths = null; private ArrayList doublePaths = null; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestChainDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestChainDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestChainDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -26,17 +26,17 @@ import java.util.Vector; +import org.openscience.cdk.AtomContainer; +import org.openscience.cdk.CDKConstants; +import org.openscience.cdk.aromaticity.HueckelAromaticityDetector; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.interfaces.IBond; -import org.openscience.cdk.AtomContainer; -import org.openscience.cdk.CDKConstants; import org.openscience.cdk.interfaces.IRingSet; -import org.openscience.cdk.aromaticity.HueckelAromaticityDetector; -import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.ringsearch.AllRingsFinder; import org.openscience.cdk.ringsearch.SSSRFinder; @@ -69,7 +69,7 @@ * @cdk.set qsar-descriptors */ -public class LargestChainDescriptor implements IDescriptor{ +public class LargestChainDescriptor implements IMolecularDescriptor { private boolean checkAromaticity = false; private boolean checkRingSystem = false; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestPiSystemDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestPiSystemDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestPiSystemDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -34,9 +34,9 @@ import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.interfaces.IBond; import org.openscience.cdk.interfaces.IRingSet; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.ringsearch.AllRingsFinder; @@ -64,7 +64,7 @@ */ -public class LargestPiSystemDescriptor implements IDescriptor{ +public class LargestPiSystemDescriptor implements IMolecularDescriptor { private boolean checkAromaticity = false; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LongestAliphaticChainDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LongestAliphaticChainDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LongestAliphaticChainDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -37,7 +37,7 @@ import org.openscience.cdk.interfaces.IRingSet; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.ringsearch.SSSRFinder; @@ -64,7 +64,7 @@ * @cdk.set qsar-descriptors */ -public class LongestAliphaticChainDescriptor implements IDescriptor{ +public class LongestAliphaticChainDescriptor implements IMolecularDescriptor { private boolean checkRingSystem = false; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/MomentOfInertiaDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/MomentOfInertiaDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/MomentOfInertiaDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -21,14 +21,14 @@ import javax.vecmath.Point3d; -import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.config.IsotopeFactory; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.geometry.GeometryTools; -import org.openscience.cdk.qsar.result.DoubleArrayResult; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleArrayResult; import org.openscience.cdk.tools.LoggingTool; import org.openscience.cdk.tools.MFAnalyser; @@ -66,7 +66,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:momentOfInertia */ -public class MomentOfInertiaDescriptor implements IDescriptor { +public class MomentOfInertiaDescriptor implements IMolecularDescriptor { private LoggingTool logger; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanNumberDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanNumberDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanNumberDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,14 +24,14 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; -import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.graph.PathTools; import org.openscience.cdk.graph.matrix.ConnectionMatrix; -import org.openscience.cdk.qsar.result.DoubleResult; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleResult; /** @@ -49,7 +49,7 @@ *@cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:petitjeanNumber */ -public class PetitjeanNumberDescriptor implements IDescriptor { +public class PetitjeanNumberDescriptor implements IMolecularDescriptor { /** * Constructor for the PetitjeanNumberDescriptor object Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanShapeIndexDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanShapeIndexDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanShapeIndexDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -19,19 +19,19 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; +import javax.vecmath.Point3d; + import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.geometry.GeometryTools; import org.openscience.cdk.graph.PathTools; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.result.DoubleArrayResult; import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; -import javax.vecmath.Point3d; - /** * Evaluates the Petitjean shape indices, * <p/> @@ -48,7 +48,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:petitjeanShapeIndex */ -public class PetitjeanShapeIndexDescriptor implements IDescriptor { +public class PetitjeanShapeIndexDescriptor implements IMolecularDescriptor { public PetitjeanShapeIndexDescriptor() { } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/RotatableBondsCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/RotatableBondsCountDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/RotatableBondsCountDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -26,15 +26,15 @@ import java.util.Vector; +import org.openscience.cdk.CDKConstants; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.CDKConstants; import org.openscience.cdk.interfaces.IRingSet; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.IntegerResult; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.ringsearch.AllRingsFinder; /** @@ -61,7 +61,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:rotatableBondsCount */ -public class RotatableBondsCountDescriptor implements IDescriptor { +public class RotatableBondsCountDescriptor implements IMolecularDescriptor { private boolean includeTerminals = false; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/RuleOfFiveDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/RuleOfFiveDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/RuleOfFiveDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -23,12 +23,14 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.exception.CDKException; +import org.openscience.cdk.qsar.DescriptorSpecification; +import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.descriptors.atomic.WeightDescriptor; import org.openscience.cdk.qsar.result.DoubleResult; import org.openscience.cdk.qsar.result.IntegerResult; -import org.openscience.cdk.qsar.*; -import org.openscience.cdk.qsar.descriptors.atomic.WeightDescriptor; /** * This Class contains a method that returns the number failures of the @@ -55,7 +57,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:lipinskifailures */ -public class RuleOfFiveDescriptor implements IDescriptor { +public class RuleOfFiveDescriptor implements IMolecularDescriptor { private boolean checkAromaticity = false; @@ -139,7 +141,7 @@ int lipinskifailures = 0; - IDescriptor xlogP = new XLogPDescriptor(); + IMolecularDescriptor xlogP = new XLogPDescriptor(); Object[] xlogPparams = { new Boolean(checkAromaticity), Boolean.TRUE, @@ -147,21 +149,21 @@ xlogP.setParameters(xlogPparams); double xlogPvalue = ((DoubleResult)xlogP.calculate(mol).getValue()).doubleValue(); - IDescriptor acc = new HBondAcceptorCountDescriptor(); + IMolecularDescriptor acc = new HBondAcceptorCountDescriptor(); Object[] hBondparams = { new Boolean(checkAromaticity) }; acc.setParameters(hBondparams); int acceptors = ((IntegerResult)acc.calculate(mol).getValue()).intValue(); - IDescriptor don = new HBondDonorCountDescriptor(); + IMolecularDescriptor don = new HBondDonorCountDescriptor(); don.setParameters(hBondparams); int donors = ((IntegerResult)don.calculate(mol).getValue()).intValue(); - IDescriptor mw = new WeightDescriptor(); + IMolecularDescriptor mw = new WeightDescriptor(); Object[] mwparams = {new String("")}; mw.setParameters(mwparams); double mwvalue = ((DoubleResult)mw.calculate(mol).getValue()).doubleValue(); - IDescriptor rotata = new RotatableBondsCountDescriptor(); + IMolecularDescriptor rotata = new RotatableBondsCountDescriptor(); rotata.setParameters(hBondparams); int rotatablebonds = ((IntegerResult)rotata.calculate(mol).getValue()).intValue(); Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/TPSADescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/TPSADescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/TPSADescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -34,7 +34,7 @@ import org.openscience.cdk.interfaces.IRingSet; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.result.DoubleResult; import org.openscience.cdk.ringsearch.AllRingsFinder; @@ -66,7 +66,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:tpsa */ -public class TPSADescriptor implements IDescriptor { +public class TPSADescriptor implements IMolecularDescriptor { private boolean checkAromaticity = false; private static HashMap map; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/VAdjMaDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/VAdjMaDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/VAdjMaDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,12 +24,12 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleResult; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleResult; import org.openscience.cdk.tools.MFAnalyser; /** @@ -43,7 +43,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:vAdjMa */ -public class VAdjMaDescriptor implements IDescriptor { +public class VAdjMaDescriptor implements IMolecularDescriptor { /** * Constructor for the VAdjMaDescriptor object Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ValenceCarbonConnectivityOrderOneDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ValenceCarbonConnectivityOrderOneDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ValenceCarbonConnectivityOrderOneDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -26,16 +26,16 @@ import java.util.ArrayList; import java.util.Hashtable; +import org.openscience.cdk.config.IsotopeFactory; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.interfaces.IElement; -import org.openscience.cdk.config.IsotopeFactory; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleResult; -import org.openscience.cdk.qsar.IDescriptor; -import org.openscience.cdk.qsar.descriptors.atomic.AtomValenceDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.descriptors.atomic.AtomValenceDescriptor; +import org.openscience.cdk.qsar.result.DoubleResult; import org.openscience.cdk.tools.LoggingTool; @@ -56,7 +56,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:chi1vC */ -public class ValenceCarbonConnectivityOrderOneDescriptor implements IDescriptor { +public class ValenceCarbonConnectivityOrderOneDescriptor implements IMolecularDescriptor { private LoggingTool logger; private static Hashtable valences; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ValenceCarbonConnectivityOrderZeroDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ValenceCarbonConnectivityOrderZeroDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ValenceCarbonConnectivityOrderZeroDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -25,15 +25,15 @@ import java.util.Hashtable; +import org.openscience.cdk.config.IsotopeFactory; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.interfaces.IElement; -import org.openscience.cdk.config.IsotopeFactory; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleResult; -import org.openscience.cdk.qsar.IDescriptor; -import org.openscience.cdk.qsar.descriptors.atomic.AtomValenceDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.descriptors.atomic.AtomValenceDescriptor; +import org.openscience.cdk.qsar.result.DoubleResult; import org.openscience.cdk.tools.LoggingTool; @@ -54,7 +54,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:chi0vC */ -public class ValenceCarbonConnectivityOrderZeroDescriptor implements IDescriptor { +public class ValenceCarbonConnectivityOrderZeroDescriptor implements IMolecularDescriptor { private LoggingTool logger; private static Hashtable valences; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ValenceConnectivityOrderOneDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ValenceConnectivityOrderOneDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ValenceConnectivityOrderOneDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -26,16 +26,16 @@ import java.util.ArrayList; import java.util.Hashtable; +import org.openscience.cdk.config.IsotopeFactory; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.interfaces.IElement; -import org.openscience.cdk.config.IsotopeFactory; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleResult; -import org.openscience.cdk.qsar.IDescriptor; -import org.openscience.cdk.qsar.descriptors.atomic.AtomValenceDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.descriptors.atomic.AtomValenceDescriptor; +import org.openscience.cdk.qsar.result.DoubleResult; import org.openscience.cdk.tools.LoggingTool; @@ -56,7 +56,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:chi1v */ -public class ValenceConnectivityOrderOneDescriptor implements IDescriptor { +public class ValenceConnectivityOrderOneDescriptor implements IMolecularDescriptor { private LoggingTool logger; private static Hashtable valences; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ValenceConnectivityOrderZeroDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ValenceConnectivityOrderZeroDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ValenceConnectivityOrderZeroDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -23,20 +23,20 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; +import java.util.Hashtable; + import org.openscience.cdk.config.IsotopeFactory; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.interfaces.IElement; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.descriptors.atomic.AtomValenceDescriptor; import org.openscience.cdk.qsar.result.DoubleResult; import org.openscience.cdk.tools.LoggingTool; -import java.util.Hashtable; - /** * Atomic valence connectivity index (order 0). See * <a href="http://www.edusoft-lc.com/molconn/manuals/400/chaptwo.html">http://www.edusoft-lc.com/molconn/manuals/400/chaptwo.html</a> and @@ -54,7 +54,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:chi0v */ -public class ValenceConnectivityOrderZeroDescriptor implements IDescriptor { +public class ValenceConnectivityOrderZeroDescriptor implements IMolecularDescriptor { private LoggingTool logger; private static Hashtable valences; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WHIMDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WHIMDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WHIMDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -25,13 +25,13 @@ import java.util.Hashtable; -import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.Molecule; import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleArrayResult; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleArrayResult; import org.openscience.cdk.tools.LoggingTool; import Jama.EigenvalueDecomposition; @@ -89,7 +89,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:WHIM */ -public class WHIMDescriptor implements IDescriptor { +public class WHIMDescriptor implements IMolecularDescriptor { LoggingTool logger; String type = ""; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WeightedPathDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WeightedPathDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WeightedPathDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -19,20 +19,20 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; +import java.util.ArrayList; +import java.util.List; + import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.graph.PathTools; import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.result.DoubleArrayResult; import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; -import java.util.ArrayList; -import java.util.List; - /** * Evaluates the weighted path descriptors. * <p/> @@ -63,7 +63,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:weightedPath */ -public class WeightedPathDescriptor implements IDescriptor { +public class WeightedPathDescriptor implements IMolecularDescriptor { public WeightedPathDescriptor() { } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WienerNumbersDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WienerNumbersDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WienerNumbersDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -27,10 +27,10 @@ import org.openscience.cdk.graph.PathTools; import org.openscience.cdk.graph.matrix.ConnectionMatrix; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.qsar.result.DoubleArrayResult; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleArrayResult; import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; @@ -57,7 +57,7 @@ *@cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:wienerNumbers */ -public class WienerNumbersDescriptor implements IDescriptor { +public class WienerNumbersDescriptor implements IMolecularDescriptor { double[][] matr = null; DoubleArrayResult wienerNumbers = null; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -50,7 +50,7 @@ import org.openscience.cdk.isomorphism.mcss.RMap; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.result.DoubleResult; import org.openscience.cdk.ringsearch.AllRingsFinder; import org.openscience.cdk.ringsearch.SSSRFinder; @@ -117,7 +117,7 @@ *@cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:xlogP */ -public class XLogPDescriptor implements IDescriptor { +public class XLogPDescriptor implements IMolecularDescriptor { private boolean checkAromaticity = false; private boolean salicylFlag=false; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ZagrebIndexDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ZagrebIndexDescriptor.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ZagrebIndexDescriptor.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -24,12 +24,12 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; +import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.result.DoubleResult; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.DoubleResult; /** * Zagreb index: the sum of the squares of atom degree over all heavy atoms i. @@ -40,7 +40,7 @@ * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:zagrebIndex */ -public class ZagrebIndexDescriptor implements IDescriptor { +public class ZagrebIndexDescriptor implements IMolecularDescriptor { /** * Constructor for the ZagrebIndexDescriptor object. Modified: trunk/cdk/src/org/openscience/cdk/test/io/cml/CML2WriterTest.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/test/io/cml/CML2WriterTest.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/test/io/cml/CML2WriterTest.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -40,8 +40,8 @@ import org.openscience.cdk.aromaticity.HueckelAromaticityDetector; import org.openscience.cdk.io.CMLWriter; import org.openscience.cdk.protein.data.PDBAtom; -import org.openscience.cdk.qsar.IDescriptor; import org.openscience.cdk.qsar.DescriptorValue; +import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.descriptors.atomic.WeightDescriptor; import org.openscience.cdk.templates.MoleculeFactory; import org.openscience.cdk.test.CDKTestCase; @@ -123,7 +123,7 @@ public void testQSARCustomization() { StringWriter writer = new StringWriter(); Molecule molecule = MoleculeFactory.makeBenzene(); - IDescriptor descriptor = new WeightDescriptor(); + IMolecularDescriptor descriptor = new WeightDescriptor(); CMLWriter cmlWriter = new CMLWriter(writer); try { Modified: trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/AtomCountDescriptorTest.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/AtomCountDescriptorTest.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/AtomCountDescriptorTest.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -27,7 +27,7 @@ import junit.framework.TestSuite; import org.openscience.cdk.AtomContainer; import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.descriptors.atomic.AtomCountDescriptor; import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.smiles.SmilesParser; @@ -48,7 +48,7 @@ } public void testCarbonCount() throws ClassNotFoundException, CDKException, java.lang.Exception { - IDescriptor descriptor = new AtomCountDescriptor(); + IMolecularDescriptor descriptor = new AtomCountDescriptor(); Object[] params = {"C"}; descriptor.setParameters(params); SmilesParser sp = new SmilesParser(); Modified: trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/AtomDegreeDescriptorTest.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/AtomDegreeDescriptorTest.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/AtomDegreeDescriptorTest.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -27,7 +27,7 @@ import junit.framework.TestSuite; import org.openscience.cdk.AtomContainer; import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.descriptors.atomic.AtomDegreeDescriptor; import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.smiles.SmilesParser; @@ -48,7 +48,7 @@ } public void testAtomDegreeDescriptor() throws ClassNotFoundException, CDKException, java.lang.Exception { - IDescriptor descriptor = new AtomDegreeDescriptor(); + IMolecularDescriptor descriptor = new AtomDegreeDescriptor(); Object[] params = {new Integer(1)}; descriptor.setParameters(params); SmilesParser sp = new SmilesParser(); Modified: trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/AtomHybridizationDescriptorTest.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/AtomHybridizationDescriptorTest.java 2006-05-04 19:27:39 UTC (rev 6170) +++ trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/AtomHybridizationDescriptorTest.java 2006-05-04 19:29:58 UTC (rev 6171) @@ -28,7 +28,7 @@ import org.openscience.cdk.AtomContainer; import org.openscience.cdk.Molecule; import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.qsar.IDescriptor; +import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.descriptors.atomic.AtomHybridizationDescriptor; import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.smiles.SmilesParser; @@ -50,7 +50,7 @@ } public void testAtomHybridizationDescriptorTest() throws ClassNotFoundException, CDKException, java.lang.Exception { - IDescriptor descriptor = new AtomHybridizationDescriptor(); + IMolecularDescriptor descriptor = new AtomHybridizationDescriptor(); Object[] params = {new Integer(0)}; descriptor.setParameters(params); SmilesParser sp = new SmilesParser(); Modified: trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/atomic/AtomHybridizationVSEPRDescriptorTest.java @@ Diff output truncated at 100000 characters. @@ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <egonw@us...> - 2006-06-30 13:40:13
|
Revision: 6534 Author: egonw Date: 2006-06-30 06:40:06 -0700 (Fri, 30 Jun 2006) ViewCVS: http://svn.sourceforge.net/cdk/?rev=6534&view=rev Log Message: ----------- Enabled atomic and bond descriptors Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/applications/DescriptorCalculator.java trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java Modified: trunk/cdk/src/org/openscience/cdk/applications/DescriptorCalculator.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/applications/DescriptorCalculator.java 2006-06-30 13:38:12 UTC (rev 6533) +++ trunk/cdk/src/org/openscience/cdk/applications/DescriptorCalculator.java 2006-06-30 13:40:06 UTC (rev 6534) @@ -36,7 +36,6 @@ import java.io.Writer; import java.util.Iterator; import java.util.List; -import java.util.Properties; import nu.xom.Document; import nu.xom.Serializer; @@ -52,7 +51,6 @@ import org.openscience.cdk.SetOfMolecules; import org.openscience.cdk.io.SMILESReader; import org.openscience.cdk.io.iterator.IteratingMDLReader; -import org.openscience.cdk.io.listener.PropertiesListener; import org.openscience.cdk.libio.cml.Convertor; import org.openscience.cdk.qsar.DescriptorEngine; import org.openscience.cdk.qsar.DescriptorSpecification; @@ -87,8 +85,7 @@ private boolean inputIsSMILES; private String outputFormat = null; private String suffix = null; - private String[] descTypes = null; - private PropertiesListener propsListener; + private String descType = null; private DescriptorEngine engine; public DescriptorCalculator() { @@ -101,21 +98,22 @@ suffix = ".cml"; firstTime = true; molcount = 1; - - Properties props = new Properties(); - props.setProperty("CMLIDs", "false"); - props.setProperty("NamespacedOutput", "false"); - props.setProperty("XMLDeclaration", "false"); - propsListener = new PropertiesListener(props); } private void initEngine() { - if (descTypes != null) { -// engine = new DescriptorEngine(descTypes); - System.out.println("Specification of descriptor class is currently disabled"); - System.exit(0); - } else + if ("atomic".equalsIgnoreCase(descType)) { + engine = new DescriptorEngine(DescriptorEngine.ATOMIC); + } else if ("bond".equalsIgnoreCase(descType)) { + engine = new DescriptorEngine(DescriptorEngine.BOND); + } else if ("molecular".equalsIgnoreCase(descType)) { engine = new DescriptorEngine(DescriptorEngine.MOLECULAR); + } else if (descType == null) { + engine = new DescriptorEngine(DescriptorEngine.MOLECULAR); + } else { + System.out.println("Not a valid descriptor type: " + descType); + System.out.println(" Should be either: molecular, atomic, or bond."); + System.exit(0); + } } public static void main(String[] args) { @@ -298,7 +296,7 @@ options.addOption("s","smiles", false, "input one SMILES string"); options.addOption("t","type",true, "specify which type of descriptor to calculate. "+ - "Possible values are: molecular, atomic"); + "Possible values are: molecular, atomic, bond"); options.addOption("o","output",true, "Format in which to output descriptors. Options are 'cml' or'txt' to"+ "indicate CML output or comma seperated text"); @@ -316,7 +314,7 @@ } if (line.hasOption("t") || line.hasOption("type")) { String optvalue = line.getOptionValue("t"); - descTypes = optvalue.split(","); + descType = optvalue; } if (line.hasOption("o") || line.hasOption("output")) { String optvalue = line.getOptionValue("o"); Modified: trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java 2006-06-30 13:38:12 UTC (rev 6533) +++ trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java 2006-06-30 13:40:06 UTC (rev 6534) @@ -27,10 +27,14 @@ import nu.xom.Attribute; import nu.xom.Element; import nu.xom.Elements; + +import org.openscience.cdk.dict.Dictionary; import org.openscience.cdk.dict.DictionaryDatabase; import org.openscience.cdk.dict.Entry; import org.openscience.cdk.exception.CDKException; +import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; +import org.openscience.cdk.interfaces.IBond; import org.openscience.cdk.tools.LoggingTool; import java.io.File; @@ -42,22 +46,23 @@ /** * A class that provides access to automatic descriptor calculation and more. - * <p/> - * The aim of this class is to provide an easy to use interface to automatically evaluate + * + * <p>The aim of this class is to provide an easy to use interface to automatically evaluate * all the CDK descriptors for a given molecule. Note that at a given time this class * will evaluate all <i>atomic</i> or <i>molecular</i> descriptors but not both. - * <p/> - * The available descriptors are determined by scanning all the jar files in the users CLASSPATH + * + * <p>The available descriptors are determined by scanning all the jar files in the users CLASSPATH * and selecting classes that belong to the CDK QSAR atomic or molecular descriptors package. - * <p/> - * An example of its usage would be + * + * <p>An example of its usage would be * <pre> * Molecule someMolecule; * ... * DescriptorEngine descriptoEngine = new DescriptorEngine(DescriptorEngine.MOLECULAR, null); * descriptorEngine.process(someMolecule); * </pre> - * The class allows the user to obtain a List of all the available descriptors in terms of their + * + * <p>The class allows the user to obtain a List of all the available descriptors in terms of their * Java class names as well as instances of each descriptor class. For each descriptor, it is possible to * obtain its classification as described in the CDK descriptor-algorithms OWL dictionary. * @@ -71,10 +76,11 @@ public class DescriptorEngine { private static String rdfNS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";; - public static final int ATOMIC = 1; - public static final int MOLECULAR = 2; + public static final int ATOMIC = 1; + public static final int BOND = 2; + public static final int MOLECULAR = 3; - private org.openscience.cdk.dict.Dictionary dict = null; + private Dictionary dict = null; private List classNames = null; private List descriptors = null; private List speclist = null; @@ -114,12 +120,16 @@ case ATOMIC: classNames = getDescriptorClassNameByPackage("org.openscience.cdk.qsar.descriptors.atomic", jarFileNames); break; + case BOND: + classNames = getDescriptorClassNameByPackage("org.openscience.cdk.qsar.descriptors.bond", jarFileNames); + break; case MOLECULAR: classNames = getDescriptorClassNameByPackage("org.openscience.cdk.qsar.descriptors.molecular", jarFileNames); break; } instantiateDescriptors(classNames); initializeSpecifications(descriptors); + logger.debug("Found #descriptors: ", classNames.size()); // get the dictionary for the descriptors DictionaryDatabase dictDB = new DictionaryDatabase(); @@ -139,12 +149,31 @@ * @throws CDKException if an error occured during descriptor calculation */ public void process(IAtomContainer molecule) throws CDKException { + IAtom[] atoms = molecule.getAtoms(); + IBond[] bonds = molecule.getBonds(); - for (int i = 0; i < descriptors.size(); i++) { - IMolecularDescriptor descriptor = (IMolecularDescriptor) descriptors.get(i); + for (int i = 0; i < descriptors.size(); i++) { + IDescriptor descriptor = (IDescriptor)descriptors.get(i); try { - DescriptorValue value = descriptor.calculate(molecule); - molecule.setProperty(speclist.get(i), value); + if (descriptor instanceof IMolecularDescriptor) { + DescriptorValue value = ((IMolecularDescriptor)descriptor).calculate(molecule); + molecule.setProperty(speclist.get(i), value); + logger.debug("Calculated molecular descriptors..."); + } else if (descriptor instanceof IAtomicDescriptor) { + for (int j=0; j<atoms.length; j++) { + DescriptorValue value = ((IAtomicDescriptor)descriptor).calculate(atoms[i]); + atoms[i].setProperty(speclist.get(i), value); + } + logger.debug("Calculated atomic descriptors..."); + } else if (descriptor instanceof IBondDescriptor) { + for (int j=0; j<bonds.length; j++) { + DescriptorValue value = ((IBondDescriptor)descriptor).calculate(bonds[i]); + bonds[i].setProperty(speclist.get(i), value); + } + logger.debug("Calculated bond descriptors..."); + } else { + logger.debug("Unknown descriptor type for: ", descriptor.getClass().getName()); + } } catch (CDKException exception) { logger.error("Could not calculate descriptor value for: ", descriptor.getClass().getName()); logger.debug(exception); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <egonw@us...> - 2006-07-05 18:08:57
|
Revision: 6597 Author: egonw Date: 2006-07-05 11:08:46 -0700 (Wed, 05 Jul 2006) ViewCVS: http://svn.sourceforge.net/cdk/?rev=6597&view=rev Log Message: ----------- Updated for change suggested on the mailing list Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java trunk/cdk/src/org/openscience/cdk/qsar/IAtomicDescriptor.java Modified: trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java 2006-07-05 16:00:27 UTC (rev 6596) +++ trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java 2006-07-05 18:08:46 UTC (rev 6597) @@ -161,7 +161,7 @@ logger.debug("Calculated molecular descriptors..."); } else if (descriptor instanceof IAtomicDescriptor) { for (int j=0; j<atoms.length; j++) { - DescriptorValue value = ((IAtomicDescriptor)descriptor).calculate(atoms[i]); + DescriptorValue value = ((IAtomicDescriptor)descriptor).calculate(atoms[i], molecule); atoms[i].setProperty(speclist.get(i), value); } logger.debug("Calculated atomic descriptors..."); Modified: trunk/cdk/src/org/openscience/cdk/qsar/IAtomicDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/IAtomicDescriptor.java 2006-07-05 16:00:27 UTC (rev 6596) +++ trunk/cdk/src/org/openscience/cdk/qsar/IAtomicDescriptor.java 2006-07-05 18:08:46 UTC (rev 6597) @@ -25,6 +25,7 @@ import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtom; +import org.openscience.cdk.interfaces.IAtomContainer; /** * Classes that implement this interface are QSAR descriptor calculators. @@ -38,12 +39,13 @@ * * @param atom An {@link IAtom} for which this descriptor should be * calculated + * @param container TODO * @return An object of {@link DescriptorValue} that contain the * calculated value as well as specification details * @throws CDKException if an error occurs during calculation. See * documentation for individual descriptors */ - public DescriptorValue calculate(IAtom atom) throws CDKException; + public DescriptorValue calculate(IAtom atom, IAtomContainer container) throws CDKException; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <egonw@us...> - 2006-07-05 19:18:53
|
Revision: 6602 Author: egonw Date: 2006-07-05 12:18:45 -0700 (Wed, 05 Jul 2006) ViewCVS: http://svn.sourceforge.net/cdk/?rev=6602&view=rev Log Message: ----------- Same trick for IBondDescriptor: descriptor might depends on the whole molecule to be calculated. Abstract helper class for caching properties, so that they can be retrieved one by one. Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java trunk/cdk/src/org/openscience/cdk/qsar/IBondDescriptor.java Added Paths: ----------- trunk/cdk/src/org/openscience/cdk/qsar/AbstractBondDescriptor.java Added: trunk/cdk/src/org/openscience/cdk/qsar/AbstractBondDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/AbstractBondDescriptor.java (rev 0) +++ trunk/cdk/src/org/openscience/cdk/qsar/AbstractBondDescriptor.java 2006-07-05 19:18:45 UTC (rev 6602) @@ -0,0 +1,75 @@ +/* $RCSfile$ + * $Author: egonw $ + * $Date: 2006-03-29 10:27:08 +0200 (Wed, 29 Mar 2006) $ + * $Revision: 5855 $ + * + * Copyright (C) 2006 The Chemistry Development Kit (CDK) project + * + * Contact: cdk-devel@... + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.openscience.cdk.qsar; + +import java.util.HashMap; +import java.util.Map; + +import org.openscience.cdk.interfaces.IAtomContainer; +import org.openscience.cdk.interfaces.IBond; + +/** + * Abstract bond descriptor class with helper functions for descriptors + * that require the whole molecule to calculate the descriptor values, + * which in turn need to be cached for all bonds, so that they can be + * retrieved one by one. + * + * @cdk.module qsar + */ +public abstract class AbstractBondDescriptor implements IBondDescriptor { + + private static final String PREVIOUS_ATOMCONTAINER = "previousAtomContainer"; + + private Map cachedDescriptorValues = null; + + /** + * Returns the cached DescriptorValue for the given IAtom. + * + * @param atom the IAtom for which the DescriptorValue is requested + * @return null, if no DescriptorValue was cached for the given IAtom + */ + public DescriptorValue getCachedDescriptorValue(IBond bond) { + if (cachedDescriptorValues == null) return null; + return (DescriptorValue)cachedDescriptorValues.get(bond); + } + + /** + * Caches a DescriptorValue for a given IAtom. This method may only + * be called after setNewContainer() is called. + * + * @param atom IAtom to cache the value for + * @param value DescriptorValue for the given IAtom + */ + public void cacheDescriptorValue(IBond bond, IAtomContainer container, DescriptorValue value) { + if (cachedDescriptorValues == null) { + cachedDescriptorValues = new HashMap(); + cachedDescriptorValues.put(PREVIOUS_ATOMCONTAINER, container); + } else if (cachedDescriptorValues.get(PREVIOUS_ATOMCONTAINER) != container) { + cachedDescriptorValues.clear(); + cachedDescriptorValues.put(PREVIOUS_ATOMCONTAINER, container); + } + cachedDescriptorValues.put(bond, value); + } +} + Modified: trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java 2006-07-05 19:15:00 UTC (rev 6601) +++ trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java 2006-07-05 19:18:45 UTC (rev 6602) @@ -161,14 +161,14 @@ logger.debug("Calculated molecular descriptors..."); } else if (descriptor instanceof IAtomicDescriptor) { for (int j=0; j<atoms.length; j++) { - DescriptorValue value = ((IAtomicDescriptor)descriptor).calculate(atoms[i], molecule); - atoms[i].setProperty(speclist.get(i), value); + DescriptorValue value = ((IAtomicDescriptor)descriptor).calculate(atoms[j], molecule); + atoms[j].setProperty(speclist.get(i), value); } logger.debug("Calculated atomic descriptors..."); } else if (descriptor instanceof IBondDescriptor) { for (int j=0; j<bonds.length; j++) { - DescriptorValue value = ((IBondDescriptor)descriptor).calculate(bonds[i]); - bonds[i].setProperty(speclist.get(i), value); + DescriptorValue value = ((IBondDescriptor)descriptor).calculate(bonds[j], molecule); + bonds[j].setProperty(speclist.get(i), value); } logger.debug("Calculated bond descriptors..."); } else { Modified: trunk/cdk/src/org/openscience/cdk/qsar/IBondDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/IBondDescriptor.java 2006-07-05 19:15:00 UTC (rev 6601) +++ trunk/cdk/src/org/openscience/cdk/qsar/IBondDescriptor.java 2006-07-05 19:18:45 UTC (rev 6602) @@ -24,6 +24,7 @@ package org.openscience.cdk.qsar; import org.openscience.cdk.exception.CDKException; +import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.interfaces.IBond; /** @@ -43,7 +44,7 @@ * @throws CDKException if an error occurs during calculation. See * documentation for individual descriptors */ - public DescriptorValue calculate(IBond bond) throws CDKException; + public DescriptorValue calculate(IBond bond, IAtomContainer container) throws CDKException; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <egonw@us...> - 2006-07-14 11:07:49
|
Revision: 6671 Author: egonw Date: 2006-07-14 04:07:00 -0700 (Fri, 14 Jul 2006) ViewCVS: http://svn.sourceforge.net/cdk/?rev=6671&view=rev Log Message: ----------- Last batch of JavaDoc fixes Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/fingerprint/Fingerprinter.java trunk/cdk/src/org/openscience/cdk/libio/biojava/Convertor.java trunk/cdk/src/org/openscience/cdk/qsar/AbstractBondDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/bond/BondPartialTChargeDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestChainDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestPiSystemDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LongestAliphaticChainDescriptor.java trunk/cdk/src/org/openscience/cdk/renderer/Renderer2DModel.java trunk/cdk/src/org/openscience/cdk/tools/FormatStringBuffer.java trunk/cdk/src/org/openscience/cdk/tools/GridGenerator.java trunk/cdk/src/org/openscience/cdk/tools/HydrogenAdder.java trunk/cdk/src/org/openscience/cdk/tools/LonePairElectronChecker.java trunk/cdk/src/org/openscience/cdk/tools/SaturationChecker.java trunk/cdk/src/org/openscience/cdk/tools/features/MoleculeFeaturesTool.java trunk/cdk/src/org/openscience/cdk/tools/manipulator/ReactionManipulator.java Modified: trunk/cdk/src/org/openscience/cdk/fingerprint/Fingerprinter.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/fingerprint/Fingerprinter.java 2006-07-14 10:41:57 UTC (rev 6670) +++ trunk/cdk/src/org/openscience/cdk/fingerprint/Fingerprinter.java 2006-07-14 11:07:00 UTC (rev 6671) @@ -121,7 +121,6 @@ * @param size The desired size of the fingerprint * @param searchDepth The desired depth of search * @param ringFinder The AllRingsFinder to be used by the aromaticity detection - * @return The Fingerprint (A one-dimensional bit array) */ public Fingerprinter(int size, int searchDepth, AllRingsFinder ringFinder) { this.size = size; Modified: trunk/cdk/src/org/openscience/cdk/libio/biojava/Convertor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/libio/biojava/Convertor.java 2006-07-14 10:41:57 UTC (rev 6670) +++ trunk/cdk/src/org/openscience/cdk/libio/biojava/Convertor.java 2006-07-14 11:07:00 UTC (rev 6671) @@ -39,8 +39,8 @@ * convert CDK classes to <a href="http://www.biojava.org/">BioJava</a> * classes and visa versa. * - * @cdk.module libio-biojava - * @cdk.requires biojava-1.4.jar + * @cdk.module libio-biojava + * @cdk.builddepends biojava-1.4.jar * * @cdk.keyword BioJava * @cdk.keyword class convertor Modified: trunk/cdk/src/org/openscience/cdk/qsar/AbstractBondDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/AbstractBondDescriptor.java 2006-07-14 10:41:57 UTC (rev 6670) +++ trunk/cdk/src/org/openscience/cdk/qsar/AbstractBondDescriptor.java 2006-07-14 11:07:00 UTC (rev 6671) @@ -44,10 +44,10 @@ private Map cachedDescriptorValues = null; /** - * Returns the cached DescriptorValue for the given IAtom. + * Returns the cached DescriptorValue for the given IBond. * - * @param atom the IAtom for which the DescriptorValue is requested - * @return null, if no DescriptorValue was cached for the given IAtom + * @param bond the IAtom for which the DescriptorValue is requested + * @return null, if no DescriptorValue was cached for the given IBond */ public DescriptorValue getCachedDescriptorValue(IBond bond) { if (cachedDescriptorValues == null) return null; @@ -55,11 +55,11 @@ } /** - * Caches a DescriptorValue for a given IAtom. This method may only + * Caches a DescriptorValue for a given IBond. This method may only * be called after setNewContainer() is called. * - * @param atom IAtom to cache the value for - * @param value DescriptorValue for the given IAtom + * @param bond IBond to cache the value for + * @param value DescriptorValue for the given IBond */ public void cacheDescriptorValue(IBond bond, IAtomContainer container, DescriptorValue value) { if (cachedDescriptorValues == null) { Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/bond/BondPartialTChargeDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/bond/BondPartialTChargeDescriptor.java 2006-07-14 10:41:57 UTC (rev 6670) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/bond/BondPartialTChargeDescriptor.java 2006-07-14 11:07:00 UTC (rev 6671) @@ -24,7 +24,6 @@ */ package org.openscience.cdk.qsar.descriptors.bond; -import org.openscience.cdk.Molecule; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; @@ -32,6 +31,7 @@ import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.descriptors.atomic.PartialPiChargeDescriptor; +import org.openscience.cdk.qsar.descriptors.atomic.PartialSigmaChargeDescriptor; import org.openscience.cdk.qsar.descriptors.atomic.PartialTChargePEOEDescriptor; import org.openscience.cdk.qsar.result.DoubleResult; @@ -53,14 +53,13 @@ * </tr> * </table> * - * * @author Miguel Rojas * @cdk.created 2006-05-18 * @cdk.module qsar * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:bondPartialTCharge - * @see PartialPiChargeDescriptor - * @see PartialSigmaChargeDescriptor + * @see org.openscience.cdk.qsar.descriptors.atomic.PartialPiChargeDescriptor + * @see org.openscience.cdk.qsar.descriptors.atomic.PartialSigmaChargeDescriptor */ public class BondPartialTChargeDescriptor implements IMolecularDescriptor { Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestChainDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestChainDescriptor.java 2006-07-14 10:41:57 UTC (rev 6670) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestChainDescriptor.java 2006-07-14 11:07:00 UTC (rev 6671) @@ -143,15 +143,17 @@ /** - * Calculate the count of atoms of the largest chain in the supplied {@link AtomContainer}. + * Calculate the count of atoms of the largest chain in the supplied {@link IAtomContainer}. * - * The method require two parameters: - * if checkAromaticity is true, the method check the aromaticity, - * if false, means that the aromaticity has already been checked + * <p>The method require two parameters: + * <ol> + * <li>if checkAromaticity is true, the method check the aromaticity, + * <li>if false, means that the aromaticity has already been checked + * </ol> * - * Same for checkRingSystem, if true the CDKConstant.ISINRING will be set + * <p>Same for checkRingSystem, if true the CDKConstant.ISINRING will be set * - *@param ac The {@link AtomContainer} for which this descriptor is to be calculated + *@param container The {@link AtomContainer} for which this descriptor is to be calculated *@return the number of atoms in the largest chain of this AtomContainer *@throws CDKException if there is a problem in aromaticity detection *@see #setParameters Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestPiSystemDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestPiSystemDescriptor.java 2006-07-14 10:41:57 UTC (rev 6670) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestPiSystemDescriptor.java 2006-07-14 11:07:00 UTC (rev 6671) @@ -138,12 +138,13 @@ /** * Calculate the count of atoms of the largest pi system in the supplied {@link AtomContainer}. * - * The method require one parameter: - * if checkAromaticity is true, the method check the aromaticity, - * if false, means that the aromaticity has already been checked + * <p>The method require one parameter: + * <ol> + * <li>if checkAromaticity is true, the method check the aromaticity, + * <li>if false, means that the aromaticity has already been checked + * </ol> * - * - *@param ac The {@link AtomContainer} for which this descriptor is to be calculated + *@param container The {@link IAtomContainer} for which this descriptor is to be calculated *@return the number of atoms in the largest pi system of this AtomContainer *@throws CDKException if there is a problem in atomaticity detection *@see #setParameters Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LongestAliphaticChainDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LongestAliphaticChainDescriptor.java 2006-07-14 10:41:57 UTC (rev 6670) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LongestAliphaticChainDescriptor.java 2006-07-14 11:07:00 UTC (rev 6671) @@ -137,10 +137,10 @@ /** * Calculate the count of atoms of the longest aliphatic chain in the supplied {@link AtomContainer}. * - * The method require two parameters: + * The method require one parameter: * if checkRingSyste is true the CDKConstant.ISINRING will be set * - *@param ac The {@link AtomContainer} for which this descriptor is to be calculated + *@param container The {@link AtomContainer} for which this descriptor is to be calculated *@return the number of atoms in the longest aliphatic chain of this AtomContainer *@throws CDKException if there is a problem in aromaticity detection *@see #setParameters Modified: trunk/cdk/src/org/openscience/cdk/renderer/Renderer2DModel.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/renderer/Renderer2DModel.java 2006-07-14 10:41:57 UTC (rev 6670) +++ trunk/cdk/src/org/openscience/cdk/renderer/Renderer2DModel.java 2006-07-14 11:07:00 UTC (rev 6671) @@ -987,8 +987,6 @@ /** * Gets the color used for drawing the part which was selected externally - * - * @param externalHighlightColor The color */ public Color getExternalHighlightColor() { return externalHighlightColor; @@ -1005,8 +1003,6 @@ /** * Gets the color used for drawing the part we are hovering over. - * - * @param hoverOverColor The color */ public Color getHoverOverColor() { return hoverOverColor; @@ -1023,8 +1019,6 @@ /** * Gets the color used for drawing the internally selected part. - * - * @param selectedPartColor The color */ public Color getSelectedPartColor() { return selectedPartColor; Modified: trunk/cdk/src/org/openscience/cdk/tools/FormatStringBuffer.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/tools/FormatStringBuffer.java 2006-07-14 10:41:57 UTC (rev 6670) +++ trunk/cdk/src/org/openscience/cdk/tools/FormatStringBuffer.java 2006-07-14 11:07:00 UTC (rev 6671) @@ -145,8 +145,6 @@ * Reset this <tt>FormatStringBuffer</tt> with the format string * given in the constructor or last call to <tt>reset(String)</tt>. * This is automatically called after <tt>toString()</tt>. - * - * @param format the format string. */ public FormatStringBuffer reset() { this.buffer = new StringBuffer(); Modified: trunk/cdk/src/org/openscience/cdk/tools/GridGenerator.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/tools/GridGenerator.java 2006-07-14 10:41:57 UTC (rev 6670) +++ trunk/cdk/src/org/openscience/cdk/tools/GridGenerator.java 2006-07-14 11:07:00 UTC (rev 6671) @@ -31,11 +31,10 @@ import javax.vecmath.Point3d; /** - * Generates a grid within given boundaries + * Generates a grid of points in 3D space within given boundaries. * * @author cho * @cdk.created 2005-09-30 - * */ public class GridGenerator { @@ -54,19 +53,13 @@ public GridGenerator() { } - /** - * @param double min - * @param double max - */ public GridGenerator(double min, double max) { setDimension(min, max); generateGrid(); } /** - * @param double min - * @param double max - * @param double initialValue for the grid points + * @param initialValue used as initial value for the grid points */ public GridGenerator(double min, double max, double initialValue) { setDimension(min, max); @@ -74,12 +67,6 @@ initializeGrid(initialValue); } - // minx,maxx,miny,maxy,minz,maxz or flag - /** - * @param double[] minMax values - * @param double initialValue - * @param boolean cubicGridFlag - */ public GridGenerator(double[] minMax, double initialValue, boolean cubicGridFlag) { setDimension(minMax, cubicGridFlag); @@ -88,11 +75,7 @@ } /** - * Method sets the maximal 3d dimensions to given min and max values - * - * @param double min - * @param double max - * @return void + * Method sets the maximal 3d dimensions to given min and max values. */ public void setDimension(double min, double max) { this.minx = min; @@ -104,11 +87,7 @@ } /** - * Method sets the maximal 3d dimensions to given min and max values - * - * @param doublem min - * @param double max - * @return void + * Method sets the maximal 3d dimensions to given min and max values. */ public void setDimension(double[] minMax, boolean cubicGridFlag) { if (cubicGridFlag) { @@ -133,11 +112,7 @@ } /** - * Method sets the maximal 3d dimensions to given min and max values - * - * @param double min - * @param double max - * @return void + * Method sets the maximal 3d dimensions to given min and max values. */ public void setDimension(double minx, double maxx, double miny, double maxy, double minz, double maxz) { @@ -151,9 +126,8 @@ /** * Main method creates a grid between given boundaries (dimensions). - * The grid my be extended over the given boundaries with the variable extendGrid - * - * @return void + * The grid my be extended over the given boundaries with the + * variable extendGrid. */ public void generateGrid() { minx = minx - extendGrid; @@ -171,10 +145,7 @@ } /** - * Method initialise the given grid points with a value - * - * @param double value - * @return void + * Method initialise the given grid points with a value. */ public void initializeGrid(double value) { for (int i = 0; i < grid.length; i++) { @@ -187,12 +158,7 @@ } /** - * Method initialise the given grid points with a value - * - * @param double[][][] grid - * @param double value - * @return - * @return double[][][] + * Method initialise the given grid points with a value. */ public double[][][] initializeGrid(double grid[][][], double value) { for (int i = 0; i < grid.length; i++) { @@ -206,11 +172,7 @@ } /** - * Method transforms the grid to an array - * - * @param double[][][] grid - * @return - * @return double[] + * Method transforms the grid to an array. */ public double[] gridToGridArray(double[][][] grid) { if (grid == null) { @@ -230,10 +192,7 @@ } /** - * Method calculates coordiantes from a given grid point - * - * @param Point3d gridPoint - * @return Point3d coordinates + * Method calculates coordiantes from a given grid point. */ public Point3d getCoordinatesFromGridPoint(Point3d gridPoint) { double dx = minx + latticeConstant * gridPoint.x; @@ -243,11 +202,7 @@ } /** - * Method calculates coordiantes from a given grid array position - * - * @param int gridPoint - * @return - * @return Point3d coordinates + * Method calculates coordiantes from a given grid array position. */ public Point3d getCoordinatesFromGridPoint(int gridPoint) { int dimCounter = 0; @@ -269,11 +224,7 @@ } /** - * Method calculates the nearest grid point from given coordinates - * - * @param Point3d coord - * @throws Exception - * @return Point3d grid point + * Method calculates the nearest grid point from given coordinates. */ public Point3d getGridPointFrom3dCoordinates(Point3d coord) throws Exception { @@ -305,11 +256,7 @@ } /** - * Method transforms the grid into pmesh format - * - * @param String outPutFileName - * @throws IOException - * @return void + * Method transforms the grid into pmesh format. */ public void writeGridInPmeshFormat(String outPutFileName) throws IOException { @@ -332,15 +279,12 @@ } /** - * Method transforms the grid into pmesh format.Only grid points with specific value - * defined with cutoff are considered. + * Method transforms the grid into pmesh format. Only grid points + * with specific value defined with cutoff are considered. + * <pre> * cutoff <0, the values considered must be <=cutoff * cutoff >0, the values considered must be >=cutoff - * - * @param String outPutFileName - * @param double cutoff - * @throws IOException - * @return void + * </pre> */ public void writeGridInPmeshFormat(String outPutFileName, double cutOff) throws IOException { @@ -400,7 +344,7 @@ /** - * @return int[] Returns the dim. + * @return Returns the dim. */ public int[] getDim() { return dim; @@ -408,7 +352,7 @@ /** - * @param int[] dim The dim to set. + * @param dim The dim to set. */ public void setDim(int[] dim) { this.dim = dim; @@ -416,7 +360,7 @@ /** - * @return double Returns the extendGrid. + * @return Returns the extendGrid. */ public double getExtendGrid() { return extendGrid; @@ -424,7 +368,7 @@ /** - * @param double extendGrid The extendGrid to set. + * @param extendGrid The extendGrid to set. */ public void setExtendGrid(double extendGrid) { this.extendGrid = extendGrid; @@ -432,7 +376,7 @@ /** - * @return double[][][] Returns the grid. + * @return Returns the grid. */ public double[][][] getGrid() { return grid; @@ -440,7 +384,7 @@ /** - * @param double[][][] grid The grid to set. + * @param grid The grid to set. */ public void setGrid(double[][][] grid) { this.grid = grid; @@ -448,7 +392,7 @@ /** - * @return double Returns the latticeConstant. + * @return Returns the latticeConstant. */ public double getLatticeConstant() { return latticeConstant; @@ -456,7 +400,7 @@ /** - * @param double latticeConstant The latticeConstant to set. + * @param latticeConstant The latticeConstant to set. */ public void setLatticeConstant(double latticeConstant) { this.latticeConstant = latticeConstant; @@ -464,7 +408,7 @@ /** - * @return double[] Returns the gridArray. + * @return Returns the gridArray. */ public double[] getGridArray() { return gridArray; @@ -472,7 +416,7 @@ /** - * @return double Returns the maxx. + * @return Returns the maxx. */ public double getMaxx() { return maxx; @@ -480,7 +424,7 @@ /** - * @return double Returns the maxy. + * @return Returns the maxy. */ public double getMaxy() { return maxy; @@ -488,7 +432,7 @@ /** - * @return double Returns the maxz. + * @return Returns the maxz. */ public double getMaxz() { return maxz; @@ -496,7 +440,7 @@ /** - * @return double Returns the minx. + * @return Returns the minx. */ public double getMinx() { return minx; @@ -504,7 +448,7 @@ /** - * @return double Returns the miny. + * @return Returns the miny. */ public double getMiny() { return miny; @@ -512,7 +456,7 @@ /** - * @return double Returns the minz. + * @return Returns the minz. */ public double getMinz() { return minz; Modified: trunk/cdk/src/org/openscience/cdk/tools/HydrogenAdder.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/tools/HydrogenAdder.java 2006-07-14 10:41:57 UTC (rev 6670) +++ trunk/cdk/src/org/openscience/cdk/tools/HydrogenAdder.java 2006-07-14 11:07:00 UTC (rev 6671) @@ -141,7 +141,6 @@ * org.openscience.cdk.HydrogenPlacer(atomContainer, bondLength); * * @param molecule Molecule to saturate - * @return * @cdk.keyword hydrogen, adding * @cdk.keyword explicit hydrogen */ @@ -163,7 +162,6 @@ * org.openscience.cdk.HydrogenPlacer(atomContainer, bondLength); * * @param molecule Molecule to saturate - * @return * @cdk.keyword hydrogen, adding * @cdk.keyword explicit hydrogen */ @@ -199,7 +197,6 @@ * @param atom Atom to saturate * @param container AtomContainer containing the atom * @param totalContainer In case you have a container containing multiple structures, this is the total container, whereas container is a partial structure - * @return * * @cdk.keyword hydrogen, adding * @cdk.keyword explicit hydrogen @@ -227,7 +224,6 @@ * @param atom Atom to saturate * @param container AtomContainer containing the atom * @param totalContainer In case you have a container containing multiple structures, this is the total container, whereas container is a partial structure - * @return * * @cdk.keyword hydrogen, adding * @cdk.keyword explicit hydrogen @@ -252,7 +248,6 @@ * @param container AtomContainer containing the atom * @param count Number of hydrogens to add * @param totalContainer In case you have a container containing multiple structures, this is the total container, whereas container is a partial structure - * @return * * @cdk.keyword hydrogen, adding * @cdk.keyword explicit hydrogen @@ -278,10 +273,9 @@ } /** - * Method that saturates a molecule by adding implicit hydrogens. + * Method that saturates a molecule by adding implicit hydrogens. * *@param container Molecule to saturate - * @return *@cdk.keyword hydrogen, adding *@cdk.keyword implicit hydrogen */ @@ -305,7 +299,6 @@ * * @param container Molecule to saturate * @param atom Atom to satureate. - * @return * @cdk.keyword hydrogen, adding * @cdk.keyword implicit hydrogen */ Modified: trunk/cdk/src/org/openscience/cdk/tools/LonePairElectronChecker.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/tools/LonePairElectronChecker.java 2006-07-14 10:41:57 UTC (rev 6670) +++ trunk/cdk/src/org/openscience/cdk/tools/LonePairElectronChecker.java 2006-07-14 11:07:00 UTC (rev 6671) @@ -69,21 +69,13 @@ } /** * Determines of all atoms on the AtomContainer have specified the right number the lone pair electrons. - * - * @param container - * @return - * - * @throws CDKException */ public boolean isSaturated(IAtomContainer container) throws CDKException { return allSaturated(container); } + /** * Determines of all atoms on the AtomContainer have specified the right number the lone pair electrons. - * - * @param ac - * @return - * @throws CDKException */ public boolean allSaturated(IAtomContainer ac) throws CDKException { @@ -99,12 +91,7 @@ /** * Checks wether an Atom is saturated their lone pair electrons by comparing it with known AtomTypes. - * @param atom The atom - * @param ac The atomcontainer - * * @return True, if it's right satured - * - * @throws CDKException */ public boolean isSaturated(IAtom atom, IAtomContainer ac) throws CDKException { @@ -135,9 +122,6 @@ } /** * Saturates a molecule by setting appropriate number lone pair electrons. - * - * @param atomContainer - * @throws CDKException */ public void newSaturate(IAtomContainer atomContainer) throws CDKException { logger.info("Saturating atomContainer by adjusting lone pair electrons..."); @@ -151,9 +135,6 @@ } /** * Saturates a atom by setting appropriate number lone pair electrons. - * - * @param atomContainer - * @throws CDKException */ public void newSaturate(IAtom atom, IAtomContainer ac) throws CDKException { logger.info("Saturating atom by adjusting lone pair electrons..."); Modified: trunk/cdk/src/org/openscience/cdk/tools/SaturationChecker.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/tools/SaturationChecker.java 2006-07-14 10:41:57 UTC (rev 6670) +++ trunk/cdk/src/org/openscience/cdk/tools/SaturationChecker.java 2006-07-14 11:07:00 UTC (rev 6671) @@ -61,6 +61,7 @@ * @cdk.keyword atom, valency * * @cdk.module valencycheck + * @cdk.bug 1167386 */ public class SaturationChecker implements IValencyChecker { @@ -290,7 +291,6 @@ * * @cdk.keyword bond order, calculation * @cdk.created 2003-10-03 - * @cdk.bug 1167386 */ public void newSaturate(IAtomContainer atomContainer) throws CDKException { logger.info("Saturating atomContainer by adjusting bond orders..."); Modified: trunk/cdk/src/org/openscience/cdk/tools/features/MoleculeFeaturesTool.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/tools/features/MoleculeFeaturesTool.java 2006-07-14 10:41:57 UTC (rev 6670) +++ trunk/cdk/src/org/openscience/cdk/tools/features/MoleculeFeaturesTool.java 2006-07-14 11:07:00 UTC (rev 6671) @@ -69,9 +69,6 @@ /** * Checks wether all bonds have exactly two atoms. - * - * @param molecule - * @return */ public static boolean hasGraphRepresentation(IMolecule molecule) { IBond[] bonds = molecule.getBonds(); Modified: trunk/cdk/src/org/openscience/cdk/tools/manipulator/ReactionManipulator.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/tools/manipulator/ReactionManipulator.java 2006-07-14 10:41:57 UTC (rev 6670) +++ trunk/cdk/src/org/openscience/cdk/tools/manipulator/ReactionManipulator.java 2006-07-14 11:07:00 UTC (rev 6671) @@ -241,7 +241,7 @@ * get the IAtom which is mapped * * @param reaction The IReaction which contains the mapping - * @param atom The IChemObject which will be searched its mapped IChemObject + * @param chemObject The IChemObject which will be searched its mapped IChemObject * @return The mapped IChemObject */ public static IChemObject getMappedChemObject(IReaction reaction, IChemObject chemObject){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <egonw@us...> - 2006-08-30 09:48:16
|
Revision: 6821 Author: egonw Date: 2006-08-30 02:48:07 -0700 (Wed, 30 Aug 2006) ViewCVS: http://svn.sourceforge.net/cdk/?rev=6821&view=rev Log Message: ----------- Set up an interface for atom-pair descriptors. Added Paths: ----------- trunk/cdk/src/org/openscience/cdk/qsar/IAtomPairDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atompair/ Added: trunk/cdk/src/org/openscience/cdk/qsar/IAtomPairDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/IAtomPairDescriptor.java (rev 0) +++ trunk/cdk/src/org/openscience/cdk/qsar/IAtomPairDescriptor.java 2006-08-30 09:48:07 UTC (rev 6821) @@ -0,0 +1,50 @@ +/* $Revision: 5855 $ $Author: egonw $ $Date: 2006-03-29 10:27:08 +0200 (Wed, 29 Mar 2006) $ + * + * Copyright (C) 2006 Egon Willighagen <egonw@...> + * + * Contact: cdk-devel@... + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.openscience.cdk.qsar; + +import org.openscience.cdk.exception.CDKException; +import org.openscience.cdk.interfaces.IAtom; +import org.openscience.cdk.interfaces.IAtomContainer; + +/** + * Classes that implement this interface are QSAR descriptor calculators. + * + * @cdk.module qsar + */ +public interface IAtomPairDescriptor extends IDescriptor { + + /** + * Calculates the descriptor value for the given IAtom. + * + * @param atom The first {@link IAtom} of the pair for which this + * descriptor should be calculated + * @param atom2 The second {@link IAtom} of the pair for which this + * descriptor should be calculated + * @param container TODO + * @return An object of {@link DescriptorValue} that contain the + * calculated value as well as specification details + * @throws CDKException if an error occurs during calculation. See + * documentation for individual descriptors + */ + public DescriptorValue calculate(IAtom atom, IAtom atom2, IAtomContainer container) throws CDKException; + +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rajarshi@us...> - 2006-09-17 23:09:51
|
Revision: 6873 http://svn.sourceforge.net/cdk/?rev=6873&view=rev Author: rajarshi Date: 2006-09-17 16:09:40 -0700 (Sun, 17 Sep 2006) Log Message: ----------- Updated to remove PMD unused warnings Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/PartialTChargePEOEDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/model/R2/RModel.java Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/PartialTChargePEOEDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/PartialTChargePEOEDescriptor.java 2006-09-15 13:46:30 UTC (rev 6872) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/PartialTChargePEOEDescriptor.java 2006-09-17 23:09:40 UTC (rev 6873) @@ -66,15 +66,14 @@ private AbstractAtomicDescriptor sigmaCharge; private AbstractAtomicDescriptor piCharge; - private IAtomContainer acCloned; /** * Constructor for the PartialTChargePEOEDescriptor object */ - public PartialTChargePEOEDescriptor() { - sigmaCharge = new PartialSigmaChargeDescriptor(); - piCharge = new PartialPiChargeDescriptor(); + public PartialTChargePEOEDescriptor() { + sigmaCharge = new PartialSigmaChargeDescriptor(); + piCharge = new PartialPiChargeDescriptor(); } @@ -122,14 +121,9 @@ * @exception CDKException Possible Exceptions */ public DescriptorValue calculate(IAtom atom, IAtomContainer ac) throws CDKException { - - try { - acCloned = (IAtomContainer)ac.clone(); - } catch (CloneNotSupportedException e) { - throw new CDKException("Could not clone IMolecule!", e); - } - - double piRC= ((DoubleResult)piCharge.calculate(atom, ac).getValue()).doubleValue(); + + + double piRC= ((DoubleResult)piCharge.calculate(atom, ac).getValue()).doubleValue(); double sigmaRC= ((DoubleResult)sigmaCharge.calculate(atom, ac).getValue()).doubleValue(); Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor.java 2006-09-15 13:46:30 UTC (rev 6872) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor.java 2006-09-17 23:09:40 UTC (rev 6873) @@ -24,12 +24,6 @@ */ package org.openscience.cdk.qsar.descriptors.atomic; -import java.util.ArrayList; -import java.util.List; - -import javax.vecmath.Point3d; -import javax.vecmath.Vector3d; - import org.openscience.cdk.CDKConstants; import org.openscience.cdk.Molecule; import org.openscience.cdk.Ring; @@ -48,6 +42,11 @@ import org.openscience.cdk.qsar.result.IntegerArrayResult; import org.openscience.cdk.ringsearch.AllRingsFinder; +import javax.vecmath.Point3d; +import javax.vecmath.Vector3d; +import java.util.ArrayList; +import java.util.List; + /** * This class calculates 5 RDF proton descriptors used in neural networks for H1 NMR shift. * @@ -168,10 +167,9 @@ *@exception CDKException Possible Exceptions */ public DescriptorValue calculate(IAtom atom, IAtomContainer ac, IRingSet precalculatedringset) throws CDKException { - IAtom target = atom; - int atomPosition = ac.getAtomNumber(atom); + int atomPosition = ac.getAtomNumber(atom); IntegerArrayResult rdfProtonCalculatedValues = new IntegerArrayResult(5); - if(target.getSymbol().equals("H")) { + if(atom.getSymbol().equals("H")) { /////////////////////////FIRST SECTION OF MAIN METHOD: DEFINITION OF MAIN VARIABLES /////////////////////////AND AROMATICITY AND PI-SYSTEM AND RINGS DETECTION @@ -207,7 +205,7 @@ } } // SET ISINRING FLAGS FOR ATOMS - org.openscience.cdk.interfaces.IRingSet ringsWithThisAtom = null; + org.openscience.cdk.interfaces.IRingSet ringsWithThisAtom; IAtom[] atomsInContainer = ac.getAtoms(); for (int w = 0; w < atomsInContainer.length; w++) { @@ -220,15 +218,15 @@ IAtomContainer detected = acSet.getAtomContainer(0); // neighboors[0] is the atom joined to the target proton: - IAtom[] neighboors = mol.getConnectedAtoms(target); + IAtom[] neighboors = mol.getConnectedAtoms(atom); // 2', 3', 4', 5', 6', and 7' atoms up to the target are detected: IAtom[] atomsInSecondSphere = mol.getConnectedAtoms(neighboors[0]); - IAtom[] atomsInThirdSphere = null; - IAtom[] atomsInFourthSphere = null; - IAtom[] atomsInFifthSphere = null; - IAtom[] atomsInSixthSphere = null; - IAtom[] atomsInSeventhSphere = null; + IAtom[] atomsInThirdSphere; + IAtom[] atomsInFourthSphere; + IAtom[] atomsInFifthSphere; + IAtom[] atomsInSixthSphere; + IAtom[] atomsInSeventhSphere; // SOME LISTS ARE CREATED FOR STORING OF INTERESTING ATOMS AND BONDS DURING DETECTION ArrayList singles = new ArrayList(); // list of any bond not rotatable @@ -238,28 +236,28 @@ ArrayList bondsInCycloex = new ArrayList(); // list for bonds in cycloexane-like rings // 2', 3', 4', 5', 6', and 7' bonds up to the target are detected: - org.openscience.cdk.interfaces.IBond secondBond = null; // (remember that first bond is proton bond) - org.openscience.cdk.interfaces.IBond thirdBond = null; // - org.openscience.cdk.interfaces.IBond fourthBond = null; // - org.openscience.cdk.interfaces.IBond fifthBond = null; // - org.openscience.cdk.interfaces.IBond sixthBond = null; // - org.openscience.cdk.interfaces.IBond seventhBond = null; // + org.openscience.cdk.interfaces.IBond secondBond; // (remember that first bond is proton bond) + org.openscience.cdk.interfaces.IBond thirdBond; // + org.openscience.cdk.interfaces.IBond fourthBond; // + org.openscience.cdk.interfaces.IBond fifthBond; // + org.openscience.cdk.interfaces.IBond sixthBond; // + org.openscience.cdk.interfaces.IBond seventhBond; // // definition of some variables used in the main FOR loop for detection of interesting atoms and bonds: - boolean theBondIsInA6MemberedRing = false; // this is like a flag for bonds which are in cycloexane-like rings (rings with more than 4 at.) - double bondOrder = 0; - int bondNumber = 0; - int sphere = 0; + boolean theBondIsInA6MemberedRing; // this is like a flag for bonds which are in cycloexane-like rings (rings with more than 4 at.) + double bondOrder; + int bondNumber; + int sphere; // THIS MAIN FOR LOOP DETECT RIGID BONDS IN 7 SPHERES: for(int a = 0; a < atomsInSecondSphere.length; a++) { secondBond = mol.getBond(neighboors[0], atomsInSecondSphere[a]); - if(mol.getAtomNumber(atomsInSecondSphere[a])!=atomPosition && getIfBondIsNotRotatable(mol, secondBond, detected)==true) { + if(mol.getAtomNumber(atomsInSecondSphere[a])!=atomPosition && getIfBondIsNotRotatable(mol, secondBond, detected)) { sphere = 2; bondOrder = secondBond.getOrder(); bondNumber = mol.getBondNumber(secondBond); theBondIsInA6MemberedRing = false; - checkAndStore(bondNumber, bondOrder, singles, doubles, bondsInCycloex, mol.getAtomNumber(atomsInSecondSphere[a]), atomsInSecondSphere[a].getSymbol(), atoms, sphere, theBondIsInA6MemberedRing); + checkAndStore(bondNumber, bondOrder, singles, doubles, bondsInCycloex, mol.getAtomNumber(atomsInSecondSphere[a]), atoms, sphere, theBondIsInA6MemberedRing); atomsInThirdSphere = mol.getConnectedAtoms(atomsInSecondSphere[a]); if(atomsInThirdSphere.length > 0) { for(int b = 0; b < atomsInThirdSphere.length; b++) { @@ -284,7 +282,7 @@ } } } - checkAndStore(bondNumber, bondOrder, singles, doubles, bondsInCycloex, mol.getAtomNumber(atomsInThirdSphere[b]), atomsInThirdSphere[b].getSymbol(), atoms, sphere, theBondIsInA6MemberedRing); + checkAndStore(bondNumber, bondOrder, singles, doubles, bondsInCycloex, mol.getAtomNumber(atomsInThirdSphere[b]), atoms, sphere, theBondIsInA6MemberedRing); theBondIsInA6MemberedRing = false; atomsInFourthSphere = mol.getConnectedAtoms(atomsInThirdSphere[b]); if(atomsInFourthSphere.length > 0) { @@ -295,7 +293,7 @@ bondOrder = fourthBond.getOrder(); bondNumber = mol.getBondNumber(fourthBond); theBondIsInA6MemberedRing = false; - checkAndStore(bondNumber, bondOrder, singles, doubles, bondsInCycloex, mol.getAtomNumber(atomsInFourthSphere[c]), atomsInFourthSphere[c].getSymbol(), atoms, sphere, theBondIsInA6MemberedRing); + checkAndStore(bondNumber, bondOrder, singles, doubles, bondsInCycloex, mol.getAtomNumber(atomsInFourthSphere[c]), atoms, sphere, theBondIsInA6MemberedRing); atomsInFifthSphere = mol.getConnectedAtoms(atomsInFourthSphere[c]); if(atomsInFifthSphere.length > 0) { for(int d = 0; d < atomsInFifthSphere.length; d++) { @@ -305,7 +303,7 @@ bondOrder = fifthBond.getOrder(); bondNumber = mol.getBondNumber(fifthBond); theBondIsInA6MemberedRing = false; - checkAndStore(bondNumber, bondOrder, singles, doubles, bondsInCycloex, mol.getAtomNumber(atomsInFifthSphere[d]), atomsInFifthSphere[d].getSymbol(), atoms, sphere, theBondIsInA6MemberedRing); + checkAndStore(bondNumber, bondOrder, singles, doubles, bondsInCycloex, mol.getAtomNumber(atomsInFifthSphere[d]), atoms, sphere, theBondIsInA6MemberedRing); atomsInSixthSphere = mol.getConnectedAtoms(atomsInFifthSphere[d]); if(atomsInSixthSphere.length > 0) { for(int e = 0; e < atomsInSixthSphere.length; e++) { @@ -315,7 +313,7 @@ bondOrder = sixthBond.getOrder(); bondNumber = mol.getBondNumber(sixthBond); theBondIsInA6MemberedRing = false; - checkAndStore(bondNumber, bondOrder, singles, doubles, bondsInCycloex, mol.getAtomNumber(atomsInSixthSphere[e]), atomsInSixthSphere[e].getSymbol(), atoms, sphere, theBondIsInA6MemberedRing); + checkAndStore(bondNumber, bondOrder, singles, doubles, bondsInCycloex, mol.getAtomNumber(atomsInSixthSphere[e]), atoms, sphere, theBondIsInA6MemberedRing); atomsInSeventhSphere = mol.getConnectedAtoms(atomsInSixthSphere[e]); if(atomsInSeventhSphere.length > 0) { for(int f = 0; f < atomsInSeventhSphere.length; f++) { @@ -325,7 +323,7 @@ bondOrder = seventhBond.getOrder(); bondNumber = mol.getBondNumber(seventhBond); theBondIsInA6MemberedRing = false; - checkAndStore(bondNumber, bondOrder, singles, doubles, bondsInCycloex, mol.getAtomNumber(atomsInSeventhSphere[f]), atomsInSeventhSphere[f].getSymbol(), atoms, sphere, theBondIsInA6MemberedRing); + checkAndStore(bondNumber, bondOrder, singles, doubles, bondsInCycloex, mol.getAtomNumber(atomsInSeventhSphere[f]), atoms, sphere, theBondIsInA6MemberedRing); } }} } @@ -343,16 +341,16 @@ ////////////////////// NOW ATOMS AND BONDS ARE DETECTED, THEN WE HAVE SOME LISTS WITH A DESCRIPTION OF THE PROTON ENVIRONMENT // some of these variables are used in all descriptors: - double[] values = new double[4]; // for storage of results of other methods - double distance = 0; - double sum = 0; + double[] values; // for storage of results of other methods + double distance; + double sum; double smooth = -20; - double partial = 0; - int position = 0; + double partial; + int position; double limitInf = 1.4; double limitSup = 4; double step = (limitSup - limitInf)/15; - IAtom atom2 = null; + IAtom atom2; ///////////////////////THE FIRST CALCULATED DESCRIPTOR IS g(H)r WITH PARTIAL CHARGES: @@ -367,14 +365,14 @@ Integer thisAtom = (Integer)atoms.get(at); position = thisAtom.intValue(); atom2 = mol.getAtom(position); - distance = calculateDistanceBetweenTwoAtoms( mol, target, atom2 ); + distance = calculateDistanceBetweenTwoAtoms(atom, atom2 ); partial = atom2.getCharge() * Math.exp( smooth * (Math.pow( (ghr - distance) , 2))); sum += partial; } gHr_function.add(new Double(sum)); //System.out.println("RDF gr distance prob.: "+sum+ " at distance "+ghr); } - target.setProperty("gasteigerGHR", new ArrayList(gHr_function)); + atom.setProperty("gasteigerGHR", new ArrayList(gHr_function)); rdfProtonCalculatedValues.add(1); } else rdfProtonCalculatedValues.add(0); @@ -389,13 +387,13 @@ position = 0; atom2 = null; org._3pq.jgrapht.Graph mygraph = MoleculeGraphs.getMoleculeGraph(mol); - Object startVertex = target; - Object endVertex = null; - org._3pq.jgrapht.Edge edg = null; - java.util.List mylist = null; - IAtom atomTarget = null; - IAtom atomSource = null; - Integer thisAtom = null; + Object startVertex = atom; + Object endVertex; + org._3pq.jgrapht.Edge edg; + java.util.List mylist; + IAtom atomTarget; + IAtom atomSource; + Integer thisAtom; partial = 0; limitInf = 1.4; limitSup = 4; @@ -417,7 +415,7 @@ edg = (org._3pq.jgrapht.Edge)mylist.get(u); atomTarget = (IAtom)edg.getTarget(); atomSource = (IAtom)edg.getSource(); - distance += calculateDistanceBetweenTwoAtoms(mol, atomTarget, atomSource); + distance += calculateDistanceBetweenTwoAtoms(atomTarget, atomSource); } partial = atom2.getCharge() * Math.exp( smooth * (Math.pow( (ghrt - distance) , 2))); sum += partial; @@ -425,7 +423,7 @@ gHr_topol_function.add(new Double(sum)); //System.out.println("RDF gr-topol distance prob.: "+sum+ " at distance "+ghrt); } - target.setProperty("gasteigerGHRtopol", new ArrayList(gHr_topol_function)); + atom.setProperty("gasteigerGHRtopol", new ArrayList(gHr_topol_function)); rdfProtonCalculatedValues.add(1); } else rdfProtonCalculatedValues.add(0); @@ -442,16 +440,16 @@ double angle = 0; if(doubles.size() > 0) { - IAtom[] goodAtoms = null; + IAtom[] goodAtoms; limitInf = 0; limitSup = Math.PI / 2; step = (limitSup - limitInf)/7; position = 0; partial = 0; - org.openscience.cdk.interfaces.IBond theDoubleBond = null; + org.openscience.cdk.interfaces.IBond theDoubleBond; smooth = -1.15; int goodPosition = 0; - org.openscience.cdk.interfaces.IBond goodBond = null; + org.openscience.cdk.interfaces.IBond goodBond; ArrayList gDr_function = new ArrayList(7); for(double ghd = limitInf; ghd < limitSup; ghd = ghd + step) { sum = 0; @@ -460,14 +458,14 @@ Integer thisDoubleBond = (Integer)doubles.get(dou); position = thisDoubleBond.intValue(); theDoubleBond = mol.getBond(position); - goodPosition = getNearestBondtoAGivenAtom(mol, target, theDoubleBond); + goodPosition = getNearestBondtoAGivenAtom(mol, atom, theDoubleBond); goodBond = mol.getBond(goodPosition); goodAtoms = goodBond.getAtoms(); //System.out.println("GOOD POS IS "+mol.getAtomNumber(goodAtoms[0])+" "+mol.getAtomNumber(goodAtoms[1])); middlePoint = theDoubleBond.get3DCenter(); - values = calculateDistanceBetweenAtomAndBond( mol, target, theDoubleBond ); + values = calculateDistanceBetweenAtomAndBond(atom, theDoubleBond ); if(theDoubleBond.contains(goodAtoms[0])) { a_a.set(goodAtoms[0].getPoint3d().x, goodAtoms[0].getPoint3d().y, goodAtoms[0].getPoint3d().z); @@ -478,14 +476,14 @@ a_b.set(goodAtoms[0].getPoint3d().x, goodAtoms[0].getPoint3d().y, goodAtoms[0].getPoint3d().z); } b_b.set(middlePoint.x, middlePoint.y, middlePoint.z); - b_b.set(target.getPoint3d().x, target.getPoint3d().y, target.getPoint3d().z); + b_b.set(atom.getPoint3d().x, atom.getPoint3d().y, atom.getPoint3d().z); angle = calculateAngleBetweenTwoLines(a_a, a_b, b_a, b_b); partial = ( ( 1 / (Math.pow( values[0], 2 ) ) ) * Math.exp( smooth * (Math.pow( (ghd - angle) , 2) ) ) ); sum += partial; } gDr_function.add(new Double(sum)); } - target.setProperty("gasteigerGDR", new ArrayList(gDr_function)); + atom.setProperty("gasteigerGDR", new ArrayList(gDr_function)); rdfProtonCalculatedValues.add(1); } else rdfProtonCalculatedValues.add(0); @@ -496,9 +494,9 @@ if(singles.size() > 0) { - double dist0 = 0; - double dist1 = 0; - IAtom[] atomsInSingleBond = null; + double dist0; + double dist1; + IAtom[] atomsInSingleBond; distance = 0; position = 0; org.openscience.cdk.interfaces.IBond theSingleBond = null; @@ -517,16 +515,16 @@ theSingleBond = mol.getBond(position); middlePoint = theSingleBond.get3DCenter(); atomsInSingleBond = theSingleBond.getAtoms(); - dist0 = calculateDistanceBetweenTwoAtoms(mol, atomsInSingleBond[0], target); - dist1 = calculateDistanceBetweenTwoAtoms(mol, atomsInSingleBond[1], target); + dist0 = calculateDistanceBetweenTwoAtoms(atomsInSingleBond[0], atom); + dist1 = calculateDistanceBetweenTwoAtoms(atomsInSingleBond[1], atom); a_a.set(middlePoint.x, middlePoint.y, middlePoint.z); if(dist1 > dist0) a_b.set(atomsInSingleBond[0].getPoint3d().x, atomsInSingleBond[0].getPoint3d().y, atomsInSingleBond[0].getPoint3d().z); else a_b.set(atomsInSingleBond[1].getPoint3d().x, atomsInSingleBond[1].getPoint3d().y, atomsInSingleBond[1].getPoint3d().z); b_a.set(middlePoint.x, middlePoint.y, middlePoint.z); - b_b.set(target.getPoint3d().x, target.getPoint3d().y, target.getPoint3d().z); + b_b.set(atom.getPoint3d().x, atom.getPoint3d().y, atom.getPoint3d().z); - values = calculateDistanceBetweenAtomAndBond( mol, target, theSingleBond ); + values = calculateDistanceBetweenAtomAndBond(atom, theSingleBond ); angle = calculateAngleBetweenTwoLines(a_a, a_b, b_a, b_b); //System.out.println("ANGLe: "+angle+ " "+ mol.getAtomNumber(atomsInSingleBond[0]) +" " +mol.getAtomNumber(atomsInSingleBond[1])); @@ -537,7 +535,7 @@ gSr_function.add(new Double(sum)); //System.out.println("RDF gSr prob.: " + sum + " at distance " + ghs); } - target.setProperty("gasteigerGSR", new ArrayList(gSr_function)); + atom.setProperty("gasteigerGSR", new ArrayList(gSr_function)); rdfProtonCalculatedValues.add(1); } else rdfProtonCalculatedValues.add(0); @@ -550,8 +548,8 @@ if(bondsInCycloex.size() > 0) { - IAtom[] atomsInCycloexBond = null; - org.openscience.cdk.interfaces.IBond theInCycloexBond = null; + IAtom[] atomsInCycloexBond; + org.openscience.cdk.interfaces.IBond theInCycloexBond; distance = 0; limitInf = 0; limitSup = Math.PI; @@ -560,7 +558,7 @@ smooth = -2.86; angle = 0; int ya_counter = 0; - IAtom[] connAtoms = null; + IAtom[] connAtoms; ArrayList g3r_function = new ArrayList(13); for(double g3r = 0; g3r < limitSup; g3r = g3r + step) { sum = 0; @@ -587,7 +585,7 @@ a_b.set(atomsInCycloexBond[1].getPoint3d().x, atomsInCycloexBond[1].getPoint3d().y, atomsInCycloexBond[1].getPoint3d().z); } b_a.set(neighboors[0].getPoint3d().x, neighboors[0].getPoint3d().y, neighboors[0].getPoint3d().z); - b_b.set(target.getPoint3d().x, target.getPoint3d().y, target.getPoint3d().z); + b_b.set(atom.getPoint3d().x, atom.getPoint3d().y, atom.getPoint3d().z); angle = calculateAngleBetweenTwoLines(a_a, a_b, b_a, b_b); @@ -599,7 +597,7 @@ g3r_function.add(new Double(sum)); //System.out.println("RDF g-cycl prob.: "+sum+ " at distance "+g3r); } - target.setProperty("gasteigerG3R", new ArrayList(g3r_function)); + atom.setProperty("gasteigerG3R", new ArrayList(g3r_function)); rdfProtonCalculatedValues.add(1); } else rdfProtonCalculatedValues.add(0); @@ -626,8 +624,8 @@ if (detected != null) { if(detected.contains(bond)) counter += 1; } - if(atoms[0].getFlag(CDKConstants.ISINRING) == true) { - if(atoms[1].getFlag(CDKConstants.ISINRING) == true) { counter += 1; } + if(atoms[0].getFlag(CDKConstants.ISINRING)) { + if(atoms[1].getFlag(CDKConstants.ISINRING)) { counter += 1; } else { if(atoms[1].getSymbol().equals("H")) counter += 1; else counter += 0; @@ -646,7 +644,7 @@ private boolean getIfACarbonIsDoubleBondedToAnOxygen(Molecule mol, IAtom carbonAtom) { boolean isDoubleBondedToOxygen = false; IAtom[] neighToCarbon = mol.getConnectedAtoms(carbonAtom); - org.openscience.cdk.interfaces.IBond tmpBond = null; + org.openscience.cdk.interfaces.IBond tmpBond; int counter = 0; for(int nei = 0; nei < neighToCarbon.length; nei++) { if(neighToCarbon[nei].getSymbol().equals("O")) { @@ -671,7 +669,10 @@ } // this method store atoms and bonds in proper lists: - private void checkAndStore(int bondToStore, double bondOrder, ArrayList singleVec, ArrayList doubleVec, ArrayList cycloexVec, int a1, String symbol, ArrayList atomVec, int sphere, boolean isBondInCycloex) { + private void checkAndStore(int bondToStore, double bondOrder, + ArrayList singleVec, ArrayList doubleVec, + ArrayList cycloexVec, int a1, + ArrayList atomVec, int sphere, boolean isBondInCycloex) { if(!atomVec.contains(new Integer(a1))) { if(sphere < 6) atomVec.add(new Integer(a1)); } @@ -689,7 +690,7 @@ } // generic method for calculation of distance btw 2 atoms - private double calculateDistanceBetweenTwoAtoms(Molecule mol, IAtom atom1, IAtom atom2) { + private double calculateDistanceBetweenTwoAtoms(IAtom atom1, IAtom atom2) { double distance; Point3d firstPoint = atom1.getPoint3d(); Point3d secondPoint = atom2.getPoint3d(); @@ -702,13 +703,13 @@ // this method returns a bond bonded to this double bond private int getNearestBondtoAGivenAtom(Molecule mol, IAtom atom, org.openscience.cdk.interfaces.IBond bond) { int nearestBond = 0; - double[] values = new double[4]; + double[] values; double distance = 0; IAtom[] atomsInBond = bond.getAtoms(); org.openscience.cdk.interfaces.IBond[] bondsAtLeft = mol.getConnectedBonds(atomsInBond[0]); - int partial = 0; + int partial; for(int i=0; i<bondsAtLeft.length;i++) { - values = calculateDistanceBetweenAtomAndBond(mol, atom, bondsAtLeft[i]); + values = calculateDistanceBetweenAtomAndBond(atom, bondsAtLeft[i]); partial = mol.getBondNumber(bondsAtLeft[i]); if(i==0) { nearestBond = mol.getBondNumber(bondsAtLeft[i]); @@ -731,7 +732,7 @@ // method which calculated distance btw an atom and the middle point of a bond // and returns distance and coordinates of middle point - private double[] calculateDistanceBetweenAtomAndBond(Molecule mol, IAtom proton, org.openscience.cdk.interfaces.IBond theBond) { + private double[] calculateDistanceBetweenAtomAndBond(IAtom proton, org.openscience.cdk.interfaces.IBond theBond) { Point3d middlePoint = theBond.get3DCenter(); Point3d protonPoint = proton.getPoint3d(); double[] values = new double[4]; Modified: trunk/cdk/src/org/openscience/cdk/qsar/model/R2/RModel.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/model/R2/RModel.java 2006-09-15 13:46:30 UTC (rev 6872) +++ trunk/cdk/src/org/openscience/cdk/qsar/model/R2/RModel.java 2006-09-17 23:09:40 UTC (rev 6873) @@ -1,12 +1,5 @@ package org.openscience.cdk.qsar.model.R2; -import java.awt.*; -import java.io.*; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Random; -import java.util.Set; - import org.openscience.cdk.qsar.model.IModel; import org.openscience.cdk.qsar.model.QSARModelException; import org.openscience.cdk.tools.LoggingTool; @@ -15,6 +8,13 @@ import org.rosuda.JRI.RMainLoopCallbacks; import org.rosuda.JRI.Rengine; +import java.awt.*; +import java.io.*; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Random; +import java.util.Set; + /** * Base class for the R-CDK interface. * <p/> @@ -90,12 +90,6 @@ private static boolean doneInit = false; private static LoggingTool logger; - private void initRengine() throws QSARModelException { - String[] args = {"--vanilla", "--quiet", "--slave"}; - boolean useDisk = false; - initRengine(args, useDisk); - } - private void initRengine(String[] args, boolean useDisk) throws QSARModelException { if (!doneInit) { rengine = new Rengine(args, false, new TextConsole()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rajarshi@us...> - 2006-09-18 14:53:33
|
Revision: 6903 http://svn.sourceforge.net/cdk/?rev=6903&view=rev Author: rajarshi Date: 2006-09-18 07:53:23 -0700 (Mon, 18 Sep 2006) Log Message: ----------- Added copyright notices Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CPSADescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/EccentricConnectivityIndexDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/GravitationalIndexDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanShapeIndexDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/TaeAminoAcidDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WHIMDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WeightedPathDescriptor.java Modified: trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java 2006-09-18 14:37:47 UTC (rev 6902) +++ trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java 2006-09-18 14:53:23 UTC (rev 6903) @@ -3,7 +3,7 @@ * $Date$ * $Revision$ * - * Copyright (C) 2004-2006 The Chemistry Development Kit (CDK) project + * Copyright (C) 2004-2006 Rajarshi Guha <rguha@...> * * Contact: cdk-devel@... * Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java 2006-09-18 14:37:47 UTC (rev 6902) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java 2006-09-18 14:53:23 UTC (rev 6903) @@ -3,7 +3,7 @@ * $Date$ * $Revision$ * - * Copyright (C) 2004-2006 The Chemistry Development Kit (CDK) project + * Copyright (C) 2004-2006 Rajarshi Guha <rguha@...> * * Contact: cdk-devel@... * Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CPSADescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CPSADescriptor.java 2006-09-18 14:37:47 UTC (rev 6902) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CPSADescriptor.java 2006-09-18 14:53:23 UTC (rev 6903) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2006 The Chemistry Development Kit (CDK) project + * Copyright (C) 2004-2006 Rajarshi Guha <rguha@...> * * Contact: cdk-devel@... * Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/EccentricConnectivityIndexDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/EccentricConnectivityIndexDescriptor.java 2006-09-18 14:37:47 UTC (rev 6902) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/EccentricConnectivityIndexDescriptor.java 2006-09-18 14:53:23 UTC (rev 6903) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2006 The Chemistry Development Kit (CDK) project + * Copyright (C) 2004-2006 Rajarshi Guha <rguha@...> * * Contact: cdk-devel@... * Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/GravitationalIndexDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/GravitationalIndexDescriptor.java 2006-09-18 14:37:47 UTC (rev 6902) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/GravitationalIndexDescriptor.java 2006-09-18 14:53:23 UTC (rev 6903) @@ -4,7 +4,7 @@ * $Date$ * $Revision$ * - * Copyright (C) 2004-2006 The Chemistry Development Kit (CDK) project + * Copyright (C) 2004-2006 Rajarshi Guha <rguha@...> * * Contact: cdk-devel@... * @@ -24,8 +24,6 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; -import java.util.Vector; - import org.openscience.cdk.config.IsotopeFactory; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; @@ -35,7 +33,9 @@ import org.openscience.cdk.qsar.result.DoubleArrayResult; import org.openscience.cdk.tools.LoggingTool; +import java.util.Vector; + /** * IDescriptor characterizing the mass distribution of the molecule. * Described by Katritzky et al. {@cdk.cite KAT96}. Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanShapeIndexDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanShapeIndexDescriptor.java 2006-09-18 14:37:47 UTC (rev 6902) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanShapeIndexDescriptor.java 2006-09-18 14:53:23 UTC (rev 6903) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2006 The Chemistry Development Kit (CDK) project + * Copyright (C) 2004-2006 Rajarshi Guha <rguha@...> * * Contact: cdk-devel@... * @@ -19,8 +19,6 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; -import javax.vecmath.Point3d; - import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.geometry.GeometryTools; import org.openscience.cdk.graph.PathTools; @@ -31,7 +29,9 @@ import org.openscience.cdk.qsar.result.DoubleArrayResult; import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; +import javax.vecmath.Point3d; + /** * Evaluates the Petitjean shape indices, * <p/> Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/TaeAminoAcidDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/TaeAminoAcidDescriptor.java 2006-09-18 14:37:47 UTC (rev 6902) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/TaeAminoAcidDescriptor.java 2006-09-18 14:53:23 UTC (rev 6903) @@ -1,5 +1,31 @@ +/* $RCSfile$ + * $Author: rajarshi $ + * $Date: 2006-08-14 15:51:36 -0400 (Mon, 14 Aug 2006) $ + * $Revision: 6785 $ + * + * Copyright (C) 2004-2006 Rajarshi Guha <rguha@...> + * + * Contact: cdk-devel@... + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ + package org.openscience.cdk.qsar.descriptors.molecular; +import org.openscience.cdk.Monomer; +import org.openscience.cdk.Strand; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.interfaces.IBioPolymer; @@ -13,10 +39,9 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; +import java.util.*; + /** * An implementation of the TAE descriptors for amino acids. * <p/> @@ -92,6 +117,25 @@ private HashMap nametrans = new HashMap(); + private List getMonomers(IBioPolymer iBioPolymer) { + List monomList = new ArrayList(); + + Map strands = iBioPolymer.getStrands(); + Set strandKeys = strands.keySet(); + for (Iterator iterator = strandKeys.iterator(); iterator.hasNext();) { + Object key = iterator.next(); + Strand aStrand = (Strand) strands.get(key); + Hashtable tmp = aStrand.getMonomers(); + Set keys = tmp.keySet(); + for (Iterator iterator1 = keys.iterator(); iterator1.hasNext();) { + Object o1 = iterator1.next(); + monomList.add( tmp.get(o1) ); + } + } + + return monomList; + } + private void loadTAEParams() { String filename = "org/openscience/cdk/qsar/descriptors/data/taepeptides.txt"; InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename); @@ -222,19 +266,24 @@ IBioPolymer peptide = (IBioPolymer) container; // I assume that we get single letter names - Collection aas = peptide.getMonomerNames(); + //Collection aas = peptide.getMonomerNames(); double[] desc = new double[ndesc]; for (int i = 0; i < ndesc; i++) desc[i] = 0.0; - for (Iterator iterator = aas.iterator(); iterator.hasNext();) { - String o = (String) iterator.next(); + List monomers = getMonomers(peptide); + for (Iterator iterator = monomers.iterator(); iterator.hasNext();) { + Monomer monomer = (Monomer) iterator.next(); + + String o = monomer.getMonomerName(); + if (o.length() == 0) continue; String olc = String.valueOf(o.toLowerCase().charAt(0)); String tlc = (String) nametrans.get(olc); + logger.debug("Converted " + olc + " to " + tlc); // get the params for this AA @@ -248,4 +297,5 @@ return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval); } + } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WHIMDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WHIMDescriptor.java 2006-09-18 14:37:47 UTC (rev 6902) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WHIMDescriptor.java 2006-09-18 14:53:23 UTC (rev 6903) @@ -3,7 +3,7 @@ * $Date$ * $Revision$ * - * Copyright (C) 2004-2006 The Chemistry Development Kit (CDK) project + * Copyright (C) 2004-2006 Rajarshi Guha <rguha@...> * * Contact: cdk-devel@... * @@ -23,8 +23,8 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; -import java.util.Hashtable; - +import Jama.EigenvalueDecomposition; +import Jama.Matrix; import org.openscience.cdk.Molecule; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; @@ -34,8 +34,7 @@ import org.openscience.cdk.qsar.result.DoubleArrayResult; import org.openscience.cdk.tools.LoggingTool; -import Jama.EigenvalueDecomposition; -import Jama.Matrix; +import java.util.Hashtable; @@ -77,7 +76,6 @@ * </tr> * </table> * - * @cdk.todo Fix up the &gamm; descriptors * * @author Rajarshi Guha * @cdk.created 2004-12-1 Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WeightedPathDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WeightedPathDescriptor.java 2006-09-18 14:37:47 UTC (rev 6902) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WeightedPathDescriptor.java 2006-09-18 14:53:23 UTC (rev 6903) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2006 The Chemistry Development Kit (CDK) project + * Copyright (C) 2004-2006 Rajarshi Guha <rguha@...> * * Contact: cdk-devel@... * @@ -19,9 +19,6 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; -import java.util.ArrayList; -import java.util.List; - import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.graph.PathTools; import org.openscience.cdk.interfaces.IAtom; @@ -32,7 +29,10 @@ import org.openscience.cdk.qsar.result.DoubleArrayResult; import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; +import java.util.ArrayList; +import java.util.List; + /** * Evaluates the weighted path descriptors. * <p/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rajarshi@us...> - 2006-09-18 14:58:56
|
Revision: 6906 http://svn.sourceforge.net/cdk/?rev=6906&view=rev Author: rajarshi Date: 2006-09-18 07:58:42 -0700 (Mon, 18 Sep 2006) Log Message: ----------- Fixed copyright notices Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CPSADescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/EccentricConnectivityIndexDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/GravitationalIndexDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanShapeIndexDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/TaeAminoAcidDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WHIMDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WeightedPathDescriptor.java Modified: trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java 2006-09-18 14:56:40 UTC (rev 6905) +++ trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java 2006-09-18 14:58:42 UTC (rev 6906) @@ -3,7 +3,7 @@ * $Date$ * $Revision$ * - * Copyright (C) 2004-2006 Rajarshi Guha <rguha@...> + * Copyright (C) 2004-2006 Rajarshi Guha <rajarshi@...> * * Contact: cdk-devel@... * Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java 2006-09-18 14:56:40 UTC (rev 6905) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java 2006-09-18 14:58:42 UTC (rev 6906) @@ -3,7 +3,7 @@ * $Date$ * $Revision$ * - * Copyright (C) 2004-2006 Rajarshi Guha <rguha@...> + * Copyright (C) 2004-2006 Rajarshi Guha <rajarshi@...> * * Contact: cdk-devel@... * @@ -43,10 +43,10 @@ /** * Eigenvalue based descriptor noted for its utility in chemical diversity. * Described by Pearlman et al. {@cdk.cite PEA99}. - * + * * <p>The descriptor is based on a weighted version of the Burden matrix {@cdk.cite BUR89, BUR97} * which takes into account both the connectivity as well as atomic - * properties of a molecule. The weights are a variety of atom properties placed along the + * properties of a molecule. The weights are a variety of atom properties placed along the * diagonal of the Burden matrix. Currently three weighting schemes are employed * <ul> * <li>atomic weight @@ -57,7 +57,7 @@ * classes of descriptor in a single ArrayList (in the order shown above). However it is also * possible to supply a parameter list indicating how many of the highest and lowest eigenvalues * (for each class of descriptor) are required. - * + * * <p>The descriptor works with the hydrogen depleted molecule and thus the maximum number * of eigenvalues calculated for any class of BCUT descriptor is equal to the number * of heavy atoms present. @@ -80,17 +80,17 @@ * </tr> * </table> * - * + * * @author Rajarshi Guha * @cdk.created 2004-11-30 - * + * * @cdk.builddepends Jama-1.0.1.jar * @cdk.depends Jama-1.0.1.jar * * @cdk.module qsar * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:BCUT - * + * * @cdk.keyword BCUT * @cdk.keyword descriptor */ @@ -101,7 +101,7 @@ private int nhigh; private int nlow; private boolean checkAromaticity = true; - + public BCUTDescriptor() { // set the default number of BCUT's this.nhigh = 1; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CPSADescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CPSADescriptor.java 2006-09-18 14:56:40 UTC (rev 6905) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CPSADescriptor.java 2006-09-18 14:58:42 UTC (rev 6906) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2006 Rajarshi Guha <rguha@...> + * Copyright (C) 2004-2006 Rajarshi Guha <rajarshi@...> * * Contact: cdk-devel@... * Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/EccentricConnectivityIndexDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/EccentricConnectivityIndexDescriptor.java 2006-09-18 14:56:40 UTC (rev 6905) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/EccentricConnectivityIndexDescriptor.java 2006-09-18 14:58:42 UTC (rev 6906) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2006 Rajarshi Guha <rguha@...> + * Copyright (C) 2004-2006 Rajarshi Guha <rajarshi@...> * * Contact: cdk-devel@... * Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/GravitationalIndexDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/GravitationalIndexDescriptor.java 2006-09-18 14:56:40 UTC (rev 6905) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/GravitationalIndexDescriptor.java 2006-09-18 14:58:42 UTC (rev 6906) @@ -4,7 +4,7 @@ * $Date$ * $Revision$ * - * Copyright (C) 2004-2006 Rajarshi Guha <rguha@...> + * Copyright (C) 2004-2006 Rajarshi Guha <rajarshi@...> * * Contact: cdk-devel@... * @@ -37,10 +37,10 @@ /** - * IDescriptor characterizing the mass distribution of the molecule. + * IDescriptor characterizing the mass distribution of the molecule. * Described by Katritzky et al. {@cdk.cite KAT96}. * For modelling purposes the value of the descriptor is calculated - * both with and without H atoms. Furthermore the square and cube roots + * both with and without H atoms. Furthermore the square and cube roots * of the descriptor are also generated as described by Wessel et al. {@cdk.cite WES98}. *<p> * The descriptor routine generates 9 descriptors: @@ -55,7 +55,7 @@ * <li>grav5 - grav2 for all pairs of atoms (not just bonded pairs) * <li>grav6 - grav3 for all pairs of atoms (not just bonded pairs) * </ul> - * + * * <p>This descriptor uses these parameters: * <table border="1"> * <tr> @@ -69,22 +69,22 @@ * <td>no parameters</td> * </tr> * </table> - * + * * @author Rajarshi Guha * @cdk.created 2004-11-23 * @cdk.module qsar * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:gravitationalIndex - * + * * @cdk.keyword gravitational index * @cdk.keyword descriptor */ public class GravitationalIndexDescriptor implements IMolecularDescriptor { - + private LoggingTool logger; private class pair { int x,y; - public pair() { + public pair() { x = 0; y = 0; } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanShapeIndexDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanShapeIndexDescriptor.java 2006-09-18 14:56:40 UTC (rev 6905) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanShapeIndexDescriptor.java 2006-09-18 14:58:42 UTC (rev 6906) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2006 Rajarshi Guha <rguha@...> + * Copyright (C) 2004-2006 Rajarshi Guha <rajarshi@...> * * Contact: cdk-devel@... * Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/TaeAminoAcidDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/TaeAminoAcidDescriptor.java 2006-09-18 14:56:40 UTC (rev 6905) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/TaeAminoAcidDescriptor.java 2006-09-18 14:58:42 UTC (rev 6906) @@ -3,7 +3,7 @@ * $Date: 2006-08-14 15:51:36 -0400 (Mon, 14 Aug 2006) $ * $Revision: 6785 $ * - * Copyright (C) 2004-2006 Rajarshi Guha <rguha@...> + * Copyright (C) 2004-2006 Rajarshi Guha <rajarshi@...> * * Contact: cdk-devel@... * Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WHIMDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WHIMDescriptor.java 2006-09-18 14:56:40 UTC (rev 6905) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WHIMDescriptor.java 2006-09-18 14:58:42 UTC (rev 6906) @@ -3,7 +3,7 @@ * $Date$ * $Revision$ * - * Copyright (C) 2004-2006 Rajarshi Guha <rguha@...> + * Copyright (C) 2004-2006 Rajarshi Guha <rajarshi@...> * * Contact: cdk-devel@... * @@ -39,7 +39,7 @@ /** - * Holistic descriptors described by Todeschini et al {@cdk.cite TOD98}. + * Holistic descriptors described by Todeschini et al {@cdk.cite TOD98}. * The descriptors are based on a number of atom weightings. There are 6 different * possible weightings: * <ol> @@ -53,7 +53,7 @@ * Currently weighting schemes 1,2,3,4 & 5 are implemented. The weight values * are taken from {@cdk.cite TOD98} and as a result 19 elements are considered. * - * <p>For each weighting scheme we can obtain + * <p>For each weighting scheme we can obtain * <ul> * <li>11 directional WHIM descriptors (λ<sub>1 .. 3</sub>, ν<sub>1 .. 2</sub>, γ<sub>1 .. 3</sub>, η<sub>1 .. 3</sub>) * <li>6 non-directional WHIM descriptors (T, A, V, K, G, D) @@ -61,7 +61,7 @@ * * <p>Though {@cdk.cite TOD98} mentions that for planar molecules only 8 directional WHIM * descriptors are required the current code will return all 11. - * + * * <p>This descriptor uses these parameters: * <table border="1"> * <tr> @@ -76,17 +76,17 @@ * </tr> * </table> * - * + * * @author Rajarshi Guha * @cdk.created 2004-12-1 - * + * * @cdk.builddepends Jama-1.0.1.jar * @cdk.depends Jama-1.0.1.jar * * @cdk.module qsar * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:WHIM - * + * * @cdk.keyword WHIM * @cdk.keyword descriptor */ @@ -95,7 +95,7 @@ LoggingTool logger; String type = ""; Hashtable hashatwt,hashvdw,hasheneg,hashpol; - + public WHIMDescriptor() { logger = new LoggingTool(this); this.type = "unity"; // default weighting scheme Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WeightedPathDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WeightedPathDescriptor.java 2006-09-18 14:56:40 UTC (rev 6905) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WeightedPathDescriptor.java 2006-09-18 14:58:42 UTC (rev 6906) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2006 Rajarshi Guha <rguha@...> + * Copyright (C) 2004-2006 Rajarshi Guha <rajarshi@...> * * Contact: cdk-devel@... * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rajarshi@us...> - 2006-09-19 16:21:23
|
Revision: 6957 http://svn.sourceforge.net/cdk/?rev=6957&view=rev Author: rajarshi Date: 2006-09-19 09:21:11 -0700 (Tue, 19 Sep 2006) Log Message: ----------- Fixed PMD warnings Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java Modified: trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java 2006-09-19 16:13:34 UTC (rev 6956) +++ trunk/cdk/src/org/openscience/cdk/qsar/DescriptorEngine.java 2006-09-19 16:21:11 UTC (rev 6957) @@ -261,8 +261,8 @@ Elements classifications = rawElement.getChildElements("isClassifiedAs", dict.getNS()); for (int i = 0; i < classifications.size(); i++) { - Element e = classifications.get(i); - Attribute attr = e.getAttribute("resource", rdfNS); + Element element = classifications.get(i); + Attribute attr = element.getAttribute("resource", rdfNS); if ((attr.getValue().indexOf("molecularDescriptor") != -1) || (attr.getValue().indexOf("atomicDescriptor") != -1)) { String[] tmp = attr.getValue().split("#"); @@ -333,8 +333,8 @@ Element rawElement = (Element) dictEntries[j].getRawContent(); Elements classifications = rawElement.getChildElements("isClassifiedAs", dict.getNS()); for (int i = 0; i < classifications.size(); i++) { - Element e = classifications.get(i); - Attribute attr = e.getAttribute("resource", rdfNS); + Element element = classifications.get(i); + Attribute attr = element.getAttribute("resource", rdfNS); if ((attr.getValue().indexOf("molecularDescriptor") >= 0) || (attr.getValue().indexOf("atomicDescriptor") >= 0)) { continue; @@ -524,15 +524,15 @@ ArrayList classlist = new ArrayList(); for (int i = 0; i < jars.length; i++) { logger.debug("Looking in " + jars[i]); - JarFile j; + JarFile jarFile; try { - j = new JarFile(jars[i]); - Enumeration e = j.entries(); - while (e.hasMoreElements()) { - JarEntry je = (JarEntry) e.nextElement(); - if (je.toString().indexOf(".class") != -1) { - String className = je.toString().replace('/', '.').replaceAll(".class", ""); - if (className.indexOf("$") != -1) continue; + jarFile = new JarFile(jars[i]); + Enumeration enumeration = jarFile.entries(); + while (enumeration.hasMoreElements()) { + JarEntry jarEntry = (JarEntry) enumeration.nextElement(); + if (jarEntry.toString().indexOf(".class") != -1) { + String className = jarEntry.toString().replace('/', '.').replaceAll(".class", ""); + if (className.indexOf('$') != -1) continue; Class klass = null; try { @@ -602,16 +602,16 @@ for (int i = 0; i < jars.length; i++) { logger.debug("Looking in " + jars[i]); - JarFile j; + JarFile jarFile; try { - j = new JarFile(jars[i]); - Enumeration e = j.entries(); - while (e.hasMoreElements()) { - JarEntry je = (JarEntry) e.nextElement(); - if (je.toString().indexOf(".class") != -1) { - String tmp = je.toString().replace('/', '.').replaceAll(".class", ""); + jarFile = new JarFile(jars[i]); + Enumeration enumeration = jarFile.entries(); + while (enumeration.hasMoreElements()) { + JarEntry jarEntry = (JarEntry) enumeration.nextElement(); + if (jarEntry.toString().indexOf(".class") != -1) { + String tmp = jarEntry.toString().replace('/', '.').replaceAll(".class", ""); if (!(tmp.indexOf(packageName) != -1)) continue; - if (tmp.indexOf("$") != -1) continue; + if (tmp.indexOf('$') != -1) continue; classlist.add(tmp); } } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java 2006-09-19 16:13:34 UTC (rev 6956) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java 2006-09-19 16:21:11 UTC (rev 6957) @@ -183,40 +183,40 @@ *@return The parameterType value */ public Object getParameterType(String name) { - Object o = null; - if (name.equals("nhigh")) o = new Integer(1); - if (name.equals("nlow")) o = new Integer(1); - if (name.equals("checkAromaticity")) o = new Integer(1); - return(o); + Object object = null; + if (name.equals("nhigh")) object = new Integer(1); + if (name.equals("nlow")) object = new Integer(1); + if (name.equals("checkAromaticity")) object = new Integer(1); + return(object); } static private class BurdenMatrix { - static double[][] evalMatrix(IAtomContainer ac, double[] vsd) { - IAtomContainer local = AtomContainerManipulator.removeHydrogens(ac); + static double[][] evalMatrix(IAtomContainer atomContainer, double[] vsd) { + IAtomContainer local = AtomContainerManipulator.removeHydrogens(atomContainer); int natom = local.getAtomCount(); - double[][] m = new double[natom][natom]; + double[][] matrix = new double[natom][natom]; /* set the off diagonal entries */ for (int i = 0; i < natom-1; i++) { for (int j = i+1; j < natom; j++) { for (int k = 0; k < local.getBondCount(); k++) { - org.openscience.cdk.interfaces.IBond b = local.getBond(k); - if (b.contains(local.getAtom(i)) && b.contains(local.getAtom(j))) { - if (b.getOrder() == CDKConstants.BONDORDER_SINGLE) m[i][j] = 0.1; - else if (b.getOrder() == CDKConstants.BONDORDER_DOUBLE) m[i][j] = 0.2; - else if (b.getOrder() == CDKConstants.BONDORDER_TRIPLE) m[i][j] = 0.3; - else if (b.getOrder() == CDKConstants.BONDORDER_AROMATIC) m[i][j] = 0.15; + org.openscience.cdk.interfaces.IBond bond = local.getBond(k); + if (bond.contains(local.getAtom(i)) && bond.contains(local.getAtom(j))) { + if (bond.getOrder() == CDKConstants.BONDORDER_SINGLE) matrix[i][j] = 0.1; + else if (bond.getOrder() == CDKConstants.BONDORDER_DOUBLE) matrix[i][j] = 0.2; + else if (bond.getOrder() == CDKConstants.BONDORDER_TRIPLE) matrix[i][j] = 0.3; + else if (bond.getOrder() == CDKConstants.BONDORDER_AROMATIC) matrix[i][j] = 0.15; if (local.getBondCount(i) == 1 || local.getBondCount(j) == 1) { - m[i][j] += 0.01; + matrix[i][j] += 0.01; } - m[j][i] = m[i][j]; + matrix[j][i] = matrix[i][j]; } else { - m[i][j] = 0.001; - m[j][i] = 0.001; + matrix[i][j] = 0.001; + matrix[j][i] = 0.001; } } } @@ -224,10 +224,10 @@ /* set the diagonal entries */ for (int i = 0; i < natom; i++) { - if (vsd != null) m[i][i] = vsd[i]; - else m[i][i] = 0.0; + if (vsd != null) matrix[i][i] = vsd[i]; + else matrix[i][i] = 0.0; } - return(m); + return(matrix); } } @@ -243,26 +243,26 @@ * of heavy atoms) */ public DescriptorValue calculate(IAtomContainer container) throws CDKException { - int j; - Molecule ac = new Molecule(container); + int counter; + Molecule molecule = new Molecule(container); // add H's in case they're not present - HydrogenAdder ha = new HydrogenAdder(); + HydrogenAdder hydrogenAdder = new HydrogenAdder(); try { - ha.addExplicitHydrogensToSatisfyValency(ac); + hydrogenAdder.addExplicitHydrogensToSatisfyValency(molecule); } catch (Exception e) { System.out.println(e.toString()); } // do aromaticity detecttion for calculating polarizability later on if (this.checkAromaticity) { - HueckelAromaticityDetector.detectAromaticity(ac); + HueckelAromaticityDetector.detectAromaticity(molecule); } // find number of heavy atoms int nheavy = 0; - for (int i = 0; i < ac.getAtomCount(); i++) { - if (!ac.getAtom(i).getSymbol().equals("H")) nheavy++; + for (int i = 0; i < molecule.getAtomCount(); i++) { + if (!molecule.getAtom(i).getSymbol().equals("H")) nheavy++; } if (this.nhigh > nheavy || this.nlow > nheavy) { @@ -272,54 +272,54 @@ double[] diagvalue = new double[ nheavy ]; // get atomic mass weighted BCUT - j = 0; + counter = 0; try { - for (int i = 0; i < ac.getAtomCount(); i++) { - if (ac.getAtom(i).getSymbol().equals("H")) continue; - diagvalue[j] = IsotopeFactory.getInstance(ac.getBuilder()). - getMajorIsotope( ac.getAtom(i).getSymbol() ).getExactMass(); - j++; + for (int i = 0; i < molecule.getAtomCount(); i++) { + if (molecule.getAtom(i).getSymbol().equals("H")) continue; + diagvalue[counter] = IsotopeFactory.getInstance(molecule.getBuilder()). + getMajorIsotope( molecule.getAtom(i).getSymbol() ).getExactMass(); + counter++; } } catch (Exception e) { System.out.println(e.toString()); } - double[][] bm = BurdenMatrix.evalMatrix(ac, diagvalue); - Matrix m = new Matrix(bm); - EigenvalueDecomposition ed = new EigenvalueDecomposition(m); - double[] eval1 = ed.getRealEigenvalues(); + double[][] burdenMatrix = BurdenMatrix.evalMatrix(molecule, diagvalue); + Matrix matrix = new Matrix(burdenMatrix); + EigenvalueDecomposition eigenDecomposition = new EigenvalueDecomposition(matrix); + double[] eval1 = eigenDecomposition.getRealEigenvalues(); // get charge weighted BCUT GasteigerMarsiliPartialCharges peoe; try { peoe = new GasteigerMarsiliPartialCharges(); - peoe.assignGasteigerMarsiliSigmaPartialCharges(ac, true); + peoe.assignGasteigerMarsiliSigmaPartialCharges(molecule, true); } catch (Exception e) { System.out.println(e.toString()); } - j = 0; - for (int i = 0; i < ac.getAtomCount(); i++) { - if (ac.getAtom(i).getSymbol().equals("H")) continue; - diagvalue[j] = ac.getAtom(i).getCharge(); - j++; + counter = 0; + for (int i = 0; i < molecule.getAtomCount(); i++) { + if (molecule.getAtom(i).getSymbol().equals("H")) continue; + diagvalue[counter] = molecule.getAtom(i).getCharge(); + counter++; } - bm = BurdenMatrix.evalMatrix(ac, diagvalue); - m = new Matrix(bm); - ed = new EigenvalueDecomposition(m); - double[] eval2 = ed.getRealEigenvalues(); + burdenMatrix = BurdenMatrix.evalMatrix(molecule, diagvalue); + matrix = new Matrix(burdenMatrix); + eigenDecomposition = new EigenvalueDecomposition(matrix); + double[] eval2 = eigenDecomposition.getRealEigenvalues(); // get polarizability weighted BCUT Polarizability pol = new Polarizability(); - j = 0; - for (int i =0 ; i < ac.getAtomCount(); i++) { - if (ac.getAtom(i).getSymbol().equals("H")) continue; - diagvalue[j] = pol.calculateGHEffectiveAtomPolarizability(ac, ac.getAtom(i), 1000); - j++; + counter = 0; + for (int i =0 ; i < molecule.getAtomCount(); i++) { + if (molecule.getAtom(i).getSymbol().equals("H")) continue; + diagvalue[counter] = pol.calculateGHEffectiveAtomPolarizability(molecule, molecule.getAtom(i), 1000); + counter++; } - bm = BurdenMatrix.evalMatrix(ac, diagvalue); - m = new Matrix(bm); - ed = new EigenvalueDecomposition(m); - double[] eval3 = ed.getRealEigenvalues(); + burdenMatrix = BurdenMatrix.evalMatrix(molecule, diagvalue); + matrix = new Matrix(burdenMatrix); + eigenDecomposition = new EigenvalueDecomposition(matrix); + double[] eval3 = eigenDecomposition.getRealEigenvalues(); DoubleArrayResult retval = new DoubleArrayResult( eval1.length + eval2.length + eval3.length ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rajarshi@us...> - 2006-11-13 17:13:53
|
Revision: 7289 http://svn.sourceforge.net/cdk/?rev=7289&view=rev Author: rajarshi Date: 2006-11-13 07:03:21 -0800 (Mon, 13 Nov 2006) Log Message: ----------- Updated module tag for chi index utils. Also updated the path index code to include simple and valence indices from 0 to 7 Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/qsar/ChiIndexUtils.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiPathDescriptor.java Modified: trunk/cdk/src/org/openscience/cdk/qsar/ChiIndexUtils.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/ChiIndexUtils.java 2006-11-13 14:47:16 UTC (rev 7288) +++ trunk/cdk/src/org/openscience/cdk/qsar/ChiIndexUtils.java 2006-11-13 15:03:21 UTC (rev 7289) @@ -20,6 +20,7 @@ * be used to evaluate path, path-cluster, cluster and chain chi indices. * * @author Rajarshi Guha + * @cdk.module qsar */ public class ChiIndexUtils { @@ -91,7 +92,7 @@ int nconnected = atomContainer.getConnectedAtomsCount(atom); prod = prod * nconnected; } - sum += 1.0 / Math.sqrt(prod); + if (prod != 0) sum += 1.0 / Math.sqrt(prod); } return sum; } @@ -151,7 +152,7 @@ prod = prod * deltav; } - sum += 1.0 / Math.sqrt(prod); + if (prod != 0) sum += 1.0 / Math.sqrt(prod); } return sum; } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiPathDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiPathDescriptor.java 2006-11-13 14:47:16 UTC (rev 7288) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiPathDescriptor.java 2006-11-13 15:03:21 UTC (rev 7289) @@ -27,7 +27,9 @@ import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.exception.InvalidSmilesException; +import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; +import org.openscience.cdk.interfaces.IBond; import org.openscience.cdk.isomorphism.matchers.QueryAtomContainer; import org.openscience.cdk.isomorphism.matchers.QueryAtomContainerCreator; import org.openscience.cdk.qsar.ChiIndexUtils; @@ -40,6 +42,8 @@ import org.openscience.cdk.tools.LoggingTool; import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; +import java.util.ArrayList; +import java.util.Iterator; import java.util.List; /** @@ -51,8 +55,8 @@ * <p/> * The order of the values returned is * <ol> - * <li>Simple chain, orders 3 to 7 - * <li>Valence chain, orders 3 to 7 + * <li>Simple path, orders 0 to 7 + * <li>Valence path, orders 0 to 7 * </ol> * * @author Rajarshi Guha @@ -100,7 +104,7 @@ public DescriptorValue calculate(IAtomContainer container) throws CDKException { // make a copy and remove hydrogens - IAtomContainer localAtomContainer = null; + IAtomContainer localAtomContainer; try { localAtomContainer = (IAtomContainer) container.clone(); localAtomContainer = AtomContainerManipulator.removeHydrogens(localAtomContainer); @@ -111,18 +115,27 @@ throw new CDKException("Error occured during clone"); } + List subgraph0 = order0(localAtomContainer); + List subgraph1 = order1(localAtomContainer); + List subgraph2 = order2(localAtomContainer); List subgraph3 = order3(localAtomContainer); List subgraph4 = order4(localAtomContainer); List subgraph5 = order5(localAtomContainer); List subgraph6 = order6(localAtomContainer); List subgraph7 = order7(localAtomContainer); + double order0s = ChiIndexUtils.evalSimpleIndex(localAtomContainer, subgraph0); + double order1s = ChiIndexUtils.evalSimpleIndex(localAtomContainer, subgraph1); + double order2s = ChiIndexUtils.evalSimpleIndex(localAtomContainer, subgraph2); double order3s = ChiIndexUtils.evalSimpleIndex(localAtomContainer, subgraph3); double order4s = ChiIndexUtils.evalSimpleIndex(localAtomContainer, subgraph4); double order5s = ChiIndexUtils.evalSimpleIndex(localAtomContainer, subgraph5); double order6s = ChiIndexUtils.evalSimpleIndex(localAtomContainer, subgraph6); double order7s = ChiIndexUtils.evalSimpleIndex(localAtomContainer, subgraph7); + double order0v = ChiIndexUtils.evalValenceIndex(localAtomContainer, subgraph0); + double order1v = ChiIndexUtils.evalValenceIndex(localAtomContainer, subgraph1); + double order2v = ChiIndexUtils.evalValenceIndex(localAtomContainer, subgraph2); double order3v = ChiIndexUtils.evalValenceIndex(localAtomContainer, subgraph3); double order4v = ChiIndexUtils.evalValenceIndex(localAtomContainer, subgraph4); double order5v = ChiIndexUtils.evalValenceIndex(localAtomContainer, subgraph5); @@ -130,12 +143,18 @@ double order7v = ChiIndexUtils.evalValenceIndex(localAtomContainer, subgraph7); DoubleArrayResult retval = new DoubleArrayResult(); + retval.add(order0s); + retval.add(order1s); + retval.add(order2s); retval.add(order3s); retval.add(order4s); retval.add(order5s); retval.add(order6s); retval.add(order7s); + retval.add(order0v); + retval.add(order1v); + retval.add(order2v); retval.add(order3v); retval.add(order4v); retval.add(order5v); @@ -146,6 +165,46 @@ } + + private List order0(IAtomContainer atomContainer) { + List fragments = new ArrayList(); + Iterator atoms = atomContainer.atoms(); + while (atoms.hasNext()) { + IAtom atom = (IAtom) atoms.next(); + List tmp = new ArrayList(); + tmp.add( new Integer(atomContainer.getAtomNumber(atom)) ); + fragments.add(tmp); + } + return fragments; + } + + private List order1(IAtomContainer atomContainer) throws CDKException { + List fragments = new ArrayList(); + + Iterator bonds = atomContainer.bonds(); + + while (bonds.hasNext()) { + IBond bond = (IBond) bonds.next(); + if (bond.getAtomCount() != 2) throw new CDKException("We only consider 2 center bonds"); + List tmp = new ArrayList(); + tmp.add( new Integer(atomContainer.getAtomNumber(bond.getAtom(0))) ); + tmp.add( new Integer(atomContainer.getAtomNumber(bond.getAtom(1))) ); + fragments.add(tmp); + } + return fragments; + } + + + private List order2(IAtomContainer atomContainer) { + QueryAtomContainer[] queries = new QueryAtomContainer[1]; + try { + queries[0] = QueryAtomContainerCreator.createAnyAtomAnyBondContainer(sp.parseSmiles("CCC"), false); + } catch (InvalidSmilesException e) { + e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. + } + return ChiIndexUtils.getFragments(atomContainer, queries); + } + private List order3(IAtomContainer atomContainer) { QueryAtomContainer[] queries = new QueryAtomContainer[1]; try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rajarshi@us...> - 2006-11-18 21:39:27
|
Revision: 7310 http://svn.sourceforge.net/cdk/?rev=7310&view=rev Author: rajarshi Date: 2006-11-18 13:39:20 -0800 (Sat, 18 Nov 2006) Log Message: ----------- Added a method to DescriptorValue to get a set of descriptor names for each of the calculated value. Updated the constructor and made the old one deprecated. Also updated nearly all the molecular descriptors to provide names in the returned DescriptorValue object. Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/qsar/DescriptorSpecification.java trunk/cdk/src/org/openscience/cdk/qsar/DescriptorValue.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ALOGP.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/APolDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AminoAcidCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticAtomsCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticBondsCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AtomCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BPolDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BondCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CPSADescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderOneDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderZeroDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiChainDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiClusterDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiPathClusterDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiPathDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/EccentricConnectivityIndexDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/GravitationalIndexDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondAcceptorCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondDonorCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/KappaShapeIndicesDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestChainDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestPiSystemDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LengthOverBreadthDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LongestAliphaticChainDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/MDEDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/MomentOfInertiaDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanNumberDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanShapeIndexDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/RotatableBondsCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/RuleOfFiveDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/TPSADescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/VAdjMaDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ValenceCarbonConnectivityOrderOneDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ValenceCarbonConnectivityOrderZeroDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WHIMDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WeightDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WeightedPathDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WienerNumbersDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ZagrebIndexDescriptor.java Modified: trunk/cdk/src/org/openscience/cdk/qsar/DescriptorSpecification.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/DescriptorSpecification.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/DescriptorSpecification.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -66,19 +66,19 @@ public String getSpecificationReference() { return this.specificationReference; - }; + } public String getImplementationTitle() { return this.implementationTitle; - }; + } public String getImplementationIdentifier() { return this.implementationIdentifier; - }; + } public String getImplementationVendor() { return this.implementationVendor; - }; + } } Modified: trunk/cdk/src/org/openscience/cdk/qsar/DescriptorValue.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/DescriptorValue.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/DescriptorValue.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -24,7 +24,7 @@ package org.openscience.cdk.qsar; -import org.openscience.cdk.qsar.result.IDescriptorResult; +import org.openscience.cdk.qsar.result.*; /** * Class that is used to store descriptor values as IChemObject properties. @@ -37,7 +37,20 @@ private String[] parameterNames; private Object[] parameterSettings; private IDescriptorResult value; - + private String[] descriptorNames; + + /** + * Constructor. + * + * This constructor should not be used in new descriptor code, since it does + * not allow you to specify a set of names. + * + * @deprecated + * @param specification + * @param parameterNames + * @param parameterSettings + * @param value + */ public DescriptorValue(DescriptorSpecification specification, String[] parameterNames, Object[] parameterSettings, @@ -47,22 +60,78 @@ this.parameterSettings = parameterSettings; this.value = value; } - + + public DescriptorValue(DescriptorSpecification specification, + String[] parameterNames, + Object[] parameterSettings, + IDescriptorResult value, + String[] descriptorNames) { + this.specification = specification; + this.parameterNames = parameterNames; + this.parameterSettings = parameterSettings; + this.value = value; + this.descriptorNames = descriptorNames; + } + public DescriptorSpecification getSpecification() { return this.specification; - }; - + } + public Object[] getParameters() { return this.parameterSettings; - }; - + } + public String[] getParameterNames() { return this.parameterNames; - }; - + } + public IDescriptorResult getValue() { return this.value; } - + + /** + * Returns an array of names for each descriptor value calculated. + * <p/> + * Many descriptors return multiple values. In general it is useful for the + * descriptor to indicate the names for each value. When a descriptor creates + * a <code>DescriptorValue</code> object, it should supply an array of names equal + * in length to the number of descriptor calculated. + * <p/> + * In many cases, these names can be as simple as X1, X2, ..., XN where X is a prefix + * and 1, 2, ..., N are the indices. On the other hand it is also possible to return + * other arbitrary names, which should be documented in the Javadocs for the decsriptor + * (e.g., the CPSA descriptor). + * <p/> + * Note that by default if a descriptor returns a single value (such as {@link org.openscience.cdk.qsar.descriptors.molecular.ALOGP} + * the return array will have a single element + * <p/> + * In case a descriptor creates a <code>DescriptorValue</code> object with no names, this + * method will generate a set of names based on the {@link DescriptorSpecification} object + * supplied at instantiation. + * + * @return An array of descriptor names. + */ + public String[] getNames() { + if (descriptorNames == null || descriptorNames.length == 0) { + String title = specification.getImplementationTitle(); + if (value instanceof BooleanResult || + value instanceof DoubleResult || + value instanceof IntegerResult) { + descriptorNames = new String[1]; + descriptorNames[0] = title; + } else { + int ndesc = 0; + if (value instanceof DoubleArrayResult) { + ndesc = ((DoubleArrayResult) value).size(); + } else if (value instanceof IntegerArrayResult) { + ndesc = ((IntegerArrayResult)value).size(); + } + descriptorNames = new String[ndesc]; + for (int i = 1; i < ndesc+1; i++) descriptorNames[i] = title+i; + } + } + return descriptorNames; + } + } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ALOGP.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ALOGP.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ALOGP.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -23,18 +23,11 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; -import java.lang.reflect.Method; - import org.openscience.cdk.CDKConstants; import org.openscience.cdk.atomtype.EStateAtomTypeMatcher; import org.openscience.cdk.atomtype.IAtomTypeMatcher; import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.interfaces.IAtom; -import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.interfaces.IAtomType; -import org.openscience.cdk.interfaces.IBond; -import org.openscience.cdk.interfaces.IRing; -import org.openscience.cdk.interfaces.IRingSet; +import org.openscience.cdk.interfaces.*; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; @@ -42,6 +35,8 @@ import org.openscience.cdk.ringsearch.AllRingsFinder; import org.openscience.cdk.tools.AtomicProperties; +import java.lang.reflect.Method; + /** * This class calculates ALOGP (Ghose-Crippen LogKow) and the * Ghose-Crippen molar refractivity. @@ -64,6 +59,13 @@ * <td>no parameters</td> * </tr> * </table> + * + * Returns three values + * <ol> + * <li>ALogP - Ghose-Crippen LogKow + * <li>ALogP2 + * <li>AMR - molar refractivity + * </ol> * * @author Todd Martin * @cdk.module nocompile @@ -1918,7 +1920,7 @@ results.add(AMR); return new DescriptorValue(getSpecification(), getParameterNames(), - getParameters(), results); + getParameters(), results, new String[] {"ALogP", "ALogP2", "AMR"} ); } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/APolDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/APolDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/APolDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -26,8 +26,8 @@ import org.openscience.cdk.config.IsotopeFactory; import org.openscience.cdk.exception.CDKException; +import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IElement; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; @@ -56,7 +56,9 @@ * <td>no parameters</td> * </tr> * </table> - * + * + * Returns a single value with name <i>apol</i>. + * * @author mfe4 * @cdk.created 2004-11-13 * @cdk.module qsar @@ -162,7 +164,8 @@ atomicNumber = element.getAtomicNumber(); apol += polarizabilities[atomicNumber]; } - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(apol)); + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), + new DoubleResult(apol), new String[] {"apol"}); } catch (Exception ex1) { logger.debug(ex1); throw new CDKException("Problems with IsotopeFactory due to " + ex1.toString(), ex1); Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AminoAcidCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AminoAcidCountDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AminoAcidCountDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -23,8 +23,6 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; -import java.util.List; - import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAminoAcid; import org.openscience.cdk.interfaces.IAtomContainer; @@ -36,9 +34,11 @@ import org.openscience.cdk.qsar.result.IntegerArrayResult; import org.openscience.cdk.templates.AminoAcids; +import java.util.List; + /** - * Class that returns the number of amino acids in an atom container. + * Class that returns the number of each amino acid in an atom container. * * <p>This descriptor uses these parameters: * <table border="1"> @@ -53,7 +53,10 @@ * <td>no parameters</td> * </tr> * </table> - * + * + * Returns 20 values with names of the form <i>nX</i>, where <i>X</i> is the short versio + * of the amino acid name + * * @author egonw * @cdk.created 2006-01-15 * @cdk.module qsar-pdb @@ -144,9 +147,12 @@ } } + String[] names = new String[substructureSet.getAtomContainerCount()]; + IAminoAcid[] aas = AminoAcids.createAAs(); + for (int i = 0; i < aas.length; i++) names[i] = "n"+aas[i].getProperty(AminoAcids.RESIDUE_NAME_SHORT); + return new DescriptorValue(getSpecification(), getParameterNames(), - getParameters(), results - ); + getParameters(), results, names); } /** Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticAtomsCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticAtomsCountDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticAtomsCountDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -52,6 +52,8 @@ * </tr> * </table> * + * Returns a single value with name <i>nAromAtom</i> + * * @author mfe4 * @cdk.created 2004-11-03 * @cdk.module qsar @@ -151,7 +153,8 @@ aromaticAtomsCount += 1; } } - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(aromaticAtomsCount)); + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), + new IntegerResult(aromaticAtomsCount), new String[] {"nAromAtom"}); } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticBondsCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticBondsCountDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticBondsCountDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -52,6 +52,8 @@ * </tr> * </table> * + * Returns a single value with name <i>nAromBond</i> + * * @author mfe4 * @cdk.created 2004-11-03 * @cdk.module qsar @@ -151,7 +153,8 @@ aromaticBondsCount += 1; } } - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(aromaticBondsCount)); + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), + new IntegerResult(aromaticBondsCount), new String[] {"nAromBond"}); } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AtomCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AtomCountDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AtomCountDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -51,6 +51,7 @@ * </tr> * </table> * + * Returns a single value with name <i>nX</i> where <i>X</i> is the atomic symbol. * * @author mfe4 * @cdk.created 2004-11-13 @@ -167,7 +168,8 @@ } } } - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(atomCount)); + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), + new IntegerResult(atomCount), new String[] { "n"+elementName }); } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -43,7 +43,7 @@ /** * Eigenvalue based descriptor noted for its utility in chemical diversity. * Described by Pearlman et al. {@cdk.cite PEA99}. - * + * <p/> * <p>The descriptor is based on a weighted version of the Burden matrix {@cdk.cite BUR89, BUR97} * which takes into account both the connectivity as well as atomic * properties of a molecule. The weights are a variety of atom properties placed along the @@ -57,40 +57,46 @@ * classes of descriptor in a single ArrayList (in the order shown above). However it is also * possible to supply a parameter list indicating how many of the highest and lowest eigenvalues * (for each class of descriptor) are required. - * + * <p/> * <p>The descriptor works with the hydrogen depleted molecule and thus the maximum number * of eigenvalues calculated for any class of BCUT descriptor is equal to the number * of heavy atoms present. * <p>This descriptor uses these parameters: * <table border="1"> - * <tr> - * <td>Name</td> - * <td>Default</td> - * <td>Description</td> - * </tr> - * <tr> - * <td>nhigh</td> - * <td>1</td> - * <td>The number of highest eigenvalue</td> - * </tr> - * <tr> - * <td>nlow</td> - * <td>1</td> - * <td>The number of lowest eigenvalue</td> - * </tr> + * <tr> + * <td>Name</td> + * <td>Default</td> + * <td>Description</td> + * </tr> + * <tr> + * <td>nhigh</td> + * <td>1</td> + * <td>The number of highest eigenvalue</td> + * </tr> + * <tr> + * <td>nlow</td> + * <td>1</td> + * <td>The number of lowest eigenvalue</td> + * </tr> * </table> + * <p/> + * Returns an array of values in the following order + * <ol> + * <p/> + * <li>BCUTw-1l, BCUTw-2l ... - <i>nhigh</i> lowest atom weighted BCUTS + * <li>BCUTw-1h, BCUTw-2h ... - <i>nlow</i> highest atom weighted BCUTS + * <li>BCUTc-1l, BCUTc-2l ... - <i>nhigh</i> lowest partial charge weighted BCUTS + * <li>BCUTc-1h, BCUTc-2h ... - <i>nlow</i> highest partial charge weighted BCUTS + * <li>BCUTp-1l, BCUTp-2l ... - <i>nhigh</i> lowest polarizability weighted BCUTS + * <li>BCUTp-1h, BCUTp-2h ... - <i>nlow</i> highest polarizability weighted BCUTS * - * - * @author Rajarshi Guha - * @cdk.created 2004-11-30 - * + * @author Rajarshi Guha + * @cdk.created 2004-11-30 * @cdk.builddepends Jama-1.0.1.jar * @cdk.depends Jama-1.0.1.jar - * * @cdk.module qsar - * @cdk.set qsar-descriptors + * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:BCUT - * * @cdk.keyword BCUT * @cdk.keyword descriptor */ @@ -117,15 +123,15 @@ } /** - * Sets the parameters attribute of the BCUTDescriptor object. + * Sets the parameters attribute of the BCUTDescriptor object. * - *@param params The new parameter values. This descriptor takes 3 parameters: number of highest - * eigenvalues and number of lowest eigenvalues. If 0 is specified for either (the default) - * then all calculated eigenvalues are returned. The third parameter checkAromaticity is a boolean. - * If checkAromaticity is true, the method check the aromaticity, if false, means that the aromaticity has - * already been checked. - *@throws CDKException if the parameters are of the wrong type - *@see #getParameters + * @param params The new parameter values. This descriptor takes 3 parameters: number of highest + * eigenvalues and number of lowest eigenvalues. If 0 is specified for either (the default) + * then all calculated eigenvalues are returned. The third parameter checkAromaticity is a boolean. + * If checkAromaticity is true, the method check the aromaticity, if false, means that the aromaticity has + * already been checked. + * @throws CDKException if the parameters are of the wrong type + * @see #getParameters */ public void setParameters(Object[] params) throws CDKException { // we expect 3 parameters @@ -134,13 +140,13 @@ } if (!(params[0] instanceof Integer) || !(params[1] instanceof Integer)) { throw new CDKException("Parameters must be of type Integer"); - }else if(!(params[2] instanceof Boolean)) { - throw new CDKException("The third parameter must be of type Boolean"); + } else if (!(params[2] instanceof Boolean)) { + throw new CDKException("The third parameter must be of type Boolean"); } // ok, all should be fine - - this.nhigh = ((Integer)params[0]).intValue(); - this.nlow = ((Integer)params[1]).intValue(); + + this.nhigh = ((Integer) params[0]).intValue(); + this.nlow = ((Integer) params[1]).intValue(); this.checkAromaticity = ((Boolean) params[2]).booleanValue(); if (this.nhigh < 0 || this.nlow < 0) { @@ -149,50 +155,51 @@ } /** - * Gets the parameters attribute of the BCUTDescriptor object. + * Gets the parameters attribute of the BCUTDescriptor object. * - *@return Three element array of Integer and one boolean representing number of highest and lowest eigenvalues and the checkAromaticity flag - * to return respectively - *@see #setParameters + * @return Three element array of Integer and one boolean representing number of highest and lowest eigenvalues and the checkAromaticity flag + * to return respectively + * @see #setParameters */ public Object[] getParameters() { Object params[] = new Object[3]; params[0] = new Integer(this.nhigh); params[1] = new Integer(this.nlow); params[2] = Boolean.valueOf(this.checkAromaticity); - return(params); + return (params); } + /** - * Gets the parameterNames attribute of the BCUTDescriptor object. + * Gets the parameterNames attribute of the BCUTDescriptor object. * - *@return The parameterNames value + * @return The parameterNames value */ public String[] getParameterNames() { String[] params = new String[3]; params[0] = "nhigh"; params[1] = "nlow"; params[2] = "checkAromaticity"; - return(params); + return (params); } /** - * Gets the parameterType attribute of the BCUTDescriptor object. + * Gets the parameterType attribute of the BCUTDescriptor object. * - *@param name Description of the Parameter (can be either 'nhigh' or 'nlow' or checkAromaticity) - *@return The parameterType value + * @param name Description of the Parameter (can be either 'nhigh' or 'nlow' or checkAromaticity) + * @return The parameterType value */ public Object getParameterType(String name) { - Object object = null; + Object object = null; if (name.equals("nhigh")) object = new Integer(1); if (name.equals("nlow")) object = new Integer(1); if (name.equals("checkAromaticity")) object = new Integer(1); - return(object); + return (object); } static private class BurdenMatrix { - + static double[][] evalMatrix(IAtomContainer atomContainer, double[] vsd) { IAtomContainer local = AtomContainerManipulator.removeHydrogens(atomContainer); @@ -200,10 +207,10 @@ double[][] matrix = new double[natom][natom]; /* set the off diagonal entries */ - for (int i = 0; i < natom-1; i++) { - for (int j = i+1; j < natom; j++) { + for (int i = 0; i < natom - 1; i++) { + for (int j = i + 1; j < natom; j++) { for (int k = 0; k < local.getBondCount(); k++) { - org.openscience.cdk.interfaces.IBond bond = local.getBond(k); + org.openscience.cdk.interfaces.IBond bond = local.getBond(k); if (bond.contains(local.getAtom(i)) && bond.contains(local.getAtom(j))) { if (bond.getOrder() == CDKConstants.BONDORDER_SINGLE) matrix[i][j] = 0.1; else if (bond.getOrder() == CDKConstants.BONDORDER_DOUBLE) matrix[i][j] = 0.2; @@ -227,20 +234,20 @@ if (vsd != null) matrix[i][i] = vsd[i]; else matrix[i][i] = 0.0; } - return(matrix); + return (matrix); } } - - /** - * Calculates the three classes of BCUT descriptors. + + /** + * Calculates the three classes of BCUT descriptors. * - *@param container Parameter is the atom container. - *@return An ArrayList containing the descriptors. The default is to return - * all calculated eigenvalues of the Burden matrices in the order described - * above. If a parameter list was supplied, then only the specified number - * of highest and lowest eigenvalues (for each class of BCUT) will be returned. - *@throws CDKException if the wrong number of eigenvalues are requested (negative or more than the number - * of heavy atoms) + * @param container Parameter is the atom container. + * @return An ArrayList containing the descriptors. The default is to return + * all calculated eigenvalues of the Burden matrices in the order described + * above. If a parameter list was supplied, then only the specified number + * of highest and lowest eigenvalues (for each class of BCUT) will be returned. + * @throws CDKException if the wrong number of eigenvalues are requested (negative or more than the number + * of heavy atoms) */ public DescriptorValue calculate(IAtomContainer container) throws CDKException { int counter; @@ -256,7 +263,7 @@ // do aromaticity detecttion for calculating polarizability later on if (this.checkAromaticity) { - HueckelAromaticityDetector.detectAromaticity(molecule); + HueckelAromaticityDetector.detectAromaticity(molecule); } // find number of heavy atoms @@ -277,7 +284,7 @@ for (int i = 0; i < molecule.getAtomCount(); i++) { if (molecule.getAtom(i).getSymbol().equals("H")) continue; diagvalue[counter] = IsotopeFactory.getInstance(molecule.getBuilder()). - getMajorIsotope( molecule.getAtom(i).getSymbol() ).getExactMass(); + getMajorIsotope(molecule.getAtom(i).getSymbol()).getExactMass(); counter++; } } catch (Exception e) { @@ -288,7 +295,6 @@ EigenvalueDecomposition eigenDecomposition = new EigenvalueDecomposition(matrix); double[] eval1 = eigenDecomposition.getRealEigenvalues(); - // get charge weighted BCUT GasteigerMarsiliPartialCharges peoe; try { @@ -311,7 +317,7 @@ // get polarizability weighted BCUT Polarizability pol = new Polarizability(); counter = 0; - for (int i =0 ; i < molecule.getAtomCount(); i++) { + for (int i = 0; i < molecule.getAtomCount(); i++) { if (molecule.getAtom(i).getSymbol().equals("H")) continue; diagvalue[counter] = pol.calculateGHEffectiveAtomPolarizability(molecule, molecule.getAtom(i), 1000); counter++; @@ -321,25 +327,50 @@ eigenDecomposition = new EigenvalueDecomposition(matrix); double[] eval3 = eigenDecomposition.getRealEigenvalues(); - DoubleArrayResult retval = new DoubleArrayResult( eval1.length + eval2.length + eval3.length ); + DoubleArrayResult retval = new DoubleArrayResult(eval1.length + eval2.length + eval3.length); + String[] names; + String[] suffix = {"w", "c", "p"}; + if (nhigh == 0 || nlow == 0) { // return all calculated eigenvalues - for (int i = 0; i < eval1.length; i++) retval.add( eval1[i] ); - for (int i = 0; i < eval2.length; i++) retval.add( eval2[i] ); - for (int i = 0; i < eval3.length; i++) retval.add( eval3[i] ); + for (int i = 0; i < eval1.length; i++) retval.add(eval1[i]); + for (int i = 0; i < eval2.length; i++) retval.add(eval2[i]); + for (int i = 0; i < eval3.length; i++) retval.add(eval3[i]); + + names = new String[retval.size()]; + for (int j = 0; j < suffix.length; j++) { + for (int i = 0; i < eval1.length; i++) { + names[i] = "BCUT" + suffix[j] + "-" + (i + 1) + "l"; + } + for (int i = 0; i < eval1.length; i++) { + names[i] = "BCUT" + suffix[j] + "-" + (i + 1) + "h"; + } + } } else { // return only the n highest & lowest eigenvalues - for (int i = 0; i < nlow; i++) retval.add( eval1[i] ); - for (int i = 0; i < nhigh; i++) retval.add( eval1[ eval1.length-i-1 ] ); - - for (int i = 0; i < nlow; i++) retval.add( eval2[i] ); - for (int i = 0; i < nhigh; i++) retval.add( eval2[ eval2.length-i-1 ] ); - - for (int i = 0; i < nlow; i++) retval.add( eval3[i] ); - for (int i = 0; i < nhigh; i++) retval.add( eval3[ eval3.length-i-1 ] ); + for (int i = 0; i < nlow; i++) retval.add(eval1[i]); + for (int i = 0; i < nhigh; i++) retval.add(eval1[eval1.length - i - 1]); + + for (int i = 0; i < nlow; i++) retval.add(eval2[i]); + for (int i = 0; i < nhigh; i++) retval.add(eval2[eval2.length - i - 1]); + + for (int i = 0; i < nlow; i++) retval.add(eval3[i]); + for (int i = 0; i < nhigh; i++) retval.add(eval3[eval3.length - i - 1]); + + names = new String[ 3 * nhigh + 3 * nlow ]; + for (int j = 0; j < suffix.length; j++) { + for (int i = 0; i < nhigh; i++) { + names[i] = "BCUT" + suffix[j] + "-" + (i + 1) + "l"; + } + for (int i = 0; i < nlow; i++) { + names[i] = "BCUT" + suffix[j] + "-" + (i + 1) + "h"; + } + } } - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval); + + + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval, names); } } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BPolDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BPolDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BPolDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -26,7 +26,6 @@ import org.openscience.cdk.config.IsotopeFactory; import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.interfaces.IElement; import org.openscience.cdk.qsar.DescriptorSpecification; @@ -54,7 +53,9 @@ * <td>no parameters</td> * </tr> * </table> - * + * + * Returns a single value with name <i>bpol</i>. + * * @author mfe4 * @cdk.created 2004-11-13 * @cdk.module qsar @@ -149,7 +150,8 @@ difference = polarizabilities[atomicNumber0] -polarizabilities[atomicNumber1]; bpol += Math.abs(difference); } - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(bpol)); + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), + new DoubleResult(bpol), new String[] {"bpol"}); } catch (Exception ex1) { logger.debug(ex1); throw new CDKException("Problems with IsotopeFactory due to " + ex1.toString(), ex1); Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BondCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BondCountDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BondCountDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -48,6 +48,14 @@ * </tr> * </table> * + * Returns a single value with name <i>nBX</i> where <i>X</i> can be + * <ul> + * <li>s for single bonds + * <li>d for double bonds + * <li>t for triple bonds + * <li>a for aromatic bonds + * </ul> + * * @author mfe4 * @cdk.created 2004-11-13 * @cdk.module qsar @@ -124,7 +132,15 @@ bondCount += 1; } } - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(bondCount)); + + String name = "nB"; + if (order == 1) name += "s"; + else if (order == 2) name += "d"; + else if (order == 3) name += "t"; + else if (order == 1.5) name += "a"; + + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), + new IntegerResult(bondCount), new String[] {name}); } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CPSADescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CPSADescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CPSADescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -31,7 +31,7 @@ /** * Calculates 29 Charged Partial Surface Area (CPSA) descriptors. - * + * <p/> * The CPSA's were developed by Stanton et al. ({@cdk.cite STA90}) and * are related to the Polar Surface Area descriptors. The original * implementation was in the ADAPT software package and the the definitions @@ -98,103 +98,103 @@ * </tr> * </tbody> * </table> - * <p> + * <p/> * <b>NOTE</b>: The values calculated by this implementation will differ from those * calculated by the original ADAPT implementation of the CPSA descriptors. This - * is becaause the original implementation used an analytical surface area algorithm + * is because the original implementation used an analytical surface area algorithm * and used partial charges obtained from MOPAC using the AM1 Hamiltonian. * This implementation uses a numerical * algorithm to obtain surface areas (see {@link NumericalSurface}) and obtains partial * charges using the Gasteiger-Marsilli algorithm (see {@link GasteigerMarsiliPartialCharges}). - * <p> + * <p/> * However, a comparison of the values calculated by the two implementations indicates * that they are qualitatively the same. - * + * <p/> * <p>This descriptor uses these parameters: * <table border="1"> - * <tr> - * <td>Name</td> - * <td>Default</td> - * <td>Description</td> - * </tr> - * <tr> - * <td></td> - * <td></td> - * <td>no parameters</td> - * </tr> + * <tr> + * <td>Name</td> + * <td>Default</td> + * <td>Description</td> + * </tr> + * <tr> + * <td></td> + * <td></td> + * <td>no parameters</td> + * </tr> * </table> * - * @author Rajarshi Guha - * @cdk.created 2005-05-16 - * - * @cdk.module qsar - * @cdk.set qsar-descriptors + * @author Rajarshi Guha + * @cdk.created 2005-05-16 + * @cdk.module qsar + * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:CPSA */ public class CPSADescriptor implements IMolecularDescriptor { - + //private LoggingTool logger; - + public CPSADescriptor() { //logger = new LoggingTool(this); } - public DescriptorSpecification getSpecification() { + public DescriptorSpecification getSpecification() { return new DescriptorSpecification( - "http://www.blueobelisk.org/ontologies/chemoinformatics-algorithms/#CPSA";, - this.getClass().getName(), - "$Id$", - "The Chemistry Development Kit"); - }; + "http://www.blueobelisk.org/ontologies/chemoinformatics-algorithms/#CPSA";, + this.getClass().getName(), + "$Id$", + "The Chemistry Development Kit"); + } /** - * Sets the parameters attribute of the CPSADescriptor object. + * Sets the parameters attribute of the CPSADescriptor object. * - *@param params The new parameters value - *@exception CDKException Description of the Exception - *@see #getParameters + * @param params The new parameters value + * @throws CDKException Description of the Exception + * @see #getParameters */ public void setParameters(Object[] params) throws CDKException { // no parameters for this descriptor } /** - * Gets the parameters attribute of the CPSADescriptor object. + * Gets the parameters attribute of the CPSADescriptor object. * - *@return The parameters value - *@see #setParameters + * @return The parameters value + * @see #setParameters */ public Object[] getParameters() { // no parameters to return - return(null); + return (null); } + /** - * Gets the parameterNames attribute of the CPSADescriptor object. + * Gets the parameterNames attribute of the CPSADescriptor object. * - *@return The parameterNames value + * @return The parameterNames value */ public String[] getParameterNames() { // no param names to return - return(null); + return (null); } /** - * Gets the parameterType attribute of the CPSADescriptor object. + * Gets the parameterType attribute of the CPSADescriptor object. * - *@param name Description of the Parameter - *@return The parameterType value + * @param name Description of the Parameter + * @return The parameterType value */ public Object getParameterType(String name) { - return (null); + return (null); } /** * Evaluates the 29 CPSA descriptors using Gasteiger-Marsilli charges. * - *@param container Parameter is the atom container. - *@return An ArrayList containing 29 elements in the order described above - @throws CDKException if the charge calculation fails + * @param container Parameter is the atom container. + * @return An ArrayList containing 29 elements in the order described above + * @throws CDKException if the charge calculation fails */ public DescriptorValue calculate(IAtomContainer container) throws CDKException { @@ -207,7 +207,7 @@ GasteigerMarsiliPartialCharges peoe = null; try { - peoe= new GasteigerMarsiliPartialCharges(); + peoe = new GasteigerMarsiliPartialCharges(); peoe.assignGasteigerMarsiliSigmaPartialCharges(container, true); } catch (Exception e) { throw new CDKException("Problem assigning Gasteiger - Marsili partial charges", e); @@ -259,84 +259,96 @@ double wnsa3 = pnsa3 * totalSA / 1000; // hydrophobic and poalr surface area - double phobic = 0.0; - double polar = 0.0; - for (int i = 0; i < container.getAtomCount(); i++) { - if (Math.abs(container.getAtom(i).getCharge()) < 0.2) { - phobic += atomSurfaces[i]; - } else { - polar += atomSurfaces[i]; - } - } - double thsa = phobic; - double tpsa = polar; - double rhsa = phobic / totalSA; - double rpsa = polar / totalSA; - - // differential +ve & -ve SA - double dpsa1 = ppsa1 - pnsa1; - double dpsa2 = ppsa2 - pnsa2; - double dpsa3 = ppsa3 - pnsa3; + double phobic = 0.0; + double polar = 0.0; + for (int i = 0; i < container.getAtomCount(); i++) { + if (Math.abs(container.getAtom(i).getCharge()) < 0.2) { + phobic += atomSurfaces[i]; + } else { + polar += atomSurfaces[i]; + } + } + double thsa = phobic; + double tpsa = polar; + double rhsa = phobic / totalSA; + double rpsa = polar / totalSA; - double maxpcharge = 0.0; - double maxncharge = 0.0; - int pidx = 0; - int nidx = 0; - for (int i = 0; i < container.getAtomCount(); i++) { - double charge = container.getAtom(i).getCharge(); - if (charge > maxpcharge) { - maxpcharge = charge; - pidx = i; - } - if (charge < maxncharge) { - maxncharge = charge; - nidx = i; - } - } + // differential +ve & -ve SA + double dpsa1 = ppsa1 - pnsa1; + double dpsa2 = ppsa2 - pnsa2; + double dpsa3 = ppsa3 - pnsa3; - // relative descriptors - double rpcg = maxpcharge / totpcharge; - double rncg = maxncharge / totncharge; - double rpcs = atomSurfaces[pidx] * rpcg; - double rncs = atomSurfaces[nidx] * rncg; - - // fill in the values - retval.add(ppsa1); - retval.add(ppsa2); - retval.add(ppsa3); - retval.add(pnsa1); - retval.add(pnsa2); - retval.add(pnsa3); + double maxpcharge = 0.0; + double maxncharge = 0.0; + int pidx = 0; + int nidx = 0; + for (int i = 0; i < container.getAtomCount(); i++) { + double charge = container.getAtom(i).getCharge(); + if (charge > maxpcharge) { + maxpcharge = charge; + pidx = i; + } + if (charge < maxncharge) { + maxncharge = charge; + nidx = i; + } + } - retval.add(dpsa1); - retval.add(dpsa2); - retval.add(dpsa3); + // relative descriptors + double rpcg = maxpcharge / totpcharge; + double rncg = maxncharge / totncharge; + double rpcs = atomSurfaces[pidx] * rpcg; + double rncs = atomSurfaces[nidx] * rncg; - retval.add(fpsa1); - retval.add(fpsa2); - retval.add(fpsa3); - retval.add(fnsa1); - retval.add(fnsa2); - retval.add(fnsa3); + // fill in the values + retval.add(ppsa1); + retval.add(ppsa2); + retval.add(ppsa3); + retval.add(pnsa1); + retval.add(pnsa2); + retval.add(pnsa3); - retval.add(wpsa1); - retval.add(wpsa2); - retval.add(wpsa3); - retval.add(wnsa1); - retval.add(wnsa2); - retval.add(wnsa3); + retval.add(dpsa1); + retval.add(dpsa2); + retval.add(dpsa3); - retval.add(rpcg); - retval.add(rncg); - retval.add(rpcs); - retval.add(rncs); + retval.add(fpsa1); + retval.add(fpsa2); + retval.add(fpsa3); + retval.add(fnsa1); + retval.add(fnsa2); + retval.add(fnsa3); - retval.add(thsa); - retval.add(tpsa); - retval.add(rhsa); - retval.add(rpsa); + retval.add(wpsa1); + retval.add(wpsa2); + retval.add(wpsa3); + retval.add(wnsa1); + retval.add(wnsa2); + retval.add(wnsa3); - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval); + retval.add(rpcg); + retval.add(rncg); + retval.add(rpcs); + retval.add(rncs); + + retval.add(thsa); + retval.add(tpsa); + retval.add(rhsa); + retval.add(rpsa); + + String[] names = { + "PPSA-1", "PPSA-2", "PPSA-3", + "PNSA-1", "PNSA-2", "PNSA-3", + "DPSA-1", "DPSA-2", "DPSA-3", + "FPSA-1", "FPSA-2", "FPSA-3", + "FNSA-1", "FNSA-2", "FNSA-3", + "WPSA-1", "WPSA-2", "WPSA-3", + "WNSA-1", "WNSA-2", "WNSA-3", + "RPCG", "RNCG", "RPCS", "RNCS", + "THSA", "TPSA", "RHSA", "RPSA" + }; + + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval, names); } } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderOneDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderOneDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderOneDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -24,8 +24,6 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; -import java.util.ArrayList; - import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; @@ -34,6 +32,8 @@ import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.result.DoubleResult; +import java.util.ArrayList; + /** * CarbonConnectivity index (order 1): * http://www.edusoft-lc.com/molconn/manuals/400/chaptwo.html @@ -144,7 +144,8 @@ } } } - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(chi1C)); + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(chi1C), + new String[] {"chi1C"}); } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderZeroDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderZeroDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderZeroDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -25,8 +25,8 @@ package org.openscience.cdk.qsar.descriptors.molecular; import org.openscience.cdk.exception.CDKException; +import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; @@ -126,7 +126,8 @@ } } } - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(chi0C)); + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), + new DoubleResult(chi0C), new String[] {"chi0C"}); } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiChainDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiChainDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiChainDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -52,14 +52,14 @@ * <p/> * The order of the values returned is * <ol> - * <li>Simple chain, order 3 - * <li>Simple chain, order 4 - * <li>Simple chain, order 5 - * <li>Simple chain, order 6 - * <li>Valence chain, order 3 - * <li>Valence chain, order 4 - * <li>Valence chain, order 5 - * <li>Valence chain, order 6 + * <li>SCH-3 - Simple chain, order 3 + * <li>SCH-4 - Simple chain, order 4 + * <li>SCH-5 - Simple chain, order 5 + * <li>SCH-6 - Simple chain, order 6 + * <li>VCH-3 - Valence chain, order 3 + * <li>VCH-4 - Valence chain, order 4 + * <li>VCH-5 - Valence chain, order 5 + * <li>VCH-6 - Valence chain, order 6 * </ol> * * @author Rajarshi Guha @@ -145,7 +145,10 @@ retval.add(order5v); retval.add(order6v); - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval); + String[] names = { + "SCH-3", "SCH-4", "SCH-5", "SCH-6", + "VCH-3", "VCH-4", "VCH-5", "VCH-6"}; + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval, names); } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiClusterDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiClusterDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiClusterDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -51,14 +51,14 @@ * <p/> * The order of the values returned is * <ol> - * <li>Simple cluster, order 3 - * <li>Simple cluster, order 4 - * <li>Simple cluster, order 5 - * <li>Simple cluster, order 6 - * <li>Valence cluster, order 3 - * <li>Valence cluster, order 4 - * <li>Valence cluster, order 5 - * <li>Valence cluster, order 6 + * <li>SC-3 - Simple cluster, order 3 + * <li>SC-4 - Simple cluster, order 4 + * <li>SC-5 - Simple cluster, order 5 + * <li>SC-6 - Simple cluster, order 6 + * <li>VC-3 - Valence cluster, order 3 + * <li>VC-4 - Valence cluster, order 4 + * <li>VC-5 - Valence cluster, order 5 + * <li>VC-6 - Valence cluster, order 6 * </ol> * * @author Rajarshi Guha @@ -144,7 +144,11 @@ retval.add(order5v); retval.add(order6v); - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval); + String[] names = { + "SC-3", "SC-4", "SC-5", "SC-6", + "VC-3", "VC-4", "VC-5", "VC-6" + }; + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval, names); } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiPathClusterDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiPathClusterDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiPathClusterDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -50,12 +50,12 @@ * <p/> * The order of the values returned is * <ol> - * <li>Simple path cluster, order 4 - * <li>Simple path cluster, order 5 - * <li>Simple path cluster, order 6 - * <li>Valence path cluster, order 4 - * <li>Valence path cluster, order 5 - * <li>Valence path cluster, order 6 + * <li>SPC-4 - Simple path cluster, order 4 + * <li>SPC-5 - Simple path cluster, order 5 + * <li>SPC-6 - Simple path cluster, order 6 + * <li>VPC-4 - Valence path cluster, order 4 + * <li>VPC-5 - Valence path cluster, order 5 + * <li>VPC-6 - Valence path cluster, order 6 * </ol> * * @author Rajarshi Guha @@ -136,7 +136,11 @@ retval.add(order5v); retval.add(order6v); - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval); + String[] names = { + "SPC-4", "SPC-5", "SPC-6", + "VPC-4", "VPC-5", "VPC-6" + }; + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval, names); } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiPathDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiPathDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiPathDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -55,8 +55,8 @@ * <p/> * The order of the values returned is * <ol> - * <li>Simple path, orders 0 to 7 - * <li>Valence path, orders 0 to 7 + * <li>SP-0, SP-1, ..., SP-7 - Simple path, orders 0 to 7 + * <li>VP-0, VP-1, ..., VP-7 - Valence path, orders 0 to 7 * </ol> * * @author Rajarshi Guha @@ -161,7 +161,12 @@ retval.add(order6v); retval.add(order7v); - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval); + String[] names = new String[16]; + for (int i = 0; i <8; i++) { + names[i] = "SP-"+i; + names[i+8] = "VP"+(i+8); + } + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval, names); } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/EccentricConnectivityIndexDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/EccentricConnectivityIndexDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/EccentricConnectivityIndexDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -58,7 +58,8 @@ * <td>no parameters</td> * </tr> * </table> - * + * + * Returns a single value with name <i>ECCEN</i> * @author Rajarshi Guha * @cdk.created 2005-03-19 * @cdk.module qsar @@ -141,7 +142,7 @@ eccenindex += max * degree; } IntegerResult retval = new IntegerResult(eccenindex); - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval); + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval, new String[] {"ECCEN"}); } } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/GravitationalIndexDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/GravitationalIndexDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/GravitationalIndexDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -45,15 +45,15 @@ *<p> * The descriptor routine generates 9 descriptors: * <ul> - * <li>grav1 - gravitational index of heavy atoms - * <li>grav2 - square root of gravitational index of heavy atoms - * <li>grav3 - cube root of gravitational index of heavy atoms - * <li>gravh1 - gravitational index - hydrogens included - * <li>gravh2 - square root of hydrogen-included gravitational index - * <li>gravh3 - cube root of hydrogen-included gravitational index - * <li>grav4 - grav1 for all pairs of atoms (not just bonded pairs) - * <li>grav5 - grav2 for all pairs of atoms (not just bonded pairs) - * <li>grav6 - grav3 for all pairs of atoms (not just bonded pairs) + * <li>GRAV-1 - gravitational index of heavy atoms + * <li>GRAV-2 - square root of gravitational index of heavy atoms + * <li>GRAV-3 - cube root of gravitational index of heavy atoms + * <li>GRAVH-1 - gravitational index - hydrogens included + * <li>GRAVH-2 - square root of hydrogen-included gravitational index + * <li>GRAVH-3 - cube root of hydrogen-included gravitational index + * <li>GRAV-4 - grav1 for all pairs of atoms (not just bonded pairs) + * <li>GRAV-5 - grav2 for all pairs of atoms (not just bonded pairs) + * <li>GRAV-6 - grav3 for all pairs of atoms (not just bonded pairs) * </ul> * * <p>This descriptor uses these parameters: @@ -271,7 +271,12 @@ retval.add( Math.sqrt(allheavysum) ); retval.add( Math.pow(allheavysum,1.0/3.0) ); - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval); + String[] names = { + "GRAV-1", "GRAV-2", "GRAV-3", + "GRAVH-1", "GRAVH-2", "GRAVH-3", + "GRAV-4", "GRAV-5", "GRAV-6" + }; + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval, names); } } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondAcceptorCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondAcceptorCountDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondAcceptorCountDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -27,8 +27,8 @@ import org.openscience.cdk.CDKConstants; import org.openscience.cdk.aromaticity.HueckelAromaticityDetector; import org.openscience.cdk.exception.CDKException; +import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; @@ -50,6 +50,8 @@ * </ol> * </ul> * + * Returns a single value named <i>nHBAcc</i>. + * * <p>This descriptor uses these parameters: * <table> * <tr> @@ -166,7 +168,8 @@ } } - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(hBondAcceptors)); + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), + new IntegerResult(hBondAcceptors), new String[] {"nHBAcc"}); } /** Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondDonorCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondDonorCountDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondDonorCountDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -25,8 +25,8 @@ package org.openscience.cdk.qsar.descriptors.molecular; import org.openscience.cdk.exception.CDKException; +import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; @@ -45,7 +45,9 @@ * <p> * This descriptor works properly with AtomContainers whose atoms contain either <b>implicit</b> or <b>explicit * hydrogen</b> atoms. It does not work with atoms that contain neither implicit nor explicit hydrogens. - * + * + * Returns a single value named <i>nHBAcc</i>. + * * <p>This descriptor uses these parameters: * <table border="1"> * <tr> @@ -149,7 +151,8 @@ } } - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(hBondDonors)); + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), + new IntegerResult(hBondDonors), new String[] {"nHBDon"}); } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/KappaShapeIndicesDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/KappaShapeIndicesDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/KappaShapeIndicesDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -24,16 +24,16 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; -import java.util.ArrayList; - import org.openscience.cdk.exception.CDKException; +import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.result.DoubleArrayResult; +import java.util.ArrayList; + /** * Kier and Hall kappa molecular shape indices compare the molecular graph with minimal and maximal molecular graphs; * a description is given at: http://www.chemcomp.com/Journal_of_CCG/Features/descr.htm#KH : @@ -41,8 +41,14 @@ * In the following description, n denotes the number of atoms in the hydrogen suppressed graph, * m is the number of bonds in the hydrogen suppressed graph. Also, let p2 denote the number of paths of length 2 * and let p3 denote the number of paths of length 3". - * Values kier1, kier2 and kier3 are returned as arrayList of doubles. * + * Returns three values in the order + * <ol> + * <li>Kier1 - First kappa shape index + * <li>Kier2 - Second kappa shape index + * <li>Kier3 - Third kappa (κ) shape index + * </ol> + * * <p>This descriptor uses these parameters: * <table border="1"> * <tr> @@ -221,7 +227,8 @@ kierValues.add(kier1); kierValues.add(kier2); kierValues.add(kier3); - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), kierValues); + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), kierValues, + new String[] {"Kier1", "Kier2", "Kier3"}); } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestChainDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestChainDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestChainDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -24,8 +24,6 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; -import java.util.Vector; - import org.openscience.cdk.AtomContainer; import org.openscience.cdk.CDKConstants; import org.openscience.cdk.aromaticity.HueckelAromaticityDetector; @@ -41,55 +39,60 @@ import org.openscience.cdk.ringsearch.AllRingsFinder; import org.openscience.cdk.ringsearch.SSSRFinder; +import java.util.Vector; + /** - * Class that returns the number of atoms in the largest chain. - * + * Class that returns the number of atoms in the largest chain. + * <p/> * <p>This descriptor uses these parameters: * <table border="1"> - * <tr> - * <td>Name</td> - * <td>Default</td> - * <td>Description</td> - * </tr> - * <tr> - * <td>checkAromaticity</td> - * <td>false</td> - * <td>True is the aromaticity has to be checked</td> - * </tr> - * <tr> - * <td>checkRingSystem</td> - * <td>false</td> - * <td>True is the CDKConstant.ISINRING has to be set</td> - * </tr> + * <tr> + * <td>Name</td> + * <td>Default</td> + * <td>Description</td> + * </tr> + * <tr> + * <td>checkAromaticity</td> + * <td>false</td> + * <td>True is the aromaticity has to be checked</td> + * </tr> + * <tr> + * <td>checkRingSystem</td> + * <td>false</td> + * <td>True is the CDKConstant.ISINRING has to be set</td> + * </tr> * </table> + * <p/> + * Returns a single value named <i>nAtomLAC</i> * - * @author chhoppe from EUROSCREEN + * @author chhoppe from EUROSCREEN * @cdk.created 2006-1-03 - * @cdk.module qsar - * @cdk.set qsar-descriptors + * @cdk.module qsar + * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:largestChain */ public class LargestChainDescriptor implements IMolecularDescriptor { - private boolean checkAromaticity = false; - private boolean checkRingSystem = false; + private boolean checkAromaticity = false; + private boolean checkRingSystem = false; /** - * Constructor for the LargestChain object. + * Constructor for the LargestChain object. */ - public LargestChainDescriptor() { } + public LargestChainDescriptor() { + } /** * Returns a <code>Map</code> which specifies which descriptor - * is implemented by this class. - * + * is implemented by this class. + * <p/> * These fields are used in the map: * <ul> * <li>Specification-Reference: refers to an entry in a unique dictionary * <li>Implementation-Title: anything * <li>Implementation-Identifier: a unique identifier for this version of - * this class + * this class * <li>Implementation-Vendor: CDK, JOELib, or anything else * </ul> * @@ -105,13 +108,13 @@ /** - * Sets the parameters attribute of the LargestChain object. - * + * Sets the parameters attribute of the LargestChain object. + * <p/> * This descriptor takes one parameter, which should be Boolean to indicate whether * aromaticity has been checked (TRUE) or not (FALSE). - * - * @param params The new parameters value - * @exception CDKException if more than one parameter or a non-Boolean parameter is specified + * + * @param params The new parameters value + * @throws CDKException if more than one parameter or a non-Boolean parameter is specified * @see #getParameters */ public void setParameters(Object[] params) throws CDKException { @@ -128,9 +131,9 @@ /** - * Gets the parameters attribute of the LargestChainDescriptor object. + * Gets the parameters attribute of the LargestChainDescriptor object. * - * @return The parameters value + * @return The parameters value * @see #setParameters */ public Object[] getParameters() { @@ -144,123 +147,127 @@ /** * Calculate the count of atoms of the largest chain in the supplied {@link IAtomContainer}. - * + * <p/> * <p>The method require two parameters: * <ol> - * <li>if checkAromaticity is true, the method check the aromaticity, - * <li>if false, means that the aromaticity has already been checked + * <li>if checkAromaticity is true, the method check the aromaticity, + * <li>if false, means that the aromaticity has already been checked * </ol> - * + * <p/> * <p>Same for checkRingSystem, if true the CDKConstant.ISINRING will be set * - *@param container The {@link AtomContainer} for which this descriptor is to be calculated - *@return the number of atoms in the largest chain of this AtomContainer - *@throws CDKException if there is a problem in aromaticity detection - *@see #setParameters + * @param container The {@link AtomContainer} for which this descriptor is to be calculated + * @return the number of atoms in the largest chain of this AtomContainer + * @throws CDKException if there is a problem in aromaticity detection + * @see #setParameters */ public DescriptorValue calculate(IAtomContainer container) throws CDKException { - //System.out.println("LargestChainDescriptor"); - IRingSet rs = null; - - if (checkAromaticity && !checkRingSystem) { + //System.out.println("LargestChainDescriptor"); + IRingSet rs = null; + + if (checkAromaticity && !checkRingSystem) { rs = (IRingSet) (new AllRingsFinder()).findAllRings(container); HueckelAromaticityDetector.detectAromaticity(container, rs, true); - }else if (checkAromaticity && checkRingSystem) { + } else if (checkAromaticity && checkRingSystem) { rs = (IRingSet) (new AllRingsFinder()).findAllRings(container); HueckelAromaticityDetector.detectAromaticity(container, rs, true); - for (int i=0;i<container.getAtomCount();i++){ - if (rs.contains(container.getAtom(i))){ - container.getAtom(i).setFlag(CDKConstants.ISINRING,true); - } + for (int i = 0; i < container.getAtomCount(); i++) { + if (rs.contains(container.getAtom(i))) { + container.getAtom(i).setFlag(CDKConstants.ISINRING, true); + } } - }else if (!checkAromaticity && checkRingSystem) { - rs = (IRingSet) new SSSRFinder(container).findSSSR(); - for (int i=0;i<container.getAtomCount();i++){ - if (rs.contains(container.getAtom(i))){ - container.getAtom(i).setFlag(CDKConstants.ISINRING,true); - } + } else if (!checkAromaticity && checkRingSystem) { + rs = (IRingSet) new SSSRFinder(container).findSSSR(); + for (int i = 0; i < container.getAtomCount(); i++) { + if (rs.contains(container.getAtom(i))) { + container.getAtom(i).setFlag(CDKConstants.ISINRING, true); + } } } - - - int largestChainAtomsCount=0; - //IAtom[] atoms = container.getAtoms(); - Vector startSphere = null; - Vector path = null; - //Set all VisitedFlags to False - for (int i =0;i<container.getAtomCount();i++){ - container.getAtom(i).setFlag(CDKConstants.VISITED, false); - } - - //System.out.println("Set all atoms to Visited False"); - for (int i =0;i<container.getAtomCount();i++){ - IAtom atomi = container.getAtom(i); - // chain sp3 - //System.out.println("atom:"+i+" maxBondOrder:"+container.getMaximumBondOrder(atoms[i])+" Aromatic:"+atoms[i].getFlag(CDKConstants.ISAROMATIC)+" Ring:"+atoms[i].getFlag(CDKConstants.ISINRING)+" FormalCharge:"+atoms[i].getFormalCharge()+" Charge:"+atoms[i].getCharge()+" Flag:"+atoms[i].getFlag(CDKConstants.VISITED)); - if ((!atomi.getFlag(CDKConstants.ISAROMATIC) && !atomi.getFlag(CDKConstants.ISINRING)) & !atomi.getFlag(CDKConstants.VISITED)){ - //System.out.println("...... -> containercepted"); - startSphere = new Vector(); - path = new Vector(); - startSphere.addElement(atomi); - breadthFirstSearch(container, startSphere, path); - if (path.size() > largestChainAtomsCount){ - largestChainAtomsCount=path.size(); - } - } - - } - - - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(largestChainAtomsCount)); + + + int largestChainAtomsCount = 0; + //IAtom[] atoms = container.getAtoms(); + Vector startSphere = null; + Vector path = null; + //Set all VisitedFlags to False + for (int i = 0; i < container.getAtomCount(); i++) { + container.getAtom(i).setFlag(CDKConstants.VISITED, false); + } + + //System.out.println("Set all atoms to Visited False"); + for (int i = 0; i < container.getAtomCount(); i++) { + IAtom atomi = container.getAtom(i); + // chain sp3 + //System.out.println("atom:"+i+" maxBondOrder:"+container.getMaximumBondOrder(atoms[i])+" Aromatic:"+atoms[i].getFlag(CDKConstants.ISAROMATIC)+" Ring:"+atoms[i].getFlag(CDKConstants.ISINRING)+" FormalCharge:"+atoms[i].getFormalCharge()+" Charge:"+atoms[i].getCharge()+" Flag:"+atoms[i].getFlag(CDKConstants.VISITED)); + if ((!atomi.getFlag(CDKConstants.ISAROMATIC) && !atomi.getFlag(CDKConstants.ISINRING)) & !atomi.getFlag(CDKConstants.VISITED)) + { + //System.out.println("...... -> containercepted"); + startSphere = new Vector(); + path = new Vector(); + startSphere.addElement(atomi); + breadthFirstSearch(container, startSphere, path); + if (path.size() > largestChainAtomsCount) { + largestChainAtomsCount = path.size(); + } + } + + } + + + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), + new IntegerResult(largestChainAtomsCount), new String[]{"nAtomLC"}); } - /** - * Performs a breadthFirstSearch in an AtomContainer starting with a - * particular sphere, which usually consists of one start atom, and searches - * for a pi system. - * - *@param container The AtomContainer to - * be searched - *@param sphere A sphere of atoms to - * start the search with - *@param path A vector which stores the atoms belonging to the pi system - *@exception org.openscience.cdk.exception.CDKException Description of the - * Exception - */ - public void breadthFirstSearch(IAtomContainer container, Vector sphere, Vector path) throws org.openscience.cdk.exception.CDKException{ - IAtom atom = null; - IAtom nextAtom = null; - Vector newSphere = new Vector(); - //System.out.println("Start of breadthFirstSearch"); - for (int i = 0; i < sphere.size(); i++){ - atom = (IAtom) sphere.elementAt(i); - //System.out.println("BreadthFirstSearch around atom " + (atomNr + 1)); - java.util.List bonds = container.getConnectedBondsList(atom); - for (int j = 0; j < bonds.size(); j++){ - nextAtom = ((IBond)bonds.get(j)).getConnectedAtom(atom); - if ((!nextAtom.getFlag(CDKConstants.ISAROMATIC)&& !nextAtom.getFlag(CDKConstants.ISINRING)) & !nextAtom.getFlag(CDKConstants.VISITED)){ - //System.out.println("BDS> AtomNr:"+container.getAtomNumber(nextAtom)+" maxBondOrder:"+container.getMaximumBondOrder(nextAtom)+" Aromatic:"+nextAtom.getFlag(CDKConstants.ISAROMATIC)+" FormalCharge:"+nextAtom.getFormalCharge()+" Charge:"+nextAtom.getCharge()+" Flag:"+nextAtom.getFlag(CDKConstants.VISITED)); - path.addElement(nextAtom); - //System.out.println("BreadthFirstSearch is meeting new atom " + (nextAtomNr + 1)); - nextAtom.setFlag(CDKConstants.VISITED, true); - if (container.getBondCount(nextAtom) > 1){ - newSphere.addElement(nextAtom); - } - }else{ - nextAtom.setFlag(CDKConstants.VISITED, true); - } - } - } - if (newSphere.size() > 0){ - breadthFirstSearch(container, newSphere, path); - } - } + /** + * Performs a breadthFirstSearch in an AtomContainer starting with a + * particular sphere, which usually consists of one start atom, and searches + * for a pi system. + * + * @param container The AtomContainer to + * be searched + * @param sphere A sphere of atoms to + * start the search with + * @param path A vector which stores the atoms belonging to the pi system + * @throws org.openscience.cdk.exception.CDKException + * Description of the + * Exception + */ + public void breadthFirstSearch(IAtomContainer container, Vector sphere, Vector path) throws org.openscience.cdk.exception.CDKException { + IAtom atom = null; + IAtom nextAtom = null; + Vector newSphere = new Vector(); + //System.out.println("Start of breadthFirstSearch"); + for (int i = 0; i < sphere.size(); i++) { + atom = (IAtom) sphere.elementAt(i); + //System.out.println("BreadthFirstSearch around atom " + (atomNr + 1)); + java.util.List bonds = container.getConnectedBondsList(atom); + for (int j = 0; j < bonds.size(); j++) { + nextAtom = ((IBond) bonds.get(j)).getConnectedAtom(atom); + if ((!nextAtom.getFlag(CDKConstants.ISAROMATIC) && !nextAtom.getFlag(CDKConstants.ISINRING)) & !nextAtom.getFlag(CDKConstants.VISITED)) + { + //System.out.println("BDS> AtomNr:"+container.getAtomNumber(nextAtom)+" maxBondOrder:"+container.getMaximumBondOrder(nextAtom)+" Aromatic:"+nextAtom.getFlag(CDKConstants.ISAROMATIC)+" FormalCharge:"+nextAtom.getFormalCharge()+" Charge:"+nextAtom.getCharge()+" Flag:"+nextAtom.getFlag(CDKConstants.VISITED)); + path.addElement(nextAtom); + //System.out.println("BreadthFirstSearch is meeting new atom " + (nextAtomNr + 1)); + nextAtom.setFlag(CDKConstants.VISITED, true); + if (container.getBondCount(nextAtom) > 1) { + newSphere.addElement(nextAtom); + } + } else { + nextAtom.setFlag(CDKConstants.VISITED, true); + } + } + } + if (newSphere.size() > 0) { + breadthFirstSearch(container, newSphere, path); + } + } - + /** - * Gets the parameterNames attribute of the LargestPiSystemDescriptor object. + * Gets the parameterNames attribute of the LargestPiSystemDescriptor object. * - *@return The parameterNames value + * @return The parameterNames value */ public String[] getParameterNames() { String[] params = new String[2]; @@ -270,17 +277,16 @@ } - /** - * Gets the parameterType attribute of the LargestChainDescriptor object. + * Gets the parameterType attribute of the LargestChainDescriptor object. * - *@param name Description of the Parameter - *@return An Object of class equal to that of the parameter being requested + * @param name Description of the Parameter + * @return An Object of class equal to that of the parameter being requested */ public Object getParameterType(String name) { Object[] paramTypes = new Object[2]; - paramTypes[0] = new Boolean(true); - paramTypes[1] = new Boolean(true); + paramTypes[0] = Boolean.TRUE; + paramTypes[1] = Boolean.TRUE; return paramTypes; } } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestPiSystemDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestPiSystemDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestPiSystemDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -24,8 +24,6 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; -import java.util.Vector; - import org.openscience.cdk.AtomContainer; import org.openscience.cdk.CDKConstants; import org.openscience.cdk.aromaticity.HueckelAromaticityDetector; @@ -40,51 +38,56 @@ import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.ringsearch.AllRingsFinder; +import java.util.Vector; + /** - * Class that returns the number of atoms in the largest pi system. - * + * Class that returns the number of atoms in the largest pi system. + * <p/> * <p>This descriptor uses these parameters: * <table border="1"> - * <tr> - * <td>Name</td> - * <td>Default</td> - * <td>Description</td> - * </tr> - * <tr> - * <td>checkAromaticity</td> - * <td>false</td> - * <td>True is the aromaticity has to be checked</td> - * </tr> + * <tr> + * <td>Name</td> + * <td>Default</td> + * <td>Description</td> + * </tr> + * <tr> + * <td>checkAromaticity</td> + * <td>false</td> + * <td>True is the aromaticity has to be checked</td> + * </tr> * </table> + * <p/> + * Returns a single value named <i>nAtomPi</i> * - * @author chhoppe from EUROSCREEN + * @author chhoppe from EUROSCREEN * @cdk.created 2006-1-03 - * @cdk.module qsar - * @cdk.set qsar-descriptors + * @cdk.module qsar + * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:largestPiSystem */ public class LargestPiSystemDescriptor implements IMolecularDescriptor { - private boolean checkAromaticity = false; + private boolean checkAromaticity = false; /** - * Constructor for the LargestPiSystemDescriptor object. + * Constructor for the LargestPiSystemDescriptor object. */ - public LargestPiSystemDescriptor() { } + public LargestPiSystemDescriptor() { + } /** * Returns a <code>Map</code> which specifies which descriptor - * is implemented by this class. - * + * is implemented by this class. + * <p/> * These fields are used in the map: * <ul> * <li>Specification-Reference: refers to an entry in a unique dictionary * <li>Implementation-Title: anything * <li>Implementation-Identifier: a unique identifier for this version of - * this class + * this class * <li>Implementation-Vendor: CDK, JOELib, or anything else * </ul> * @@ -100,13 +103,13 @@ /** - * Sets the parameters attribute of the LargestPiSystemDescriptor object. - * + * Sets the parameters attribute of the LargestPiSystemDescriptor object. + * <p/> * This descriptor takes one parameter, which should be Boolean to indicate whether * aromaticity has been checked (TRUE) or not (FALSE). - * - * @param params The new parameters value - * @exception CDKException if more than one parameter or a non-Boolean parameter is specified + * + * @param params The new parameters value + * @throws CDKException if more than one parameter or a non-Boolean parameter is specified * @see #getParameters */ public void setParameters(Object[] params) throws CDKException { @@ -122,9 +125,9 @@ /** - * Gets the parameters attribute of the LargestPiSystemDescriptor object. + * Gets the parameters attribute of the LargestPiSystemDescriptor object. * - * @return The parameters value + * @return The parameters value * @see #setParameters */ public Object[] getParameters() { @@ -137,99 +140,103 @@ /** * Calculate the count of atoms of the largest pi system in the supplied {@link AtomContainer}. - * + * <p/> * <p>The method require one parameter: * <ol> - * <li>if checkAromaticity is true, the method check the aromaticity, - * <li>if false, means that the aromaticity has already been checked + * <li>if checkAromaticity is true, the method check the aromaticity, + * <li>if false, means that the aromaticity has already been checked * </ol> * - *@param container The {@link IAtomContainer} for which this descriptor is to be calculated - *@return the number of atoms in the largest pi system of this AtomContainer - *@throws CDKException if there is a problem in atomaticity detection - *@see #setParameters + * @param container The {@link IAtomContainer} for which this descriptor is to be calculated + * @return the number of atoms in the largest pi system of this AtomContainer + * @throws CDKException if there is a problem in atomaticity detection + * @see #setParameters */ public DescriptorValue calculate(IAtomContainer container) throws CDKException { - //System.out.println("LargestPiSystemDescriptor"); - if (checkAromaticity) { + //System.out.println("LargestPiSystemDescriptor"); + if (checkAromaticity) { IRingSet rs = (new AllRingsFinder()).findAllRings(container); HueckelAromaticityDetector.detectAromaticity(container, rs, true); } - int largestPiSystemAtomsCount=0; - Vector startSphere = null; - Vector path = null; - //Set all VisitedFlags to False - for (int i =0;i<container.getAtomCount();i++){ - container.getAtom(i).setFlag(CDKConstants.VISITED, false); - } - //System.out.println("Set all atoms to Visited False"); - for (int i =0;i<container.getAtomCount();i++){ - //Possible pi System double bond or triple bond, charge, N or O (free electron pair) - //System.out.println("atom:"+i+" maxBondOrder:"+container.getMaximumBondOrder(atoms[i])+" Aromatic:"+atoms[i].getFlag(CDKConstants.ISAROMATIC)+" FormalCharge:"+atoms[i].getFormalCharge()+" Charge:"+atoms[i].getCharge()+" Flag:"+atoms[i].getFlag(CDKConstants.VISITED)); - if ((container.getMaximumBondOrder(container.getAtom(i))>1 || Math.abs(container.getAtom(i).getFormalCharge())>=1 || container.getAtom(i).getFlag(CDKConstants.ISAROMATIC)|| container.getAtom(i).getSymbol().equals("N")||container.getAtom(i).getSymbol().equals("O"))& !container.getAtom(i).getFlag(CDKConstants.VISITED)){ - //System.out.println("...... -> Accepted"); - startSphere = new Vector(); - path = new Vector(); - startSphere.addElement(container.getAtom(i)); - breadthFirstSearch(container, startSphere, path); - if (path.size() > largestPiSystemAtomsCount){ - largestPiSystemAtomsCount=path.size(); - } - } - - } - - - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(largestPiSystemAtomsCount)); + int largestPiSystemAtomsCount = 0; + Vector startSphere = null; + Vector path = null; + //Set all VisitedFlags to False + for (int i = 0; i < container.getAtomCount(); i++) { + container.getAtom(i).setFlag(CDKConstants.VISITED, false); + } + //System.out.println("Set all atoms to Visited False"); + for (int i = 0; i < container.getAtomCount(); i++) { + //Possible pi System double bond or triple bond, charge, N or O (free electron pair) + //System.out.println("atom:"+i+" maxBondOrder:"+container.getMaximumBondOrder(atoms[i])+" Aromatic:"+atoms[i].getFlag(CDKConstants.ISAROMATIC)+" FormalCharge:"+atoms[i].getFormalCharge()+" Charge:"+atoms[i].getCharge()+" Flag:"+atoms[i].getFlag(CDKConstants.VISITED)); + if ((container.getMaximumBondOrder(container.getAtom(i)) > 1 || Math.abs(container.getAtom(i).getFormalCharge()) >= 1 || container.getAtom(i).getFlag(CDKConstants.ISAROMATIC) || container.getAtom(i).getSymbol().equals("N") || container.getAtom(i).getSymbol().equals("O")) & !container.getAtom(i).getFlag(CDKConstants.VISITED)) + { + //System.out.println("...... -> Accepted"); + startSphere = new Vector(); + path = new Vector(); + startSphere.addElement(container.getAtom(i)); + breadthFirstSearch(container, startSphere, path); + if (path.size() > largestPiSystemAtomsCount) { + largestPiSystemAtomsCount = path.size(); + } + } + + } + + + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), + new IntegerResult(largestPiSystemAtomsCount), new String[] {"nAtomP"}); } - /** - * Performs a breadthFirstSearch in an AtomContainer starting with a - * particular sphere, which usually consists of one start atom, and searches - * for a pi system. - * - *@param container The AtomContainer to - * be searched - *@param sphere A sphere of atoms to - * start the search with - *@param path A vector which stores the atoms belonging to the pi system - *@exception org.openscience.cdk.exception.CDKException Description of the - * Exception - */ - public void breadthFirstSearch(IAtomContainer container, Vector sphere, Vector path) throws org.openscience.cdk.exception.CDKException{ - IAtom atom = null; - IAtom nextAtom = null; - Vector newSphere = new Vector(); - //System.out.println("Start of breadthFirstSearch"); - for (int i = 0; i < sphere.size(); i++){ - atom = (IAtom) sphere.elementAt(i); - //System.out.println("BreadthFirstSearch around atom " + (atomNr + 1)); - java.util.List bonds = container.getConnectedBondsList(atom); - for (int j = 0; j < bonds.size(); j++){ - nextAtom = ((IBond)bonds.get(j)).getConnectedAtom(atom); - if ((container.getMaximumBondOrder(nextAtom)>1 || Math.abs(nextAtom.getFormalCharge())>=1 || nextAtom.getFlag(CDKConstants.ISAROMATIC) || nextAtom.getSymbol().equals("N")||nextAtom.getSymbol().equals("O"))& !nextAtom.getFlag(CDKConstants.VISITED)){ - //System.out.println("BDS> AtomNr:"+container.getAtomNumber(nextAtom)+" maxBondOrder:"+container.getMaximumBondOrder(nextAtom)+" Aromatic:"+nextAtom.getFlag(CDKConstants.ISAROMATIC)+" FormalCharge:"+nextAtom.getFormalCharge()+" Charge:"+nextAtom.getCharge()+" Flag:"+nextAtom.getFlag(CDKConstants.VISITED)); - path.addElement(nextAtom); - //System.out.println("BreadthFirstSearch is meeting new atom " + (nextAtomNr + 1)); - nextAtom.setFlag(CDKConstants.VISITED, true); - if (container.getBondCount(nextAtom) > 1){ - newSphere.addElement(nextAtom); - } - }else{ - nextAtom.setFlag(CDKConstants.VISITED, true); - } - } - } - if (newSphere.size() > 0){ - breadthFirstSearch(container, newSphere, path); - } - } + /** + * Performs a breadthFirstSearch in an AtomContainer starting with a + * particular sphere, which usually consists of one start atom, and searches + * for a pi system. + * + * @param container The AtomContainer to + * be searched + * @param sphere A sphere of atoms to + * start the search with + * @param path A vector which stores the atoms belonging to the pi system + * @throws org.openscience.cdk.exception.CDKException + * Description of the + * Exception + */ + public void breadthFirstSearch(IAtomContainer container, Vector sphere, Vector path) throws org.openscience.cdk.exception.CDKException { + IAtom atom = null; + IAtom nextAtom = null; + Vector newSphere = new Vector(); + //System.out.println("Start of breadthFirstSearch"); + for (int i = 0; i < sphere.size(); i++) { + atom = (IAtom) sphere.elementAt(i); + //System.out.println("BreadthFirstSearch around atom " + (atomNr + 1)); + java.util.List bonds = container.getConnectedBondsList(atom); + for (int j = 0; j < bonds.size(); j++) { + nextAtom = ((IBond) bonds.get(j)).getConnectedAtom(atom); + if ((container.getMaximumBondOrder(nextAtom) > 1 || Math.abs(nextAtom.getFormalCharge()) >= 1 || nextAtom.getFlag(CDKConstants.ISAROMATIC) || nextAtom.getSymbol().equals("N") || nextAtom.getSymbol().equals("O")) & !nextAtom.getFlag(CDKConstants.VISITED)) + { + //System.out.println("BDS> AtomNr:"+container.getAtomNumber(nextAtom)+" maxBondOrder:"+container.getMaximumBondOrder(nextAtom)+" Aromatic:"+nextAtom.getFlag(CDKConstants.ISAROMATIC)+" FormalCharge:"+nextAtom.getFormalCharge()+" Charge:"+nextAtom.getCharge()+" Flag:"+nextAtom.getFlag(CDKConstants.VISITED)); + path.addElement(nextAtom); + //System.out.println("BreadthFirstSearch is meeting new atom " + (nextAtomNr + 1)); + nextAtom.setFlag(CDKConstants.VISITED, true); + if (container.getBondCount(nextAtom) > 1) { + newSphere.addElement(nextAtom); + } + } else { + nextAtom.setFlag(CDKConstants.VISITED, true); + } + } + } + if (newSphere.size() > 0) { + breadthFirstSearch(container, newSphere, path); + } + } - + /** - * Gets the parameterNames attribute of the LargestPiSystemDescriptor object. + * Gets the parameterNames attribute of the LargestPiSystemDescriptor object. * - *@return The parameterNames value + * @return The parameterNames value */ public String[] getParameterNames() { String[] params = new String[1]; @@ -238,12 +245,11 @@ } - /** - * Gets the parameterType attribute of the LargestPiSystemDescriptor object. + * Gets the parameterType attribute of the LargestPiSystemDescriptor object. * - *@param name Description of the Parameter - *@return An Object of class equal to that of the parameter being requested + * @param name Description of the Parameter + * @return An Object of class equal to that of the parameter being requested */ public Object getParameterType(String name) { Object[] paramTypes = new Object[1]; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LengthOverBreadthDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LengthOverBreadthDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LengthOverBreadthDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -1,7 +1,6 @@ package org.openscience.cdk.qsar.descriptors.molecular; -import javax.vecmath.Point3d; - +import Jama.Matrix; import org.openscience.cdk.config.AtomTypeFactory; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.geometry.GeometryToolsInternalCoordinates; @@ -13,7 +12,7 @@ import org.openscience.cdk.qsar.result.DoubleArrayResult; import org.openscience.cdk.tools.LoggingTool; -import Jama.Matrix; +import javax.vecmath.Point3d; /** * Evaluates length over breadth descriptors. @@ -150,7 +149,7 @@ return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), - result); + result, new String[] {"LOBMAX", "LOBMIN"}); } private void rotateZ(double[][] coords, double theta) { Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LongestAliphaticChainDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LongestAliphaticChainDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LongestAliphaticChainDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -58,6 +58,7 @@ * </tr> * </table> * + * Returns a single value named <i>nAtomLAC</i> * @author chhoppe from EUROSCREEN * @cdk.created 2006-1-03 * @cdk.module qsar @@ -193,7 +194,8 @@ } } - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(longestChainAtomsCount)); + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), + new IntegerResult(longestChainAtomsCount), new String[] {"nAtomLAC"}); } private int getLongestChainPath(int[][] apsp){ Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/MDEDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/MDEDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/MDEDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -191,8 +191,18 @@ retval.add(dedge(local, i)); } + String[] names = { + "MDEC-11", "MDEC-12", "MDEC-13", "MDEC-14", + "MDEC-22", "MDEC-23", "MDEC-24", + "MDEC-33", "MDEC-34", + "MDEC-44", + "MDEO-11", "MDEO-12", "MDEO-22" , + "MDEN-11", "MDEN-12", "MDEN-13", + "MDEN-22", "MDEN-23", + "MDEN-33" + }; return new DescriptorValue(getSpecification(), - getParameterNames(), getParameters(), retval); + getParameterNames(), getParameters(), retval, names); } private double dedge(IAtomContainer atomContainer, int which) { Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/MomentOfInertiaDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/MomentOfInertiaDescriptor.java 2006-11-18 19:04:53 UTC (rev 7309) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/MomentOfInertiaDescriptor.java 2006-11-18 21:39:20 UTC (rev 7310) @@ -19,8 +19,8 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; -import javax.vecmath.Point3d; - +import Jama.EigenvalueDecomposition; +import Jama.Matrix; import org.openscience.cdk.config.IsotopeFactory; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.geometry.GeometryToolsInternalCoordinates; @@ -32,8 +32,7 @@ import org.openscience.cdk.tools.LoggingTool; import org.openscience.cdk.tools.MFAnalyser; -import Jama.EigenvalueDecomposition; -import Jama.Matrix; +import javax.vecmath.Point3d; /** * A descriptor that calculates the moment of inertia and radius of gyration. @@ -42,108 +41,107 @@ * are also well know modeling variables. This descriptor calculates the MI values * along the X, Y and Z axes as well as the ratio's X/Y, X/Z and Y/Z. Finally it also * calculates the radius of gyration of the molecule. - * <p> + * <p/> * The descriptor generates 7 values in the following order * <ul> - * <li>MI along X axis - * <li>MI along Y axis - * <li>MI along Z axis - * <li>X/Y - * <li>X/Z - * <li>Y/Z - * <li>Radius of gyration + * <li>MOMI-X - MI along X axis + * <li>MOMI-Y - MI along Y axis + * <li>MOMI-Z - MI along Z axis + * <li>MOMI-XY - X/Y + * <li>MOMI-XZ - X/Z + * <li>MOMI-YZ Y/Z + * <li>MOMI-R - Radius of gyration * </ul> * One important aspect of the algorithm is that if the eigenvalues of the MI tensor * are below 1e-3, then the ratio's are set to a default of 1000. - * + * <p/> * <p>This descriptor uses these parameters: * <table border="1"> - * <tr> - * <td>Name</td> - * <td>Default</td> - * <td>Description</td> - * </tr> - * <tr> - * <td></td> - * <td></td> - * <td>no parameters</td> - * </tr> + * <tr> + * <td>Name</td> + * <td>Default</td> + * <td>Description</td> + * </tr> + * <tr> + * <td></td> + * <td></td> + * <td>no parameters</td> + * </tr> * </table> - * - * @author Rajarshi Guha - * @cdk.created 2005-02-07 * + * @author Rajarshi Guha + * @cdk.created 2005-02-07 * @cdk.builddepends Jama-1.0.1.jar * @cdk.depends Jama-1.0.1.jar - * - * @cdk.module qsar - * @cdk.set qsar-descriptors + * @cdk.module qsar + * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:momentOfInertia */ public class MomentOfInertiaDescriptor implements IMolecularDescriptor { - + private LoggingTool logger; - + public MomentOfInertiaDescriptor() { logger = new LoggingTool(this); } - public DescriptorSpecification getSpecification() { + public DescriptorSpecification getSpecification() { return new DescriptorSpecification( - "http://www.blueobelisk.org/ontologies/chemoinformatics-algorithms/#momentOfInertia";, - this.getClass().getName(), - "$Id$", - "The Chemistry Development Kit"); - }; + "http://www.blueobelisk.org/ontologies/chemoinformatics-algorithms/#momentOfInertia";, + this.getClass().getName(), + "$Id$", + "The Chemistry Development Kit"); + } /** - * Sets the parameters attribute of the MomentOfInertiaDescriptor object. + * Sets the parameters attribute of the MomentOfInertiaDescriptor object. * - *@param params The new parameters value - *@exception CDKException Description of the Exception - *@see #getParameters + * @param params The new parameters value + * @throws CDKException Description of the Exception + * @see #getParameters */ public void setParameters(Object[] params) throws CDKException { // no parameters for this descriptor } /** - * Gets the parameters attribute of the MomentOfInertiaDescriptor object. + * Gets the parameters attribute of the MomentOfInertiaDescriptor object. * - *@return The parameters value - *@see #setParameters + * @return The parameters value + * @see #setParameters */ public Object[] getParameters() { // no parameters to return - return(null); + return (null); } + /** - * Gets the parameterNames attribute of the MomentOfInertiaDescriptor object. + * Gets the parameterNames attribute of the MomentOfInertiaDescriptor object. * - *@return The parameterNames value + * @return The parameterNames value */ public String[] getParameterNames() { // no param names to return - return(null); + return (null); } /** - * Gets the parameterType attribute of the MomentOfInertiaDescriptor object. + * Gets the parameterType attribute of the MomentOfInertiaDescriptor object. * - *@param name Description of the Parameter - *@return The parameterType value + * @param name Description of the Parameter + * @return The parameterType value */ public Object getParameterType(String name) { - return (null); + return (null); } /** - * Calculates the 3 MI's, 3 ration and the R_gyr value. + * Calculates the 3 MI's, 3 ration and the R_gyr value. * - *@param container Parameter is the atom container. - *@return An ArrayList containing 7 elements in the order described above - *@throws CDKException if the supplied AtomContainer does not contain 3D coordinates + * @param container Parameter is the atom container. + * @return An ArrayList containing 7 elements in the order described above + * @throws CDKException if the supplied AtomContainer does not contain 3D coordinates */ public DescriptorValue calculate(IAtomContainer container) throws CDKException { @@ -172,7 +170,7 @@ for (int i = 0; i < container.getAtomCount(); i++) { org.openscience.cdk.interfaces.IAtom currentAtom = container.getAtom(i); if (currentAtom.getPoint3d() == null) { - throw new CDKException("Atom "+i+" did not have any 3D coordinates. These are required"); + throw new CDKException("Atom " + i + " did not have any 3D coordinates. These are required"); } double mass = factory.getMajorIsotope(currentAtom.getSymbol()).getExactMass(); @@ -203,34 +201,38 @@ EigenvalueDecomposition eigenDecomp = tmp.eig(); double[] eval = eigenDecomp.getRealEigenvalues(); - retval.add( eval[2] ); - retval.add( eval[1] ); - retval.add( eval[0] ); + retval.add(eval[2]); + retval.add(eval[1]); + retval.add(eval[0]); double etmp = eval[0]; eval[0] = eval[2]; eval[2] = etmp; - if (Math.abs(eval[1]) > 1e-3) retval.add( eval[0]/eval[1] ); - else retval.add( 1000 ); + if (Math.abs(eval[1]) > 1e-3) retval.add(eval[0] / eval[1]); + else retval.add(1000); if (Math.abs(eval[2]) > 1e-3) { - retval.add( eval[0]/eval[2] ); - retval.add( eval[1]/eval[2] ); + retval.add(eval[0] / eval[2]); + retval.add(eval[1] / eval[2]); + } else { + retval.add(1000); + retval.add(1000); } - else { - retval.add( 1000 ); - retval.add( 1000 ); - } - + // finally get the radius of gyration double pri = 0.0; MFAnalyser mfa = new MFAnalyser(container); - if (Math.abs(eval[2]) > eps) pri = Math.pow( eval[0]*eval[1]*eval[2], 1.0/3.0 ) ; - else pri = Math.sqrt( eval[0] * ccf / mfa.getMass() ); - retval.add( Math.sqrt(Math.PI * 2 * pri * ccf / mfa.getMass()) ); - - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval); + if (Math.abs(eval[2]) > eps) pri = Math.pow(eval[0] * eval[1] * eval[2], 1.0 / 3.0); @@ Diff output truncated at 100000 characters. @@ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rajarshi@us...> - 2007-02-01 19:46:37
|
Revision: 7844 http://svn.sourceforge.net/cdk/?rev=7844&view=rev Author: rajarshi Date: 2007-02-01 11:46:29 -0800 (Thu, 01 Feb 2007) Log Message: ----------- Added a method to the IMolecularDescriptor interface which allows you to get the actual type of the DescriptorResult object that a descriptor implementing the itnerface will return. Its utility is that the return type can be evaluated without having to evaluate the descriptor first. also updated all implementing classes Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/qsar/IMolecularDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ALOGP.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/APolDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AminoAcidCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticAtomsCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticBondsCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AtomCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BPolDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BondCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CPSADescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderOneDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderZeroDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiChainDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiClusterDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiPathClusterDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiPathDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/EccentricConnectivityIndexDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/FragmentComplexityDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/GravitationalIndexDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondAcceptorCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondDonorCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/IPMolecularDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/KappaShapeIndicesDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestChainDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestPiSystemDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LengthOverBreadthDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LongestAliphaticChainDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/MDEDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/MomentOfInertiaDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanNumberDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanShapeIndexDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/RotatableBondsCountDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/RuleOfFiveDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/TPSADescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/TaeAminoAcidDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/VAdjMaDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ValenceCarbonConnectivityOrderOneDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ValenceCarbonConnectivityOrderZeroDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WHIMDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WeightDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WeightedPathDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/WienerNumbersDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ZagrebIndexDescriptor.java Modified: trunk/cdk/src/org/openscience/cdk/qsar/IMolecularDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/IMolecularDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/IMolecularDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -25,6 +25,7 @@ import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtomContainer; +import org.openscience.cdk.qsar.result.IDescriptorResult; /** * Classes that implement this interface are QSAR descriptor calculators. @@ -32,18 +33,31 @@ * @cdk.module qsar */ public interface IMolecularDescriptor extends IDescriptor { - - /** + + /** * Calculates the descriptor value for the given IAtomContainer. * - * @param container An {@link IAtomContainer} for which this descriptor - * should be calculated - * @return An object of {@link DescriptorValue} that contain the - * calculated value as well as specification details - * @throws CDKException if an error occurs during calculation. See + * @param container An {@link IAtomContainer} for which this descriptor + * should be calculated + * @return An object of {@link DescriptorValue} that contain the + * calculated value as well as specification details + * @throws CDKException if an error occurs during calculation. See * documentation for individual descriptors */ public DescriptorValue calculate(IAtomContainer container) throws CDKException; - + + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @return an object that implements the {@link IDescriptorResult} interface indicating + * the actual type of values returned by the descriptor in the {@link DescriptorValue} object + */ + public IDescriptorResult getDescriptorResultType(); + } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ALOGP.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ALOGP.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ALOGP.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -32,6 +32,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.IDescriptorResult; import org.openscience.cdk.ringsearch.AllRingsFinder; import org.openscience.cdk.tools.AtomicProperties; @@ -1923,14 +1924,29 @@ getParameters(), results, new String[] {"ALogP", "ALogP2", "AMR"} ); } + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new DoubleArrayResult(); + } - public DescriptorSpecification getSpecification() { - return new DescriptorSpecification( - "http://www.epa.gov/toddmartin/#ALOGP";, - this.getClass().getName(), - "$Id: AminoAcidCountDescriptor.java 6171 2006-05-04 19:29:58 +0000 (Thu, 04 May 2006) egonw $", + + public DescriptorSpecification getSpecification() { + return new DescriptorSpecification( + "http://www.epa.gov/toddmartin/#ALOGP";, + this.getClass().getName(), + "$Id: AminoAcidCountDescriptor.java 6171 2006-05-04 19:29:58 +0000 (Thu, 04 May 2006) egonw $", "The Chemistry Development Kit"); - } + } public String[] getParameterNames() { Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/APolDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/APolDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/APolDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -33,6 +33,7 @@ import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.result.DoubleResult; +import org.openscience.cdk.qsar.result.IDescriptorResult; import org.openscience.cdk.tools.LoggingTool; /** @@ -172,7 +173,22 @@ } } + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new DoubleResult(0.0); + } + /** * Gets the parameterNames attribute of the APolDescriptor object. * Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AminoAcidCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AminoAcidCountDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AminoAcidCountDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -31,6 +31,7 @@ import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IDescriptorResult; import org.openscience.cdk.qsar.result.IntegerArrayResult; import org.openscience.cdk.templates.AminoAcids; @@ -156,6 +157,21 @@ } /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new IntegerArrayResult(); + } + + /** * Gets the parameterNames attribute of the AromaticAtomsCountDescriptor object. * * @return The parameterNames value Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticAtomsCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticAtomsCountDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticAtomsCountDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -32,6 +32,7 @@ import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IDescriptorResult; import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.ringsearch.AllRingsFinder; @@ -157,7 +158,22 @@ new IntegerResult(aromaticAtomsCount), new String[] {"nAromAtom"}); } + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new IntegerResult(1); + } + /** * Gets the parameterNames attribute of the AromaticAtomsCountDescriptor object. * Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticBondsCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticBondsCountDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AromaticBondsCountDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -33,6 +33,7 @@ import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IDescriptorResult; import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.ringsearch.AllRingsFinder; @@ -161,7 +162,22 @@ new IntegerResult(aromaticBondsCount), new String[] {"nAromBond"}); } + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new IntegerResult(1); + } + /** * Gets the parameterNames attribute of the AromaticBondsCountDescriptor object. * Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AtomCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AtomCountDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/AtomCountDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -29,6 +29,7 @@ import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IDescriptorResult; import org.openscience.cdk.qsar.result.IntegerResult; /** @@ -147,13 +148,13 @@ if (container.getAtomCount() == 0) throw new CDKException("There were no atoms in the supplied AtomContainer"); if (elementName.equals("*")) { - for (int i = 0; i < container.getAtomCount(); i++) { + for (int i = 0; i < container.getAtomCount(); i++) { atomCount += container.getAtom(i).getHydrogenCount(); } atomCount += container.getAtomCount(); } else if (elementName.equals("H")) { - for (int i = 0; i < container.getAtomCount(); i++) { + for (int i = 0; i < container.getAtomCount(); i++) { if (container.getAtom(i).getSymbol().equals(elementName)) { atomCount += 1; } @@ -177,7 +178,22 @@ new IntegerResult(atomCount), new String[] { name }); } + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new IntegerResult(1); + } + /** * Gets the parameterNames attribute of the AtomCountDescriptor object. * Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -37,6 +37,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.IDescriptorResult; import org.openscience.cdk.tools.HydrogenAdder; import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; @@ -372,6 +373,21 @@ return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval, names); } + + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new DoubleArrayResult(); + } } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BPolDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BPolDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BPolDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -33,6 +33,7 @@ import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.result.DoubleResult; +import org.openscience.cdk.qsar.result.IDescriptorResult; import org.openscience.cdk.tools.LoggingTool; import java.util.Iterator; @@ -162,7 +163,22 @@ } } + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new DoubleResult(0.0); + } + /** * Gets the parameterNames attribute of the BPolDescriptor object * Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BondCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BondCountDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/BondCountDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -30,6 +30,7 @@ import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IDescriptorResult; import org.openscience.cdk.qsar.result.IntegerResult; import java.util.Iterator; @@ -147,7 +148,22 @@ new IntegerResult(bondCount), new String[]{name}); } + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new IntegerResult(1); + } + /** * Gets the parameterNames attribute of the BondCountDescriptor object * Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CPSADescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CPSADescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CPSADescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -27,6 +27,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.IDescriptorResult; import org.openscience.cdk.tools.LoggingTool; //import org.openscience.cdk.tools.LoggingTool; @@ -233,14 +234,14 @@ NumericalSurface surface; try { - surface = new NumericalSurface(container); - surface.calculateSurface(); + surface = new NumericalSurface(container); + surface.calculateSurface(); } catch (NullPointerException npe) { logger.debug("Error in surface area calculation"); for (int i = 0; i < 29; i++) retval.add(Double.NaN); return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval, names); } - + //double molecularWeight = mfa.getMass(); double[] atomSurfaces = surface.getAllSurfaceAreas(); double totalSA = surface.getTotalSurfaceArea(); @@ -361,9 +362,23 @@ retval.add(rpsa); - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval, names); } + + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new DoubleArrayResult(); + } } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderOneDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderOneDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderOneDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -24,9 +24,6 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; -import java.util.ArrayList; -import java.util.Iterator; - import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; @@ -35,7 +32,11 @@ import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.result.DoubleResult; +import org.openscience.cdk.qsar.result.IDescriptorResult; +import java.util.ArrayList; +import java.util.Iterator; + /** * CarbonConnectivity index (order 1): * http://www.edusoft-lc.com/molconn/manuals/400/chaptwo.html @@ -150,7 +151,22 @@ new String[] {"chi1C"}); } + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new DoubleResult(0.0); + } + /** * Gets the parameterNames attribute of the CarbonConnectivityOrderOneDescriptor object * Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderZeroDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderZeroDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/CarbonConnectivityOrderZeroDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -31,6 +31,7 @@ import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.result.DoubleResult; +import org.openscience.cdk.qsar.result.IDescriptorResult; /** * Carbon Connectivity index (order 0): @@ -130,7 +131,22 @@ new DoubleResult(chi0C), new String[] {"chi0C"}); } + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new DoubleResult(0.0); + } + /** * Gets the parameterNames attribute of the CarbonConnectivityOrderZeroDescriptor object * Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiChainDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiChainDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiChainDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -25,8 +25,6 @@ package org.openscience.cdk.qsar.descriptors.molecular; -import java.util.List; - import org.openscience.cdk.DefaultChemObjectBuilder; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.exception.InvalidSmilesException; @@ -38,12 +36,15 @@ 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.IDescriptorResult; import org.openscience.cdk.smiles.SmilesParser; import org.openscience.cdk.tools.HydrogenAdder; import org.openscience.cdk.tools.LoggingTool; import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; +import java.util.List; + /** * Evaluates chi chain descriptors. * <p/> @@ -153,6 +154,21 @@ } + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new DoubleArrayResult(); + } + private List order3(IAtomContainer atomContainer) { QueryAtomContainer[] queries = new QueryAtomContainer[1]; try { Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiClusterDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiClusterDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiClusterDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -25,8 +25,6 @@ package org.openscience.cdk.qsar.descriptors.molecular; -import java.util.List; - import org.openscience.cdk.DefaultChemObjectBuilder; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.exception.InvalidSmilesException; @@ -38,11 +36,14 @@ 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.IDescriptorResult; import org.openscience.cdk.smiles.SmilesParser; import org.openscience.cdk.tools.HydrogenAdder; import org.openscience.cdk.tools.LoggingTool; import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; +import java.util.List; + /** * Evaluates chi cluster descriptors. * <p/> @@ -146,13 +147,28 @@ retval.add(order6v); String[] names = { - "SC-3", "SC-4", "SC-5", "SC-6", - "VC-3", "VC-4", "VC-5", "VC-6" + "SC-3", "SC-4", "SC-5", "SC-6", + "VC-3", "VC-4", "VC-5", "VC-6" }; return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval, names); } + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new DoubleArrayResult(); + } + private List order3(IAtomContainer atomContainer) { QueryAtomContainer[] queries = new QueryAtomContainer[1]; try { Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiPathClusterDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiPathClusterDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiPathClusterDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -24,8 +24,6 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; -import java.util.List; - import org.openscience.cdk.DefaultChemObjectBuilder; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.exception.InvalidSmilesException; @@ -37,11 +35,14 @@ 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.IDescriptorResult; import org.openscience.cdk.smiles.SmilesParser; import org.openscience.cdk.tools.HydrogenAdder; import org.openscience.cdk.tools.LoggingTool; import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; +import java.util.List; + /** * Evaluates chi path cluster descriptors. * <p/> @@ -138,13 +139,28 @@ retval.add(order6v); String[] names = { - "SPC-4", "SPC-5", "SPC-6", - "VPC-4", "VPC-5", "VPC-6" + "SPC-4", "SPC-5", "SPC-6", + "VPC-4", "VPC-5", "VPC-6" }; return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval, names); } + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new DoubleArrayResult(); + } + private List order4(IAtomContainer atomContainer) { QueryAtomContainer[] queries = new QueryAtomContainer[1]; try { Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiPathDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiPathDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/ChiPathDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -25,10 +25,6 @@ package org.openscience.cdk.qsar.descriptors.molecular; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - import org.openscience.cdk.DefaultChemObjectBuilder; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.exception.InvalidSmilesException; @@ -42,11 +38,16 @@ 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.IDescriptorResult; import org.openscience.cdk.smiles.SmilesParser; import org.openscience.cdk.tools.HydrogenAdder; import org.openscience.cdk.tools.LoggingTool; import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + /** * Evaluates chi path descriptors. * <p/> @@ -163,14 +164,28 @@ retval.add(order7v); String[] names = new String[16]; - for (int i = 0; i <8; i++) { - names[i] = "SP-"+i; - names[i+8] = "VP-"+(i+8); + for (int i = 0; i < 8; i++) { + names[i] = "SP-" + i; + names[i + 8] = "VP-" + (i + 8); } return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval, names); } + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new DoubleArrayResult(); + } private List order0(IAtomContainer atomContainer) { List fragments = new ArrayList(); @@ -178,7 +193,7 @@ while (atoms.hasNext()) { IAtom atom = (IAtom) atoms.next(); List tmp = new ArrayList(); - tmp.add( new Integer(atomContainer.getAtomNumber(atom)) ); + tmp.add(new Integer(atomContainer.getAtomNumber(atom))); fragments.add(tmp); } return fragments; @@ -187,14 +202,14 @@ private List order1(IAtomContainer atomContainer) throws CDKException { List fragments = new ArrayList(); - Iterator bonds = atomContainer.bonds(); + Iterator bonds = atomContainer.bonds(); while (bonds.hasNext()) { IBond bond = (IBond) bonds.next(); if (bond.getAtomCount() != 2) throw new CDKException("We only consider 2 center bonds"); List tmp = new ArrayList(); - tmp.add( new Integer(atomContainer.getAtomNumber(bond.getAtom(0))) ); - tmp.add( new Integer(atomContainer.getAtomNumber(bond.getAtom(1))) ); + tmp.add(new Integer(atomContainer.getAtomNumber(bond.getAtom(0)))); + tmp.add(new Integer(atomContainer.getAtomNumber(bond.getAtom(1)))); fragments.add(tmp); } return fragments; Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/EccentricConnectivityIndexDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/EccentricConnectivityIndexDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/EccentricConnectivityIndexDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -26,6 +26,7 @@ import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IDescriptorResult; import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; @@ -144,6 +145,21 @@ IntegerResult retval = new IntegerResult(eccenindex); return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval, new String[] {"ECCEN"}); } + + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new IntegerResult(1); + } } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/FragmentComplexityDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/FragmentComplexityDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/FragmentComplexityDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -31,6 +31,7 @@ import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.result.DoubleResult; +import org.openscience.cdk.qsar.result.IDescriptorResult; /** * Class that returns the complexity of a system. The complexity is defined as @cdk.cite{Nilakantan06}: @@ -103,7 +104,7 @@ * @see #setParameters */ public Object[] getParameters() { - return null; + return null; // return the parameters as used for the descriptor calculation } @@ -111,37 +112,52 @@ /** * Calculate the complexity in the supplied {@link AtomContainer}. * - *@param ac The {@link AtomContainer} for which this descriptor is to be calculated + *@param container The {@link AtomContainer} for which this descriptor is to be calculated *@return the complexity *@see #setParameters */ public DescriptorValue calculate(IAtomContainer container) throws CDKException { - //System.out.println("FragmentComplexityDescriptor"); - int A=0; - double H=0; - for (int i=0; i<container.getAtomCount();i++){ - if (!container.getAtom(i).getSymbol().equals("H")){ - A++; - } - if (!container.getAtom(i).getSymbol().equals("H") & !container.getAtom(i).getSymbol().equals("C")){ - H++; - } - } - int B=container.getBondCount(); - double C=Math.abs(B*B-A*A+A)+(H/100); - //System.out.println("A:"+A+" B:"+B+" H:"+H+"H/100:"+H/100+" C:"+C); - return new DescriptorValue(getSpecification(), getParameterNames(), - getParameters(), new DoubleResult(C), new String[] { "fragC" }); + //System.out.println("FragmentComplexityDescriptor"); + int A=0; + double H=0; + for (int i=0; i<container.getAtomCount();i++){ + if (!container.getAtom(i).getSymbol().equals("H")){ + A++; + } + if (!container.getAtom(i).getSymbol().equals("H") & !container.getAtom(i).getSymbol().equals("C")){ + H++; + } + } + int B=container.getBondCount(); + double C=Math.abs(B*B-A*A+A)+(H/100); + //System.out.println("A:"+A+" B:"+B+" H:"+H+"H/100:"+H/100+" C:"+C); + return new DescriptorValue(getSpecification(), getParameterNames(), + getParameters(), new DoubleResult(C), new String[] { "fragC" }); } - /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new DoubleResult(0.0); + } + + + /** * Gets the parameterNames attribute of the FragmentComplexityDescriptor object. * *@return The parameterNames value */ public String[] getParameterNames() { - return null; + return null; } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/GravitationalIndexDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/GravitationalIndexDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/GravitationalIndexDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -31,6 +31,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.IDescriptorResult; import org.openscience.cdk.tools.LoggingTool; import java.util.Vector; @@ -42,7 +43,7 @@ * For modelling purposes the value of the descriptor is calculated * both with and without H atoms. Furthermore the square and cube roots * of the descriptor are also generated as described by Wessel et al. {@cdk.cite WES98}. - *<p> + * <p/> * The descriptor routine generates 9 descriptors: * <ul> * <li>GRAV-1 - gravitational index of heavy atoms @@ -55,36 +56,37 @@ * <li>GRAV-5 - grav2 for all pairs of atoms (not just bonded pairs) * <li>GRAV-6 - grav3 for all pairs of atoms (not just bonded pairs) * </ul> - * + * <p/> * <p>This descriptor uses these parameters: * <table border="1"> - * <tr> - * <td>Name</td> - * <td>Default</td> - * <td>Description</td> - * </tr> - * <tr> - * <td></td> - * <td></td> - * <td>no parameters</td> - * </tr> + * <tr> + * <td>Name</td> + * <td>Default</td> + * <td>Description</td> + * </tr> + * <tr> + * <td></td> + * <td></td> + * <td>no parameters</td> + * </tr> * </table> * - * @author Rajarshi Guha - * @cdk.created 2004-11-23 - * @cdk.module qsar - * @cdk.set qsar-descriptors + * @author Rajarshi Guha + * @cdk.created 2004-11-23 + * @cdk.module qsar + * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:gravitationalIndex - * * @cdk.keyword gravitational index * @cdk.keyword descriptor */ public class GravitationalIndexDescriptor implements IMolecularDescriptor { private LoggingTool logger; + private class pair { - int x,y; - public pair() { + int x, y; + + public pair() { x = 0; y = 0; } @@ -94,61 +96,64 @@ logger = new LoggingTool(this); } - public DescriptorSpecification getSpecification() { + public DescriptorSpecification getSpecification() { return new DescriptorSpecification( - "http://www.blueobelisk.org/ontologies/chemoinformatics-algorithms/#gravitationalIndex";, - this.getClass().getName(), - "$Id$", - "The Chemistry Development Kit"); - }; + "http://www.blueobelisk.org/ontologies/chemoinformatics-algorithms/#gravitationalIndex";, + this.getClass().getName(), + "$Id$", + "The Chemistry Development Kit"); + } + ; + /** - * Sets the parameters attribute of the GravitationalIndexDescriptor object. + * Sets the parameters attribute of the GravitationalIndexDescriptor object. * - *@param params The new parameters value - *@exception CDKException Description of the Exception - *@see #getParameters + * @param params The new parameters value + * @throws CDKException Description of the Exception + * @see #getParameters */ public void setParameters(Object[] params) throws CDKException { // no parameters for this descriptor } /** - * Gets the parameters attribute of the GravitationalIndexDescriptor object. + * Gets the parameters attribute of the GravitationalIndexDescriptor object. * - *@return The parameters value - *@see #setParameters + * @return The parameters value + * @see #setParameters */ public Object[] getParameters() { // no parameters to return - return(null); + return (null); } + /** - * Gets the parameterNames attribute of the GravitationalIndexDescriptor object. + * Gets the parameterNames attribute of the GravitationalIndexDescriptor object. * - *@return The parameterNames value + * @return The parameterNames value */ public String[] getParameterNames() { // no param names to return - return(null); + return (null); } /** - * Gets the parameterType attribute of the GravitationalIndexDescriptor object. + * Gets the parameterType attribute of the GravitationalIndexDescriptor object. * - *@param name Description of the Parameter - *@return The parameterType value + * @param name Description of the Parameter + * @return The parameterType value */ public Object getParameterType(String name) { - return (null); + return (null); } /** - * Calculates the 9 gravitational indices. + * Calculates the 9 gravitational indices. * - *@param container Parameter is the atom container. - *@return An ArrayList containing 9 elements in the order described above + * @param container Parameter is the atom container. + * @return An ArrayList containing 9 elements in the order described above */ public DescriptorValue calculate(IAtomContainer container) throws CDKException { @@ -163,14 +168,14 @@ double sum = 0; for (int i = 0; i < container.getBondCount(); i++) { - org.openscience.cdk.interfaces.IBond bond = container.getBond(i); + org.openscience.cdk.interfaces.IBond bond = container.getBond(i); if (bond.getAtomCount() != 2) { throw new CDKException("GravitationalIndex: Only handles 2 center bonds"); } - mass1 = factory.getMajorIsotope( bond.getAtom(0).getSymbol() ).getMassNumber(); - mass2 = factory.getMajorIsotope( bond.getAtom(1).getSymbol() ).getMassNumber(); + mass1 = factory.getMajorIsotope(bond.getAtom(0).getSymbol()).getMassNumber(); + mass2 = factory.getMajorIsotope(bond.getAtom(1).getSymbol()).getMassNumber(); double x1 = bond.getAtom(0).getPoint3d().x; double y1 = bond.getAtom(0).getPoint3d().y; @@ -179,27 +184,26 @@ double y2 = bond.getAtom(1).getPoint3d().y; double z2 = bond.getAtom(1).getPoint3d().z; - double dist = (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) + (z1-z2)*(z1-z2); - sum += (mass1*mass2) / dist; + double dist = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2); + sum += (mass1 * mass2) / dist; } // heavy atoms only double heavysum = 0; for (int i = 0; i < container.getBondCount(); i++) { - org.openscience.cdk.interfaces.IBond b = container.getBond(i); + org.openscience.cdk.interfaces.IBond b = container.getBond(i); if (b.getAtomCount() != 2) { throw new CDKException("GravitationalIndex: Only handles 2 center bonds"); } - if (b.getAtom(0).getSymbol().equals("H") || + if (b.getAtom(0).getSymbol().equals("H") || b.getAtom(1).getSymbol().equals("H")) continue; + mass1 = factory.getMajorIsotope(b.getAtom(0).getSymbol()).getMassNumber(); + mass2 = factory.getMajorIsotope(b.getAtom(1).getSymbol()).getMassNumber(); - mass1 = factory.getMajorIsotope( b.getAtom(0).getSymbol() ).getMassNumber(); - mass2 = factory.getMajorIsotope( b.getAtom(1).getSymbol() ).getMassNumber(); - double x1 = b.getAtom(0).getPoint3d().x; double y1 = b.getAtom(0).getPoint3d().y; double z1 = b.getAtom(0).getPoint3d().z; @@ -207,28 +211,28 @@ double y2 = b.getAtom(1).getPoint3d().y; double z2 = b.getAtom(1).getPoint3d().z; - double dist = (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) + (z1-z2)*(z1-z2); - heavysum += (mass1*mass2) / dist; + double dist = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2); + heavysum += (mass1 * mass2) / dist; } // all pairs Vector x = new Vector(); for (int i = 0; i < container.getAtomCount(); i++) { if (container.getAtom(i).getSymbol().equals("H")) continue; - else x.add( new Integer(i) ); + else x.add(new Integer(i)); } - int npair = x.size() * (x.size()-1) / 2; + int npair = x.size() * (x.size() - 1) / 2; pair[] p = new pair[npair]; for (int i = 0; i < npair; i++) p[i] = new pair(); int pcount = 0; - for (int i = 0; i < x.size()-1; i++) { - for (int j = i+1; j < x.size(); j++) { + for (int i = 0; i < x.size() - 1; i++) { + for (int j = i + 1; j < x.size(); j++) { int present = 0; - int a = ((Integer)x.get(i)).intValue(); - int b = ((Integer)x.get(j)).intValue(); + int a = ((Integer) x.get(i)).intValue(); + int b = ((Integer) x.get(j)).intValue(); for (int k = 0; k < pcount; k++) { - if ( (p[k].x == a && p[k].y == b) || - (p[k].y == a && p[k].x == b) ) present = 1; + if ((p[k].x == a && p[k].y == b) || + (p[k].y == a && p[k].x == b)) present = 1; } if (present == 1) continue; p[pcount].x = a; @@ -241,8 +245,8 @@ int atomNumber1 = p[i].x; int atomNumber2 = p[i].y; - mass1 = factory.getMajorIsotope( container.getAtom(atomNumber1).getSymbol() ).getMassNumber(); - mass2 = factory.getMajorIsotope( container.getAtom(atomNumber2).getSymbol() ).getMassNumber(); + mass1 = factory.getMajorIsotope(container.getAtom(atomNumber1).getSymbol()).getMassNumber(); + mass2 = factory.getMajorIsotope(container.getAtom(atomNumber2).getSymbol()).getMassNumber(); double x1 = container.getAtom(atomNumber1).getPoint3d().x; double y1 = container.getAtom(atomNumber1).getPoint3d().y; @@ -251,24 +255,24 @@ double y2 = container.getAtom(atomNumber2).getPoint3d().y; double z2 = container.getAtom(atomNumber2).getPoint3d().z; - double dist = (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) + (z1-z2)*(z1-z2); - allheavysum += (mass1*mass2) / dist; + double dist = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2); + allheavysum += (mass1 * mass2) / dist; } DoubleArrayResult retval = new DoubleArrayResult(9); - retval.add( heavysum ); - retval.add( Math.sqrt(heavysum) ); - retval.add( Math.pow(heavysum,1.0/3.0) ); - - retval.add( sum ); - retval.add( Math.sqrt(sum) ); - retval.add( Math.pow(sum,1.0/3.0) ); - - retval.add( allheavysum ); - retval.add( Math.sqrt(allheavysum) ); - retval.add( Math.pow(allheavysum,1.0/3.0) ); + retval.add(heavysum); + retval.add(Math.sqrt(heavysum)); + retval.add(Math.pow(heavysum, 1.0 / 3.0)); + retval.add(sum); + retval.add(Math.sqrt(sum)); + retval.add(Math.pow(sum, 1.0 / 3.0)); + + retval.add(allheavysum); + retval.add(Math.sqrt(allheavysum)); + retval.add(Math.pow(allheavysum, 1.0 / 3.0)); + String[] names = { "GRAV-1", "GRAV-2", "GRAV-3", "GRAVH-1", "GRAVH-2", "GRAVH-3", @@ -276,6 +280,22 @@ }; return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval, names); } + + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new DoubleArrayResult(); + } + } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondAcceptorCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondAcceptorCountDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondAcceptorCountDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -32,6 +32,7 @@ import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IDescriptorResult; import org.openscience.cdk.qsar.result.IntegerResult; /** @@ -159,7 +160,7 @@ if(ac.getAtom(atomIndex).getSymbol().equals("O") && ac.getAtom(atomIndex).getFormalCharge() <= 0) { //excluding oxygens that are adjacent to a nitrogen or to an aromatic carbon - java.util.List neighbours = ac.getConnectedAtomsList(ac.getAtom(atomIndex)); + java.util.List neighbours = ac.getConnectedAtomsList(ac.getAtom(atomIndex)); for(int neighbourIndex = 0; neighbourIndex < neighbours.size(); neighbourIndex++) if(((IAtom)neighbours.get(neighbourIndex)).getSymbol().equals("N") || (((IAtom)neighbours.get(neighbourIndex)).getSymbol().equals("C") && ((IAtom)neighbours.get(neighbourIndex)).getFlag(CDKConstants.ISAROMATIC))) @@ -173,6 +174,21 @@ } /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new IntegerResult(1); + } + + /** * Gets the parameterNames attribute of the HBondAcceptorCountDescriptor object. * * @return The parameterNames value Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondDonorCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondDonorCountDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/HBondDonorCountDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -30,6 +30,7 @@ import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IDescriptorResult; import org.openscience.cdk.qsar.result.IntegerResult; /** @@ -128,7 +129,7 @@ atomloop: for(int atomIndex = 0; atomIndex < ac.getAtomCount(); atomIndex++) { - IAtom atom = (IAtom)ac.getAtom(atomIndex); + IAtom atom = (IAtom)ac.getAtom(atomIndex); // checking for O and N atoms where the formal charge is >= 0 if((atom.getSymbol().equals("O") || atom.getSymbol().equals("N")) && atom.getFormalCharge() >= 0) { @@ -155,7 +156,22 @@ new IntegerResult(hBondDonors), new String[] {"nHBDon"}); } + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new IntegerResult(1); + } + /** * Gets the parameterNames of the HBondDonorCountDescriptor. * Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/IPMolecularDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/IPMolecularDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/IPMolecularDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -20,8 +20,6 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; -import java.util.Iterator; - import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; @@ -34,7 +32,10 @@ import org.openscience.cdk.qsar.descriptors.bond.IPBondDescriptor; import org.openscience.cdk.qsar.result.DoubleArrayResult; import org.openscience.cdk.qsar.result.DoubleResult; +import org.openscience.cdk.qsar.result.IDescriptorResult; +import java.util.Iterator; + /** * This class returns the ionization potential of a molecule. It is * based on a decision tree which is extracted from Weka(J48) from @@ -67,9 +68,9 @@ */ public class IPMolecularDescriptor implements IMolecularDescriptor { - /** parameter for inizate IReactionSet*/ - private boolean setEnergy = false; - private IReactionSet reactionSet; + /** parameter for inizate IReactionSet*/ + private boolean setEnergy = false; + private IReactionSet reactionSet; /** * Constructor for the IPMolecularDescriptor object */ @@ -120,61 +121,77 @@ *@exception CDKException Possible Exceptions */ public DescriptorValue calculate(IAtomContainer atomContainer) throws CDKException { - reactionSet = atomContainer.getBuilder().newReactionSet(); - DoubleArrayResult dar = new DoubleArrayResult(); - IPAtomicDescriptor descriptorA = new IPAtomicDescriptor(); - Iterator itA = atomContainer.atoms(); - while(itA.hasNext()){ - IAtom atom = (IAtom) itA.next(); - double result = -1; - if(setEnergy){ - IReactionSet irs = descriptorA.getReactionSet(atom,atomContainer); - if(irs.getReactionCount() > 0){ - Iterator iter = irs.reactions(); - while(iter.hasNext()){ - reactionSet.addReaction((IReaction)iter.next()); - } - } - - }else - result = ((DoubleResult)descriptorA.calculate(atom,atomContainer).getValue()).doubleValue(); - - if(result != -1) - dar.add(result); - } - - IPBondDescriptor descriptorB = new IPBondDescriptor(); - for(int i = 0; i < atomContainer.getBondCount(); i++){ - double result = -1; - if(setEnergy){ - IReactionSet irs = descriptorB.getReactionSet(atomContainer.getBond(i),atomContainer); - if(irs.getReactionCount() > 0){ - Iterator iter = irs.reactions(); - while(iter.hasNext()){ - reactionSet.addReaction((IReaction)iter.next()); - } - } - }else - result = ((DoubleResult)descriptorB.calculate(atomContainer.getBond(i),atomContainer).getValue()).doubleValue(); - - if(result != -1) - dar.add(result); - } - return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), dar); + reactionSet = atomContainer.getBuilder().newReactionSet(); + DoubleArrayResult dar = new DoubleArrayResult(); + IPAtomicDescriptor descriptorA = new IPAtomicDescriptor(); + Iterator itA = atomContainer.atoms(); + while(itA.hasNext()){ + IAtom atom = (IAtom) itA.next(); + double result = -1; + if(setEnergy){ + IReactionSet irs = descriptorA.getReactionSet(atom,atomContainer); + if(irs.getReactionCount() > 0){ + Iterator iter = irs.reactions(); + while(iter.hasNext()){ + reactionSet.addReaction((IReaction)iter.next()); + } + } + + }else + result = ((DoubleResult)descriptorA.calculate(atom,atomContainer).getValue()).doubleValue(); + + if(result != -1) + dar.add(result); + } + + IPBondDescriptor descriptorB = new IPBondDescriptor(); + for(int i = 0; i < atomContainer.getBondCount(); i++){ + double result = -1; + if(setEnergy){ + IReactionSet irs = descriptorB.getReactionSet(atomContainer.getBond(i),atomContainer); + if(irs.getReactionCount() > 0){ + Iterator iter = irs.reactions(); + while(iter.hasNext()){ + reactionSet.addReaction((IReaction)iter.next()); + } + } + }else + result = ((DoubleResult)descriptorB.calculate(atomContainer.getBond(i),atomContainer).getValue()).doubleValue(); + + if(result != -1) + dar.add(result); + } + return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), dar); } + /** - * This method calculates the ionization potential of a molecule and set the ionization - * energy into each reaction as property - * - * @return The IReactionSet value - */ - public IReactionSet getReactionSet(IAtomContainer container) throws CDKException{ - setEnergy = true; - calculate(container); - return reactionSet; - } + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new DoubleArrayResult(); + } + /** + * This method calculates the ionization potential of a molecule and set the ionization + * energy into each reaction as property + * + * @return The IReactionSet value + */ + public IReactionSet getReactionSet(IAtomContainer container) throws CDKException{ + setEnergy = true; + calculate(container); + return reactionSet; + } + /** * Gets the parameterNames attribute of the IPMolecularDescriptor object * Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/KappaShapeIndicesDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/KappaShapeIndicesDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/KappaShapeIndicesDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -31,44 +31,44 @@ 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.IDescriptorResult; import java.util.ArrayList; /** - * Kier and Hall kappa molecular shape indices compare the molecular graph with minimal and maximal molecular graphs; - * a description is given at: http://www.chemcomp.com/Journal_of_CCG/Features/descr.htm#KH : - * "they are intended to capture different aspects of molecular shape. - * In the following description, n denotes the number of atoms in the hydrogen suppressed graph, - * m is the number of bonds in the hydrogen suppressed graph. Also, let p2 denote the number of paths of length 2 - * and let p3 denote the number of paths of length 3". - * + * Kier and Hall kappa molecular shape indices compare the molecular graph with minimal and maximal molecular graphs; + * a description is given at: http://www.chemcomp.com/Journal_of_CCG/Features/descr.htm#KH : + * "they are intended to capture different aspects of molecular shape. + * In the following description, n denotes the number of atoms in the hydrogen suppressed graph, + * m is the number of bonds in the hydrogen suppressed graph. Also, let p2 denote the number of paths of length 2 + * and let p3 denote the number of paths of length 3". + * <p/> * Returns three values in the order * <ol> * <li>Kier1 - First kappa shape index * <li>Kier2 - Second kappa shape index * <li>Kier3 - Third kappa (κ) shape index * </ol> - * + * <p/> * <p>This descriptor uses these parameters: * <table border="1"> - * <tr> - * <td>Name</td> - * <td>Default</td> - * <td>Description</td> - * </tr> - * <tr> - * <td></td> - * <td></td> - * <td>no parameters</td> - * </tr> + * <tr> + * <td>Name</td> + * <td>Default</td> + * <td>Description</td> + * </tr> + * <tr> + * <td></td> + * <td></td> + * <td>no parameters</td> + * </tr> * </table> * - * @author mfe4 + * @author mfe4 * @cdk.created 2004-11-03 - * @cdk.module qsar - * @cdk.set qsar-descriptors + * @cdk.module qsar + * @cdk.set qsar-descriptors * @cdk.dictref qsar-descriptors:kierValues - * * @cdk.keyword Kappe shape index * @cdk.keyword descriptor */ @@ -77,33 +77,35 @@ private ArrayList singlePaths = null; private ArrayList doublePaths = null; private ArrayList triplePaths = null; + /** - * Constructor for the KappaShapeIndicesDescriptor object + * Constructor for the KappaShapeIndicesDescriptor object */ - public KappaShapeIndicesDescriptor() { } + public KappaShapeIndicesDescriptor() { + } /** - * Gets the specification attribute of the - * KappaShapeIndicesDescriptor object + * Gets the specification attribute of the + * KappaShapeIndicesDescriptor object * - *@return The specification value + * @return The specification value */ public DescriptorSpecification getSpecification() { return new DescriptorSpecification( - "http://www.blueobelisk.org/ontologies/chemoinformatics-algorithms/#kierValues";, - this.getClass().getName(), - "$Id$", - "The Chemistry Development Kit"); + "http://www.blueobelisk.org/ontologies/chemoinformatics-algorithms/#kierValues";, + this.getClass().getName(), + "$Id$", + "The Chemistry Development Kit"); } /** - * Sets the parameters attribute of the - * KappaShapeIndicesDescriptor object + * Sets the parameters attribute of the + * KappaShapeIndicesDescriptor object * - *@param params The new parameters value - *@exception CDKException Description of the Exception + * @param params The new parameters value + * @throws CDKException Description of the Exception */ public void setParameters(Object[] params) throws CDKException { // no parameters for this descriptor @@ -111,10 +113,10 @@ /** - * Gets the parameters attribute of the - * KappaShapeIndicesDescriptor object + * Gets the parameters attribute of the + * KappaShapeIndicesDescriptor object * - *@return The parameters value + * @return The parameters value */ public Object[] getParameters() { // no parameters to return @@ -123,11 +125,11 @@ /** - * calculates the kier shape indices for an atom container + * calculates the kier shape indices for an atom container * - *@param atomContainer AtomContainer - *@return kier1, kier2 and kier3 are returned as arrayList of doubles - *@exception CDKException Possible Exceptions + * @param atomContainer AtomContainer + * @return kier1, kier2 and kier3 are returned as arrayList of doubles + * @throws CDKException Possible Exceptions */ public DescriptorValue calculate(IAtomContainer atomContainer) throws CDKException { @@ -155,15 +157,15 @@ bond1 = 0; firstAtomNeighboors = atomContainer.getConnectedAtomsList(atomContainer.getAtom(a1)); for (int a2 = 0; a2 < firstAtomNeighboors.size(); a2 ++) { - bond1 = atomContainer.getBondNumber( atomContainer.getAtom(a1), (IAtom)firstAtomNeighboors.get(a2) ); - if(!singlePaths.contains(new Double(bond1))) { + bond1 = atomContainer.getBondNumber(atomContainer.getAtom(a1), (IAtom) firstAtomNeighboors.get(a2)); + if (!singlePaths.contains(new Double(bond1))) { singlePaths.add(new Double(bond1)); java.util.Collections.sort(singlePaths); } - secondAtomNeighboors = atomContainer.getConnectedAtomsList((IAtom)firstAtomNeighboors.get(a2)); + secondAtomNeighboors = atomContainer.getConnectedAtomsList((IAtom) firstAtomNeighboors.get(a2)); for (int a3 = 0; a3 < secondAtomNeighboors.size(); a3 ++) { - bond2 = atomContainer.getBondNumber( (IAtom)firstAtomNeighboors.get(a2), (IAtom)secondAtomNeighboors.get(a3) ); - if(!singlePaths.contains(new Double(bond2))) { + bond2 = atomContainer.getBondNumber((IAtom) firstAtomNeighboors.get(a2), (IAtom) secondAtomNeighboors.get(a3)); + if (!singlePaths.contains(new Double(bond2))) { singlePaths.add(new Double(bond2)); } sorterFirst[0] = bond1; @@ -172,13 +174,13 @@ tmpbond2 = sorterFirst[0] + "+" + sorterFirst[1]; - if(!doublePaths.contains(tmpbond2) && (bond1 != bond2)) { + if (!doublePaths.contains(tmpbond2) && (bond1 != bond2)) { doublePaths.add(tmpbond2); } - thirdAtomNeighboors = atomContainer.getConnectedAtomsList((IAtom)secondAtomNeighboors.get(a3)); + thirdAtomNeighboors = atomContainer.getConnectedAtomsList((IAtom) secondAtomNeighboors.get(a3)); for (int a4 = 0; a4 < thirdAtomNeighboors.size(); a4 ++) { - bond3 = atomContainer.getBondNumber( (IAtom)secondAtomNeighboors.get(a3), (IAtom)thirdAtomNeighboors.get(a4) ); - if(!singlePaths.contains(new Double(bond3))) { + bond3 = atomContainer.getBondNumber((IAtom) secondAtomNeighboors.get(a3), (IAtom) thirdAtomNeighboors.get(a4)); + if (!singlePaths.contains(new Double(bond3))) { singlePaths.add(new Double(bond3)); } sorterSecond[0] = bond1; @@ -187,8 +189,8 @@ java.util.Arrays.sort(sorterSecond); tmpbond3 = sorterSecond[0] + "+" + sorterSecond[1] + "+" + sorterSecond[2]; - if(!triplePaths.contains(tmpbond3)) { - if((bond1 != bond2) && (bond1 != bond3) && (bond2 != bond3)) { + if (!triplePaths.contains(tmpbond3)) { + if ((bond1 != bond2) && (bond1 != bond3) && (bond2 != bond3)) { triplePaths.add(tmpbond3); } } @@ -197,31 +199,30 @@ } } - if(atomsCount == 1) { + if (atomsCount == 1) { kier1 = 0; kier2 = 0; kier3 = 0; - } - else { - kier1 = ( ( (atomsCount) * ( (atomsCount - 1) * (atomsCount - 1) ) ) / ( singlePaths.size() * singlePaths.size() ) ); - if(atomsCount == 2) { + } else { + kier1 = (((atomsCount) * ((atomsCount - 1) * (atomsCount - 1))) / (singlePaths.size() * singlePaths.size())); + if (atomsCount == 2) { kier2 = 0; kier3 = 0; - } - else { + } else { if (doublePaths.size() == 0) kier2 = Double.NaN; - else kier2 = ( ( (atomsCount - 1) * ( (atomsCount - 2) * (atomsCount - 2) ) ) / ( doublePaths.size() * doublePaths.size() ) ); - if(atomsCount == 3) { + else + kier2 = (((atomsCount - 1) * ((atomsCount - 2) * (atomsCount - 2))) / (doublePaths.size() * doublePaths.size())); + if (atomsCount == 3) { kier3 = 0; - } - else { - if(atomsCount % 2 != 0) { + } else { + if (atomsCount % 2 != 0) { if (triplePaths.size() == 0) kier3 = Double.NaN; - else kier3 = ( ( (atomsCount - 1) * ( (atomsCount - 3) * (atomsCount - 3) ) ) / ( triplePaths.size() * triplePaths.size() ) ); - } - else { + else + kier3 = (((atomsCount - 1) * ((atomsCount - 3) * (atomsCount - 3))) / (triplePaths.size() * triplePaths.size())); + } else { if (triplePaths.size() == 0) kier3 = Double.NaN; - else kier3 = ( ( (atomsCount - 3) * ( (atomsCount - 2) * (atomsCount - 2) ) ) / ( triplePaths.size() * triplePaths.size() ) ); + else + kier3 = (((atomsCount - 3) * ((atomsCount - 2) * (atomsCount - 2))) / (triplePaths.size() * triplePaths.size())); } } } @@ -231,15 +232,30 @@ kierValues.add(kier2); kierValues.add(kier3); return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), kierValues, - new String[] {"Kier1", "Kier2", "Kier3"}); + new String[]{"Kier1", "Kier2", "Kier3"}); } + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new DoubleArrayResult(); + } + /** - * Gets the parameterNames attribute of the - * KappaShapeIndicesDescriptor object + * Gets the parameterNames attribute of the + * KappaShapeIndicesDescriptor object * - *@return The parameterNames value + * @return The parameterNames value */ public String[] getParameterNames() { // no param names to return @@ -247,13 +263,12 @@ } - /** - * Gets the parameterType attribute of the - * KappaShapeIndicesDescriptor object + * Gets the parameterType attribute of the + * KappaShapeIndicesDescriptor object * - *@param name Description of the Parameter - *@return The parameterType value + * @param name Description of the Parameter + * @return The parameterType value */ public Object getParameterType(String name) { return (null); Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestChainDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestChainDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestChainDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -35,6 +35,7 @@ import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IDescriptorResult; import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.ringsearch.AllRingsFinder; import org.openscience.cdk.ringsearch.SSSRFinder; @@ -220,6 +221,21 @@ } /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new IntegerResult(1); + } + + /** * Performs a breadthFirstSearch in an AtomContainer starting with a * particular sphere, which usually consists of one start atom, and searches * for a pi system. Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestPiSystemDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestPiSystemDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LargestPiSystemDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -35,6 +35,7 @@ import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IDescriptorResult; import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.ringsearch.AllRingsFinder; @@ -189,6 +190,21 @@ } /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new IntegerResult(1); + } + + /** * Performs a breadthFirstSearch in an AtomContainer starting with a * particular sphere, which usually consists of one start atom, and searches * for a pi system. Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LengthOverBreadthDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LengthOverBreadthDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LengthOverBreadthDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -10,6 +10,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.IDescriptorResult; import org.openscience.cdk.tools.LoggingTool; import javax.vecmath.Point3d; @@ -152,6 +153,21 @@ result, new String[] {"LOBMAX", "LOBMIN"}); } + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new DoubleArrayResult(); + } + private void rotateZ(double[][] coords, double theta) { int natom = coords.length; Matrix rZ = new Matrix(4, 4); Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LongestAliphaticChainDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LongestAliphaticChainDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/LongestAliphaticChainDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -36,6 +36,7 @@ import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IDescriptorResult; import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.ringsearch.SSSRFinder; @@ -198,16 +199,31 @@ new IntegerResult(longestChainAtomsCount), new String[] {"nAtomLAC"}); } + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new IntegerResult(1); + } + private int getLongestChainPath(int[][] apsp){ - int longestPath=0; - for (int i = 0; i < apsp.length; i++){ - for (int j = 0; j < apsp.length; j++){ - if (apsp[i][j]+1 > longestPath){ - longestPath = apsp[i][j]+1; - } - } - } - return longestPath; + int longestPath=0; + for (int i = 0; i < apsp.length; i++){ + for (int j = 0; j < apsp.length; j++){ + if (apsp[i][j]+1 > longestPath){ + longestPath = apsp[i][j]+1; + } + } + } + return longestPath; } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/MDEDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/MDEDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/MDEDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -28,6 +28,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.IDescriptorResult; import org.openscience.cdk.tools.LoggingTool; import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; @@ -205,6 +206,21 @@ getParameterNames(), getParameters(), retval, names); } + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new DoubleArrayResult(); + } + private double dedge(IAtomContainer atomContainer, int which) { int[][] adjMatrix = AdjacencyMatrix.getMatrix(atomContainer); int[][] tdist = PathTools.computeFloydAPSP(adjMatrix); Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/MomentOfInertiaDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/MomentOfInertiaDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/MomentOfInertiaDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -29,6 +29,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.IDescriptorResult; import org.openscience.cdk.tools.LoggingTool; import org.openscience.cdk.tools.MFAnalyser; @@ -234,6 +235,21 @@ return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval, names); } + + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new DoubleArrayResult(); + } } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanNumberDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanNumberDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanNumberDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -32,6 +32,7 @@ import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.result.DoubleResult; +import org.openscience.cdk.qsar.result.IDescriptorResult; /** @@ -157,6 +158,21 @@ } /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new DoubleResult(0.0); + } + + /** * Gets the parameterNames attribute of the PetitjeanNumberDescriptor object * *@return The parameterNames value Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanShapeIndexDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanShapeIndexDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanShapeIndexDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -27,6 +27,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.IDescriptorResult; import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; import javax.vecmath.Point3d; @@ -178,6 +179,21 @@ return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval, new String[] {"topoShape", "geomShape"}); } + + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new DoubleArrayResult(); + } } Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/RotatableBondsCountDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/RotatableBondsCountDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/RotatableBondsCountDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -24,9 +24,6 @@ */ package org.openscience.cdk.qsar.descriptors.molecular; -import java.util.Iterator; -import java.util.List; - import org.openscience.cdk.CDKConstants; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.interfaces.IAtom; @@ -36,9 +33,13 @@ import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; +import org.openscience.cdk.qsar.result.IDescriptorResult; import org.openscience.cdk.qsar.result.IntegerResult; import org.openscience.cdk.ringsearch.AllRingsFinder; +import java.util.Iterator; +import java.util.List; + /** * The number of rotatable bonds is given by the SMARTS specified by Daylight on * <a href="http://www.daylight.com/dayhtml_tutorials/languages/smarts/smarts_examples.html#EXMPL">SMARTS tutorial</a><p> @@ -176,21 +177,36 @@ new String[] { includeTerminals ? "nRotBt" : "nRotB"}); } + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new IntegerResult(1); + } - /** - * Gets the parameterNames attribute of the RotatableBondsCountDescriptor - * object - * - *@return The parameterNames value - */ - public String[] getParameterNames() { - String[] params = new String[1]; - params[0] = "includeTerminals"; - return params; - } + /** + * Gets the parameterNames attribute of the RotatableBondsCountDescriptor + * object + * + *@return The parameterNames value + */ + public String[] getParameterNames() { + String[] params = new String[1]; + params[0] = "includeTerminals"; + return params; + } + /** * Gets the parameterType attribute of the RotatableBondsCountDescriptor * object Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/RuleOfFiveDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/RuleOfFiveDescriptor.java 2007-02-01 19:34:23 UTC (rev 7843) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/RuleOfFiveDescriptor.java 2007-02-01 19:46:29 UTC (rev 7844) @@ -29,6 +29,7 @@ import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IMolecularDescriptor; import org.openscience.cdk.qsar.result.DoubleResult; +import org.openscience.cdk.qsar.result.IDescriptorResult; import org.openscience.cdk.qsar.result.IntegerResult; /** @@ -148,8 +149,8 @@ IMolecularDescriptor xlogP = new XLogPDescriptor(); Object[] xlogPparams = { - new Boolean(checkAromaticity), - Boolean.TRUE, + new Boolean(checkAromaticity), + Boolean.TRUE, }; xlogP.setParameters(xlogPparams); double xlogPvalue = ((DoubleResult)xlogP.calculate(mol).getValue()).doubleValue(); @@ -183,7 +184,22 @@ new String[] {"LipinksiFailures"}); } + /** + * Returns the specific type of the DescriptorResult object. + * <p/> + * The return value from this method really indicates what type of result will + * be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result + * can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method + * allows you to do the same thing, without actually calculating the descriptor. + * + * @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 + */ + public IDescriptorResult getDescriptorResultType() { + return new IntegerResult(1); + } + /** * Gets the parameterNames attribute of the RuleOfFiveDescriptor object. * Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/molecular/TPSADescriptor.java @@ Diff output truncated at 100000 characters. @@ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <egonw@us...> - 2007-12-31 13:47:01
|
Revision: 9755 http://cdk.svn.sourceforge.net/cdk/?rev=9755&view=rev Author: egonw Date: 2007-12-31 05:46:53 -0800 (Mon, 31 Dec 2007) Log Message: ----------- Fixed copyright line; add details on descriptor length depending on parameter values Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/qsar/IAtomicDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/IBondDescriptor.java trunk/cdk/src/org/openscience/cdk/qsar/IMolecularDescriptor.java Modified: trunk/cdk/src/org/openscience/cdk/qsar/IAtomicDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/IAtomicDescriptor.java 2007-12-31 13:39:09 UTC (rev 9754) +++ trunk/cdk/src/org/openscience/cdk/qsar/IAtomicDescriptor.java 2007-12-31 13:46:53 UTC (rev 9755) @@ -1,9 +1,6 @@ -/* $RCSfile$ - * $Author: egonw $ - * $Date: 2006-03-29 10:27:08 +0200 (Wed, 29 Mar 2006) $ - * $Revision: 5855 $ +/* $Revision: 5855 $ $Author: egonw $ $Date: 2006-03-29 10:27:08 +0200 (Wed, 29 Mar 2006) $ * - * Copyright (C) 2002-2007 The Chemistry Development Kit (CDK) project + * Copyright (C) 2006-2007 Egon Willighagen <egonw@...> * * Contact: cdk-devel@... * Modified: trunk/cdk/src/org/openscience/cdk/qsar/IBondDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/IBondDescriptor.java 2007-12-31 13:39:09 UTC (rev 9754) +++ trunk/cdk/src/org/openscience/cdk/qsar/IBondDescriptor.java 2007-12-31 13:46:53 UTC (rev 9755) @@ -1,9 +1,6 @@ -/* $RCSfile$ - * $Author: egonw $ - * $Date: 2006-03-29 10:27:08 +0200 (Wed, 29 Mar 2006) $ - * $Revision: 5855 $ +/* $Revision: 5855 $ $Author: egonw $ $Date: 2006-03-29 10:27:08 +0200 (Wed, 29 Mar 2006) $ * - * Copyright (C) 2002-2007 The Chemistry Development Kit (CDK) project + * Copyright (C) 2006-2007 Egon Willighagen <egonw@...> * * Contact: cdk-devel@... * Modified: trunk/cdk/src/org/openscience/cdk/qsar/IMolecularDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/IMolecularDescriptor.java 2007-12-31 13:39:09 UTC (rev 9754) +++ trunk/cdk/src/org/openscience/cdk/qsar/IMolecularDescriptor.java 2007-12-31 13:46:53 UTC (rev 9755) @@ -1,9 +1,6 @@ -/* $RCSfile$ - * $Author: egonw $ - * $Date: 2006-03-29 10:27:08 +0200 (Wed, 29 Mar 2006) $ - * $Revision: 5855 $ +/* $Revision: 5855 $ $Author: egonw $ $Date: 2006-03-29 10:27:08 +0200 (Wed, 29 Mar 2006) $ * - * Copyright (C) 2002-2007 The Chemistry Development Kit (CDK) project + * Copyright (C) 2006-2007 Egon Willighagen <egonw@...> * * Contact: cdk-devel@... * @@ -28,7 +25,8 @@ import org.openscience.cdk.qsar.result.IDescriptorResult; /** - * Classes that implement this interface are QSAR descriptor calculators. + * Classes that implement this interface are QSAR descriptor calculators + * for <code>IMolecule</code> objects. * * @cdk.module qsar * @cdk.svnrev $Revision: 9162 $ @@ -49,11 +47,15 @@ /** * Returns the specific type of the DescriptorResult object. - * <p/> * The return value from this method really indicates what type of result will * be obtained from the {@link DescriptorValue} object. Note that the same result * can be achieved by interrogating the {@link DescriptorValue} object; this method * allows you to do the same thing, without actually calculating the descriptor. + * + * <p>Additionally, the length indicated by the result type must match the actual + * length of a descriptor calculated with the current parameters. Typically, the + * length of array result types vary with the values of the parameters. See + * {@link IDescriptor} for more details. * * @return an object that implements the {@link IDescriptorResult} interface indicating * the actual type of values returned by the descriptor in the {@link DescriptorValue} object This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |