Permalink
Browse files

Updated issues in Javadocs, copyright and method names

  • Loading branch information...
rajarshi authored and egonw committed Nov 5, 2010
1 parent 133f314 commit dee515eaffe22f1973297697f2abea1df81279b9
@@ -1,8 +1,7 @@
-/* $Revision$ $Author$ $Date$
- *
+/*
* Copyright (C) 2010 Rajarshi Guha <rajarshi.guha@gmail.com>
*
- * Contact: rajarshi.guha@gmail.com
+ * Contact: cdk-devel@lists.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -39,7 +38,7 @@
/**
* An implementation of the LINGO fingerprint {@cdk.cite Vidal2005}.
- *
+ * <p>
* While the current implementation converts ring closure symbols to 0's
* it does not convert 2-letter element symbols to single letters (ala
* OpenEye).
@@ -79,7 +78,7 @@ public BitSet getFingerprint(IAtomContainer iAtomContainer) throws CDKException
@TestMethod("testFingerprint")
public Map<String, Integer> getRawFingerprint(IAtomContainer atomContainer) throws CDKException {
- String smiles = refactorSmnile(gen.createSMILES(atomContainer));
+ String smiles = refactorSmiles(gen.createSMILES(atomContainer));
Map<String, Integer> map = new HashMap<String,Integer>();
for (int i = 0; i < smiles.length()-q+1; i++) {
String subsmi = smiles.substring(i, i+q);
@@ -94,7 +93,7 @@ public int getSize() {
return -1;
}
- private String refactorSmnile(String smiles) {
+ private String refactorSmiles(String smiles) {
Matcher matcher = ringClosurePattern.matcher(smiles);
return matcher.replaceAll("0");
}
@@ -2,7 +2,7 @@
*
* Copyright (C) 2010 Rajarshi Guha <rajarshi.guha@gmail.com>
*
- * Contact: rajarshi.guha@gmail.com
+ * Contact: cdk-devel@lists.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -33,6 +33,9 @@
/**
* A class to evaluate the similarity between two LINGO's as described in {@cdk.cite Vidal2005}.
*
+ * The similarity calculation is a variant of the Tanimoto coefficient and hence its
+ * value ranges from 0 to 1
+ *
* @author Rajarshi Guha
* @cdk.githash
* @cdk.keyword lingo
@@ -41,6 +44,19 @@
*/
@TestClass("org.openscience.cdk.similarity.LingoTest")
public class LingoSimilarity {
+
+ private LingoSimilarity() {
+ }
+
+ /**
+ * Evaluate the LINGO similarity between two key,value sty;e fingerprints.
+ *
+ * The value will range from 0.0 to 1.0.
+ *
+ * @param features1
+ * @param features2
+ * @return
+ */
@TestMethod("testLingoSim")
public static float calculate(Map<String, Integer> features1, Map<String, Integer> features2) {
TreeSet<String> keys = new TreeSet<String>(features1.keySet());
@@ -70,9 +70,12 @@
public class Tanimoto
{
+ private Tanimoto() {
+ }
+
/**
* Evaluates Tanimoto coefficient for two bit sets.
- *
+ * <p>
* @param bitset1 A bitset (such as a fingerprint) for the first molecule
* @param bitset2 A bitset (such as a fingerprint) for the second molecule
* @return The Tanimoto coefficient
@@ -94,7 +97,7 @@ public static float calculate(BitSet bitset1, BitSet bitset2) throws CDKExceptio
/**
* Evaluates the continuous Tanimoto coefficient for two real valued vectors.
- *
+ * <p>
* @param features1 The first feature vector
* @param features2 The second feature vector
* @return The continuous Tanimoto coefficient
@@ -122,7 +125,7 @@ public static float calculate(double[] features1, double[] features2) throws CDK
/**
* Evaluate continuous Tanimoto coefficient for two feature,count fingerprint representations.
- *
+ * <p>
* Note that feature/count type fingerprints may not be of the same length.
*
* @param features1 The first feature map
@@ -1,8 +1,7 @@
-/* $Revision$ $Author$ $Date$
- *
+/*
* Copyright (C) 2010 Rajarshi Guha <rajarshi.guha@gmail.com>
*
- * Contact: rajarshi.guha@gmail.com
+ * Contact: cdk-devel@lists.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -40,7 +39,7 @@
boolean standAlone = false;
public IFingerprinter getFingerprinter() {
- return new Fingerprinter();
+ return new LingoFingerprinter();
}
@Test
@@ -26,9 +26,11 @@
import org.openscience.cdk.coverage.FingerprintCoverageTest;
import org.openscience.cdk.fingerprint.EStateFingerprinterTest;
import org.openscience.cdk.fingerprint.ExtendedFingerprinterTest;
+import org.openscience.cdk.fingerprint.LingoFingerprinterTest;
import org.openscience.cdk.fingerprint.MACCSFingerprinterTest;
import org.openscience.cdk.fingerprint.PubchemFingerprinterTest;
import org.openscience.cdk.similarity.DistanceMomentTest;
+import org.openscience.cdk.similarity.LingoSimilarityTest;
import org.openscience.cdk.similarity.TanimotoTest;
/**
@@ -43,8 +45,10 @@
ExtendedFingerprinterTest.class,
MACCSFingerprinterTest.class,
EStateFingerprinterTest.class,
- PubchemFingerprinterTest.class,
+ PubchemFingerprinterTest.class,
+ LingoFingerprinterTest.class,
DistanceMomentTest.class,
- TanimotoTest.class
+ TanimotoTest.class,
+ LingoSimilarityTest.class
})
public class MfingerprintTests {}
@@ -1,8 +1,8 @@
-/* $Revision$ $Author$ $Date$
+/*
*
* Copyright (C) 2010 Rajarshi Guha <rajarshi.guha@gmail.com>
*
- * Contact: rajarshi.guha@gmail.com
+ * Contact: cdk-devel@lists.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -39,8 +39,6 @@
*/
public class LingoSimilarityTest extends CDKTestCase {
- boolean standAlone = false;
-
@Test
public void testLingoSim() throws Exception {
Molecule mol1 = MoleculeFactory.makeIndole();
@@ -49,8 +47,7 @@ public void testLingoSim() throws Exception {
Map<String, Integer> bs1 = fingerprinter.getRawFingerprint(mol1);
Map<String, Integer> bs2 = fingerprinter.getRawFingerprint(mol2);
float lingosim = LingoSimilarity.calculate(bs1, bs2);
- if (standAlone) System.out.println("LingoSimilarity similarity: " + lingosim);
- if (!standAlone) Assert.assertEquals(1.0, lingosim, 0.01);
+ Assert.assertEquals(1.0, lingosim, 0.01);
}
@@ -76,7 +76,7 @@ public void testTanimoto2() throws java.lang.Exception
if (!standAlone) Assert.assertEquals(1.0, tanimoto, 0.001);
}
- @Test public void testTanimoto4() throws Exception {
+ @Test public void testExactMatch() throws Exception {
Molecule mol1 = MoleculeFactory.makeIndole();
Molecule mol2 = MoleculeFactory.makeIndole();
LingoFingerprinter fingerprinter = new LingoFingerprinter();

0 comments on commit dee515e

Please sign in to comment.