Enhancements to build external projects for walker sharing.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4348 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2010-09-24 21:17:16 +00:00
parent eb1fa4bff3
commit 6ebca5d219
3 changed files with 43 additions and 144 deletions

View File

@ -4,6 +4,7 @@
<property name="build.dir" value="build" />
<property name="dist.dir" value="dist" />
<property name="external.dir" value="external" />
<property name="java.source.dir" value="java/src" />
<property name="java.classes" value="${build.dir}/java/classes" />
<property name="resource.file" value="StingText.properties" />
@ -33,13 +34,19 @@
<property environment="env"/>
<dirset id="java.source.files" dir="${java.source.dir}">
<patternset>
<include name="org/broadinstitute/sting/**"/>
<exclude name="**/playground/**" unless="include.playground" />
<exclude name="**/oneoffprojects/**" unless="include.oneoffs" />
</patternset>
</dirset>
<patternset id="java.source.pattern">
<include name="**/*.java"/>
<exclude name="**/playground/**" unless="include.playground" />
<exclude name="**/oneoffprojects/**" unless="include.oneoffs" />
</patternset>
<fileset id="java.source.files" dir="${java.source.dir}">
<patternset refid="java.source.pattern" />
</fileset>
<fileset id="external.source.files" dir="${external.dir}" erroronmissingdir="false">
<patternset refid="java.source.pattern" />
</fileset>
<!-- the path for resources that need to go into the GATK jar;
any additional resources should go into this set. -->
@ -195,12 +202,28 @@
<target name="gatk.compile" depends="tribble,init,resolve"
description="compile the source">
<!-- Compile the java code from ${src} into build -->
<javac srcdir="${java.source.dir}" destdir="${java.classes}" debug="true" debuglevel="lines,vars,source" classpathref="external.dependencies">
<exclude name="**/examples/**" />
<exclude name="**/playground/**" unless="include.playground"/>
<exclude name="**/oneoffprojects/**" unless="include.oneoffs"/>
</javac>
<!-- Compile the java code from ${src} into build -->
<javac srcdir="${java.source.dir}" destdir="${java.classes}" debug="true" debuglevel="lines,vars,source" classpathref="external.dependencies">
<exclude name="**/examples/**" />
<exclude name="**/playground/**" unless="include.playground"/>
<exclude name="**/oneoffprojects/**" unless="include.oneoffs"/>
</javac>
<pathconvert property="external.build.dir">
<path path="${java.classes}"/>
</pathconvert>
<!-- GATK dependencies consist of 3rd party plugins plus compiled GATK classes -->
<pathconvert property="external.gatk.classpath">
<path path="${java.classes}"/>
<path refid="external.dependencies" />
</pathconvert>
<subant target="compile" genericantfile="build.xml">
<property name="build.dir" value="${external.build.dir}" />
<property name="gatk.classpath" value="${external.gatk.classpath}" />
<fileset dir="${basedir}" includes="external/*/build.xml" />
</subant>
</target>
<!-- Queue depends on the gatk since it contains the StingUtils (including CommandLine) -->
@ -239,11 +262,13 @@
<path refid="external.dependencies" />
<pathelement location="${java.classes}" />
</path>
<javadoc doclet="org.broadinstitute.sting.utils.help.ResourceBundleExtractorDoclet"
docletpathref="doclet.classpath"
classpathref="external.dependencies"
additionalparam="-build-timestamp &quot;${build.timestamp}&quot; -version-suffix .${build.version} -out ${basedir}/${resource.path}">
<packageset refid="java.source.files"/>
additionalparam="-build-timestamp &quot;${build.timestamp}&quot; -version-suffix .${build.version} -out ${basedir}/${resource.path} -quiet">
<fileset refid="java.source.files"/>
<fileset refid="external.source.files"/>
</javadoc>
</target>
@ -611,7 +636,7 @@
<mkdir dir="${dist.dir}/packages" />
<xslt in="packages/PicardPrivate.xml" out="${dist.dir}/packages/BuildPicardPrivate.xml" style="packages/CreatePackager.xsl" />
<ant antfile="${dist.dir}/packages/BuildPicardPrivate.xml">
<property name="additional.jars" value="${required.picard.jars}" />
<property name="additional.jars" value="${required.picard.jars}" />
</ant>
</target>
@ -619,7 +644,7 @@
<!-- Find bug tasks -->
<!-- ******************************************************************************** -->
<path id="findbugs.classpath">
<fileset dir="lib" erroronmissingdir="true" includes="*.jar"/>
<fileset dir="lib" erroronmissingdir="true" includes="*.jar"/>
</path>
<target name="findbugs" depends="dist">
<antcall target ="resolve">
@ -639,9 +664,7 @@
<sourcePath path="../java/src" />
<class location="dist/GenomeAnalysisTK.jar" />
</findbugs>
</target>
</target>
<target name="clean" description="clean up" depends="tribble.clean,clean.javadoc">
<delete dir="out"/>
@ -651,6 +674,5 @@
<delete dir="${dist.dir}"/>
<!-- When we clean, make sure to clean out tribble as well -->
<ant antfile="tribble/build.xml" target="clean"/>
</target>
</project>

View File

@ -1,83 +0,0 @@
/*
* Copyright (c) 2009 The Broad Institute
* 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.
*/
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.commandline.Output;
import java.io.PrintStream;
/**
* An example walker for illustrative purposes.
*/
public class HelloWalker extends LocusWalker<Integer,Long> {
@Output
PrintStream out;
/**
* The map function runs once per single-base locus, and accepts a 'context', a
* data structure consisting of the reads which overlap the locus, the sites over
* which they fall, and the base from the reference that overlaps.
* @param tracker The accessor for reference metadata.
* @param ref The reference base that lines up with this locus.
* @param context Information about reads aligning to this locus.
* @return In this case, returns a count of how many loci were seen at this site (1).
*/
@Override
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
out.printf("Hello locus %s; your ref base is %c and you have %d reads%n", context.getLocation(), ref.getBase(), context.getBasePileup().size() );
return 1;
}
/**
* Provides an initial value for the reduce function. Hello walker counts loci,
* so the base case for the inductive step is 0, indicating that the walker has seen 0 loci.
* @return 0.
*/
@Override
public Long reduceInit() { return 0L; }
/**
* Combines the result of the latest map with the accumulator. In inductive terms,
* this represents the step loci[x + 1] = loci[x] + 1
* @param value result of the map.
* @param sum accumulator for the reduce.
* @return The total count of loci processed so far.
*/
@Override
public Long reduce(Integer value, Long sum) {
return sum + value;
}
/**
* Retrieves the final result of the traversal.
* @param result The ultimate value of the traversal, produced when map[n] is combined with reduce[n-1]
* by the reduce function.
*/
@Override
public void onTraversalDone(Long result) {
out.println("Number of loci viewed is: " + result);
}
}

View File

@ -1,40 +0,0 @@
<!--
~ Copyright (c) 2009 The Broad Institute
~ 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.
-->
<project name="BuildHelloWalker" default="dist" basedir=".">
<description>Build the GATK examples</description>
<property name="gatk.home" value="${user.home}/GenomeAnalysisTK" />
<property name="walker.home" value="${gatk.home}/walkers" />
<target name="dist">
<mkdir dir="${walker.home}" />
<javac srcdir="${basedir}" destdir="${walker.home}">
<classpath>
<fileset dir="${gatk.home}" includes="GenomeAnalysisTK.jar" />
</classpath>
</javac>
</target>
</project>