Skip to content

Commit

Permalink
Fixed classpath conflicts by compiling against specific CDK versions,…
Browse files Browse the repository at this point in the history
… and only including Japex on the default classpath
  • Loading branch information
egonw committed Jul 13, 2011
1 parent 40ff1f7 commit 83983db
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 4 deletions.
29 changes: 27 additions & 2 deletions build.xml
Expand Up @@ -22,7 +22,15 @@
<property name="config" value="mx-cdk-sdf.xml"/>
<!-- filesets -->
<fileset dir="${lib.dir}" id="libs">
<include name="**/*.jar" />
<include name="slf4j*.jar" />
<include name="mail-1.4.jar" />
<include name="jsr173_api-1.0.jar" />
<include name="jfreechart-1.0.12.jar" />
<include name="jcommon-1.0.12.jar" />
<include name="jaxb-api-2.0.jar" />
<include name="japex-1.2.2.jar" />
<include name="activiation-1.1.jar" />
<include name="ant-*.jar" />
</fileset>
<!-- targets -->
<target name="init" description="Create build directories." >
Expand All @@ -38,9 +46,26 @@
<delete dir="${doc.dir}" />
</target>
<target name="compile" depends="init" description="Compile sources.">
<javac srcdir="${source.dir}" destdir="${class.dir}" includes="net/openmolecules/benchmark/**/*.java" debug="on" source="1.5" target="1.5">
<javac srcdir="${source.dir}" destdir="${class.dir}"
includes="net/openmolecules/benchmark/**/*.java"
excludes="net/openmolecules/benchmark/**/*14.java"
debug="on" source="1.5" target="1.5">
<classpath>
<fileset refid="libs" />
<fileset dir="lib">
<include name="cdk-1.3.*.jar"/>
<include name="mx*.jar"/>
</fileset>
</classpath>
</javac>
<javac srcdir="${source.dir}" destdir="${class.dir}"
includes="net/openmolecules/benchmark/**/*14.java"
debug="on" source="1.5" target="1.5">
<classpath>
<fileset refid="libs" />
<fileset dir="lib">
<include name="cdk-1.4.0.jar"/>
</fileset>
</classpath>
</javac>
</target>
Expand Down
Binary file modified lib/cdk-1.4.0.jar
Binary file not shown.
9 changes: 7 additions & 2 deletions mx-cdk-sdf.xml
Expand Up @@ -3,8 +3,8 @@
<param name="basedir" value="."/>
<param name="japex.classPath" value="build/classes"/>
<param name="japex.resultUnit" value="ms"/>
<param name="japex.warmupIterations" value="10"/>
<param name="japex.runIterations" value="50"/>
<param name="japex.warmupIterations" value="50"/>
<param name="japex.runIterations" value="500"/>
<param name="japex.reportsDirectory" value="build/reports"/>
<driverGroup name="MX-CDK-SDF" xmlns="http://www.sun.com/japex/testSuite">
<driver name="CDK-1.2.x">
Expand All @@ -17,6 +17,11 @@
<param name="japex.classPath" value="${basedir}/lib/cdk-1.3.x-20091008.jar"/>
<param name="description" value="Reads SD file, prints sum of calculated molecular masses."/>
</driver>
<driver name="CDK-1.4.x">
<param name="japex.driverClass" value="net.openmolecules.benchmark.driver.CDKSDFBench14"/>
<param name="japex.classPath" value="${basedir}/lib/cdk-1.4.0.jar"/>
<param name="description" value="Reads SD file, prints sum of calculated molecular masses."/>
</driver>
<driver name="mx-0.108.1">
<param name="japex.driverClass" value="net.openmolecules.benchmark.driver.MXSDFBench"/>
<param name="japex.classPath" value="${basedir}/lib/mx-0.108.1.jar"/>
Expand Down
91 changes: 91 additions & 0 deletions src/net/openmolecules/benchmark/driver/CDKSDFBench14.java
@@ -0,0 +1,91 @@
/*
* ChemBench - The Benchmark Suite for Cheminformatics
*
* Copyright (c) 2009 Metamolecular, LLC (http://metamolecular.com)
* 2011 Egon Willighagen <egonw@users.sf.net>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

package net.openmolecules.benchmark.driver;

import com.sun.japex.JapexDriverBase;
import com.sun.japex.TestCase;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import org.openscience.cdk.DefaultChemObjectBuilder;
import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.io.iterator.IteratingMDLReader;
import org.openscience.cdk.qsar.descriptors.molecular.WeightDescriptor;
import org.openscience.cdk.qsar.result.DoubleResult;

/**
* @author Richard L. Apodaca
*/
public class CDKSDFBench14 extends JapexDriverBase
{

@Override
public void prepare()
{
}

@Override
public void run(TestCase testCase)
{
IteratingMDLReader reader = getReader(testCase.getParam("japex.inputFile"));
WeightDescriptor calculator = new WeightDescriptor();
double sum = 0;

while (reader.hasNext())
{
IMolecule molecule = (IMolecule) reader.next();
sum += (((DoubleResult)calculator.calculate(molecule).getValue()).doubleValue());
}

try
{
reader.close();
}

catch (IOException e)
{
throw new RuntimeException(e);
}
}

private IteratingMDLReader getReader(String filename)
{
IteratingMDLReader result = null;

try
{
Reader raw = new FileReader(filename);
//BufferedReader reader = new BufferedReader(raw);

result = new IteratingMDLReader(raw, DefaultChemObjectBuilder.getInstance());
} catch (Exception e)
{
throw new RuntimeException(e.getMessage(), e);
}

return result;
}
}

0 comments on commit 83983db

Please sign in to comment.