diff --git a/.gitignore b/.gitignore
index b640999cc..a2ff166e5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,3 +38,5 @@ resources/
velocity.log
perf
verify
+maven-metadata-local.xml
+dependency-reduced-pom.xml
diff --git a/ant-bridge.sh b/ant-bridge.sh
new file mode 100755
index 000000000..9f4713d7c
--- /dev/null
+++ b/ant-bridge.sh
@@ -0,0 +1,173 @@
+#!/bin/sh
+
+mvn_args="verify"
+mvn_properties=
+mvn_clean=
+unknown_args=
+property_regex='-D(.*)=(.*)'
+unit_test_regex='.*UnitTest'
+post_script=
+run_type="run"
+
+for arg in "${@}" ; do
+ if [[ "${arg}" == "dry" ]] ; then
+ run_type="dry"
+
+ elif [[ "${arg}" == "clean" ]] ; then
+ mvn_clean="clean"
+ mvn_args=
+
+ elif [[ "${arg}" =~ ${property_regex} ]] ; then
+ property_name=${BASH_REMATCH[1]}
+ property_value=${BASH_REMATCH[2]}
+
+ if [[ "${property_name}" == "single" ]] ; then
+ test_property="test"
+ test_disabled="it.test"
+ if [[ ! "${property_value}" =~ ${unit_test_regex} ]] ; then
+ test_property="it.test"
+ test_disabled="test"
+ fi
+
+ mvn_properties="${mvn_properties} -D${test_disabled}=disabled -D${test_property}=${property_value}"
+
+ elif [[ "${property_name}" == "test.debug.port" ]] ; then
+ mvn_properties="${mvn_properties} -Dmaven.surefire.debug=\"-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${property_value}\""
+ mvn_properties="${mvn_properties} -Dmaven.failsafe.debug=\"-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${property_value}\""
+
+ elif [[ "${property_name}" == "test.default.maxmemory" ]] ; then
+ mvn_properties="${mvn_properties} -Dtest.maxmemory=${property_value}"
+
+ else
+ unknown_args="${unknown_args} \"${arg}\""
+
+ fi
+
+ else
+ if [[ "${arg}" != "dist" && "${mvn_args}" != "" && "${mvn_args}" != "verify" ]] ; then
+ echo "Sorry, this script does not currently support mixing targets." >&2
+ exit 1
+
+ elif [[ "${arg}" == "dist" ]] ; then
+ mvn_args="verify"
+
+ elif [[ "${arg}" == "gatk" ]] ; then
+ mvn_args="verify '-P!queue'"
+
+ elif [[ "${arg}" == "test.compile" ]] ; then
+ mvn_args="test-compile"
+
+ elif [[ "${arg}" == "gatkdocs" ]] ; then
+ local_repo="sitetemprepo"
+ mvn_args="install -Dmaven.repo.local=${local_repo} -Ddisable.queue && mvn site -Dmaven.repo.local=${local_repo} -Ddisable.queue"
+
+ elif [[ "${arg}" == "package.gatk.full" ]] ; then
+ mvn_args="package '-P!private,!queue'"
+
+ elif [[ "${arg}" == "package.gatk.all" ]] ; then
+ mvn_args="package '-P!queue'"
+
+ elif [[ "${arg}" == "package.queue.full" ]] ; then
+ mvn_args="package '-P!private'"
+
+ elif [[ "${arg}" == "package.queue.all" ]] ; then
+ mvn_args="package"
+
+# elif [[ "${arg}" == "release.gatk.full" ]] ; then
+# mvn_args="package '-P!private,!queue'"
+# post_script=" && private/src/main/scripts/shell/copy_release.sh public/gatk-package/target/GenomeAnalysisTK-*.tar.bz2"
+
+# elif [[ "${arg}" == "release.queue.full" ]] ; then
+# mvn_args="package '-P!private'"
+# post_script=" && private/src/main/scripts/shell/copy_release.sh public/queue-package/target/Queue-*.tar.bz2"
+
+ elif [[ "${arg}" == "build-picard-private" ]] ; then
+ mvn_args="mvn install -f private/picard-maven/pom.xml"
+
+ # TODO: clover support
+ # see ant and maven docs for clover:
+ # https://confluence.atlassian.com/display/CLOVER/1.+QuickStart+Guide
+ # https://confluence.atlassian.com/display/CLOVER/Clover-for-Maven+2+and+3+User%27s+Guide
+ #
+ #elif [[ "${arg}" == "clover.report" ]] ; then
+ # mvn_args=...
+ #
+ #elif [[ "${arg}" == "with.clover" ]] ; then
+ # mvn_args=...
+
+ # TODO: This runs *all* commit tests, including the few on Queue.
+ elif [[ "${arg}" == "gatkfull.binary.release.tests" ]] ; then
+ local_repo="sitetemprepo"
+ mvn_args="install -Dmaven.repo.local=${local_repo} && mvn verify"
+ mvn_args="${mvn_args} -Dmaven.repo.local=${local_repo}"
+ mvn_args="${mvn_args} -Dsting.packagetests.enabled=true"
+ mvn_args="${mvn_args} -Dsting.packagecommittests.skipped=false"
+
+ # TODO: This runs only the pipeline tests (full, non-dry run), but not the commit tests for Queue.
+ elif [[ "${arg}" == "queuefull.binary.release.tests" ]] ; then
+ local_repo="sitetemprepo"
+ mvn_args="install -Dmaven.repo.local=${local_repo} && mvn verify"
+ mvn_args="${mvn_args} -Dmaven.repo.local=${local_repo}"
+ mvn_args="${mvn_args} -Dsting.packagetests.enabled=true"
+ mvn_args="${mvn_args} -Dsting.packagepipelinetests.skipped=false"
+ mvn_args="${mvn_args} -Dsting.pipelinetests.run=true"
+
+ elif [[ "${arg}" == "committests" ]] ; then
+ mvn_args="verify -Dsting.committests.skipped=false"
+
+ elif [[ "${arg}" == "test" ]] ; then
+ mvn_args="test -Dsting.unittests.skipped=false"
+
+ elif [[ "${arg}" == "unittest" ]] ; then
+ mvn_args="test -Dsting.unittests.skipped=false"
+
+ elif [[ "${arg}" == "integrationtest" ]] ; then
+ mvn_args="verify -Dsting.integrationtests.skipped=false"
+
+ elif [[ "${arg}" == "largescaletest" ]] ; then
+ mvn_args="verify -Dsting.largescaletests.skipped=false"
+
+ elif [[ "${arg}" == "knowledgebasetest" ]] ; then
+ mvn_args="verify -Dsting.knowledgebasetests.skipped=false"
+
+ elif [[ "${arg}" == "pipelinetest" ]] ; then
+ mvn_args="verify -Dsting.pipelinetests.skipped=false"
+
+ elif [[ "${arg}" == "pipelinetestrun" ]] ; then
+ mvn_args="verify -Dsting.pipelinetests.skipped=false -Dsting.pipelinetests.run=true"
+
+ elif [[ "${arg}" == "fasttest" ]] ; then
+ mvn_args="verify -Dsting.committests.skipped=false -pl private/gatk-private -am -Dresource.bundle.skip=true"
+
+ else
+ unknown_args="${unknown_args} \"${arg}\""
+
+ fi
+
+ fi
+
+done
+
+mvn_cmd=
+if [[ "${mvn_clean}" != "" ]] ; then
+ if [[ "${mvn_args}" != "" ]] ; then
+ mvn_cmd="mvn ${mvn_clean} && mvn ${mvn_args}"
+ else
+ mvn_cmd="mvn ${mvn_clean}"
+ fi
+else
+ mvn_cmd="mvn ${mvn_args}"
+fi
+
+if [[ "${unknown_args}" != "" ]] ; then
+ echo "Unrecognized arguments:${unknown_args}" >&2
+
+else
+ echo "Equivalent maven command"
+ echo "${mvn_cmd}${mvn_properties}${post_script}"
+
+ if [[ "${run_type}" != "dry" ]] ; then
+ sh -c "${mvn_cmd}${mvn_properties}${post_script}"
+ fi
+
+fi
diff --git a/build.xml b/build.xml
deleted file mode 100644
index 2493553fc..000000000
--- a/build.xml
+++ /dev/null
@@ -1,1533 +0,0 @@
-
-
-
-
- Compile and distribute the Sting toolkit
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Generating Queue GATK extensions...
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Building Scala...
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ivy.xml b/ivy.xml
deleted file mode 100644
index 2e45247ab..000000000
--- a/ivy.xml
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 000000000..3abf73151
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,862 @@
+
+
+ 4.0.0
+
+
+
+
+ org.broadinstitute.sting
+ sting-root
+ 2.8-SNAPSHOT
+ public/sting-root
+
+
+ sting-aggregator
+ pom
+ Sting Aggregator
+
+
+ public
+
+
+
+
+ ${project.basedir}
+ StingText.properties
+ false
+
+ -build-timestamp "${maven.build.timestamp}"
+
+
+ package
+ generate-resources
+ process-resources
+ process-test-resources
+
+
+ true
+ ${sting.packagecommittests.skipped}
+ ${sting.packagecommittests.skipped}
+ ${sting.packagecommittests.skipped}
+ true
+ true
+
+
+ true
+ ${sting.serialcommittests.skipped}
+ ${sting.serialcommittests.skipped}
+ ${sting.serialcommittests.skipped}
+ true
+ true
+
+
+
+
+ com.sun
+ tools
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-clean-plugin
+
+
+
+
+ gatkdocs
+
+
+ ${basedir}
+
+ javadoc.sh
+ options
+ packages
+
+
+
+
+ ${basedir}
+
+ dependency-reduced-pom.xml
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ unpack-direct-dependencies
+
+ unpack-dependencies
+
+ none
+
+ true
+ ${project.build.outputDirectory}
+ jar
+ system
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+
+
+ default-resources
+
+ resources
+
+ ${sting.process-resources.phase}
+
+
+ default-testResources
+
+ testResources
+
+ ${sting.process-test-resources.phase}
+
+
+ copy-resource-bundle-log4j
+
+ copy-resources
+
+ none
+
+ ${project.reporting.outputDirectory}/apidocs
+
+
+ ${sting.basedir}/sting-utils/src/main/config/org/broadinstitute/sting/utils/help
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+
+ extract-resource-bundle
+
+ javadoc
+
+ none
+
+
+ ${resource.bundle.skip}
+ org.broadinstitute.sting.utils.help.ResourceBundleExtractorDoclet
+
+ ${project.build.outputDirectory}
+
+ ${project.groupId}
+
+ gatk-framework
+ ${project.version}
+
+ 2g
+ false
+ true
+ -build-timestamp "${maven.build.timestamp}" -absolute-version ${build.version} -out ${project.build.outputDirectory}/${resource.bundle.path}
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ none
+
+ com.google.java.contract.core.apt.AnnotationProcessor
+
+
+
+
+ default-compile
+ none
+
+
+ default-testCompile
+ none
+
+
+
+ compile-package-info
+
+ compile
+
+ compile
+
+
+ -Xpkginfo:always
+
+
+ **/package-info.java
+
+
+
+
+
+ compile-java
+
+ compile
+
+ compile
+
+
+
+ **/package-info.java
+
+
+
+
+
+ testCompile-java
+
+ testCompile
+
+ test-compile
+
+
+
+
+
+ org.scala-tools
+ maven-scala-plugin
+
+
+
+ compile
+ testCompile
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+ default-jar
+ ${sting.jar.phase}
+
+
+ test-jar
+
+ test-jar
+
+ ${sting.jar.phase}
+
+ true
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+
+
+ sting-executable
+
+ shade
+
+ none
+
+ true
+
+
+ org.broadinstitute.sting:gsalib:tar.gz:*
+ org.broadinstitute.sting:*:tar.bz2:example-resources
+
+
+
+
+
+ ${app.main.class}
+
+
+
+ ${resource.bundle.path}
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+
+
+ example-resources
+
+ single
+
+ none
+
+
+ src/main/assembly/example-resources.xml
+
+
+
+
+ binary-dist
+
+ single
+
+ none
+
+
+ src/main/assembly/binary-dist.xml
+
+
+
+
+
+
+
+
+ com.pyx4j
+ maven-junction-plugin
+
+
+ link-public-testdata
+
+ link
+
+ none
+
+
+
+ ${basedir}/public/testdata
+ ${sting.basedir}/public/gatk-framework/src/test/resources
+
+
+
+
+
+ unlink-public-testdata
+
+ unlink
+
+ none
+
+
+
+ ${basedir}/public/testdata
+ ${sting.basedir}/public/gatk-framework/src/test/resources
+
+
+
+
+
+ link-private-testdata
+
+ link
+
+ none
+
+
+
+ ${basedir}/private/testdata
+ ${sting.basedir}/private/gatk-private/src/test/resources
+
+
+
+
+
+ unlink-private-testdata
+
+ unlink
+
+ none
+
+
+
+ ${basedir}/private/testdata
+ ${sting.basedir}/private/gatk-private/src/test/resources
+
+
+
+
+
+ link-public-qscript
+
+ link
+
+ none
+
+
+
+ ${basedir}/public/scala/qscript
+ ${sting.basedir}/public/queue-framework/src/main/qscripts
+
+
+
+
+
+ unlink-public-qscript
+
+ unlink
+
+ none
+
+
+
+ ${basedir}/public/scala/qscript
+ ${sting.basedir}/public/queue-framework/src/main/qscripts
+
+
+
+
+
+ link-private-qscript
+
+ link
+
+ none
+
+
+
+ ${basedir}/private/scala/qscript
+ ${sting.basedir}/private/queue-private/src/main/qscripts
+
+
+
+
+
+ unlink-private-qscript
+
+ unlink
+
+ none
+
+
+
+ ${basedir}/private/scala/qscript
+ ${sting.basedir}/private/queue-private/src/main/qscripts
+
+
+
+
+
+ link-binary-jar
+
+ link
+
+ none
+
+
+
+ ${sting.basedir}/target/${sting.binary-dist.name}.${project.packaging}
+ ${project.build.directory}/${project.build.finalName}.${project.packaging}
+
+
+
+
+
+ link-git-release
+
+ link
+
+ none
+
+
+
+ ${project.build.directory}/${sting.binary-dist.name}-${build.version}.tar.bz2
+ ${project.build.directory}/${project.build.finalName}-binary-dist.tar.bz2
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-invoker-plugin
+
+ true
+ false
+ ${sting.basedir}/public/package-tests/pom.xml
+ true
+ true
+ ${sting.basedir}/${maven.repo.local}
+
+ ${test}
+ ${it.test}
+ false
+ false
+ ${sting.packagetests.artifactId}
+ ${project.build.testOutputDirectory}
+ ${project.basedir}
+ ${sting.pipelinetests.run}
+ ${maven.surefire.debug}
+ ${maven.failsafe.debug}
+
+
+
+
+
+ package-unittests
+
+ run
+
+
+
+ test
+
+ ${project.build.directory}/invoker-reports/unit/${test}
+ ${sting.packageunittests.skipped}
+
+ true
+ ${sting.packageunittests.skipped}
+
+
+
+
+ package-integrationtests
+
+ integration-test
+ verify
+
+
+
+ verify
+
+ ${project.build.directory}/invoker-reports/integration/${it.test}
+ ${sting.packageintegrationtests.skipped}
+
+ true
+ ${sting.packageintegrationtests.skipped}
+ ${project.build.directory}/failsafe-reports/integration/failsafe-summary-${it.test}.xml
+
+
+
+
+ package-pipelinetests
+
+ integration-test
+ verify
+
+
+
+ verify
+
+ ${project.build.directory}/invoker-reports/pipeline/${it.test}
+ ${sting.packagepipelinetests.skipped}
+
+ true
+ ${sting.packagepipelinetests.skipped}
+ ${project.build.directory}/failsafe-reports/pipeline/failsafe-summary-${it.test}.xml
+
+
+
+
+ package-largescaletests
+
+ integration-test
+ verify
+
+
+
+ verify
+
+ ${project.build.directory}/invoker-reports/largescale/${it.test}
+ ${sting.packagelargescaletests.skipped}
+
+ true
+ ${sting.packagelargescaletests.skipped}
+ ${project.build.directory}/failsafe-reports/largescale/failsafe-summary-${it.test}.xml
+
+
+
+
+ package-knowledgebasetests
+
+ integration-test
+ verify
+
+
+
+ verify
+
+ ${project.build.directory}/invoker-reports/knowledgebase/${it.test}
+ ${sting.packageknowledgebasetests.skipped}
+
+ true
+ ${sting.packageknowledgebasetests.skipped}
+ ${project.build.directory}/failsafe-reports/knowledgebase/failsafe-summary-${it.test}.xml
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-install-plugin
+ 2.5
+
+
+ install-package
+
+ install-file
+
+ none
+
+ true
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+ ${project.packaging}
+ ${project.build.directory}/${project.build.finalName}.${project.packaging}
+
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+
+
+ com.pyx4j
+ maven-junction-plugin
+
+
+ link-public-testdata
+ process-test-resources
+
+
+ unlink-public-testdata
+ clean
+
+
+ link-public-qscript
+ process-test-resources
+
+
+ unlink-public-qscript
+ clean
+
+
+
+
+ org.apache.maven.plugins
+ maven-clean-plugin
+
+
+ com.google.code.sortpom
+ maven-sortpom-plugin
+
+
+ package-tests
+
+ sort
+
+ verify
+ false
+
+ public/package-tests/pom.xml
+
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.9.1
+
+
+
+
+
+
+ generate-gatk-docs
+
+ aggregate
+
+
+ false
+
+ org.broadinstitute.sting.utils.help.GATKDoclet
+
+ ${project.groupId}
+ gatk-package
+ ${project.version}
+
+ false
+ true
+ private
+ -build-timestamp "${maven.build.timestamp}" -absolute-version ${build.version} ${gatkdocs.include.hidden} -settings-dir ${sting.basedir}/settings/helpTemplates -destination-dir ${project.build.directory}/gatkdocs
+
+
+
+
+
+
+
+
+
+
+ protected
+
+
+ ${basedir}/protected/pom.xml
+
+
+
+ protected
+
+
+
+
+
+ private
+
+
+ ${basedir}/private/pom.xml
+
+
+
+ private
+
+
+
+
+
+ com.pyx4j
+ maven-junction-plugin
+
+
+ link-private-testdata
+ process-test-resources
+
+
+ unlink-private-testdata
+ clean
+
+
+ link-private-qscript
+ process-test-resources
+
+
+ unlink-private-qscript
+ clean
+
+
+
+
+
+
+
+
+
+ packagetests-enabled
+
+
+ sting.packagetests.enabled
+ true
+
+
+
+ true
+ true
+ none
+ none
+ none
+ none
+
+
+
+
+
diff --git a/protected/gatk-protected/pom.xml b/protected/gatk-protected/pom.xml
new file mode 100644
index 000000000..d75c5b056
--- /dev/null
+++ b/protected/gatk-protected/pom.xml
@@ -0,0 +1,139 @@
+
+
+ 4.0.0
+
+
+ org.broadinstitute.sting
+ sting-aggregator
+ 2.8-SNAPSHOT
+ ../..
+
+
+ gatk-protected
+ jar
+ GATK Protected
+
+
+ ${project.basedir}/../..
+ gatk-package
+
+
+
+
+ ${project.groupId}
+ gatk-framework
+ ${project.version}
+
+
+
+ net.sf.jgrapht
+ jgrapht
+
+
+
+ gov.nist.math
+ jama
+
+
+
+ it.unimi.dsi
+ fastutil
+
+
+
+ ${project.groupId}
+ gatk-framework
+ ${project.version}
+ test-jar
+ test
+
+
+
+ org.testng
+ testng
+ test
+
+
+ com.google.caliper
+ caliper
+ test
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+
+
+ copy-resource-bundle-log4j
+ prepare-package
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+
+ extract-resource-bundle
+ prepare-package
+
+
+
+
+ org.apache.maven.plugins
+ maven-invoker-plugin
+
+
+ package-unittests
+
+
+ package-integrationtests
+
+
+ package-largescaletests
+
+
+ package-knowledgebasetests
+
+
+ package-pipelinetests
+
+
+
+
+
+
+
+
+ private
+
+
+ ${basedir}/../../private/gatk-private/pom.xml
+
+
+
+
+
+
+ com.pyx4j
+ maven-junction-plugin
+
+
+ link-private-testdata
+ process-test-resources
+
+
+ unlink-private-testdata
+ clean
+
+
+
+
+
+
+
+
+
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/arguments/StandardCallerArgumentCollection.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/arguments/StandardCallerArgumentCollection.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/arguments/StandardCallerArgumentCollection.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/arguments/StandardCallerArgumentCollection.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/BaseQualityRankSumTest.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/BaseQualityRankSumTest.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/BaseQualityRankSumTest.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/BaseQualityRankSumTest.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ChromosomeCounts.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/ChromosomeCounts.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ChromosomeCounts.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/ChromosomeCounts.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ClippingRankSumTest.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/ClippingRankSumTest.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ClippingRankSumTest.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/ClippingRankSumTest.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/Coverage.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/Coverage.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/Coverage.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/Coverage.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthPerAlleleBySample.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/DepthPerAlleleBySample.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthPerAlleleBySample.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/DepthPerAlleleBySample.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthPerSampleHC.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/DepthPerSampleHC.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthPerSampleHC.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/DepthPerSampleHC.java
diff --git a/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java
new file mode 100644
index 000000000..a04815e62
--- /dev/null
+++ b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java
@@ -0,0 +1,517 @@
+/*
+* By downloading the PROGRAM you agree to the following terms of use:
+*
+* BROAD INSTITUTE - SOFTWARE LICENSE AGREEMENT - FOR ACADEMIC NON-COMMERCIAL RESEARCH PURPOSES ONLY
+*
+* This Agreement is made between the Broad Institute, Inc. with a principal address at 7 Cambridge Center, Cambridge, MA 02142 (BROAD) and the LICENSEE and is effective at the date the downloading is completed (EFFECTIVE DATE).
+*
+* WHEREAS, LICENSEE desires to license the PROGRAM, as defined hereinafter, and BROAD wishes to have this PROGRAM utilized in the public interest, subject only to the royalty-free, nonexclusive, nontransferable license rights of the United States Government pursuant to 48 CFR 52.227-14; and
+* WHEREAS, LICENSEE desires to license the PROGRAM and BROAD desires to grant a license on the following terms and conditions.
+* NOW, THEREFORE, in consideration of the promises and covenants made herein, the parties hereto agree as follows:
+*
+* 1. DEFINITIONS
+* 1.1 PROGRAM shall mean copyright in the object code and source code known as GATK2 and related documentation, if any, as they exist on the EFFECTIVE DATE and can be downloaded from http://www.broadinstitute/GATK on the EFFECTIVE DATE.
+*
+* 2. LICENSE
+* 2.1 Grant. Subject to the terms of this Agreement, BROAD hereby grants to LICENSEE, solely for academic non-commercial research purposes, a non-exclusive, non-transferable license to: (a) download, execute and display the PROGRAM and (b) create bug fixes and modify the PROGRAM.
+* The LICENSEE may apply the PROGRAM in a pipeline to data owned by users other than the LICENSEE and provide these users the results of the PROGRAM provided LICENSEE does so for academic non-commercial purposes only. For clarification purposes, academic sponsored research is not a commercial use under the terms of this Agreement.
+* 2.2 No Sublicensing or Additional Rights. LICENSEE shall not sublicense or distribute the PROGRAM, in whole or in part, without prior written permission from BROAD. LICENSEE shall ensure that all of its users agree to the terms of this Agreement. LICENSEE further agrees that it shall not put the PROGRAM on a network, server, or other similar technology that may be accessed by anyone other than the LICENSEE and its employees and users who have agreed to the terms of this agreement.
+* 2.3 License Limitations. Nothing in this Agreement shall be construed to confer any rights upon LICENSEE by implication, estoppel, or otherwise to any computer software, trademark, intellectual property, or patent rights of BROAD, or of any other entity, except as expressly granted herein. LICENSEE agrees that the PROGRAM, in whole or part, shall not be used for any commercial purpose, including without limitation, as the basis of a commercial software or hardware product or to provide services. LICENSEE further agrees that the PROGRAM shall not be copied or otherwise adapted in order to circumvent the need for obtaining a license for use of the PROGRAM.
+*
+* 3. OWNERSHIP OF INTELLECTUAL PROPERTY
+* LICENSEE acknowledges that title to the PROGRAM shall remain with BROAD. The PROGRAM is marked with the following BROAD copyright notice and notice of attribution to contributors. LICENSEE shall retain such notice on all copies. LICENSEE agrees to include appropriate attribution if any results obtained from use of the PROGRAM are included in any publication.
+* Copyright 2012 Broad Institute, Inc.
+* Notice of attribution: The GATK2 program was made available through the generosity of Medical and Population Genetics program at the Broad Institute, Inc.
+* LICENSEE shall not use any trademark or trade name of BROAD, or any variation, adaptation, or abbreviation, of such marks or trade names, or any names of officers, faculty, students, employees, or agents of BROAD except as states above for attribution purposes.
+*
+* 4. INDEMNIFICATION
+* LICENSEE shall indemnify, defend, and hold harmless BROAD, and their respective officers, faculty, students, employees, associated investigators and agents, and their respective successors, heirs and assigns, (Indemnitees), against any liability, damage, loss, or expense (including reasonable attorneys fees and expenses) incurred by or imposed upon any of the Indemnitees in connection with any claims, suits, actions, demands or judgments arising out of any theory of liability (including, without limitation, actions in the form of tort, warranty, or strict liability and regardless of whether such action has any factual basis) pursuant to any right or license granted under this Agreement.
+*
+* 5. NO REPRESENTATIONS OR WARRANTIES
+* THE PROGRAM IS DELIVERED AS IS. BROAD MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE PROGRAM OR THE COPYRIGHT, EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, WHETHER OR NOT DISCOVERABLE. BROAD EXTENDS NO WARRANTIES OF ANY KIND AS TO PROGRAM CONFORMITY WITH WHATEVER USER MANUALS OR OTHER LITERATURE MAY BE ISSUED FROM TIME TO TIME.
+* IN NO EVENT SHALL BROAD OR ITS RESPECTIVE DIRECTORS, OFFICERS, EMPLOYEES, AFFILIATED INVESTIGATORS AND AFFILIATES BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, INCLUDING, WITHOUT LIMITATION, ECONOMIC DAMAGES OR INJURY TO PROPERTY AND LOST PROFITS, REGARDLESS OF WHETHER BROAD SHALL BE ADVISED, SHALL HAVE OTHER REASON TO KNOW, OR IN FACT SHALL KNOW OF THE POSSIBILITY OF THE FOREGOING.
+*
+* 6. ASSIGNMENT
+* This Agreement is personal to LICENSEE and any rights or obligations assigned by LICENSEE without the prior written consent of BROAD shall be null and void.
+*
+* 7. MISCELLANEOUS
+* 7.1 Export Control. LICENSEE gives assurance that it will comply with all United States export control laws and regulations controlling the export of the PROGRAM, including, without limitation, all Export Administration Regulations of the United States Department of Commerce. Among other things, these laws and regulations prohibit, or require a license for, the export of certain types of software to specified countries.
+* 7.2 Termination. LICENSEE shall have the right to terminate this Agreement for any reason upon prior written notice to BROAD. If LICENSEE breaches any provision hereunder, and fails to cure such breach within thirty (30) days, BROAD may terminate this Agreement immediately. Upon termination, LICENSEE shall provide BROAD with written assurance that the original and all copies of the PROGRAM have been destroyed, except that, upon prior written authorization from BROAD, LICENSEE may retain a copy for archive purposes.
+* 7.3 Survival. The following provisions shall survive the expiration or termination of this Agreement: Articles 1, 3, 4, 5 and Sections 2.2, 2.3, 7.3, and 7.4.
+* 7.4 Notice. Any notices under this Agreement shall be in writing, shall specifically refer to this Agreement, and shall be sent by hand, recognized national overnight courier, confirmed facsimile transmission, confirmed electronic mail, or registered or certified mail, postage prepaid, return receipt requested. All notices under this Agreement shall be deemed effective upon receipt.
+* 7.5 Amendment and Waiver; Entire Agreement. This Agreement may be amended, supplemented, or otherwise modified only by means of a written instrument signed by all parties. Any waiver of any rights or failure to act in a specific instance shall relate only to such instance and shall not be construed as an agreement to waive any rights or fail to act in any other instance, whether or not similar. This Agreement constitutes the entire agreement among the parties with respect to its subject matter and supersedes prior agreements or understandings between the parties relating to its subject matter.
+* 7.6 Binding Effect; Headings. This Agreement shall be binding upon and inure to the benefit of the parties and their respective permitted successors and assigns. All headings are for convenience only and shall not affect the meaning of any provision of this Agreement.
+* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
+*/
+
+package org.broadinstitute.sting.gatk.walkers.annotator;
+
+import cern.jet.math.Arithmetic;
+import org.apache.log4j.Logger;
+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.gatk.walkers.annotator.interfaces.ActiveRegionBasedAnnotation;
+import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.AnnotatorCompatible;
+import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
+import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.StandardAnnotation;
+import org.broadinstitute.sting.utils.genotyper.MostLikelyAllele;
+import org.broadinstitute.sting.utils.genotyper.PerReadAlleleLikelihoodMap;
+import org.broadinstitute.sting.utils.QualityUtils;
+import org.broadinstitute.variant.variantcontext.Genotype;
+import org.broadinstitute.variant.variantcontext.GenotypesContext;
+import org.broadinstitute.variant.vcf.VCFHeaderLineType;
+import org.broadinstitute.variant.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.pileup.PileupElement;
+import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
+import org.broadinstitute.sting.utils.sam.ReadUtils;
+import org.broadinstitute.variant.variantcontext.Allele;
+import org.broadinstitute.variant.variantcontext.VariantContext;
+
+import java.util.*;
+
+
+/**
+ * Phred-scaled p-value using Fisher's Exact Test to detect strand bias
+ *
+ *
Phred-scaled p-value using Fisher's Exact Test to detect strand bias (the variation
+ * being seen on only the forward or only the reverse strand) in the reads. More bias is
+ * indicative of false positive calls.
+ *
+ *
+ *
Caveat
+ *
The Fisher Strand test may not be calculated for certain complex indel cases or for multi-allelic sites.
+ */
+public class FisherStrand extends InfoFieldAnnotation implements StandardAnnotation, ActiveRegionBasedAnnotation {
+ private final static boolean ENABLE_DEBUGGING = false;
+ private final static Logger logger = Logger.getLogger(FisherStrand.class);
+
+ private static final String FS = "FS";
+ private static final double MIN_PVALUE = 1E-320;
+ private static final int MIN_QUAL_FOR_FILTERED_TEST = 17;
+ private static final int MIN_COUNT = 2;
+
+ public Map annotate(final RefMetaDataTracker tracker,
+ final AnnotatorCompatible walker,
+ final ReferenceContext ref,
+ final Map stratifiedContexts,
+ final VariantContext vc,
+ final Map stratifiedPerReadAlleleLikelihoodMap) {
+ if ( !vc.isVariant() )
+ return null;
+
+ if ( vc.hasGenotypes() ) {
+ final int[][] tableFromPerSampleAnnotations = getTableFromSamples( vc.getGenotypes() );
+ if ( tableFromPerSampleAnnotations != null ) {
+ return pValueForBestTable(tableFromPerSampleAnnotations, null);
+ }
+ }
+
+ if (vc.isSNP() && stratifiedContexts != null) {
+ final int[][] tableNoFiltering = getSNPContingencyTable(stratifiedContexts, vc.getReference(), vc.getAltAlleleWithHighestAlleleCount(), -1);
+ final int[][] tableFiltering = getSNPContingencyTable(stratifiedContexts, vc.getReference(), vc.getAltAlleleWithHighestAlleleCount(), MIN_QUAL_FOR_FILTERED_TEST);
+ printTable("unfiltered", tableNoFiltering);
+ printTable("filtered", tableFiltering);
+ return pValueForBestTable(tableFiltering, tableNoFiltering);
+ }
+ else if (stratifiedPerReadAlleleLikelihoodMap != null) {
+ // either SNP with no alignment context, or indels: per-read likelihood map needed
+ final int[][] table = getContingencyTable(stratifiedPerReadAlleleLikelihoodMap, vc);
+// logger.info("VC " + vc);
+// printTable(table, 0.0);
+ return pValueForBestTable(table, null);
+ }
+ else
+ // for non-snp variants, we need per-read likelihoods.
+ // for snps, we can get same result from simple pileup
+ return null;
+ }
+
+ /**
+ * Create the FisherStrand table by retrieving the per-sample strand bias annotation and adding them together
+ * @param genotypes the genotypes from which to pull out the per-sample strand bias annotation
+ * @return the table used for the FisherStrand p-value calculation, will be null if none of the genotypes contain the per-sample SB annotation
+ */
+ private int[][] getTableFromSamples( final GenotypesContext genotypes ) {
+ if( genotypes == null ) { throw new IllegalArgumentException("Genotypes cannot be null."); }
+
+ final int[] sbArray = {0,0,0,0}; // reference-forward-reverse -by- alternate-forward-reverse
+ boolean foundData = false;
+
+ for( final Genotype g : genotypes ) {
+ if( g.isNoCall() || ! g.hasAnyAttribute(StrandBiasBySample.STRAND_BIAS_BY_SAMPLE_KEY_NAME) )
+ continue;
+
+ foundData = true;
+ final String sbbsString = (String) g.getAnyAttribute(StrandBiasBySample.STRAND_BIAS_BY_SAMPLE_KEY_NAME);
+ final int[] data = encodeSBBS(sbbsString);
+ if ( passesMinimumThreshold(data) ) {
+ for( int index = 0; index < sbArray.length; index++ ) {
+ sbArray[index] += data[index];
+ }
+ }
+ }
+
+ return ( foundData ? decodeSBBS(sbArray) : null );
+ }
+
+ /**
+ * Does this strand data array pass the minimum threshold for inclusion?
+ *
+ * @param data the array
+ * @return true if it passes the minimum threshold, false otherwise
+ */
+ private static boolean passesMinimumThreshold(final int[] data) {
+ // the ref and alt totals must each be greater than MIN_COUNT
+ return data[0] + data[1] > MIN_COUNT && data[2] + data[3] > MIN_COUNT;
+ }
+
+ /**
+ * Create an annotation for the highest (i.e., least significant) p-value of table1 and table2
+ *
+ * @param table1 a contingency table, may be null
+ * @param table2 a contingency table, may be null
+ * @return annotation result for FS given tables
+ */
+ private Map pValueForBestTable(final int[][] table1, final int[][] table2) {
+ if ( table2 == null )
+ return table1 == null ? null : annotationForOneTable(pValueForContingencyTable(table1));
+ else if (table1 == null)
+ return annotationForOneTable(pValueForContingencyTable(table2));
+ else { // take the one with the best (i.e., least significant pvalue)
+ double pvalue1 = pValueForContingencyTable(table1);
+ double pvalue2 = pValueForContingencyTable(table2);
+ return annotationForOneTable(Math.max(pvalue1, pvalue2));
+ }
+ }
+
+ /**
+ * Returns an annotation result given a pValue
+ *
+ * @param pValue
+ * @return a hash map from FS -> phred-scaled pValue
+ */
+ private Map annotationForOneTable(final double pValue) {
+ final Object value = String.format("%.3f", QualityUtils.phredScaleErrorRate(Math.max(pValue, MIN_PVALUE))); // prevent INFINITYs
+ return Collections.singletonMap(FS, value);
+ }
+
+ public List getKeyNames() {
+ return Collections.singletonList(FS);
+ }
+
+ public List getDescriptions() {
+ return Collections.singletonList(new VCFInfoHeaderLine(FS, 1, VCFHeaderLineType.Float, "Phred-scaled p-value using Fisher's exact test to detect strand bias"));
+ }
+
+ /**
+ * Helper function to turn the FisherStrand table into the SB annotation array
+ * @param table the table used by the FisherStrand annotation
+ * @return the array used by the per-sample Strand Bias annotation
+ */
+ public static List getContingencyArray( final int[][] table ) {
+ if(table.length != 2) { throw new IllegalArgumentException("Expecting a 2x2 strand bias table."); }
+ if(table[0].length != 2) { throw new IllegalArgumentException("Expecting a 2x2 strand bias table."); }
+ final List list = new ArrayList<>(4); // TODO - if we ever want to do something clever with multi-allelic sites this will need to change
+ list.add(table[0][0]);
+ list.add(table[0][1]);
+ list.add(table[1][0]);
+ list.add(table[1][1]);
+ return list;
+ }
+
+ /**
+ * Helper function to parse the genotype annotation into the SB annotation array
+ * @param string the string that is returned by genotype.getAnnotation("SB")
+ * @return the array used by the per-sample Strand Bias annotation
+ */
+ private static int[] encodeSBBS( final String string ) {
+ final int[] array = new int[4];
+ final StringTokenizer tokenizer = new StringTokenizer(string, ",", false);
+ for( int index = 0; index < 4; index++ ) {
+ array[index] = Integer.parseInt(tokenizer.nextToken());
+ }
+ return array;
+ }
+
+ /**
+ * Helper function to turn the SB annotation array into the FisherStrand table
+ * @param array the array used by the per-sample Strand Bias annotation
+ * @return the table used by the FisherStrand annotation
+ */
+ private static int[][] decodeSBBS( final int[] array ) {
+ if(array.length != 4) { throw new IllegalArgumentException("Expecting a length = 4 strand bias array."); }
+ final int[][] table = new int[2][2];
+ table[0][0] = array[0];
+ table[0][1] = array[1];
+ table[1][0] = array[2];
+ table[1][1] = array[3];
+ return table;
+ }
+
+ private Double pValueForContingencyTable(int[][] originalTable) {
+ final int[][] normalizedTable = normalizeContingencyTable(originalTable);
+
+ int[][] table = copyContingencyTable(normalizedTable);
+
+ double pCutoff = computePValue(table);
+ //printTable(table, pCutoff);
+
+ double pValue = pCutoff;
+ while (rotateTable(table)) {
+ double pValuePiece = computePValue(table);
+
+ //printTable(table, pValuePiece);
+
+ if (pValuePiece <= pCutoff) {
+ pValue += pValuePiece;
+ }
+ }
+
+ table = copyContingencyTable(normalizedTable);
+ while (unrotateTable(table)) {
+ double pValuePiece = computePValue(table);
+
+ //printTable(table, pValuePiece);
+
+ if (pValuePiece <= pCutoff) {
+ pValue += pValuePiece;
+ }
+ }
+
+ //System.out.printf("P-cutoff: %f\n", pCutoff);
+ //System.out.printf("P-value: %f\n\n", pValue);
+
+ // min is necessary as numerical precision can result in pValue being slightly greater than 1.0
+ return Math.min(pValue, 1.0);
+ }
+
+ // how large do we want the normalized table to be?
+ private static final double TARGET_TABLE_SIZE = 200.0;
+
+ /**
+ * Normalize the table so that the entries are not too large.
+ * Note that this method does NOT necessarily make a copy of the table being passed in!
+ *
+ * @param table the original table
+ * @return a normalized version of the table or the original table if it is already normalized
+ */
+ private static int[][] normalizeContingencyTable(final int[][] table) {
+ final int sum = table[0][0] + table[0][1] + table[1][0] + table[1][1];
+ if ( sum <= TARGET_TABLE_SIZE * 2 )
+ return table;
+
+ final double normalizationFactor = (double)sum / TARGET_TABLE_SIZE;
+
+ final int[][] normalized = new int[2][2];
+ for ( int i = 0; i < 2; i++ ) {
+ for ( int j = 0; j < 2; j++ )
+ normalized[i][j] = (int)(table[i][j] / normalizationFactor);
+ }
+
+ return normalized;
+ }
+
+ private static int [][] copyContingencyTable(int [][] t) {
+ int[][] c = new int[2][2];
+
+ for ( int i = 0; i < 2; i++ )
+ for ( int j = 0; j < 2; j++ )
+ c[i][j] = t[i][j];
+
+ return c;
+ }
+
+
+ private static void printTable(int[][] table, double pValue) {
+ logger.info(String.format("%d %d; %d %d : %f", table[0][0], table[0][1], table[1][0], table[1][1], pValue));
+ }
+
+ /**
+ * Printing information to logger.info for debugging purposes
+ *
+ * @param name the name of the table
+ * @param table the table itself
+ */
+ private void printTable(final String name, final int[][] table) {
+ if ( ENABLE_DEBUGGING ) {
+ final String pValue = (String)annotationForOneTable(pValueForContingencyTable(table)).get(FS);
+ logger.info(String.format("FS %s (REF+, REF-, ALT+, ALT-) = (%d, %d, %d, %d) = %s",
+ name, table[0][0], table[0][1], table[1][0], table[1][1], pValue));
+ }
+ }
+
+ private static boolean rotateTable(int[][] table) {
+ table[0][0] -= 1;
+ table[1][0] += 1;
+
+ table[0][1] += 1;
+ table[1][1] -= 1;
+
+ return (table[0][0] >= 0 && table[1][1] >= 0);
+ }
+
+ private static boolean unrotateTable(int[][] table) {
+ table[0][0] += 1;
+ table[1][0] -= 1;
+
+ table[0][1] -= 1;
+ table[1][1] += 1;
+
+ return (table[0][1] >= 0 && table[1][0] >= 0);
+ }
+
+ private static double computePValue(int[][] table) {
+
+ int[] rowSums = { sumRow(table, 0), sumRow(table, 1) };
+ int[] colSums = { sumColumn(table, 0), sumColumn(table, 1) };
+ int N = rowSums[0] + rowSums[1];
+
+ // calculate in log space so we don't die with high numbers
+ double pCutoff = Arithmetic.logFactorial(rowSums[0])
+ + Arithmetic.logFactorial(rowSums[1])
+ + Arithmetic.logFactorial(colSums[0])
+ + Arithmetic.logFactorial(colSums[1])
+ - Arithmetic.logFactorial(table[0][0])
+ - Arithmetic.logFactorial(table[0][1])
+ - Arithmetic.logFactorial(table[1][0])
+ - Arithmetic.logFactorial(table[1][1])
+ - Arithmetic.logFactorial(N);
+ return Math.exp(pCutoff);
+ }
+
+ private static int sumRow(int[][] table, int column) {
+ int sum = 0;
+ for (int r = 0; r < table.length; r++) {
+ sum += table[r][column];
+ }
+
+ return sum;
+ }
+
+ private static int sumColumn(int[][] table, int row) {
+ int sum = 0;
+ for (int c = 0; c < table[row].length; c++) {
+ sum += table[row][c];
+ }
+
+ return sum;
+ }
+
+ /**
+ Allocate and fill a 2x2 strand contingency table. In the end, it'll look something like this:
+ * fw rc
+ * allele1 # #
+ * allele2 # #
+ * @return a 2x2 contingency table
+ */
+ public static int[][] getContingencyTable( final Map stratifiedPerReadAlleleLikelihoodMap, final VariantContext vc) {
+ if( stratifiedPerReadAlleleLikelihoodMap == null ) { throw new IllegalArgumentException("stratifiedPerReadAlleleLikelihoodMap cannot be null"); }
+ if( vc == null ) { throw new IllegalArgumentException("input vc cannot be null"); }
+
+ final Allele ref = vc.getReference();
+ final Allele alt = vc.getAltAlleleWithHighestAlleleCount();
+ final int[][] table = new int[2][2];
+
+ for (final PerReadAlleleLikelihoodMap maps : stratifiedPerReadAlleleLikelihoodMap.values() ) {
+ final int[] myTable = new int[4];
+ for (final Map.Entry> el : maps.getLikelihoodReadMap().entrySet()) {
+ final MostLikelyAllele mostLikelyAllele = PerReadAlleleLikelihoodMap.getMostLikelyAllele(el.getValue());
+ final GATKSAMRecord read = el.getKey();
+ final int representativeCount = read.isReducedRead() ? read.getReducedCount(ReadUtils.getReadCoordinateForReferenceCoordinateUpToEndOfRead(read, vc.getStart(), ReadUtils.ClippingTail.RIGHT_TAIL)) : 1;
+ updateTable(myTable, mostLikelyAllele.getAlleleIfInformative(), read, ref, alt, representativeCount);
+ }
+ if ( passesMinimumThreshold(myTable) )
+ copyToMainTable(myTable, table);
+ }
+
+ return table;
+ }
+
+ /**
+ * Helper method to copy the per-sample table to the main table
+ *
+ * @param perSampleTable per-sample table (single dimension)
+ * @param mainTable main table (two dimensions)
+ */
+ private static void copyToMainTable(final int[] perSampleTable, final int[][] mainTable) {
+ mainTable[0][0] += perSampleTable[0];
+ mainTable[0][1] += perSampleTable[1];
+ mainTable[1][0] += perSampleTable[2];
+ mainTable[1][1] += perSampleTable[3];
+ }
+
+ /**
+ Allocate and fill a 2x2 strand contingency table. In the end, it'll look something like this:
+ * fw rc
+ * allele1 # #
+ * allele2 # #
+ * @return a 2x2 contingency table
+ */
+ private static int[][] getSNPContingencyTable(final Map stratifiedContexts,
+ final Allele ref,
+ final Allele alt,
+ final int minQScoreToConsider ) {
+ int[][] table = new int[2][2];
+
+ for ( Map.Entry sample : stratifiedContexts.entrySet() ) {
+ final int[] myTable = new int[4];
+ for (PileupElement p : sample.getValue().getBasePileup()) {
+
+ if ( ! isUsableBase(p) ) // ignore deletions and bad MQ
+ continue;
+
+ if ( p.getQual() < minQScoreToConsider || p.getMappingQual() < minQScoreToConsider )
+ continue;
+
+ updateTable(myTable, Allele.create(p.getBase(), false), p.getRead(), ref, alt, p.getRepresentativeCount());
+ }
+ if ( passesMinimumThreshold(myTable) )
+ copyToMainTable(myTable, table);
+ }
+
+ return table;
+ }
+
+ /**
+ * Can the base in this pileup element be used in comparative tests?
+ *
+ * @param p the pileup element to consider
+ *
+ * @return true if this base is part of a meaningful read for comparison, false otherwise
+ */
+ private static boolean isUsableBase(final PileupElement p) {
+ return !( p.isDeletion() ||
+ p.getMappingQual() == 0 ||
+ p.getMappingQual() == QualityUtils.MAPPING_QUALITY_UNAVAILABLE ||
+ ((int) p.getQual()) < QualityUtils.MIN_USABLE_Q_SCORE);
+ }
+
+ private static void updateTable(final int[] table, final Allele allele, final GATKSAMRecord read, final Allele ref, final Allele alt, final int representativeCount) {
+
+ final boolean matchesRef = allele.equals(ref, true);
+ final boolean matchesAlt = allele.equals(alt, true);
+
+ if ( matchesRef || matchesAlt ) {
+ final int offset = matchesRef ? 0 : 2;
+
+ if ( read.isStrandless() ) {
+
+ // ignore strandless reduced reads because they are always on the forward strand!
+ if ( !read.isReducedRead() ) {
+
+ // a strandless read counts as observations on both strand, at 50% weight, with a minimum of 1
+ // (the 1 is to ensure that a strandless read always counts as an observation on both strands, even
+ // if the read is only seen once, because it's a merged read or other)
+ final int toAdd = Math.max(representativeCount / 2, 1);
+ table[offset] += toAdd;
+ table[offset + 1] += toAdd;
+ }
+ } else {
+ // a normal read with an actual strand
+ final boolean isFW = !read.getReadNegativeStrandFlag();
+ table[offset + (isFW ? 0 : 1)] += representativeCount;
+ }
+ }
+ }
+}
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/GCContent.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/GCContent.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/GCContent.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/GCContent.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HaplotypeScore.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/HaplotypeScore.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HaplotypeScore.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/HaplotypeScore.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HardyWeinberg.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/HardyWeinberg.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HardyWeinberg.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/HardyWeinberg.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HomopolymerRun.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/HomopolymerRun.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HomopolymerRun.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/HomopolymerRun.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/InbreedingCoeff.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/InbreedingCoeff.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/InbreedingCoeff.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/InbreedingCoeff.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/LikelihoodRankSumTest.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/LikelihoodRankSumTest.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/LikelihoodRankSumTest.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/LikelihoodRankSumTest.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MVLikelihoodRatio.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/MVLikelihoodRatio.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MVLikelihoodRatio.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/MVLikelihoodRatio.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityRankSumTest.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityRankSumTest.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityRankSumTest.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityRankSumTest.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZero.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZero.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZero.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZero.java
diff --git a/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java
new file mode 100644
index 000000000..7ebbd49dd
--- /dev/null
+++ b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java
@@ -0,0 +1,191 @@
+/*
+* By downloading the PROGRAM you agree to the following terms of use:
+*
+* BROAD INSTITUTE - SOFTWARE LICENSE AGREEMENT - FOR ACADEMIC NON-COMMERCIAL RESEARCH PURPOSES ONLY
+*
+* This Agreement is made between the Broad Institute, Inc. with a principal address at 7 Cambridge Center, Cambridge, MA 02142 (BROAD) and the LICENSEE and is effective at the date the downloading is completed (EFFECTIVE DATE).
+*
+* WHEREAS, LICENSEE desires to license the PROGRAM, as defined hereinafter, and BROAD wishes to have this PROGRAM utilized in the public interest, subject only to the royalty-free, nonexclusive, nontransferable license rights of the United States Government pursuant to 48 CFR 52.227-14; and
+* WHEREAS, LICENSEE desires to license the PROGRAM and BROAD desires to grant a license on the following terms and conditions.
+* NOW, THEREFORE, in consideration of the promises and covenants made herein, the parties hereto agree as follows:
+*
+* 1. DEFINITIONS
+* 1.1 PROGRAM shall mean copyright in the object code and source code known as GATK2 and related documentation, if any, as they exist on the EFFECTIVE DATE and can be downloaded from http://www.broadinstitute/GATK on the EFFECTIVE DATE.
+*
+* 2. LICENSE
+* 2.1 Grant. Subject to the terms of this Agreement, BROAD hereby grants to LICENSEE, solely for academic non-commercial research purposes, a non-exclusive, non-transferable license to: (a) download, execute and display the PROGRAM and (b) create bug fixes and modify the PROGRAM.
+* The LICENSEE may apply the PROGRAM in a pipeline to data owned by users other than the LICENSEE and provide these users the results of the PROGRAM provided LICENSEE does so for academic non-commercial purposes only. For clarification purposes, academic sponsored research is not a commercial use under the terms of this Agreement.
+* 2.2 No Sublicensing or Additional Rights. LICENSEE shall not sublicense or distribute the PROGRAM, in whole or in part, without prior written permission from BROAD. LICENSEE shall ensure that all of its users agree to the terms of this Agreement. LICENSEE further agrees that it shall not put the PROGRAM on a network, server, or other similar technology that may be accessed by anyone other than the LICENSEE and its employees and users who have agreed to the terms of this agreement.
+* 2.3 License Limitations. Nothing in this Agreement shall be construed to confer any rights upon LICENSEE by implication, estoppel, or otherwise to any computer software, trademark, intellectual property, or patent rights of BROAD, or of any other entity, except as expressly granted herein. LICENSEE agrees that the PROGRAM, in whole or part, shall not be used for any commercial purpose, including without limitation, as the basis of a commercial software or hardware product or to provide services. LICENSEE further agrees that the PROGRAM shall not be copied or otherwise adapted in order to circumvent the need for obtaining a license for use of the PROGRAM.
+*
+* 3. OWNERSHIP OF INTELLECTUAL PROPERTY
+* LICENSEE acknowledges that title to the PROGRAM shall remain with BROAD. The PROGRAM is marked with the following BROAD copyright notice and notice of attribution to contributors. LICENSEE shall retain such notice on all copies. LICENSEE agrees to include appropriate attribution if any results obtained from use of the PROGRAM are included in any publication.
+* Copyright 2012 Broad Institute, Inc.
+* Notice of attribution: The GATK2 program was made available through the generosity of Medical and Population Genetics program at the Broad Institute, Inc.
+* LICENSEE shall not use any trademark or trade name of BROAD, or any variation, adaptation, or abbreviation, of such marks or trade names, or any names of officers, faculty, students, employees, or agents of BROAD except as states above for attribution purposes.
+*
+* 4. INDEMNIFICATION
+* LICENSEE shall indemnify, defend, and hold harmless BROAD, and their respective officers, faculty, students, employees, associated investigators and agents, and their respective successors, heirs and assigns, (Indemnitees), against any liability, damage, loss, or expense (including reasonable attorneys fees and expenses) incurred by or imposed upon any of the Indemnitees in connection with any claims, suits, actions, demands or judgments arising out of any theory of liability (including, without limitation, actions in the form of tort, warranty, or strict liability and regardless of whether such action has any factual basis) pursuant to any right or license granted under this Agreement.
+*
+* 5. NO REPRESENTATIONS OR WARRANTIES
+* THE PROGRAM IS DELIVERED AS IS. BROAD MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE PROGRAM OR THE COPYRIGHT, EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, WHETHER OR NOT DISCOVERABLE. BROAD EXTENDS NO WARRANTIES OF ANY KIND AS TO PROGRAM CONFORMITY WITH WHATEVER USER MANUALS OR OTHER LITERATURE MAY BE ISSUED FROM TIME TO TIME.
+* IN NO EVENT SHALL BROAD OR ITS RESPECTIVE DIRECTORS, OFFICERS, EMPLOYEES, AFFILIATED INVESTIGATORS AND AFFILIATES BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, INCLUDING, WITHOUT LIMITATION, ECONOMIC DAMAGES OR INJURY TO PROPERTY AND LOST PROFITS, REGARDLESS OF WHETHER BROAD SHALL BE ADVISED, SHALL HAVE OTHER REASON TO KNOW, OR IN FACT SHALL KNOW OF THE POSSIBILITY OF THE FOREGOING.
+*
+* 6. ASSIGNMENT
+* This Agreement is personal to LICENSEE and any rights or obligations assigned by LICENSEE without the prior written consent of BROAD shall be null and void.
+*
+* 7. MISCELLANEOUS
+* 7.1 Export Control. LICENSEE gives assurance that it will comply with all United States export control laws and regulations controlling the export of the PROGRAM, including, without limitation, all Export Administration Regulations of the United States Department of Commerce. Among other things, these laws and regulations prohibit, or require a license for, the export of certain types of software to specified countries.
+* 7.2 Termination. LICENSEE shall have the right to terminate this Agreement for any reason upon prior written notice to BROAD. If LICENSEE breaches any provision hereunder, and fails to cure such breach within thirty (30) days, BROAD may terminate this Agreement immediately. Upon termination, LICENSEE shall provide BROAD with written assurance that the original and all copies of the PROGRAM have been destroyed, except that, upon prior written authorization from BROAD, LICENSEE may retain a copy for archive purposes.
+* 7.3 Survival. The following provisions shall survive the expiration or termination of this Agreement: Articles 1, 3, 4, 5 and Sections 2.2, 2.3, 7.3, and 7.4.
+* 7.4 Notice. Any notices under this Agreement shall be in writing, shall specifically refer to this Agreement, and shall be sent by hand, recognized national overnight courier, confirmed facsimile transmission, confirmed electronic mail, or registered or certified mail, postage prepaid, return receipt requested. All notices under this Agreement shall be deemed effective upon receipt.
+* 7.5 Amendment and Waiver; Entire Agreement. This Agreement may be amended, supplemented, or otherwise modified only by means of a written instrument signed by all parties. Any waiver of any rights or failure to act in a specific instance shall relate only to such instance and shall not be construed as an agreement to waive any rights or fail to act in any other instance, whether or not similar. This Agreement constitutes the entire agreement among the parties with respect to its subject matter and supersedes prior agreements or understandings between the parties relating to its subject matter.
+* 7.6 Binding Effect; Headings. This Agreement shall be binding upon and inure to the benefit of the parties and their respective permitted successors and assigns. All headings are for convenience only and shall not affect the meaning of any provision of this Agreement.
+* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
+*/
+
+package org.broadinstitute.sting.gatk.walkers.annotator;
+
+import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
+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.gatk.walkers.annotator.interfaces.ActiveRegionBasedAnnotation;
+import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.AnnotatorCompatible;
+import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
+import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.StandardAnnotation;
+import org.broadinstitute.sting.utils.MathUtils;
+import org.broadinstitute.sting.utils.genotyper.PerReadAlleleLikelihoodMap;
+import org.broadinstitute.sting.utils.variant.GATKVariantContextUtils;
+import org.broadinstitute.variant.vcf.VCFHeaderLineType;
+import org.broadinstitute.variant.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.variant.variantcontext.Genotype;
+import org.broadinstitute.variant.variantcontext.GenotypesContext;
+import org.broadinstitute.variant.variantcontext.VariantContext;
+
+import java.util.*;
+
+/**
+ * Variant confidence (from the QUAL field) / unfiltered depth of non-reference samples. Note that the QD is also normalized by event length.
+ *
+ * Low scores are indicative of false positive calls and artifacts. Note that QualByDepth requires sequencing
+ * reads associated with the samples with polymorphic genotypes.
+ */
+public class QualByDepth extends InfoFieldAnnotation implements StandardAnnotation, ActiveRegionBasedAnnotation {
+// private final static Logger logger = Logger.getLogger(QualByDepth.class);
+
+ public Map annotate(final RefMetaDataTracker tracker,
+ final AnnotatorCompatible walker,
+ final ReferenceContext ref,
+ final Map stratifiedContexts,
+ final VariantContext vc,
+ final Map perReadAlleleLikelihoodMap ) {
+ if ( !vc.hasLog10PError() )
+ return null;
+
+ final GenotypesContext genotypes = vc.getGenotypes();
+ if ( genotypes == null || genotypes.size() == 0 )
+ return null;
+
+ int standardDepth = 0;
+ int ADrestrictedDepth = 0;
+
+ for ( final Genotype genotype : genotypes ) {
+
+ // we care only about variant calls with likelihoods
+ if ( !genotype.isHet() && !genotype.isHomVar() )
+ continue;
+
+ // if we have the AD values for this sample, let's make sure that the variant depth is greater than 1!
+ // TODO -- If we like how this is working and want to apply it to a situation other than the single sample HC pipeline,
+ // TODO -- then we will need to modify the annotateContext() - and related - routines in the VariantAnnotatorEngine
+ // TODO -- so that genotype-level annotations are run first (to generate AD on the samples) and then the site-level
+ // TODO -- annotations must come afterwards (so that QD can use the AD).
+ if ( genotype.hasAD() ) {
+ final int[] AD = genotype.getAD();
+ final int totalADdepth = (int)MathUtils.sum(AD);
+ if ( totalADdepth - AD[0] > 1 )
+ ADrestrictedDepth += totalADdepth;
+ standardDepth += totalADdepth;
+ continue;
+ }
+
+ if (stratifiedContexts!= null && !stratifiedContexts.isEmpty()) {
+ final AlignmentContext context = stratifiedContexts.get(genotype.getSampleName());
+ if ( context == null )
+ continue;
+ standardDepth += context.getBasePileup().depthOfCoverage();
+
+ } else if (perReadAlleleLikelihoodMap != null) {
+ final PerReadAlleleLikelihoodMap perReadAlleleLikelihoods = perReadAlleleLikelihoodMap.get(genotype.getSampleName());
+ if (perReadAlleleLikelihoods == null || perReadAlleleLikelihoods.isEmpty())
+ continue;
+
+ standardDepth += perReadAlleleLikelihoods.getNumberOfStoredElements();
+ } else if ( genotype.hasDP() ) {
+ standardDepth += genotype.getDP();
+ }
+ }
+
+ // if the AD-restricted depth is a usable value (i.e. not zero), then we should use that one going forward
+ if ( ADrestrictedDepth > 0 )
+ standardDepth = ADrestrictedDepth;
+
+ if ( standardDepth == 0 )
+ return null;
+
+ final double altAlleleLength = GATKVariantContextUtils.getMeanAltAlleleLength(vc);
+ // Hack: when refContext == null then we know we are coming from the HaplotypeCaller and do not want to do a
+ // full length-based normalization (because the indel length problem is present only in the UnifiedGenotyper)
+ double QD = -10.0 * vc.getLog10PError() / ((double)standardDepth * indelNormalizationFactor(altAlleleLength, ref != null));
+
+ // Hack: see note in the fixTooHighQD method below
+ QD = fixTooHighQD(QD);
+
+ final Map map = new HashMap<>();
+ map.put(getKeyNames().get(0), String.format("%.2f", QD));
+ return map;
+ }
+
+ /**
+ * Generate the indel normalization factor.
+ *
+ * @param altAlleleLength the average alternate allele length for the call
+ * @param increaseNormalizationAsLengthIncreases should we apply a normalization factor based on the allele length?
+ * @return a possitive double
+ */
+ private double indelNormalizationFactor(final double altAlleleLength, final boolean increaseNormalizationAsLengthIncreases) {
+ return ( increaseNormalizationAsLengthIncreases ? Math.max(altAlleleLength / 3.0, 1.0) : 1.0);
+ }
+
+ /**
+ * The haplotype caller generates very high quality scores when multiple events are on the
+ * same haplotype. This causes some very good variants to have unusually high QD values,
+ * and VQSR will filter these out. This code looks at the QD value, and if it is above
+ * threshold we map it down to the mean high QD value, with some jittering
+ *
+ * // TODO -- remove me when HaplotypeCaller bubble caller is live
+ *
+ * @param QD the raw QD score
+ * @return a QD value
+ */
+ private double fixTooHighQD(final double QD) {
+ if ( QD < MAX_QD_BEFORE_FIXING ) {
+ return QD;
+ } else {
+ return IDEAL_HIGH_QD + GenomeAnalysisEngine.getRandomGenerator().nextGaussian() * JITTER_SIGMA;
+ }
+ }
+
+ private final static double MAX_QD_BEFORE_FIXING = 35;
+ private final static double IDEAL_HIGH_QD = 30;
+ private final static double JITTER_SIGMA = 3;
+
+ public List getKeyNames() { return Arrays.asList("QD"); }
+
+ public List getDescriptions() {
+ return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFHeaderLineType.Float, "Variant Confidence/Quality by Depth"));
+ }
+
+
+}
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RMSMappingQuality.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/RMSMappingQuality.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RMSMappingQuality.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/RMSMappingQuality.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RankSumTest.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/RankSumTest.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RankSumTest.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/RankSumTest.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ReadPosRankSumTest.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/ReadPosRankSumTest.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ReadPosRankSumTest.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/ReadPosRankSumTest.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SampleList.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/SampleList.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SampleList.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/SampleList.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SpanningDeletions.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/SpanningDeletions.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SpanningDeletions.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/SpanningDeletions.java
diff --git a/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/StrandBiasBySample.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/StrandBiasBySample.java
new file mode 100644
index 000000000..ec1c1e729
--- /dev/null
+++ b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/StrandBiasBySample.java
@@ -0,0 +1,99 @@
+/*
+* By downloading the PROGRAM you agree to the following terms of use:
+*
+* BROAD INSTITUTE - SOFTWARE LICENSE AGREEMENT - FOR ACADEMIC NON-COMMERCIAL RESEARCH PURPOSES ONLY
+*
+* This Agreement is made between the Broad Institute, Inc. with a principal address at 7 Cambridge Center, Cambridge, MA 02142 (BROAD) and the LICENSEE and is effective at the date the downloading is completed (EFFECTIVE DATE).
+*
+* WHEREAS, LICENSEE desires to license the PROGRAM, as defined hereinafter, and BROAD wishes to have this PROGRAM utilized in the public interest, subject only to the royalty-free, nonexclusive, nontransferable license rights of the United States Government pursuant to 48 CFR 52.227-14; and
+* WHEREAS, LICENSEE desires to license the PROGRAM and BROAD desires to grant a license on the following terms and conditions.
+* NOW, THEREFORE, in consideration of the promises and covenants made herein, the parties hereto agree as follows:
+*
+* 1. DEFINITIONS
+* 1.1 PROGRAM shall mean copyright in the object code and source code known as GATK2 and related documentation, if any, as they exist on the EFFECTIVE DATE and can be downloaded from http://www.broadinstitute/GATK on the EFFECTIVE DATE.
+*
+* 2. LICENSE
+* 2.1 Grant. Subject to the terms of this Agreement, BROAD hereby grants to LICENSEE, solely for academic non-commercial research purposes, a non-exclusive, non-transferable license to: (a) download, execute and display the PROGRAM and (b) create bug fixes and modify the PROGRAM.
+* The LICENSEE may apply the PROGRAM in a pipeline to data owned by users other than the LICENSEE and provide these users the results of the PROGRAM provided LICENSEE does so for academic non-commercial purposes only. For clarification purposes, academic sponsored research is not a commercial use under the terms of this Agreement.
+* 2.2 No Sublicensing or Additional Rights. LICENSEE shall not sublicense or distribute the PROGRAM, in whole or in part, without prior written permission from BROAD. LICENSEE shall ensure that all of its users agree to the terms of this Agreement. LICENSEE further agrees that it shall not put the PROGRAM on a network, server, or other similar technology that may be accessed by anyone other than the LICENSEE and its employees and users who have agreed to the terms of this agreement.
+* 2.3 License Limitations. Nothing in this Agreement shall be construed to confer any rights upon LICENSEE by implication, estoppel, or otherwise to any computer software, trademark, intellectual property, or patent rights of BROAD, or of any other entity, except as expressly granted herein. LICENSEE agrees that the PROGRAM, in whole or part, shall not be used for any commercial purpose, including without limitation, as the basis of a commercial software or hardware product or to provide services. LICENSEE further agrees that the PROGRAM shall not be copied or otherwise adapted in order to circumvent the need for obtaining a license for use of the PROGRAM.
+*
+* 3. OWNERSHIP OF INTELLECTUAL PROPERTY
+* LICENSEE acknowledges that title to the PROGRAM shall remain with BROAD. The PROGRAM is marked with the following BROAD copyright notice and notice of attribution to contributors. LICENSEE shall retain such notice on all copies. LICENSEE agrees to include appropriate attribution if any results obtained from use of the PROGRAM are included in any publication.
+* Copyright 2012 Broad Institute, Inc.
+* Notice of attribution: The GATK2 program was made available through the generosity of Medical and Population Genetics program at the Broad Institute, Inc.
+* LICENSEE shall not use any trademark or trade name of BROAD, or any variation, adaptation, or abbreviation, of such marks or trade names, or any names of officers, faculty, students, employees, or agents of BROAD except as states above for attribution purposes.
+*
+* 4. INDEMNIFICATION
+* LICENSEE shall indemnify, defend, and hold harmless BROAD, and their respective officers, faculty, students, employees, associated investigators and agents, and their respective successors, heirs and assigns, (Indemnitees), against any liability, damage, loss, or expense (including reasonable attorneys fees and expenses) incurred by or imposed upon any of the Indemnitees in connection with any claims, suits, actions, demands or judgments arising out of any theory of liability (including, without limitation, actions in the form of tort, warranty, or strict liability and regardless of whether such action has any factual basis) pursuant to any right or license granted under this Agreement.
+*
+* 5. NO REPRESENTATIONS OR WARRANTIES
+* THE PROGRAM IS DELIVERED AS IS. BROAD MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE PROGRAM OR THE COPYRIGHT, EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, WHETHER OR NOT DISCOVERABLE. BROAD EXTENDS NO WARRANTIES OF ANY KIND AS TO PROGRAM CONFORMITY WITH WHATEVER USER MANUALS OR OTHER LITERATURE MAY BE ISSUED FROM TIME TO TIME.
+* IN NO EVENT SHALL BROAD OR ITS RESPECTIVE DIRECTORS, OFFICERS, EMPLOYEES, AFFILIATED INVESTIGATORS AND AFFILIATES BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, INCLUDING, WITHOUT LIMITATION, ECONOMIC DAMAGES OR INJURY TO PROPERTY AND LOST PROFITS, REGARDLESS OF WHETHER BROAD SHALL BE ADVISED, SHALL HAVE OTHER REASON TO KNOW, OR IN FACT SHALL KNOW OF THE POSSIBILITY OF THE FOREGOING.
+*
+* 6. ASSIGNMENT
+* This Agreement is personal to LICENSEE and any rights or obligations assigned by LICENSEE without the prior written consent of BROAD shall be null and void.
+*
+* 7. MISCELLANEOUS
+* 7.1 Export Control. LICENSEE gives assurance that it will comply with all United States export control laws and regulations controlling the export of the PROGRAM, including, without limitation, all Export Administration Regulations of the United States Department of Commerce. Among other things, these laws and regulations prohibit, or require a license for, the export of certain types of software to specified countries.
+* 7.2 Termination. LICENSEE shall have the right to terminate this Agreement for any reason upon prior written notice to BROAD. If LICENSEE breaches any provision hereunder, and fails to cure such breach within thirty (30) days, BROAD may terminate this Agreement immediately. Upon termination, LICENSEE shall provide BROAD with written assurance that the original and all copies of the PROGRAM have been destroyed, except that, upon prior written authorization from BROAD, LICENSEE may retain a copy for archive purposes.
+* 7.3 Survival. The following provisions shall survive the expiration or termination of this Agreement: Articles 1, 3, 4, 5 and Sections 2.2, 2.3, 7.3, and 7.4.
+* 7.4 Notice. Any notices under this Agreement shall be in writing, shall specifically refer to this Agreement, and shall be sent by hand, recognized national overnight courier, confirmed facsimile transmission, confirmed electronic mail, or registered or certified mail, postage prepaid, return receipt requested. All notices under this Agreement shall be deemed effective upon receipt.
+* 7.5 Amendment and Waiver; Entire Agreement. This Agreement may be amended, supplemented, or otherwise modified only by means of a written instrument signed by all parties. Any waiver of any rights or failure to act in a specific instance shall relate only to such instance and shall not be construed as an agreement to waive any rights or fail to act in any other instance, whether or not similar. This Agreement constitutes the entire agreement among the parties with respect to its subject matter and supersedes prior agreements or understandings between the parties relating to its subject matter.
+* 7.6 Binding Effect; Headings. This Agreement shall be binding upon and inure to the benefit of the parties and their respective permitted successors and assigns. All headings are for convenience only and shall not affect the meaning of any provision of this Agreement.
+* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
+*/
+
+package org.broadinstitute.sting.gatk.walkers.annotator;
+
+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.gatk.walkers.annotator.interfaces.AnnotatorCompatible;
+import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.GenotypeAnnotation;
+import org.broadinstitute.sting.utils.genotyper.PerReadAlleleLikelihoodMap;
+import org.broadinstitute.variant.variantcontext.Genotype;
+import org.broadinstitute.variant.variantcontext.GenotypeBuilder;
+import org.broadinstitute.variant.variantcontext.VariantContext;
+import org.broadinstitute.variant.vcf.VCFFormatHeaderLine;
+import org.broadinstitute.variant.vcf.VCFHeaderLineType;
+
+import java.util.*;
+
+/**
+ * Per-sample component statistics which comprise the Fisher's Exact Test to detect strand bias
+ * User: rpoplin
+ * Date: 8/28/13
+ */
+
+public class StrandBiasBySample extends GenotypeAnnotation {
+
+ public final static String STRAND_BIAS_BY_SAMPLE_KEY_NAME = "SB";
+
+ @Override
+ public void annotate(final RefMetaDataTracker tracker,
+ final AnnotatorCompatible walker,
+ final ReferenceContext ref,
+ final AlignmentContext stratifiedContext,
+ final VariantContext vc,
+ final Genotype g,
+ final GenotypeBuilder gb,
+ final PerReadAlleleLikelihoodMap alleleLikelihoodMap) {
+ if ( ! isAppropriateInput(alleleLikelihoodMap, g) )
+ return;
+
+ final int[][] table = FisherStrand.getContingencyTable(Collections.singletonMap(g.getSampleName(), alleleLikelihoodMap), vc);
+
+ gb.attribute(STRAND_BIAS_BY_SAMPLE_KEY_NAME, FisherStrand.getContingencyArray(table));
+ }
+
+ @Override
+ public List getKeyNames() { return Collections.singletonList(STRAND_BIAS_BY_SAMPLE_KEY_NAME); }
+
+ @Override
+ public List getDescriptions() { return Collections.singletonList(new VCFFormatHeaderLine(getKeyNames().get(0), 4, VCFHeaderLineType.Integer, "Per-sample component statistics which comprise the Fisher's Exact Test to detect strand bias.")); }
+
+ private boolean isAppropriateInput(final PerReadAlleleLikelihoodMap map, final Genotype g) {
+ return ! (map == null || g == null || !g.isCalled());
+ }
+}
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/TandemRepeatAnnotator.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/TandemRepeatAnnotator.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/TandemRepeatAnnotator.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/TandemRepeatAnnotator.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/TransmissionDisequilibriumTest.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/TransmissionDisequilibriumTest.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/TransmissionDisequilibriumTest.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/TransmissionDisequilibriumTest.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantType.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/VariantType.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantType.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/annotator/VariantType.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/AnalyzeCovariates.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/bqsr/AnalyzeCovariates.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/AnalyzeCovariates.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/bqsr/AnalyzeCovariates.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/BQSRGatherer.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/bqsr/BQSRGatherer.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/BQSRGatherer.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/bqsr/BQSRGatherer.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/BaseRecalibrator.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/bqsr/BaseRecalibrator.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/BaseRecalibrator.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/bqsr/BaseRecalibrator.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/ReadRecalibrationInfo.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/bqsr/ReadRecalibrationInfo.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/ReadRecalibrationInfo.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/bqsr/ReadRecalibrationInfo.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/RecalibrationArgumentCollection.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/bqsr/RecalibrationArgumentCollection.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/RecalibrationArgumentCollection.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/bqsr/RecalibrationArgumentCollection.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/RecalibrationEngine.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/bqsr/RecalibrationEngine.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/RecalibrationEngine.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/bqsr/RecalibrationEngine.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/BaseAndQualsCounts.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/BaseAndQualsCounts.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/BaseAndQualsCounts.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/BaseAndQualsCounts.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/BaseCounts.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/BaseCounts.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/BaseCounts.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/BaseCounts.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/BaseIndex.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/BaseIndex.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/BaseIndex.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/BaseIndex.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/CompressionStash.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/CompressionStash.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/CompressionStash.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/CompressionStash.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/Compressor.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/Compressor.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/Compressor.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/Compressor.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/FinishedGenomeLoc.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/FinishedGenomeLoc.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/FinishedGenomeLoc.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/FinishedGenomeLoc.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/HeaderElement.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/HeaderElement.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/HeaderElement.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/HeaderElement.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/MultiSampleCompressor.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/MultiSampleCompressor.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/MultiSampleCompressor.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/MultiSampleCompressor.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/ReduceReads.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/ReduceReads.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/ReduceReads.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/ReduceReads.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/ReduceReadsStash.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/ReduceReadsStash.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/ReduceReadsStash.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/ReduceReadsStash.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/SingleSampleCompressor.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/SingleSampleCompressor.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/SingleSampleCompressor.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/SingleSampleCompressor.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/SlidingWindow.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/SlidingWindow.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/SlidingWindow.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/SlidingWindow.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/SyntheticRead.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/SyntheticRead.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/compression/reducereads/SyntheticRead.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/compression/reducereads/SyntheticRead.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/BaseCoverageDistribution.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/BaseCoverageDistribution.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/BaseCoverageDistribution.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/BaseCoverageDistribution.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/FindCoveredIntervals.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/FindCoveredIntervals.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/FindCoveredIntervals.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/FindCoveredIntervals.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/AbstractStratification.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/AbstractStratification.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/AbstractStratification.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/AbstractStratification.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/CallableStatus.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/CallableStatus.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/CallableStatus.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/CallableStatus.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/DiagnoseTargets.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/DiagnoseTargets.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/DiagnoseTargets.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/DiagnoseTargets.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/IntervalMetric.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/IntervalMetric.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/IntervalMetric.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/IntervalMetric.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/IntervalStratification.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/IntervalStratification.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/IntervalStratification.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/IntervalStratification.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusMetric.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusMetric.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusMetric.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusMetric.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusMetricCoverageGap.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusMetricCoverageGap.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusMetricCoverageGap.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusMetricCoverageGap.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusMetricExcessiveCoverage.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusMetricExcessiveCoverage.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusMetricExcessiveCoverage.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusMetricExcessiveCoverage.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusMetricLowCoverage.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusMetricLowCoverage.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusMetricLowCoverage.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusMetricLowCoverage.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusMetricPoorQuality.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusMetricPoorQuality.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusMetricPoorQuality.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusMetricPoorQuality.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusStratification.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusStratification.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusStratification.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/LocusStratification.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/Metric.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/Metric.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/Metric.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/Metric.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/PluginUtils.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/PluginUtils.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/PluginUtils.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/PluginUtils.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/SampleMetric.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/SampleMetric.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/SampleMetric.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/SampleMetric.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/SampleMetricBadMates.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/SampleMetricBadMates.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/SampleMetricBadMates.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/SampleMetricBadMates.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/SampleMetricNoReads.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/SampleMetricNoReads.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/SampleMetricNoReads.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/SampleMetricNoReads.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/SampleStratification.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/SampleStratification.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/SampleStratification.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/SampleStratification.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/ThresHolder.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/ThresHolder.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/ThresHolder.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/diagnosetargets/ThresHolder.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/missing/Metrics.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/missing/Metrics.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/missing/Metrics.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/missing/Metrics.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/missing/QualifyMissingIntervals.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/missing/QualifyMissingIntervals.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/diagnostics/missing/QualifyMissingIntervals.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/diagnostics/missing/QualifyMissingIntervals.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/BaseMismatchModel.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/BaseMismatchModel.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/BaseMismatchModel.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/BaseMismatchModel.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/ConsensusAlleleCounter.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/ConsensusAlleleCounter.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/ConsensusAlleleCounter.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/ConsensusAlleleCounter.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidSNPGenotypeLikelihoods.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidSNPGenotypeLikelihoods.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidSNPGenotypeLikelihoods.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidSNPGenotypeLikelihoods.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/ErrorModel.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/ErrorModel.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/ErrorModel.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/ErrorModel.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidyGenotypeLikelihoods.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidyGenotypeLikelihoods.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidyGenotypeLikelihoods.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidyGenotypeLikelihoods.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidyGenotypeLikelihoodsCalculationModel.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidyGenotypeLikelihoodsCalculationModel.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidyGenotypeLikelihoodsCalculationModel.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidyGenotypeLikelihoodsCalculationModel.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidyIndelGenotypeLikelihoods.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidyIndelGenotypeLikelihoods.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidyIndelGenotypeLikelihoods.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidyIndelGenotypeLikelihoods.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidyIndelGenotypeLikelihoodsCalculationModel.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidyIndelGenotypeLikelihoodsCalculationModel.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidyIndelGenotypeLikelihoodsCalculationModel.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidyIndelGenotypeLikelihoodsCalculationModel.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidySNPGenotypeLikelihoods.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidySNPGenotypeLikelihoods.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidySNPGenotypeLikelihoods.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidySNPGenotypeLikelihoods.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidySNPGenotypeLikelihoodsCalculationModel.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidySNPGenotypeLikelihoodsCalculationModel.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidySNPGenotypeLikelihoodsCalculationModel.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/GeneralPloidySNPGenotypeLikelihoodsCalculationModel.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoodsCalculationModel.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoodsCalculationModel.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoodsCalculationModel.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoodsCalculationModel.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypePriors.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypePriors.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypePriors.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypePriors.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/IndelGenotypeLikelihoodsCalculationModel.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/IndelGenotypeLikelihoodsCalculationModel.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/IndelGenotypeLikelihoodsCalculationModel.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/IndelGenotypeLikelihoodsCalculationModel.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/PoolGenotypePriors.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/PoolGenotypePriors.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/PoolGenotypePriors.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/PoolGenotypePriors.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/ProbabilityVector.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/ProbabilityVector.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/ProbabilityVector.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/ProbabilityVector.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedArgumentCollection.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedArgumentCollection.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedArgumentCollection.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedArgumentCollection.java
diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java
similarity index 100%
rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java
rename to protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java
diff --git a/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java
new file mode 100644
index 000000000..aa334f680
--- /dev/null
+++ b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java
@@ -0,0 +1,844 @@
+/*
+* By downloading the PROGRAM you agree to the following terms of use:
+*
+* BROAD INSTITUTE - SOFTWARE LICENSE AGREEMENT - FOR ACADEMIC NON-COMMERCIAL RESEARCH PURPOSES ONLY
+*
+* This Agreement is made between the Broad Institute, Inc. with a principal address at 7 Cambridge Center, Cambridge, MA 02142 (BROAD) and the LICENSEE and is effective at the date the downloading is completed (EFFECTIVE DATE).
+*
+* WHEREAS, LICENSEE desires to license the PROGRAM, as defined hereinafter, and BROAD wishes to have this PROGRAM utilized in the public interest, subject only to the royalty-free, nonexclusive, nontransferable license rights of the United States Government pursuant to 48 CFR 52.227-14; and
+* WHEREAS, LICENSEE desires to license the PROGRAM and BROAD desires to grant a license on the following terms and conditions.
+* NOW, THEREFORE, in consideration of the promises and covenants made herein, the parties hereto agree as follows:
+*
+* 1. DEFINITIONS
+* 1.1 PROGRAM shall mean copyright in the object code and source code known as GATK2 and related documentation, if any, as they exist on the EFFECTIVE DATE and can be downloaded from http://www.broadinstitute/GATK on the EFFECTIVE DATE.
+*
+* 2. LICENSE
+* 2.1 Grant. Subject to the terms of this Agreement, BROAD hereby grants to LICENSEE, solely for academic non-commercial research purposes, a non-exclusive, non-transferable license to: (a) download, execute and display the PROGRAM and (b) create bug fixes and modify the PROGRAM.
+* The LICENSEE may apply the PROGRAM in a pipeline to data owned by users other than the LICENSEE and provide these users the results of the PROGRAM provided LICENSEE does so for academic non-commercial purposes only. For clarification purposes, academic sponsored research is not a commercial use under the terms of this Agreement.
+* 2.2 No Sublicensing or Additional Rights. LICENSEE shall not sublicense or distribute the PROGRAM, in whole or in part, without prior written permission from BROAD. LICENSEE shall ensure that all of its users agree to the terms of this Agreement. LICENSEE further agrees that it shall not put the PROGRAM on a network, server, or other similar technology that may be accessed by anyone other than the LICENSEE and its employees and users who have agreed to the terms of this agreement.
+* 2.3 License Limitations. Nothing in this Agreement shall be construed to confer any rights upon LICENSEE by implication, estoppel, or otherwise to any computer software, trademark, intellectual property, or patent rights of BROAD, or of any other entity, except as expressly granted herein. LICENSEE agrees that the PROGRAM, in whole or part, shall not be used for any commercial purpose, including without limitation, as the basis of a commercial software or hardware product or to provide services. LICENSEE further agrees that the PROGRAM shall not be copied or otherwise adapted in order to circumvent the need for obtaining a license for use of the PROGRAM.
+*
+* 3. OWNERSHIP OF INTELLECTUAL PROPERTY
+* LICENSEE acknowledges that title to the PROGRAM shall remain with BROAD. The PROGRAM is marked with the following BROAD copyright notice and notice of attribution to contributors. LICENSEE shall retain such notice on all copies. LICENSEE agrees to include appropriate attribution if any results obtained from use of the PROGRAM are included in any publication.
+* Copyright 2012 Broad Institute, Inc.
+* Notice of attribution: The GATK2 program was made available through the generosity of Medical and Population Genetics program at the Broad Institute, Inc.
+* LICENSEE shall not use any trademark or trade name of BROAD, or any variation, adaptation, or abbreviation, of such marks or trade names, or any names of officers, faculty, students, employees, or agents of BROAD except as states above for attribution purposes.
+*
+* 4. INDEMNIFICATION
+* LICENSEE shall indemnify, defend, and hold harmless BROAD, and their respective officers, faculty, students, employees, associated investigators and agents, and their respective successors, heirs and assigns, (Indemnitees), against any liability, damage, loss, or expense (including reasonable attorneys fees and expenses) incurred by or imposed upon any of the Indemnitees in connection with any claims, suits, actions, demands or judgments arising out of any theory of liability (including, without limitation, actions in the form of tort, warranty, or strict liability and regardless of whether such action has any factual basis) pursuant to any right or license granted under this Agreement.
+*
+* 5. NO REPRESENTATIONS OR WARRANTIES
+* THE PROGRAM IS DELIVERED AS IS. BROAD MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE PROGRAM OR THE COPYRIGHT, EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, WHETHER OR NOT DISCOVERABLE. BROAD EXTENDS NO WARRANTIES OF ANY KIND AS TO PROGRAM CONFORMITY WITH WHATEVER USER MANUALS OR OTHER LITERATURE MAY BE ISSUED FROM TIME TO TIME.
+* IN NO EVENT SHALL BROAD OR ITS RESPECTIVE DIRECTORS, OFFICERS, EMPLOYEES, AFFILIATED INVESTIGATORS AND AFFILIATES BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, INCLUDING, WITHOUT LIMITATION, ECONOMIC DAMAGES OR INJURY TO PROPERTY AND LOST PROFITS, REGARDLESS OF WHETHER BROAD SHALL BE ADVISED, SHALL HAVE OTHER REASON TO KNOW, OR IN FACT SHALL KNOW OF THE POSSIBILITY OF THE FOREGOING.
+*
+* 6. ASSIGNMENT
+* This Agreement is personal to LICENSEE and any rights or obligations assigned by LICENSEE without the prior written consent of BROAD shall be null and void.
+*
+* 7. MISCELLANEOUS
+* 7.1 Export Control. LICENSEE gives assurance that it will comply with all United States export control laws and regulations controlling the export of the PROGRAM, including, without limitation, all Export Administration Regulations of the United States Department of Commerce. Among other things, these laws and regulations prohibit, or require a license for, the export of certain types of software to specified countries.
+* 7.2 Termination. LICENSEE shall have the right to terminate this Agreement for any reason upon prior written notice to BROAD. If LICENSEE breaches any provision hereunder, and fails to cure such breach within thirty (30) days, BROAD may terminate this Agreement immediately. Upon termination, LICENSEE shall provide BROAD with written assurance that the original and all copies of the PROGRAM have been destroyed, except that, upon prior written authorization from BROAD, LICENSEE may retain a copy for archive purposes.
+* 7.3 Survival. The following provisions shall survive the expiration or termination of this Agreement: Articles 1, 3, 4, 5 and Sections 2.2, 2.3, 7.3, and 7.4.
+* 7.4 Notice. Any notices under this Agreement shall be in writing, shall specifically refer to this Agreement, and shall be sent by hand, recognized national overnight courier, confirmed facsimile transmission, confirmed electronic mail, or registered or certified mail, postage prepaid, return receipt requested. All notices under this Agreement shall be deemed effective upon receipt.
+* 7.5 Amendment and Waiver; Entire Agreement. This Agreement may be amended, supplemented, or otherwise modified only by means of a written instrument signed by all parties. Any waiver of any rights or failure to act in a specific instance shall relate only to such instance and shall not be construed as an agreement to waive any rights or fail to act in any other instance, whether or not similar. This Agreement constitutes the entire agreement among the parties with respect to its subject matter and supersedes prior agreements or understandings between the parties relating to its subject matter.
+* 7.6 Binding Effect; Headings. This Agreement shall be binding upon and inure to the benefit of the parties and their respective permitted successors and assigns. All headings are for convenience only and shall not affect the meaning of any provision of this Agreement.
+* 7.7 Governing Law. This Agreement shall be construed, governed, interpreted and applied in accordance with the internal laws of the Commonwealth of Massachusetts, U.S.A., without regard to conflict of laws principles.
+*/
+
+package org.broadinstitute.sting.gatk.walkers.genotyper;
+
+import com.google.java.contract.Ensures;
+import com.google.java.contract.Requires;
+import org.apache.log4j.Logger;
+import org.broadinstitute.sting.commandline.RodBinding;
+import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
+import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
+import org.broadinstitute.sting.gatk.contexts.AlignmentContextUtils;
+import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
+import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
+import org.broadinstitute.sting.gatk.walkers.annotator.VariantAnnotatorEngine;
+import org.broadinstitute.sting.gatk.walkers.genotyper.afcalc.AFCalc;
+import org.broadinstitute.sting.gatk.walkers.genotyper.afcalc.AFCalcFactory;
+import org.broadinstitute.sting.gatk.walkers.genotyper.afcalc.AFCalcResult;
+import org.broadinstitute.sting.utils.*;
+import org.broadinstitute.sting.utils.baq.BAQ;
+import org.broadinstitute.sting.utils.classloader.PluginManager;
+import org.broadinstitute.sting.utils.variant.GATKVariantContextUtils;
+import org.broadinstitute.sting.utils.BaseUtils;
+import org.broadinstitute.variant.vcf.VCFConstants;
+import org.broadinstitute.sting.utils.exceptions.UserException;
+import org.broadinstitute.sting.utils.pileup.PileupElement;
+import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
+import org.broadinstitute.variant.variantcontext.*;
+
+import java.io.PrintStream;
+import java.lang.reflect.Constructor;
+import java.util.*;
+
+public class UnifiedGenotyperEngine {
+ public static final String LOW_QUAL_FILTER_NAME = "LowQual";
+ private static final String GPSTRING = "GENERALPLOIDY";
+
+ public static final String NUMBER_OF_DISCOVERED_ALLELES_KEY = "NDA";
+ public static final String PL_FOR_ALL_SNP_ALLELES_KEY = "APL";
+
+ public static final double HUMAN_SNP_HETEROZYGOSITY = 1e-3;
+ public static final double HUMAN_INDEL_HETEROZYGOSITY = 1e-4;
+
+ private static final int SNP_MODEL = 0;
+ private static final int INDEL_MODEL = 1;
+
+ public enum OUTPUT_MODE {
+ /** produces calls only at variant sites */
+ EMIT_VARIANTS_ONLY,
+ /** produces calls at variant sites and confident reference sites */
+ EMIT_ALL_CONFIDENT_SITES,
+ /** produces calls at any callable site regardless of confidence; this argument is intended only for point
+ * mutations (SNPs) in DISCOVERY mode or generally when running in GENOTYPE_GIVEN_ALLELES mode; it will by
+ * no means produce a comprehensive set of indels in DISCOVERY mode */
+ EMIT_ALL_SITES
+ }
+
+ // the unified argument collection
+ private final UnifiedArgumentCollection UAC;
+ public UnifiedArgumentCollection getUAC() { return UAC; }
+
+ // the annotation engine
+ private final VariantAnnotatorEngine annotationEngine;
+
+ // the model used for calculating genotypes
+ private ThreadLocal