From 07f379ee689b0a54fade99415451c82bb04377e3 Mon Sep 17 00:00:00 2001 From: Kristian Cibulskis Date: Fri, 16 May 2014 15:04:07 -0400 Subject: [PATCH] migration to mvn along with GATK 3.1's new build process --- README.md | 16 +- build.xml | 86 ------ make_mutect_release.pl | 13 +- mutect.xml | 27 -- pom.xml | 279 ++++++++++++++++++ resources/MuTectText.properties | 1 + run_regression.pl | 4 +- .../walkers/cancer/mutect/LocusReadPile.java | 11 +- .../gatk/walkers/cancer/mutect/MuTect.java | 2 +- 9 files changed, 310 insertions(+), 129 deletions(-) delete mode 100644 build.xml delete mode 100644 mutect.xml create mode 100644 pom.xml create mode 100644 resources/MuTectText.properties diff --git a/README.md b/README.md index 392cd37..1e6a68d 100644 --- a/README.md +++ b/README.md @@ -24,12 +24,20 @@ BUILD STEPS # get MuTect source git clone git@github.com:broadinstitute/mutect.git - cd .. # get the GATK source and set to the latest tested version git clone git@github.com:broadgsa/gatk-protected.git cd gatk-protected - git reset --hard 2.7-1-g42d771f + git reset --hard 3.1 - # build - ant -Dexternal.dir=`pwd`/../mutect-src -Dexecutable=mutect package + # build the GATK first and install it to the local mvn repo. Once GATK publishes to a public repo this will be much simpler + mvn -Ddisable.queue install + + # build MuTect and run unit tests (the target jar will be in target/mutect-*.jar) + cd ../mutect + mvn verify + + # run integration tests, if you like + ./run_regression.pl + ./tieout_regression.pl + diff --git a/build.xml b/build.xml deleted file mode 100644 index ab73a33..0000000 --- a/build.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - Build the GATK examples - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - version=${build.version} - - - - - - - - - - diff --git a/make_mutect_release.pl b/make_mutect_release.pl index 7ec1b02..70ea726 100755 --- a/make_mutect_release.pl +++ b/make_mutect_release.pl @@ -8,7 +8,6 @@ my $BASE_DIR = "$TMP_DIR/mutect-dist"; my $GATK_DIR = "$BASE_DIR/gatk-protected"; -my $MUTECT_DIR = "$BASE_DIR/mutect-src"; my $cwd = `pwd`; chomp($cwd); @@ -21,10 +20,10 @@ # update CGA and get revision info -system("cd $MUTECT_DIR && git clone git\@github.com:broadinstitute/mutect.git") == 0 or die(); +system("cd $BASE_DIR && git clone git\@github.com:broadinstitute/mutect.git") == 0 or die(); # check to see if this tag exists -my $cnt = `cd $MUTECT_DIR/mutect && git ls-remote --tags -q | grep refs/tags/$mutect_tag | wc -l`; +my $cnt = `cd $BASE_DIR/mutect && git ls-remote --tags -q | grep refs/tags/$mutect_tag | wc -l`; chomp($cnt); if ($cnt == 0) { die("ERROR: release tag $mutect_tag does not exist!\n"); } system("cd $MUTECT_DIR/mutect && git reset --hard $mutect_tag") == 0 or die(); @@ -41,14 +40,14 @@ `git describe --tags | awk '{ print "GATK Revision: " \$0 }' >> $TMP_DIST/version.txt`; # do a clean build -system("cd $GATK_DIR && ant clean") == 0 or die(); -system("cd $GATK_DIR && ant -Dexternal.dir=$MUTECT_DIR -Dexecutable=mutect package") == 0 or die(); +system("cd $GATK_DIR && mvn -Ddisable.queue install") == 0 or die(); +system("cd $BASE_DIR/mutect && mvn verify") == 0 or die(); # move the executable over to the release directory -system("cp $GATK_DIR/dist/packages/muTect-*/muTect.jar $TMP_DIST/muTect-$mutect_tag.jar") == 0 or die(); +system("cp $BASE_DIR/mutect/target/mutect-*.jar $TMP_DIST/.") == 0 or die(); # move the license over to the release directory -system("cp $MUTECT_DIR/mutect/mutect.LICENSE.TXT $TMP_DIST/LICENSE.TXT") == 0 or die(); +system("cp $BASE_DIR/mutect/mutect.LICENSE.TXT $TMP_DIST/LICENSE.TXT") == 0 or die(); # zip it up chdir($cwd); diff --git a/mutect.xml b/mutect.xml deleted file mode 100644 index f11eb57..0000000 --- a/mutect.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..4c6cd38 --- /dev/null +++ b/pom.xml @@ -0,0 +1,279 @@ + + 4.0.0 + + + org.broadinstitute.cga + mutect + jar + 1.1.7 + Mutect + + + 3.1 + + ../../gatk-protected + UTF-8 + UTF-8 + yyyy/MM/dd HH:mm:ss + + + false + ${sting.committests.skipped} + ${sting.committests.skipped} + + + package + + 1.7 + 1.7 + + + + + sting.public.repo.local + Sting Public Local Repository + file:${sting.basedir}/public/repo + + + + + + org.broadinstitute.sting + gatk-protected + ${sting.version} + + + + org.broadinstitute.sting + gatk-framework + ${sting.version} + test-jar + test + + + + org.testng + testng + 6.8 + test + + + + + + ${basedir}/src + ${basedir}/test + + + + resources + true + + **/MuTectText.properties + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.8 + + + unpack + process-resources + + unpack + + + + + org.broadinstitute.sting + gatk-framework + ${sting.version} + example-resources + tar.bz2 + ${project.build.outputDirectory} + + + + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 2.1 + + + ${sting.shade.phase} + + shade + + + true + + + + commons-logging:commons-logging + + ** + + + + org.broad:tribble + + ** + + + + org.broadinstitute:variant + + ** + + + + org.broadinstitute.sting:gatk-framework + + ** + + + + org.broadinstitute.sting:gatk-protected + + ** + + + + org.apache.commons:commons-math + + ** + + + + org.broadinstitute.sting:sting-utils + + ** + + + + colt:colt + + ** + + + + + + + org.broadinstitute.sting:gsalib:tar.gz:* + org.broadinstitute.sting:*:tar.bz2:example-resources + + + + + + org.broadinstitute.sting.gatk.CommandLineGATK + + + + StingText.properties + + + + + + + + + com.lukegb.mojo + gitdescribe-maven-plugin + 2.0 + + + --long + + true + git.version + exported + + + + gitdescribe-initialize + + gitdescribe + + initialize + + + gitdescribe-presite + + gitdescribe + + pre-site + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.8 + + + + fix-version-initialize + + regex-property + + initialize + + build.version + ${git.version} + git- + + + + fix-version-pre-site + + regex-property + + pre-site + + build.version + ${git.version} + git- + + + + + + + + + + + packagetests-enabled + + + sting.packagetests.enabled + true + + + + none + + + + + diff --git a/resources/MuTectText.properties b/resources/MuTectText.properties new file mode 100644 index 0000000..9b9343d --- /dev/null +++ b/resources/MuTectText.properties @@ -0,0 +1 @@ +version=${build.version} \ No newline at end of file diff --git a/run_regression.pl b/run_regression.pl index 13c0b93..452e74e 100755 --- a/run_regression.pl +++ b/run_regression.pl @@ -7,11 +7,13 @@ my $DBSNP="/xchip/cga/reference/hg19/dbsnp_132.b37.vcf"; my $COSMIC="/xchip/cga/reference/hg19/hg19_cosmic_v54_120711.vcf"; my $PON="/xchip/cga/reference/hg19/refseq_exome_10bp_hg19_300_1kg_normal_panel.vcf"; -my $MUTECT_JAR="../../gatk-protected/dist/GenomeAnalysisTK.jar"; +my $MUTECT_JAR=`find target -name "mutect-*.jar"`; my $OUTPUT_DIR="/tmp/regression_trial"; my $JAVA_OPTS = ""; #$JAVA_OPTS = "-agentpath:/Applications/jprofiler7/bin/macos/libjprofilerti.jnilib=port=8849"; +chomp($MUTECT_JAR); + my $cmd = "mkdir -p $OUTPUT_DIR && java -Xmx1g " . $JAVA_OPTS . " " . "-jar $MUTECT_JAR " . diff --git a/src/org/broadinstitute/cga/tools/gatk/walkers/cancer/mutect/LocusReadPile.java b/src/org/broadinstitute/cga/tools/gatk/walkers/cancer/mutect/LocusReadPile.java index 0594854..7b713c0 100644 --- a/src/org/broadinstitute/cga/tools/gatk/walkers/cancer/mutect/LocusReadPile.java +++ b/src/org/broadinstitute/cga/tools/gatk/walkers/cancer/mutect/LocusReadPile.java @@ -116,7 +116,8 @@ public LocusReadPile(ReadBackedPileup pileup, char refBase, int minQualityScore, if (p.getMappingQual() == 0 && !allowMapq0ForQualSum) { continue; } if (p.getQual() <= minQSumQualityScore) { continue; } - if (p.getQual() > this.minQSumQualityScore) { qualitySums.incrementSum((char)p.getBase(), p.getRepresentativeCount(), p.getRepresentativeCount() * p.getQual()); } + if (p.getQual() > this.minQSumQualityScore) { qualitySums.incrementSum((char)p.getBase(), 1, p.getQual()); } + } this.finalPileupReads = finalPileup.getReads(); @@ -230,8 +231,12 @@ public double calculateLogLikelihood(byte alt, double f) { } public double calculateAltVsRefLOD(ReadBackedPileup pileup, byte alt, double fAlternate, double fReference) { - double lodAlt = LocusReadPile.calculateLogLikelihood(pileup, ((byte) this.refBase), alt, fAlternate); - double lodRef = LocusReadPile.calculateLogLikelihood(pileup, ((byte) this.refBase), alt, fReference); + return LocusReadPile.calculateAltVsRefLOD(pileup, ((byte) this.refBase), alt, fAlternate, fReference); + } + + public static double calculateAltVsRefLOD(ReadBackedPileup pileup, byte ref, byte alt, double fAlternate, double fReference) { + double lodAlt = LocusReadPile.calculateLogLikelihood(pileup, ref, alt, fAlternate); + double lodRef = LocusReadPile.calculateLogLikelihood(pileup, ref, alt, fReference); return lodAlt - lodRef; } diff --git a/src/org/broadinstitute/cga/tools/gatk/walkers/cancer/mutect/MuTect.java b/src/org/broadinstitute/cga/tools/gatk/walkers/cancer/mutect/MuTect.java index 869d793..cc9ec16 100644 --- a/src/org/broadinstitute/cga/tools/gatk/walkers/cancer/mutect/MuTect.java +++ b/src/org/broadinstitute/cga/tools/gatk/walkers/cancer/mutect/MuTect.java @@ -199,7 +199,7 @@ public void initialize() { //setting version info // TODO: refactor into getMuTectVersion() final String gatkVersion = CommandLineGATK.getVersionNumber(); - ResourceBundle resources = TextFormattingUtils.loadResourceBundle("CGAText"); + ResourceBundle resources = TextFormattingUtils.loadResourceBundle("MuTectText"); final String mutectVersion = resources.containsKey("version")? resources.getString("version") : ""; final String combinedVersion = "MuTect:"+mutectVersion+" Gatk:"+gatkVersion;