diff --git a/.classpath b/.classpath deleted file mode 100644 index 35d723d42..000000000 --- a/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/.gitignore b/.gitignore index c1f7e90fc..a20c2c965 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,19 @@ htsjdk.iws .command_tmp -classes -testclasses -javadoc -dist -contracts atlassian-ide-plugin.xml -intellij.testclasses -intellij.classes /htsjdk.version.properties -/bin /test-output -target -.idea/libraries -.idea/workspace.xml \ No newline at end of file + +#intellij +.idea/ +src/htsjdk.iml +*.iml +*.ipr +*.iws + + + + +#gradle stuff +.gradle/ +build/ diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 9ca710ba4..000000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -htsjdk \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index a85231498..000000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf337..000000000 --- a/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index d82104827..000000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 258602bb2..000000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/htsjdk-build.iml b/.idea/modules/htsjdk-build.iml deleted file mode 100644 index 5ebb09a1e..000000000 --- a/.idea/modules/htsjdk-build.iml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/htsjdk.iml b/.idea/modules/htsjdk.iml deleted file mode 100644 index 57d35daa5..000000000 --- a/.idea/modules/htsjdk.iml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.idea/sbt.xml b/.idea/sbt.xml deleted file mode 100644 index 1ed756227..000000000 --- a/.idea/sbt.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/scala_compiler.xml b/.idea/scala_compiler.xml deleted file mode 100644 index 90bcca756..000000000 --- a/.idea/scala_compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml deleted file mode 100644 index 922003b84..000000000 --- a/.idea/scopes/scope_settings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 830674470..000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.project b/.project deleted file mode 100644 index d179654be..000000000 --- a/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - htsjdk - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/.travis.yml b/.travis.yml index 1f5abbe69..5c9d731b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,19 +1,19 @@ language: java +dist: trusty sudo: true +before_cache: + - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock +cache: + directories: + - $HOME/.gradle/caches/ + - $HOME/.gradle/wrapper/ + - $HOME/.m2 jdk: - oraclejdk8 -install: ant -script: ant all test sra-test +script: ./gradlew test testSRA testIntelDeflater after_success: - echo "TRAVIS_BRANCH='$TRAVIS_BRANCH'"; echo "JAVA_HOME='$JAVA_HOME'"; - if [ "$TRAVIS_BRANCH" == "master" ] && [ "$JAVA_HOME" == "/usr/lib/jvm/java-8-oracle" ]; then - sbt \ - 'set buildSnapshot := true' \ - 'set javacOptions in (Compile, doc) ++= Seq("-quiet")' \ - 'set test in publish := {}' \ - 'set resolvers += Resolver.url("bintray-sbt-plugin-releases", url("http://dl.bintray.com/content/sbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)' \ - 'set publishTo := Option("artifactory-snapshots-publish" at "https://artifactory.broadinstitute.org/artifactory/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)' \ - "set credentials += Credentials(\"Artifactory Realm\", \"artifactory.broadinstitute.org\", \"${ARTIFACTORY_USERNAME}\", \"${ARTIFACTORY_PASSWORD}\")" \ - publish; + if [ "$TRAVIS_BRANCH" == "master" ]; then + ./gradlew uploadArchives; fi diff --git a/README.md b/README.md index 7d8f2e3f8..fb433e6fb 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,62 @@ Please see the [HTSJDK Documentation](http://samtools.github.io/htsjdk) for more > **NOTE: _HTSJDK does not currently support the latest Variant Call Format Specification (VCFv4.3 and BCFv2.2)._** +#### Building HTSJDK + +HTSJDK is now built using [gradle](http://gradle.org/). + +A wrapper script (`gradlew`) is included which will download the appropriate version of gradle on the first invocation. + +Example gradle usage from the htsjdk root directory: + - compile and build a jar + ``` + ./gradlew + ``` + or + ``` + ./gradlew jar + ``` + The jar will be in build/libs/htsjdk-\.jar where version is based on the current git commit. + + - run tests, a specific test class, or run a test and wait for the debugger to connect + ``` + ./gradlew test + + ./gradlew test --tests htsjdk.variant.variantcontext.AlleleUnitTest + ./gradlew test --tests "*AlleleUnitTest" + + ./gradlew test --tests "*AlleleUnitTest" --debug-jvm + ``` + + - clean the project directory + ``` + ./gradlew clean + ``` + + - build a monolithic jar that includes all of htsjdk's dependencies + ``` + ./gradlew shadowJar + ``` + + - create a snapshot and install it into your local maven repository + ``` + ./gradlew install + ``` + + - for an exhaustive list of all available targets + ``` + ./gradlew tasks + ``` + +#### Create an HTSJDK project in IntelliJ +To create a project in IntelliJ IDE for htsjdk do the following: + +1. Select fom the menu: `File -> New -> Project from Existing Sources` +2. In the resulting dialog, chose `Import from existing model`, select `Gradle` and `Next` +3. Choose the `default gradle wrapper` and `Finish`. + +From time to time if dependencies change in htsjdk you may need to refresh the project from the `View -> Gradle` menu. + #### Licensing Information Not all sub-packages of htsjdk are subject to the same license, so a license notice is included in each source file or sub-package as appropriate. Please check the relevant license notice whenever you start working with a part of htsjdk that you have not previously worked with to avoid any surprises. diff --git a/build.gradle b/build.gradle new file mode 100644 index 000000000..54d0913cb --- /dev/null +++ b/build.gradle @@ -0,0 +1,222 @@ +buildscript { + repositories { + mavenCentral() + } +} + +plugins { + id "java" + id 'maven' + id 'signing' + id 'com.palantir.git-version' version '0.5.1' + id 'com.github.johnrengelman.shadow' version '1.2.3' +} + +repositories { + mavenCentral() +} + +dependencies { + compile "org.apache.commons:commons-jexl:2.1.1" + compile "commons-logging:commons-logging:1.1.1" + compile "org.xerial.snappy:snappy-java:1.0.3-rc3" + compile "org.apache.commons:commons-compress:1.4.1" + compile "org.tukaani:xz:1.5" + compile "org.apache.ant:ant:1.8.2" + compile "gov.nih.nlm.ncbi:ngs-java:1.2.2" + + testCompile "org.testng:testng:6.9.9" +} + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + + +final isRelease = versionDetails().commitDistance == 0 +version = isRelease ? gitVersion() : gitVersion() + "-SNAPSHOT" + +logger.info("build for version:" + version) +group = 'com.github.samtools' + +defaultTasks 'jar' + +jar { + manifest { + attributes 'Implementation-Title': 'HTSJDK', + 'Implementation-Vendor' : 'Samtools Organization', + 'Implementation-Version': version + } +} + +processResources { + into "lib/jni/", { + from ("lib/jni/libIntelDeflater.so") + } +} + +import org.gradle.internal.os.OperatingSystem; + +tasks.withType(Test) { + outputs.upToDateWhen { false } // tests will always rerun + useTestNG() + + // set heap size for the test JVM(s) + minHeapSize = "1G" + maxHeapSize = "2G" + + jvmArgs '-Djava.awt.headless=true' //this prevents awt from displaying a java icon while the tests are running + + + if (System.env.CI == "true") { //if running under a CI output less into the logs + int count = 0 + + beforeTest { descriptor -> + count++ + if( count % 100 == 0) { + logger.lifecycle("Finished "+ Integer.toString(count++) + " tests") + } + } + } else { + // show standard out and standard error of the test JVM(s) on the console + testLogging.showStandardStreams = true + beforeTest { descriptor -> + logger.lifecycle("Running Test: " + descriptor) + } + + // listen to standard out and standard error of the test JVM(s) + onOutput { descriptor, event -> + logger.lifecycle("Test: " + descriptor + " produced standard out/err: " + event.message ) + } + } + + testLogging { + testLogging { + events "skipped", "failed" + exceptionFormat = "full" + } + afterSuite { desc, result -> + if (!desc.parent) { // will match the outermost suite + println "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)" + } + } + } +} + +test { + description = "Runs the unit tests other than the SRA tests" + useTestNG { + if( OperatingSystem.current().isUnix() ){ + excludeGroups "slow", "broken", "sra", "intel" + } else { + excludeGroups "slow", "broken", "unix", "sra", "intel" + } + } +} + +task testIntelDeflater(type: Test){ + jvmArgs '-Dsamjdk.intel_deflater_so_path=lib/jni/libIntelDeflater.so' + + description "Run the Intel Deflater tests" + useTestNG { + includeGroups "intel" + } +} + +task testSRA(type: Test){ + description "Run the SRA tests" + useTestNG{ + includeGroups "sra" + } +} + +task wrapper(type: Wrapper) { + description = "Regenerate the gradle wrapper" + gradleVersion = '2.13' +} + +// This is a hack to disable the java 8 default javadoc lint until we fix the html formatting +if (JavaVersion.current().isJava8Compatible()) { + tasks.withType(Javadoc) { + options.addStringOption('Xdoclint:none', '-quiet') + } +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from 'build/docs/javadoc' +} + +task sourcesJar(type: Jar) { + from sourceSets.main.allSource + classifier = 'sources' +} + +/** + *This specifies what artifacts will be built and uploaded when performing a maven upload. + */ +artifacts { + archives jar + archives javadocJar + archives sourcesJar +} + +/** + * Sign non-snapshot releases with our secret key. This should never need to be invoked directly. + */ +signing { + required { isRelease && gradle.taskGraph.hasTask("uploadArchives") } + sign configurations.archives +} + +/** + * Upload a release to sonatype. You must be an authorized uploader and have your sonatype + * username and password information in your gradle properties file. See the readme for more info. + * + * For releasing to your local maven repo, use gradle install + */ +uploadArchives { + repositories { + mavenDeployer { + beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } + + repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { + authentication(userName: project.findProperty("sonatypeUsername"), password: project.findProperty("sonatypePassword")) + } + + snapshotRepository(url: "https://artifactory.broadinstitute.org/artifactory/libs-snapshot-local/") { + authentication(userName: System.env.ARTIFACTORY_USERNAME, password: System.env.ARTIFACTORY_PASSWORD) + } + + pom.project { + name 'HTSJDK' + packaging 'jar' + description 'A Java API for high-throughput sequencing data (HTS) formats' + url 'http://samtools.github.io/htsjdk/' + + developers { + developer { + id 'picard' + name 'Picard Team' + url 'http://broadinstitute.github.io/picard' + } + } + + scm { + url 'git@github.com:samtools/htsjdk.git' + connection 'scm:git:git@github.com:samtools/htsjdk.git' + } + + licenses { + license { + name 'MIT License' + url 'http://opensource.org/licenses/MIT' + distribution 'repo' + } + } + } + } + } + doFirst{ + System.out.println("Uploading version $version") + } +} diff --git a/build.sbt b/build.sbt deleted file mode 100644 index ebcce1bc5..000000000 --- a/build.sbt +++ /dev/null @@ -1,154 +0,0 @@ -import com.typesafe.sbt.SbtGit._ -import de.johoop.testngplugin.TestNGPlugin._ -import sbt.Package.ManifestAttributes - -//added as a workaround for #https://github.com/samtools/htsjdk/issues/573 -resolvers += Resolver.sbtPluginRepo("releases") - -name := "htsjdk" - -val buildVersion = "2.3.0" - -organization := "com.github.samtools" - -libraryDependencies += "gov.nih.nlm.ncbi" % "ngs-java" % "1.2.2" - -libraryDependencies += "org.apache.commons" % "commons-jexl" % "2.1.1" - -libraryDependencies += "commons-logging" % "commons-logging" % "1.1.1" - -libraryDependencies += "org.xerial.snappy" % "snappy-java" % "1.0.3-rc3" - -libraryDependencies += "org.apache.commons" % "commons-compress" % "1.4.1" - -libraryDependencies += "org.tukaani" % "xz" % "1.5" - -libraryDependencies += "org.apache.ant" % "ant" % "1.8.2" - -libraryDependencies += "org.testng" % "testng" % "6.8.8" - -unmanagedBase := baseDirectory.value - -mappings in (Compile, packageBin) ++= Seq( - (baseDirectory.value / "lib/jni/libIntelDeflater.so") -> "lib/jni/libIntelDeflater.so" -) - -javaSource in Compile := baseDirectory.value / "src/java" - -javaSource in Test := baseDirectory.value / "src/tests" - -testNGSettings - -testNGSuites := Seq("src/tests/resources/testng.xml") - -autoScalaLibrary := false - -publishMavenStyle := true - -publishArtifact in Test := false - -pomIncludeRepository := { _ => false} - -val gitVersion = settingKey[String]("The head commit git hash.") - -gitVersion := git.gitHeadCommit.value.get - -val gitBranch = settingKey[String]("The git branch.") - -gitBranch := git.gitCurrentBranch.value - -val buildSnapshot = settingKey[Boolean]("Is this build a snapshot.") - -buildSnapshot := false - -version := { - if (buildSnapshot.value) { - s"$buildVersion-${gitVersion.value.substring(0, 7)}-SNAPSHOT" - } else { - s"$buildVersion" - } -} - -val implementationVersion = settingKey[String]("Implementation version.") - -implementationVersion := { - if (buildSnapshot.value) - s"$buildVersion(${gitVersion.value})(SNAPSHOT)" - else - s"$buildVersion(${gitVersion.value})" -} - -publishTo := { - val nexus = "https://oss.sonatype.org/" - if (isSnapshot.value) - Some("snapshots" at nexus + "content/repositories/snapshots") - else - Some("releases" at nexus + "service/local/staging/deploy/maven2") -} - -artifactName := { (sv: ScalaVersion, module: ModuleID, artifact: Artifact) => - val classifierStr = artifact.classifier match { - case None => ""; - case Some(c) => "-" + c - } - artifact.name + "-" + module.revision + classifierStr + "." + artifact.extension -} - -crossPaths := false - -javacOptions in (Compile,doc) ++= Seq("-Xdoclint:none") - -packageOptions := Seq(ManifestAttributes( - ("Implementation-Version", s"${implementationVersion.value}"), - ("Implementation-Vendor", "Broad Institute") -)) - -assemblyJarName := s"${name.value}-${version.value}.jar" - -assemblyMergeStrategy in assembly := { - case x if Assembly.isConfigFile(x) => - MergeStrategy.concat - case PathList(ps@_*) if Assembly.isReadme(ps.last) || Assembly.isLicenseFile(ps.last) => - MergeStrategy.rename - case PathList("META-INF", path@_*) => - path map { - _.toLowerCase - } match { - case ("manifest.mf" :: Nil) | ("index.list" :: Nil) | ("dependencies" :: Nil) => - MergeStrategy.discard - case ps@(x :: xs) if ps.last.endsWith(".sf") || ps.last.endsWith(".dsa") => - MergeStrategy.discard - case "plexus" :: xs => - MergeStrategy.discard - case "spring.tooling" :: xs => - MergeStrategy.discard - case "services" :: xs => - MergeStrategy.filterDistinctLines - case ("spring.schemas" :: Nil) | ("spring.handlers" :: Nil) => - MergeStrategy.filterDistinctLines - case _ => MergeStrategy.deduplicate - } - case "asm-license.txt" | "overview.html" => - MergeStrategy.discard - case _ => MergeStrategy.deduplicate -} - -pomExtra := http://samtools.github.io/htsjdk/ - - - MIT License - http://opensource.org/licenses/MIT - repo - - - - git@github.com:samtools/htsjdk.git - scm:git:git@github.com:samtools/htsjdk.git - - - - picard - Picard Team - http://broadinstitute.github.io/picard/ - - diff --git a/build.xml b/build.xml index 9a5fb1646..59bebded3 100755 --- a/build.xml +++ b/build.xml @@ -25,273 +25,38 @@ - - - - - - - - - - - - + - + + ANT IS DEPRECATED FOR BUILDING HTSJDK - - - - - + Please switch to using gradlew - - - - - - - - - - - - - + Examples: + compile htsjdk or it's tests + ./gradlew compileJava + ./gradlew compileTest - - - - - - + build a jar + ./gradlew jar - - - - - - - - + build a jar, along with source and document jars + ./gradlew build - - - - - - - - - + build a jar that packages all of htsjdk's dependencies in a single jar + ./gradlew shadowJar - - - + run tests, or a single test, or run a test and wait for the debugger + ./gradlew test + ./gradlew test --tests "*AlleleUnitTest" + ./gradlew test --tests "*AlleleUnitTest" --debug-jvm - + clean the project directory + ./gradlew clean - - - + see an exhaustive list of all available targets + ./gradlew tasks + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/etc/test/junit-noframes.xsl b/etc/test/junit-noframes.xsl deleted file mode 100644 index ffbf68b08..000000000 --- a/etc/test/junit-noframes.xsl +++ /dev/null @@ -1,581 +0,0 @@ - - - - - - - - - - - Unit Test Results - - - - - - - - - Last Modified: - - - - -
- - - -
- - - -
- - - - - - -
- - - - - - - -

Packages

- Note: package statistics are not computed recursively, they only sum up all of its testsuites numbers. - - - - - - - - - - - - - - - - - Failure - Error - - - - - - - - - -
- - - - - - - - - - - - - -
-
- - - - - - - - - - - - -

Package - -

- - - - - - -
- Back to top -

-

- - - - - - - - -

TestCase - -

- - - - - - - - - - -
- -
- - - - - -
- - N/A - - - - - - -
- - - - - -
- - N/A - - - - - - -
- -

- - Back to top - - - - -

Summary

- - - - - - - - - - - - - - - - - Failure - Error - - - - - - - - - -
TestsFailuresErrorsSuccess rateTime
- - - - - - - - - - - - - -
- - - - -
- Note: - failures - are anticipated and checked for with assertions while - errors - are unanticipated. -
-
- - - - cur = TestCases[' - - . - - '] = new Array(); - - - cur[' - - '] = ' - - - - '; - - - - - -

Unit Test Results

- - - - - -
Designed for use with - JUnit - and - Ant - . -
-
-
- - - - Name - Tests - Errors - Failures - Time(s) - - - - - - - Name - Tests - Errors - Failures - Time(s) - - - - - - - Name - Status - Type - Time(s) - - - - - - - - System.out - - - - - - - System.err - - - - - - - - - - Failure - Error - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Error - - - - - . - - - - - Failure - - - - - - Error - - - - - - Success - - - - - - - - - - - - - - - - - - - - - - - - N/A - - - - - - -
-
- - - -
- - -
- - - - - - - - - - - - - -
-
-
- -
- - - - - - - - - - - -
- - diff --git a/etc/test/testng.css b/etc/test/testng.css deleted file mode 100644 index 617bde1d1..000000000 --- a/etc/test/testng.css +++ /dev/null @@ -1,26 +0,0 @@ -nvocation-failed, .test-failed { background-color: #ffc0cb; } -.invocation-percent, .test-percent { background-color: #66cdaa; } -.invocation-passed, .test-passed { background-color: #98fb98; } -.invocation-skipped, .test-skipped { background-color: #f0e68c; } - -.main-page { - font-size: small; - font-family: verdana, 'trebuchet ms', sans-serif; -} - - -table { - font-size: small; - font-family: verdana, 'trebuchet ms', sans-serif; -} - -h1 , h2 , h3 , h4 , h5 , h6 { - color: #999; - font-family : Georgia, "Times New Roman", Times, serif; - font-weight : normal; - font-variant : small-caps; - padding: 0px; - margin-bottom:0.2px; - margin-top:1px; -} - diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000..ca78035ef Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..aad2b2428 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri May 13 14:00:35 EDT 2016 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip diff --git a/gradlew b/gradlew new file mode 100755 index 000000000..27309d923 --- /dev/null +++ b/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/htsjdk.iml b/htsjdk.iml deleted file mode 100644 index 3c722e41e..000000000 --- a/htsjdk.iml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/htsjdk.ipr b/htsjdk.ipr deleted file mode 100644 index 9ff5fb24c..000000000 --- a/htsjdk.ipr +++ /dev/null @@ -1,352 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ribosomal - - - - - bgzipped - codecs - demultiplex - demultiplexed - eamss - endian - gzipped - illumina's - indexable - inferer - inferrer - parsability - phread - seekable - tabix - tokenizes - tribble - - - - - - - - - - http://www.w3.org/1999/xhtml - - - - - - - - - - - - - - diff --git a/lib/apache-ant-1.8.2-bzip2.jar b/lib/apache-ant-1.8.2-bzip2.jar deleted file mode 100644 index 0ca2928ec..000000000 Binary files a/lib/apache-ant-1.8.2-bzip2.jar and /dev/null differ diff --git a/lib/commons-compress-1.4.1.jar b/lib/commons-compress-1.4.1.jar deleted file mode 100644 index b58761e81..000000000 Binary files a/lib/commons-compress-1.4.1.jar and /dev/null differ diff --git a/lib/commons-jexl-2.1.1.jar b/lib/commons-jexl-2.1.1.jar deleted file mode 100644 index d160a23db..000000000 Binary files a/lib/commons-jexl-2.1.1.jar and /dev/null differ diff --git a/lib/commons-logging-1.1.1.jar b/lib/commons-logging-1.1.1.jar deleted file mode 100644 index 1deef144c..000000000 Binary files a/lib/commons-logging-1.1.1.jar and /dev/null differ diff --git a/lib/ngs-java-1.2.2.jar b/lib/ngs-java-1.2.2.jar deleted file mode 100644 index c64920c8f..000000000 Binary files a/lib/ngs-java-1.2.2.jar and /dev/null differ diff --git a/lib/snappy-java-1.0.3-rc3.jar b/lib/snappy-java-1.0.3-rc3.jar deleted file mode 100644 index 432dbe240..000000000 Binary files a/lib/snappy-java-1.0.3-rc3.jar and /dev/null differ diff --git a/lib/testng/jcommander-1.48.jar b/lib/testng/jcommander-1.48.jar deleted file mode 100644 index ad0a12c95..000000000 Binary files a/lib/testng/jcommander-1.48.jar and /dev/null differ diff --git a/lib/testng/testng-6.9.10.jar b/lib/testng/testng-6.9.10.jar deleted file mode 100644 index a9e0f76d4..000000000 Binary files a/lib/testng/testng-6.9.10.jar and /dev/null differ diff --git a/lib/xz-1.5.jar b/lib/xz-1.5.jar deleted file mode 100644 index 2e9599ecf..000000000 Binary files a/lib/xz-1.5.jar and /dev/null differ diff --git a/project/plugins.sbt b/project/plugins.sbt deleted file mode 100644 index 9c2b11449..000000000 --- a/project/plugins.sbt +++ /dev/null @@ -1,5 +0,0 @@ -addSbtPlugin("de.johoop" % "sbt-testng-plugin" % "3.0.2") - -addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.13.0") - -addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.7.1") \ No newline at end of file diff --git a/src/test/java/htsjdk/samtools/BAMCigarOverflowTest.java b/src/test/java/htsjdk/samtools/BAMCigarOverflowTest.java index 74f44a80e..dd630f937 100644 --- a/src/test/java/htsjdk/samtools/BAMCigarOverflowTest.java +++ b/src/test/java/htsjdk/samtools/BAMCigarOverflowTest.java @@ -11,7 +11,7 @@ * causes an overflow in the CIGAR when reading a BAM file for a read that spans a very large intron. */ public class BAMCigarOverflowTest { - private static final File TEST_DATA_DIR = new File("testdata/htsjdk/samtools"); + private static final File TEST_DATA_DIR = new File("src/test/resources/htsjdk/samtools"); @Test public void testCigarOverflow() throws Exception { diff --git a/src/test/java/htsjdk/samtools/BAMFileIndexTest.java b/src/test/java/htsjdk/samtools/BAMFileIndexTest.java index 7299cfcf3..170bc4726 100755 --- a/src/test/java/htsjdk/samtools/BAMFileIndexTest.java +++ b/src/test/java/htsjdk/samtools/BAMFileIndexTest.java @@ -47,7 +47,7 @@ * Test BAM file indexing. */ public class BAMFileIndexTest { - private final File BAM_FILE = new File("testdata/htsjdk/samtools/BAMFileIndexTest/index_test.bam"); + private final File BAM_FILE = new File("src/test/resources/htsjdk/samtools/BAMFileIndexTest/index_test.bam"); private final boolean mVerbose = false; @Test diff --git a/src/test/java/htsjdk/samtools/BAMIndexWriterTest.java b/src/test/java/htsjdk/samtools/BAMIndexWriterTest.java index c90798048..09f92360e 100644 --- a/src/test/java/htsjdk/samtools/BAMIndexWriterTest.java +++ b/src/test/java/htsjdk/samtools/BAMIndexWriterTest.java @@ -40,8 +40,8 @@ */ public class BAMIndexWriterTest { // Two input files for basic test - private final String BAM_FILE_LOCATION = "testdata/htsjdk/samtools/BAMFileIndexTest/index_test.bam"; - private final String BAI_FILE_LOCATION = "testdata/htsjdk/samtools/BAMFileIndexTest/index_test.bam.bai"; + private final String BAM_FILE_LOCATION = "src/test/resources/htsjdk/samtools/BAMFileIndexTest/index_test.bam"; + private final String BAI_FILE_LOCATION = "src/test/resources/htsjdk/samtools/BAMFileIndexTest/index_test.bam.bai"; private final File BAM_FILE = new File(BAM_FILE_LOCATION); private final File BAI_FILE = new File(BAI_FILE_LOCATION); diff --git a/src/test/java/htsjdk/samtools/BAMIteratorTest.java b/src/test/java/htsjdk/samtools/BAMIteratorTest.java index 369d63463..5fa9e7dc4 100644 --- a/src/test/java/htsjdk/samtools/BAMIteratorTest.java +++ b/src/test/java/htsjdk/samtools/BAMIteratorTest.java @@ -35,7 +35,7 @@ * @author alecw@broadinstitute.org */ public class BAMIteratorTest { - private static final File TEST_DATA_DIR = new File("testdata/htsjdk/samtools"); + private static final File TEST_DATA_DIR = new File("src/test/resources/htsjdk/samtools"); @Test(dataProvider = "dataProvider") public void testIterateEmptyBam(final String bam) throws Exception { diff --git a/src/test/java/htsjdk/samtools/BAMRemoteFileTest.java b/src/test/java/htsjdk/samtools/BAMRemoteFileTest.java index 6689efbd3..387de4e1a 100644 --- a/src/test/java/htsjdk/samtools/BAMRemoteFileTest.java +++ b/src/test/java/htsjdk/samtools/BAMRemoteFileTest.java @@ -40,8 +40,8 @@ * Test BAM file indexing. */ public class BAMRemoteFileTest { - private final File BAM_INDEX_FILE = new File("testdata/htsjdk/samtools/BAMFileIndexTest/index_test.bam.bai"); - private final File BAM_FILE = new File("testdata/htsjdk/samtools/BAMFileIndexTest/index_test.bam"); + private final File BAM_INDEX_FILE = new File("src/test/resources/htsjdk/samtools/BAMFileIndexTest/index_test.bam.bai"); + private final File BAM_FILE = new File("src/test/resources/htsjdk/samtools/BAMFileIndexTest/index_test.bam"); private final String BAM_URL_STRING = "http://www.broadinstitute.org/~picard/testdata/index_test.bam"; private final URL bamURL; @@ -323,4 +323,4 @@ private void verbose(final String text) { System.out.println("# " + text); } } -} \ No newline at end of file +} diff --git a/src/test/java/htsjdk/samtools/CRAMComplianceTest.java b/src/test/java/htsjdk/samtools/CRAMComplianceTest.java index bea325746..81cd2f916 100644 --- a/src/test/java/htsjdk/samtools/CRAMComplianceTest.java +++ b/src/test/java/htsjdk/samtools/CRAMComplianceTest.java @@ -77,7 +77,7 @@ public TestCase(File root, String name) { @Test(dataProvider = "test1") public void test(String name) throws IOException { - TestCase t = new TestCase(new File("testdata/htsjdk/samtools/cram/"), name); + TestCase t = new TestCase(new File("src/test/resources/htsjdk/samtools/cram/"), name); ReferenceSource source = new ReferenceSource(t.refFile); SamReader reader = SamReaderFactory.make().validationStringency(ValidationStringency.SILENT).open(t.bamFile); diff --git a/src/test/java/htsjdk/samtools/CRAMEdgeCasesTest.java b/src/test/java/htsjdk/samtools/CRAMEdgeCasesTest.java index 4d3b0a764..e77e0e8dc 100644 --- a/src/test/java/htsjdk/samtools/CRAMEdgeCasesTest.java +++ b/src/test/java/htsjdk/samtools/CRAMEdgeCasesTest.java @@ -42,8 +42,8 @@ public void testUnsorted() throws IOException { @Test(expectedExceptions = CRAMException.class) public void testContigNotFoundInRef() throws IOException { boolean sawException = false; - final File CRAMFile = new File("testdata/htsjdk/samtools/cram/CRAMException/testContigNotInRef.cram"); - final File refFile = new File("testdata/htsjdk/samtools/cram/CRAMException/testContigNotInRef.fa"); + final File CRAMFile = new File("src/test/resources/htsjdk/samtools/cram/CRAMException/testContigNotInRef.cram"); + final File refFile = new File("src/test/resources/htsjdk/samtools/cram/CRAMException/testContigNotInRef.fa"); final ReferenceSource refSource = new ReferenceSource(refFile); final CRAMIterator iterator = new CRAMIterator(new FileInputStream(CRAMFile), refSource, ValidationStringency.STRICT); while (iterator.hasNext()) { diff --git a/src/test/java/htsjdk/samtools/CRAMFileBAIIndexTest.java b/src/test/java/htsjdk/samtools/CRAMFileBAIIndexTest.java index 910828387..a5ec23926 100644 --- a/src/test/java/htsjdk/samtools/CRAMFileBAIIndexTest.java +++ b/src/test/java/htsjdk/samtools/CRAMFileBAIIndexTest.java @@ -33,7 +33,7 @@ * Created by Vadim on 14/03/2015. */ public class CRAMFileBAIIndexTest { - private final File BAM_FILE = new File("testdata/htsjdk/samtools/BAMFileIndexTest/index_test.bam"); + private final File BAM_FILE = new File("src/test/resources/htsjdk/samtools/BAMFileIndexTest/index_test.bam"); private File cramFile; private File indexFile; private byte[] cramBytes; @@ -139,8 +139,8 @@ public void scanMappedReads() throws IOException { @Test public void testNoStringencyConstructor() throws IOException { - final File CRAMFile = new File("testdata/htsjdk/samtools/cram/auxf#values.3.0.cram"); - final File refFile = new File("testdata/htsjdk/samtools/cram/auxf.fa"); + final File CRAMFile = new File("src/test/resources/htsjdk/samtools/cram/auxf#values.3.0.cram"); + final File refFile = new File("src/test/resources/htsjdk/samtools/cram/auxf.fa"); ReferenceSource refSource = new ReferenceSource(refFile); long start = 0; diff --git a/src/test/java/htsjdk/samtools/CRAMFileReaderTest.java b/src/test/java/htsjdk/samtools/CRAMFileReaderTest.java index e9db7e8e2..8c610bdf7 100644 --- a/src/test/java/htsjdk/samtools/CRAMFileReaderTest.java +++ b/src/test/java/htsjdk/samtools/CRAMFileReaderTest.java @@ -41,7 +41,7 @@ */ public class CRAMFileReaderTest { - private static final File TEST_DATA_DIR = new File("testdata/htsjdk/samtools"); + private static final File TEST_DATA_DIR = new File("src/test/resources/htsjdk/samtools"); @BeforeClass public void initClass() { diff --git a/src/test/java/htsjdk/samtools/CRAMFileWriterTest.java b/src/test/java/htsjdk/samtools/CRAMFileWriterTest.java index e09f38c92..c49552838 100644 --- a/src/test/java/htsjdk/samtools/CRAMFileWriterTest.java +++ b/src/test/java/htsjdk/samtools/CRAMFileWriterTest.java @@ -228,9 +228,9 @@ public void testCRAMWriterConstructorRequiredReference_3() { @Test public void test_roundtrip_tlen_preserved() throws IOException { - SamReader reader = SamReaderFactory.make().open(new File("testdata/htsjdk/samtools/cram_tlen_reads.sorted.sam")); + SamReader reader = SamReaderFactory.make().open(new File("src/test/resources/htsjdk/samtools/cram_tlen_reads.sorted.sam")); ByteArrayOutputStream baos = new ByteArrayOutputStream(); - final ReferenceSource source = new ReferenceSource(new File("testdata/htsjdk/samtools/cram_tlen.fasta")); + final ReferenceSource source = new ReferenceSource(new File("src/test/resources/htsjdk/samtools/cram_tlen.fasta")); CRAMFileWriter writer = new CRAMFileWriter(baos, source, reader.getFileHeader(), "test.cram"); SAMRecordIterator iterator = reader.iterator(); List records = new ArrayList(); @@ -254,8 +254,8 @@ public void test_roundtrip_tlen_preserved() throws IOException { @Test public void testCRAMQuerySort() throws IOException { - final File input = new File("testdata/htsjdk/samtools/cram_query_sorted.cram"); - final File reference = new File("testdata/htsjdk/samtools/cram_query_sorted.fasta"); + final File input = new File("src/test/resources/htsjdk/samtools/cram_query_sorted.cram"); + final File reference = new File("src/test/resources/htsjdk/samtools/cram_query_sorted.fasta"); final File outputFile = File.createTempFile("tmp.", ".cram"); try (final SamReader reader = SamReaderFactory.makeDefault().referenceSequence(reference).open(input); diff --git a/src/test/java/htsjdk/samtools/DownsamplingIteratorTests.java b/src/test/java/htsjdk/samtools/DownsamplingIteratorTests.java index d492f1110..e84ee2e48 100644 --- a/src/test/java/htsjdk/samtools/DownsamplingIteratorTests.java +++ b/src/test/java/htsjdk/samtools/DownsamplingIteratorTests.java @@ -1,5 +1,6 @@ package htsjdk.samtools; +import htsjdk.samtools.DownsamplingIteratorFactory.Strategy; import org.testng.Assert; import org.testng.annotations.Test; @@ -9,8 +10,6 @@ import java.util.List; import java.util.Random; -import htsjdk.samtools.DownsamplingIteratorFactory.Strategy; - /** * Tests for the downsampling iterator class. * @author Tim Fennell @@ -23,10 +22,16 @@ put(Strategy.ConstantMemory, 0.01); }}; + private static Random getRandom(){ + //this test is probably too strict in it's tolerances + //not every random seed works, 10000 for example is rejected + return new Random(10001); + } + @Test public void testBasicFunction() { final SAMRecordSetBuilder builder = new SAMRecordSetBuilder(); - final Random r = new Random(); + final Random r = getRandom(); for (int i=0; i recs) { @Test public void testMixOfPairsAndFrags() { final SAMRecordSetBuilder builder = new SAMRecordSetBuilder(); - final Random r = new Random(); + final Random r = getRandom(); for (int i=0; i results = executeValidation(samReader, null, IndexValidationStringency.EXHAUSTIVE); final Histogram.Bin bin = results.get(SAMValidationError.Type.INVALID_QUALITY_FORMAT.getHistogramString()); final double value = bin.getValue(); diff --git a/src/test/java/htsjdk/samtools/fastq/FastqWriterTest.java b/src/test/java/htsjdk/samtools/fastq/FastqWriterTest.java index 9610d0279..eba5c5b9f 100644 --- a/src/test/java/htsjdk/samtools/fastq/FastqWriterTest.java +++ b/src/test/java/htsjdk/samtools/fastq/FastqWriterTest.java @@ -36,7 +36,7 @@ * test fastq */ public class FastqWriterTest { - private static final File TEST_DATA_DIR = new File("testdata/htsjdk/samtools/util/QualityEncodingDetectorTest"); + private static final File TEST_DATA_DIR = new File("src/test/resources/htsjdk/samtools/util/QualityEncodingDetectorTest"); @DataProvider(name = "fastqsource") public Object[][] createTestData() { diff --git a/src/test/java/htsjdk/samtools/filter/JavascriptSamRecordFilterTest.java b/src/test/java/htsjdk/samtools/filter/JavascriptSamRecordFilterTest.java index 7fc5fd27e..78355760a 100644 --- a/src/test/java/htsjdk/samtools/filter/JavascriptSamRecordFilterTest.java +++ b/src/test/java/htsjdk/samtools/filter/JavascriptSamRecordFilterTest.java @@ -40,7 +40,7 @@ */ public class JavascriptSamRecordFilterTest { - final File testDir = new File("./testdata/htsjdk/samtools"); + final File testDir = new File("./src/test/resources/htsjdk/samtools"); @DataProvider public Object[][] jsData() { diff --git a/src/test/java/htsjdk/samtools/liftover/LiftOverTest.java b/src/test/java/htsjdk/samtools/liftover/LiftOverTest.java index 92599ba74..01aaf9b2f 100644 --- a/src/test/java/htsjdk/samtools/liftover/LiftOverTest.java +++ b/src/test/java/htsjdk/samtools/liftover/LiftOverTest.java @@ -40,7 +40,7 @@ * @author alecw@broadinstitute.org */ public class LiftOverTest { - private static final File TEST_DATA_DIR = new File("testdata/htsjdk/samtools/liftover"); + private static final File TEST_DATA_DIR = new File("src/test/resources/htsjdk/samtools/liftover"); private static final File CHAIN_FILE = new File(TEST_DATA_DIR, "hg18ToHg19.over.chain"); private LiftOver liftOver; diff --git a/src/test/java/htsjdk/samtools/metrics/MetricsFileTest.java b/src/test/java/htsjdk/samtools/metrics/MetricsFileTest.java index 23930314d..228d87d6c 100644 --- a/src/test/java/htsjdk/samtools/metrics/MetricsFileTest.java +++ b/src/test/java/htsjdk/samtools/metrics/MetricsFileTest.java @@ -182,7 +182,7 @@ public void testWriteMetricsFile() throws IOException, ClassNotFoundException { @Test public void areMetricsFilesEqualTest(){ - final File TEST_DIR = new File("testdata/htsjdk/samtools/metrics/"); + final File TEST_DIR = new File("src/test/resources/htsjdk/samtools/metrics/"); final File file1 = new File(TEST_DIR,"metricsOne.metrics"); final File file2 = new File(TEST_DIR,"metricsOneCopy.metrics"); final File fileModifiedHist = new File(TEST_DIR,"metricsOneModifiedHistogram.metrics"); diff --git a/src/test/java/htsjdk/samtools/reference/FastaSequenceFileTest.java b/src/test/java/htsjdk/samtools/reference/FastaSequenceFileTest.java index 328063eec..87927f65b 100644 --- a/src/test/java/htsjdk/samtools/reference/FastaSequenceFileTest.java +++ b/src/test/java/htsjdk/samtools/reference/FastaSequenceFileTest.java @@ -72,7 +72,7 @@ public void testIntermediateWhitespace() throws Exception { // There was a bug when reading a fasta with trailing whitespace, only when a sequence dictionary exists. @Test public void testTrailingWhitespaceWithPreexistingSequenceDictionary() throws Exception { - final File fasta = new File("testdata/htsjdk/samtools/reference/reference_with_trailing_whitespace.fasta"); + final File fasta = new File("src/test/resources/htsjdk/samtools/reference/reference_with_trailing_whitespace.fasta"); final FastaSequenceFile fastaReader = new FastaSequenceFile(fasta, true); ReferenceSequence referenceSequence = fastaReader.nextSequence(); Assert.assertEquals(referenceSequence.getName(), "chr1"); diff --git a/src/test/java/htsjdk/samtools/reference/FastaSequenceIndexTest.java b/src/test/java/htsjdk/samtools/reference/FastaSequenceIndexTest.java index 511b1ab5d..bfef121df 100644 --- a/src/test/java/htsjdk/samtools/reference/FastaSequenceIndexTest.java +++ b/src/test/java/htsjdk/samtools/reference/FastaSequenceIndexTest.java @@ -37,7 +37,7 @@ * Test the fasta sequence index reader. */ public class FastaSequenceIndexTest { - private static File TEST_DATA_DIR = new File("testdata/htsjdk/samtools/reference"); + private static File TEST_DATA_DIR = new File("src/test/resources/htsjdk/samtools/reference"); @DataProvider(name="homosapiens") public Object[][] provideHomoSapiens() throws FileNotFoundException { diff --git a/src/test/java/htsjdk/samtools/reference/IndexedFastaSequenceFileTest.java b/src/test/java/htsjdk/samtools/reference/IndexedFastaSequenceFileTest.java index 5c1a9ac05..086b3be63 100644 --- a/src/test/java/htsjdk/samtools/reference/IndexedFastaSequenceFileTest.java +++ b/src/test/java/htsjdk/samtools/reference/IndexedFastaSequenceFileTest.java @@ -38,7 +38,7 @@ * Test the indexed fasta sequence file reader. */ public class IndexedFastaSequenceFileTest{ - private static File TEST_DATA_DIR = new File("testdata/htsjdk/samtools/reference"); + private static File TEST_DATA_DIR = new File("src/test/resources/htsjdk/samtools/reference"); private static File SEQUENCE_FILE = new File(TEST_DATA_DIR,"Homo_sapiens_assembly18.trimmed.fasta"); private static File SEQUENCE_FILE_NODICT = new File(TEST_DATA_DIR,"Homo_sapiens_assembly18.trimmed.nodict.fasta"); diff --git a/src/test/java/htsjdk/samtools/reference/ReferenceSequenceFileFactoryTests.java b/src/test/java/htsjdk/samtools/reference/ReferenceSequenceFileFactoryTests.java index 6e0f1cab9..6eeae7b99 100644 --- a/src/test/java/htsjdk/samtools/reference/ReferenceSequenceFileFactoryTests.java +++ b/src/test/java/htsjdk/samtools/reference/ReferenceSequenceFileFactoryTests.java @@ -9,7 +9,7 @@ * Simple tests for the reference sequence file factory */ public class ReferenceSequenceFileFactoryTests { - public static final File hg18 = new File("testdata/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.fasta"); + public static final File hg18 = new File("src/test/resources/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.fasta"); @Test public void testPositivePath() { final ReferenceSequenceFile f = ReferenceSequenceFileFactory.getReferenceSequenceFile(hg18); diff --git a/src/test/java/htsjdk/samtools/reference/ReferenceSequenceFileWalkerTest.java b/src/test/java/htsjdk/samtools/reference/ReferenceSequenceFileWalkerTest.java index 392435423..fa746d625 100644 --- a/src/test/java/htsjdk/samtools/reference/ReferenceSequenceFileWalkerTest.java +++ b/src/test/java/htsjdk/samtools/reference/ReferenceSequenceFileWalkerTest.java @@ -17,9 +17,9 @@ @DataProvider(name = "TestReference") public Object[][] TestReference() { return new Object[][]{ - new Object[]{"testdata/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.fasta", 0, 1}, - new Object[]{"testdata/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.fasta", 1, 1}, - new Object[]{"testdata/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.fasta", 0, 0}, + new Object[]{"src/test/resources/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.fasta", 0, 1}, + new Object[]{"src/test/resources/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.fasta", 1, 1}, + new Object[]{"src/test/resources/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.fasta", 0, 0}, }; } @@ -41,15 +41,15 @@ public void testGet(final String fileName, final int index1, final int index2) t @DataProvider(name = "TestFailReference") public Object[][] TestFailReference() { return new Object[][]{ - new Object[]{"testdata/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.noindex.fasta", 1,3}, //fail because out of bounds - new Object[]{"testdata/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.noindex.fasta", 2,3}, //fail because out of bounds - new Object[]{"testdata/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.noindex.fasta", 1,0}, //fail because not allowed to look back - new Object[]{"testdata/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.noindex.fasta", -1,0}, //fail because out of bounds - new Object[]{"testdata/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.fasta", -1, 0}, //fail because out of bounds - new Object[]{"testdata/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.fasta", 1, -1}, //fail because out of bounds - new Object[]{"testdata/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.fasta", 2,3}, //fail because out of bounds - new Object[]{"testdata/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.fasta", 1,3}, //fail because out of bounds - new Object[]{"testdata/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.fasta", 1, 0} // fasta is indexed, but not allowed to look back + new Object[]{"src/test/resources/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.noindex.fasta", 1,3}, //fail because out of bounds + new Object[]{"src/test/resources/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.noindex.fasta", 2,3}, //fail because out of bounds + new Object[]{"src/test/resources/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.noindex.fasta", 1,0}, //fail because not allowed to look back + new Object[]{"src/test/resources/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.noindex.fasta", -1,0}, //fail because out of bounds + new Object[]{"src/test/resources/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.fasta", -1, 0}, //fail because out of bounds + new Object[]{"src/test/resources/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.fasta", 1, -1}, //fail because out of bounds + new Object[]{"src/test/resources/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.fasta", 2,3}, //fail because out of bounds + new Object[]{"src/test/resources/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.fasta", 1,3}, //fail because out of bounds + new Object[]{"src/test/resources/htsjdk/samtools/reference/Homo_sapiens_assembly18.trimmed.fasta", 1, 0} // fasta is indexed, but not allowed to look back }; } diff --git a/src/test/java/htsjdk/samtools/seekablestream/SeekableBufferedStreamTest.java b/src/test/java/htsjdk/samtools/seekablestream/SeekableBufferedStreamTest.java index e8999ffdb..9720218a0 100644 --- a/src/test/java/htsjdk/samtools/seekablestream/SeekableBufferedStreamTest.java +++ b/src/test/java/htsjdk/samtools/seekablestream/SeekableBufferedStreamTest.java @@ -36,9 +36,9 @@ public class SeekableBufferedStreamTest { // private final File BAM_INDEX_FILE = new File("testdata/htsjdk/samtools/BAMFileIndexTest/index_test.bam.bai"); - private final File BAM_FILE = new File("testdata/htsjdk/samtools/BAMFileIndexTest/index_test.bam"); + private final File BAM_FILE = new File("src/test/resources/htsjdk/samtools/BAMFileIndexTest/index_test.bam"); private final String BAM_URL_STRING = "http://broadinstitute.github.io/picard/testdata/index_test.bam"; - private static File TestFile = new File("testdata/htsjdk/samtools/seekablestream/megabyteZeros.dat"); + private static File TestFile = new File("src/test/resources/htsjdk/samtools/seekablestream/megabyteZeros.dat"); /** * Test reading across a buffer boundary (buffer size is 512000). The test first reads a range of diff --git a/src/test/java/htsjdk/samtools/seekablestream/SeekableFileStreamTest.java b/src/test/java/htsjdk/samtools/seekablestream/SeekableFileStreamTest.java index 052389832..35e154524 100644 --- a/src/test/java/htsjdk/samtools/seekablestream/SeekableFileStreamTest.java +++ b/src/test/java/htsjdk/samtools/seekablestream/SeekableFileStreamTest.java @@ -41,7 +41,7 @@ @Test public void testSeek() throws Exception { String expectedLine = "ccccccccc"; - File testFile = new File("testdata/htsjdk/samtools/seekablestream/seekTest.txt"); + File testFile = new File("src/test/resources/htsjdk/samtools/seekablestream/seekTest.txt"); SeekableFileStream is = new SeekableFileStream(testFile); is.seek(20); BufferedLineReader reader = new BufferedLineReader(is); diff --git a/src/test/java/htsjdk/samtools/sra/SRAAccessionTest.java b/src/test/java/htsjdk/samtools/sra/SRAAccessionTest.java index dc034533e..e241ca941 100644 --- a/src/test/java/htsjdk/samtools/sra/SRAAccessionTest.java +++ b/src/test/java/htsjdk/samtools/sra/SRAAccessionTest.java @@ -15,9 +15,9 @@ { "SRR000123", true }, { "DRR000001", true }, { "SRR000000", false }, - { "testdata/htsjdk/samtools/sra/test_archive.sra", true }, - { "testdata/htsjdk/samtools/compressed.bam", false }, - { "testdata/htsjdk/samtools/uncompressed.sam", false }, + { "src/test/resources/htsjdk/samtools/sra/test_archive.sra", true }, + { "src/test/resources/htsjdk/samtools/compressed.bam", false }, + { "src/test/resources/htsjdk/samtools/uncompressed.sam", false }, }; } diff --git a/src/test/java/htsjdk/samtools/sra/SRATest.java b/src/test/java/htsjdk/samtools/sra/SRATest.java index 420a8893e..ebdfd67b2 100644 --- a/src/test/java/htsjdk/samtools/sra/SRATest.java +++ b/src/test/java/htsjdk/samtools/sra/SRATest.java @@ -230,7 +230,7 @@ public void testReferences(String acc, int numberFirstReferenceFound, List TestIntelDeflaterIsLoadedData(){ @@ -73,9 +72,8 @@ return retVal.iterator(); } - @Test(dataProvider = "TestIntelDeflaterIsLoadedData", groups="intel",expectedExceptions = IllegalAccessError.class) + @Test(dataProvider = "TestIntelDeflaterIsLoadedData", groups={"unix", "intel"},expectedExceptions = IllegalAccessError.class) public void TestIntelDeflatorIsLoaded(final File inputFile, final Boolean eagerlyDecode,final Integer compressionLevel) throws IOException,IllegalAccessError { - Log log = Log.getInstance(IntelDeflaterTest.class); Log.setGlobalLogLevel(Log.LogLevel.INFO); diff --git a/src/test/java/htsjdk/samtools/util/IntervalListTest.java b/src/test/java/htsjdk/samtools/util/IntervalListTest.java index 6d7ffe43f..6c5fcd43c 100644 --- a/src/test/java/htsjdk/samtools/util/IntervalListTest.java +++ b/src/test/java/htsjdk/samtools/util/IntervalListTest.java @@ -51,7 +51,7 @@ final IntervalList list1, list2, list3; public IntervalListTest() { - fileHeader = IntervalList.fromFile(new File("testdata/htsjdk/samtools/intervallist/IntervalListchr123_empty.interval_list")).getHeader(); + fileHeader = IntervalList.fromFile(new File("src/test/resources/htsjdk/samtools/intervallist/IntervalListchr123_empty.interval_list")).getHeader(); fileHeader.setSortOrder(SAMFileHeader.SortOrder.unsorted); list1 = new IntervalList(fileHeader); @@ -373,10 +373,10 @@ public void testSubtractSingletonasListIntervalList(final IntervalList fromLists @DataProvider(name = "VCFCompData") public Object[][] VCFCompData() { return new Object[][]{ - new Object[]{"testdata/htsjdk/samtools/intervallist/IntervalListFromVCFTest.vcf", "testdata/htsjdk/samtools/intervallist/IntervalListFromVCFTestComp.interval_list", false}, - new Object[]{"testdata/htsjdk/samtools/intervallist/IntervalListFromVCFTest.vcf", "testdata/htsjdk/samtools/intervallist/IntervalListFromVCFTestCompInverse.interval_list", true}, - new Object[]{"testdata/htsjdk/samtools/intervallist/IntervalListFromVCFTestManual.vcf", "testdata/htsjdk/samtools/intervallist/IntervalListFromVCFTestManualComp.interval_list", false}, - new Object[]{"testdata/htsjdk/samtools/intervallist/IntervalListFromVCFTestManual.vcf", "testdata/htsjdk/samtools/intervallist/IntervalListFromVCFTestCompInverseManual.interval_list", true} + new Object[]{"src/test/resources/htsjdk/samtools/intervallist/IntervalListFromVCFTest.vcf", "src/test/resources/htsjdk/samtools/intervallist/IntervalListFromVCFTestComp.interval_list", false}, + new Object[]{"src/test/resources/htsjdk/samtools/intervallist/IntervalListFromVCFTest.vcf", "src/test/resources/htsjdk/samtools/intervallist/IntervalListFromVCFTestCompInverse.interval_list", true}, + new Object[]{"src/test/resources/htsjdk/samtools/intervallist/IntervalListFromVCFTestManual.vcf", "src/test/resources/htsjdk/samtools/intervallist/IntervalListFromVCFTestManualComp.interval_list", false}, + new Object[]{"src/test/resources/htsjdk/samtools/intervallist/IntervalListFromVCFTestManual.vcf", "src/test/resources/htsjdk/samtools/intervallist/IntervalListFromVCFTestCompInverseManual.interval_list", true} }; } @@ -413,9 +413,9 @@ public void testFromVCF(final String vcf, final String compInterval, final boole @DataProvider public Object[][] testFromSequenceData() { return new Object[][]{ - new Object[]{"testdata/htsjdk/samtools/intervallist/IntervalListFromVCFTestComp.interval_list", "1", 249250621}, - new Object[]{"testdata/htsjdk/samtools/intervallist/IntervalListFromVCFTestComp.interval_list", "2", 243199373}, - new Object[]{"testdata/htsjdk/samtools/intervallist/IntervalListFromVCFTestComp.interval_list", "3", 198022430}, + new Object[]{"src/test/resources/htsjdk/samtools/intervallist/IntervalListFromVCFTestComp.interval_list", "1", 249250621}, + new Object[]{"src/test/resources/htsjdk/samtools/intervallist/IntervalListFromVCFTestComp.interval_list", "2", 243199373}, + new Object[]{"src/test/resources/htsjdk/samtools/intervallist/IntervalListFromVCFTestComp.interval_list", "3", 198022430}, }; } @@ -517,4 +517,4 @@ public void changeHeader() { Assert.assertTrue(false); } -} \ No newline at end of file +} diff --git a/src/test/java/htsjdk/samtools/util/IoUtilTest.java b/src/test/java/htsjdk/samtools/util/IoUtilTest.java index 3dad415dd..0e4cd7a1c 100644 --- a/src/test/java/htsjdk/samtools/util/IoUtilTest.java +++ b/src/test/java/htsjdk/samtools/util/IoUtilTest.java @@ -43,9 +43,9 @@ public class IoUtilTest { - private static final File SLURP_TEST_FILE = new File("testdata/htsjdk/samtools/io/slurptest.txt"); - private static final File EMPTY_FILE = new File("testdata/htsjdk/samtools/io/empty.txt"); - private static final File FIVE_SPACES_THEN_A_NEWLINE_THEN_FIVE_SPACES_FILE = new File("testdata/htsjdk/samtools/io/5newline5.txt"); + private static final File SLURP_TEST_FILE = new File("src/test/resources/htsjdk/samtools/io/slurptest.txt"); + private static final File EMPTY_FILE = new File("src/test/resources/htsjdk/samtools/io/empty.txt"); + private static final File FIVE_SPACES_THEN_A_NEWLINE_THEN_FIVE_SPACES_FILE = new File("src/test/resources/htsjdk/samtools/io/5newline5.txt"); private static final List SLURP_TEST_LINES = Arrays.asList("bacon and rice ", "for breakfast ", "wont you join me"); private static final String SLURP_TEST_LINE_SEPARATOR = "\n"; private static final String TEST_FILE_PREFIX = "htsjdk-IOUtilTest"; diff --git a/src/test/java/htsjdk/samtools/util/QualityEncodingDetectorTest.java b/src/test/java/htsjdk/samtools/util/QualityEncodingDetectorTest.java index 466b5291b..9e014d7b7 100644 --- a/src/test/java/htsjdk/samtools/util/QualityEncodingDetectorTest.java +++ b/src/test/java/htsjdk/samtools/util/QualityEncodingDetectorTest.java @@ -27,15 +27,15 @@ final static List FASTQ_TESTCASES = Arrays.asList( // Need to use full-range quality here, as Solexa and Illumina are near indistinguishable - new Testcase(new File("./testdata/htsjdk/samtools/util/QualityEncodingDetectorTest/solexa_full_range_as_solexa.fastq"), FastqQualityFormat.Solexa), - new Testcase(new File("./testdata/htsjdk/samtools/util/QualityEncodingDetectorTest/s_1_sequence.txt"), FastqQualityFormat.Illumina), - new Testcase(new File("./testdata/htsjdk/samtools/util/QualityEncodingDetectorTest/5k-30BB2AAXX.3.aligned.sam.fastq"), FastqQualityFormat.Standard) + new Testcase(new File("./src/test/resources/htsjdk/samtools/util/QualityEncodingDetectorTest/solexa_full_range_as_solexa.fastq"), FastqQualityFormat.Solexa), + new Testcase(new File("./src/test/resources/htsjdk/samtools/util/QualityEncodingDetectorTest/s_1_sequence.txt"), FastqQualityFormat.Illumina), + new Testcase(new File("./src/test/resources/htsjdk/samtools/util/QualityEncodingDetectorTest/5k-30BB2AAXX.3.aligned.sam.fastq"), FastqQualityFormat.Standard) ); final static List BAM_TESTCASES = Arrays.asList( - new Testcase(new File("./testdata/htsjdk/samtools/util/QualityEncodingDetectorTest/unmapped.sam"), FastqQualityFormat.Standard), - new Testcase(new File("./testdata/htsjdk/samtools/BAMFileIndexTest/index_test.bam"), FastqQualityFormat.Standard), - new Testcase(new File("./testdata/htsjdk/samtools/util/QualityEncodingDetectorTest/solexa-as-standard.bam"), FastqQualityFormat.Solexa), - new Testcase(new File("./testdata/htsjdk/samtools/util/QualityEncodingDetectorTest/illumina-as-standard.bam"), FastqQualityFormat.Illumina) + new Testcase(new File("./src/test/resources/htsjdk/samtools/util/QualityEncodingDetectorTest/unmapped.sam"), FastqQualityFormat.Standard), + new Testcase(new File("./src/test/resources/htsjdk/samtools/BAMFileIndexTest/index_test.bam"), FastqQualityFormat.Standard), + new Testcase(new File("./src/test/resources/htsjdk/samtools/util/QualityEncodingDetectorTest/solexa-as-standard.bam"), FastqQualityFormat.Solexa), + new Testcase(new File("./src/test/resources/htsjdk/samtools/util/QualityEncodingDetectorTest/illumina-as-standard.bam"), FastqQualityFormat.Illumina) ); diff --git a/src/test/java/htsjdk/tribble/TestUtils.java b/src/test/java/htsjdk/tribble/TestUtils.java index 70f30bf03..f686d2557 100644 --- a/src/test/java/htsjdk/tribble/TestUtils.java +++ b/src/test/java/htsjdk/tribble/TestUtils.java @@ -24,5 +24,5 @@ * Date: 2012-Dec-13 */ public class TestUtils { - public static String DATA_DIR = "testdata/htsjdk/tribble/"; + public static String DATA_DIR = "src/test/resources/htsjdk/tribble/"; } diff --git a/src/test/java/htsjdk/tribble/index/IndexFactoryTest.java b/src/test/java/htsjdk/tribble/index/IndexFactoryTest.java index 4d5823bdc..ba64998d3 100644 --- a/src/test/java/htsjdk/tribble/index/IndexFactoryTest.java +++ b/src/test/java/htsjdk/tribble/index/IndexFactoryTest.java @@ -86,7 +86,7 @@ public void testCreateIndexDiscontinuousContigs(IndexFactory.IndexType type) thr @Test public void testCreateTabixIndexOnBlockCompressed() { // index a VCF - final File inputFileVcf = new File("testdata/htsjdk/tribble/tabix/testTabixIndex.vcf"); + final File inputFileVcf = new File("src/test/resources/htsjdk/tribble/tabix/testTabixIndex.vcf"); final VCFFileReader readerVcf = new VCFFileReader(inputFileVcf, false); final SAMSequenceDictionary vcfDict = readerVcf.getFileHeader().getSequenceDictionary(); final TabixIndex tabixIndexVcf = @@ -94,7 +94,7 @@ public void testCreateTabixIndexOnBlockCompressed() { vcfDict); // index the same bgzipped VCF - final File inputFileVcfGz = new File("testdata/htsjdk/tribble/tabix/testTabixIndex.vcf.gz"); + final File inputFileVcfGz = new File("src/test/resources/htsjdk/tribble/tabix/testTabixIndex.vcf.gz"); final VCFFileReader readerVcfGz = new VCFFileReader(inputFileVcfGz, false); final TabixIndex tabixIndexVcfGz = IndexFactory.createTabixIndex(inputFileVcfGz, new VCFCodec(), TabixFormat.VCF, diff --git a/src/test/java/htsjdk/tribble/index/tabix/TabixIndexTest.java b/src/test/java/htsjdk/tribble/index/tabix/TabixIndexTest.java index 340ff70ea..557a3987d 100644 --- a/src/test/java/htsjdk/tribble/index/tabix/TabixIndexTest.java +++ b/src/test/java/htsjdk/tribble/index/tabix/TabixIndexTest.java @@ -40,8 +40,8 @@ import java.util.Iterator; public class TabixIndexTest { - private static final File SMALL_TABIX_FILE = new File("testdata/htsjdk/tribble/tabix/trioDup.vcf.gz.tbi"); - private static final File BIGGER_TABIX_FILE = new File("testdata/htsjdk/tribble/tabix/bigger.vcf.gz.tbi"); + private static final File SMALL_TABIX_FILE = new File("src/test/resources/htsjdk/tribble/tabix/trioDup.vcf.gz.tbi"); + private static final File BIGGER_TABIX_FILE = new File("src/test/resources/htsjdk/tribble/tabix/bigger.vcf.gz.tbi"); /** * Read an existing index from disk, write it to a temp file, read that in, and assert that both in-memory @@ -72,7 +72,7 @@ public void readWriteTest(final File tabixFile) throws Exception { @Test public void testQueryProvidedItemsAmount() { - final String VCF = "testdata/htsjdk/tribble/tabix/YRI.trio.2010_07.indel.sites.vcf"; + final String VCF = "src/test/resources/htsjdk/tribble/tabix/YRI.trio.2010_07.indel.sites.vcf"; // Note that we store only compressed files final File plainTextVcfInputFile = new File(VCF); plainTextVcfInputFile.deleteOnExit(); diff --git a/src/test/java/htsjdk/variant/PrintVariantsExampleTest.java b/src/test/java/htsjdk/variant/PrintVariantsExampleTest.java index 8bb95c5f5..c82f2dbf3 100644 --- a/src/test/java/htsjdk/variant/PrintVariantsExampleTest.java +++ b/src/test/java/htsjdk/variant/PrintVariantsExampleTest.java @@ -43,7 +43,7 @@ public void testExampleWriteFile() throws IOException { final File tempFile = File.createTempFile("example", ".vcf"); tempFile.deleteOnExit(); - File f1 = new File("testdata/htsjdk/variant/ILLUMINA.wex.broad_phase2_baseline.20111114.both.exome.genotypes.1000.vcf"); + File f1 = new File("src/test/resources/htsjdk/variant/ILLUMINA.wex.broad_phase2_baseline.20111114.both.exome.genotypes.1000.vcf"); final String[] args = { f1.getAbsolutePath(), tempFile.getAbsolutePath() diff --git a/src/test/java/htsjdk/variant/VariantBaseTest.java b/src/test/java/htsjdk/variant/VariantBaseTest.java index f70bc27ed..87345a054 100644 --- a/src/test/java/htsjdk/variant/VariantBaseTest.java +++ b/src/test/java/htsjdk/variant/VariantBaseTest.java @@ -46,7 +46,7 @@ */ public class VariantBaseTest { - public static final String variantTestDataRoot = new File("testdata/htsjdk/variant/").getAbsolutePath() + "/"; + public static final String variantTestDataRoot = new File("src/test/resources/htsjdk/variant/").getAbsolutePath() + "/"; /** * Creates a temp file that will be deleted on exit after tests are complete. diff --git a/src/test/java/htsjdk/variant/utils/SAMSequenceDictionaryExtractorTest.java b/src/test/java/htsjdk/variant/utils/SAMSequenceDictionaryExtractorTest.java index 5e565879b..9fb13e802 100644 --- a/src/test/java/htsjdk/variant/utils/SAMSequenceDictionaryExtractorTest.java +++ b/src/test/java/htsjdk/variant/utils/SAMSequenceDictionaryExtractorTest.java @@ -35,7 +35,7 @@ * @author farjoun on 4/9/14. */ public class SAMSequenceDictionaryExtractorTest { - String path = "testdata/htsjdk/variant/utils/SamSequenceDictionaryExtractor/"; + String path = "src/test/resources/htsjdk/variant/utils/SamSequenceDictionaryExtractor/"; @DataProvider(name = "testExtractDictionaries") public Object[][] dictionaries() { diff --git a/src/test/java/htsjdk/variant/variantcontext/GenotypeLikelihoodsUnitTest.java b/src/test/java/htsjdk/variant/variantcontext/GenotypeLikelihoodsUnitTest.java index b5133962b..a7c2bb699 100644 --- a/src/test/java/htsjdk/variant/variantcontext/GenotypeLikelihoodsUnitTest.java +++ b/src/test/java/htsjdk/variant/variantcontext/GenotypeLikelihoodsUnitTest.java @@ -33,7 +33,7 @@ import htsjdk.variant.VariantBaseTest; import htsjdk.variant.utils.GeneralUtils; import org.testng.Assert; -import org.testng.annotations.BeforeTest; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -53,8 +53,9 @@ final static String vPLString = "93,0,39"; double[] triAllelic = new double[]{-4.2,-2.0,-3.0,-1.6,0.0,-4.0}; //AA,AB,AC,BB,BC,CC - @BeforeTest + @BeforeMethod public void initializeAnyploidPLIndexToAlleleIndices() { + GenotypeLikelihoods.anyploidPloidyToPLIndexToAlleleIndices.clear(); GenotypeLikelihoods.initializeAnyploidPLIndexToAlleleIndices(1, 1); GenotypeLikelihoods.initializeAnyploidPLIndexToAlleleIndices(2, 2); GenotypeLikelihoods.initializeAnyploidPLIndexToAlleleIndices(2, 3); @@ -333,4 +334,4 @@ public void testGetAllelesUnitialized() { GenotypeLikelihoods.anyploidPloidyToPLIndexToAlleleIndices.clear(); final List alleles = GenotypeLikelihoods.getAlleles(0, 3); } -} \ No newline at end of file +} diff --git a/src/test/java/htsjdk/variant/variantcontext/VariantContextUnitTest.java b/src/test/java/htsjdk/variant/variantcontext/VariantContextUnitTest.java index 3e20932e9..be55f8f58 100644 --- a/src/test/java/htsjdk/variant/variantcontext/VariantContextUnitTest.java +++ b/src/test/java/htsjdk/variant/variantcontext/VariantContextUnitTest.java @@ -1367,8 +1367,8 @@ private VariantContext createValidateChromosomeCountsContext(final List @DataProvider(name = "serializationTestData") public Object[][] getSerializationTestData() { return new Object[][] { - { new File("testdata/htsjdk/variant/HiSeq.10000.vcf"), new VCFCodec() }, - { new File("testdata/htsjdk/variant/serialization_test.bcf"), new BCF2Codec() } + { new File("src/test/resources/htsjdk/variant/HiSeq.10000.vcf"), new VCFCodec() }, + { new File("src/test/resources/htsjdk/variant/serialization_test.bcf"), new BCF2Codec() } }; } diff --git a/src/test/java/htsjdk/variant/variantcontext/filter/FilteringVariantContextIteratorTest.java b/src/test/java/htsjdk/variant/variantcontext/filter/FilteringVariantContextIteratorTest.java index ffb214b8d..d8decfdd9 100644 --- a/src/test/java/htsjdk/variant/variantcontext/filter/FilteringVariantContextIteratorTest.java +++ b/src/test/java/htsjdk/variant/variantcontext/filter/FilteringVariantContextIteratorTest.java @@ -37,7 +37,7 @@ */ public class FilteringVariantContextIteratorTest { - final File testDir = new File("testdata/htsjdk/variant"); + final File testDir = new File("src/test/resources/htsjdk/variant"); @DataProvider public Object [][] filteringIteratorData() { diff --git a/src/test/java/htsjdk/variant/variantcontext/filter/JavascriptVariantFilterTest.java b/src/test/java/htsjdk/variant/variantcontext/filter/JavascriptVariantFilterTest.java index 5c3cf5402..3993b792f 100644 --- a/src/test/java/htsjdk/variant/variantcontext/filter/JavascriptVariantFilterTest.java +++ b/src/test/java/htsjdk/variant/variantcontext/filter/JavascriptVariantFilterTest.java @@ -37,7 +37,7 @@ */ public class JavascriptVariantFilterTest { - final File testDir = new File("testdata/htsjdk/variant"); + final File testDir = new File("src/test/resources/htsjdk/variant"); @DataProvider public Object[][] jsData() { diff --git a/src/test/java/htsjdk/variant/variantcontext/writer/TabixOnTheFlyIndexCreationTest.java b/src/test/java/htsjdk/variant/variantcontext/writer/TabixOnTheFlyIndexCreationTest.java index 87818c3e9..2fd1520ba 100644 --- a/src/test/java/htsjdk/variant/variantcontext/writer/TabixOnTheFlyIndexCreationTest.java +++ b/src/test/java/htsjdk/variant/variantcontext/writer/TabixOnTheFlyIndexCreationTest.java @@ -37,7 +37,7 @@ import java.util.EnumSet; public class TabixOnTheFlyIndexCreationTest { - private static final File SMALL_VCF = new File("testdata/htsjdk/tribble/tabix/trioDup.vcf.gz"); + private static final File SMALL_VCF = new File("src/test/resources/htsjdk/tribble/tabix/trioDup.vcf.gz"); @Test public void simpleTest() throws Exception { final VCF3Codec codec = new VCF3Codec(); diff --git a/src/test/java/htsjdk/variant/variantcontext/writer/VCFWriterUnitTest.java b/src/test/java/htsjdk/variant/variantcontext/writer/VCFWriterUnitTest.java index 16be59edb..eaf2f95a1 100644 --- a/src/test/java/htsjdk/variant/variantcontext/writer/VCFWriterUnitTest.java +++ b/src/test/java/htsjdk/variant/variantcontext/writer/VCFWriterUnitTest.java @@ -257,7 +257,7 @@ public void TestWritingLargeVCF(final String extension) throws FileNotFoundExcep */ @Test public void testModifyHeader() { - final File originalVCF = new File("testdata/htsjdk/variant/HiSeq.10000.vcf"); + final File originalVCF = new File("src/test/resources/htsjdk/variant/HiSeq.10000.vcf"); final VCFFileReader reader = new VCFFileReader(originalVCF, false); final VCFHeader header = reader.getFileHeader(); reader.close(); diff --git a/src/test/java/htsjdk/variant/vcf/AbstractVCFCodecTest.java b/src/test/java/htsjdk/variant/vcf/AbstractVCFCodecTest.java index 044be8a6b..051c19b9f 100644 --- a/src/test/java/htsjdk/variant/vcf/AbstractVCFCodecTest.java +++ b/src/test/java/htsjdk/variant/vcf/AbstractVCFCodecTest.java @@ -38,10 +38,10 @@ public void TestSpanDelParseAllelesException(){ @DataProvider(name="thingsToTryToDecode") public Object[][] getThingsToTryToDecode(){ return new Object[][] { - {"testdata/htsjdk/tribble/tabix/testTabixIndex.vcf", true}, - {"testdata/htsjdk/tribble/tabix/testTabixIndex.vcf.gz", true}, - {"testdata/htsjdk/tribble/nonexistant.garbage", false}, - {"testdata/htsjdk/tribble/testIntervalList.list", false} + {"src/test/resources/htsjdk/tribble/tabix/testTabixIndex.vcf", true}, + {"src/test/resources/htsjdk/tribble/tabix/testTabixIndex.vcf.gz", true}, + {"src/test/resources/htsjdk/tribble/nonexistant.garbage", false}, + {"src/test/resources/htsjdk/tribble/testIntervalList.list", false} }; } diff --git a/src/test/java/htsjdk/variant/vcf/VCFHeaderUnitTest.java b/src/test/java/htsjdk/variant/vcf/VCFHeaderUnitTest.java index 04e4a7672..fed821840 100644 --- a/src/test/java/htsjdk/variant/vcf/VCFHeaderUnitTest.java +++ b/src/test/java/htsjdk/variant/vcf/VCFHeaderUnitTest.java @@ -39,11 +39,22 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import java.io.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; +import java.io.StringReader; import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.EnumSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; /** * Created by IntelliJ IDEA. @@ -143,7 +154,7 @@ public void testVCFHeaderSampleRenamingSitesOnlyVCF() throws Exception { } private VCFHeader getHiSeqVCFHeader() { - final File vcf = new File("testdata/htsjdk/variant/HiSeq.10000.vcf"); + final File vcf = new File("src/test/resources/htsjdk/variant/HiSeq.10000.vcf"); final VCFFileReader reader = new VCFFileReader(vcf, false); final VCFHeader header = reader.getFileHeader(); reader.close(); @@ -231,7 +242,7 @@ public void testVCFHeaderAddOtherLine() { @Test public void testVCFHeaderAddMetaDataLineDoesNotDuplicateContigs() { - File input = new File("testdata/htsjdk/variant/ex2.vcf"); + File input = new File("src/test/resources/htsjdk/variant/ex2.vcf"); VCFFileReader reader = new VCFFileReader(input, false); VCFHeader header = reader.getFileHeader(); @@ -252,7 +263,7 @@ public void testVCFHeaderAddMetaDataLineDoesNotDuplicateContigs() { @Test public void testVCFHeaderAddDuplicateContigLine() { - File input = new File("testdata/htsjdk/variant/ex2.vcf"); + File input = new File("src/test/resources/htsjdk/variant/ex2.vcf"); VCFFileReader reader = new VCFFileReader(input, false); VCFHeader header = reader.getFileHeader(); @@ -269,7 +280,7 @@ public void testVCFHeaderAddDuplicateContigLine() { @Test public void testVCFHeaderAddDuplicateHeaderLine() { - File input = new File("testdata/htsjdk/variant/ex2.vcf"); + File input = new File("src/test/resources/htsjdk/variant/ex2.vcf"); VCFFileReader reader = new VCFFileReader(input, false); VCFHeader header = reader.getFileHeader(); @@ -289,7 +300,7 @@ public void testVCFHeaderAddDuplicateHeaderLine() { @Test public void testVCFHeaderSerialization() throws Exception { - final VCFFileReader reader = new VCFFileReader(new File("testdata/htsjdk/variant/HiSeq.10000.vcf"), false); + final VCFFileReader reader = new VCFFileReader(new File("src/test/resources/htsjdk/variant/HiSeq.10000.vcf"), false); final VCFHeader originalHeader = reader.getFileHeader(); reader.close(); @@ -318,7 +329,7 @@ public void testVCFHeaderQuoteEscaping() throws Exception { // copy and comparing it to the first. // read an existing VCF - final VCFFileReader originalFileReader = new VCFFileReader(new File("testdata/htsjdk/variant/HiSeq.10000.vcf"), false); + final VCFFileReader originalFileReader = new VCFFileReader(new File("src/test/resources/htsjdk/variant/HiSeq.10000.vcf"), false); final VCFHeader originalHeader = originalFileReader.getFileHeader(); // add a header line with quotes to the header