Skip to content

Commit

Permalink
Merge 372b573 into 10ec74e
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-williams authored Aug 31, 2016
2 parents 10ec74e + 372b573 commit ee02423
Show file tree
Hide file tree
Showing 27 changed files with 145 additions and 144 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ build
.*.swp
.DS_Store

*#*
*#*
2 changes: 1 addition & 1 deletion adam-apis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<reportsDirectory>${project.build.directory}/scalatest-reports</reportsDirectory>
<junitxml>.</junitxml>
<filereports>ADAMTestSuite.txt</filereports>
<!--
Expand Down
2 changes: 1 addition & 1 deletion adam-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<reportsDirectory>${project.build.directory}/scalatest-reports</reportsDirectory>
<junitxml>.</junitxml>
<filereports>ADAMTestSuite.txt</filereports>
<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import org.bdgenomics.formats.avro.AlignmentRecord
class Adam2FastqSuite extends ADAMFunSuite {

sparkTest("convert SAM to paired FASTQ") {
val readsFilepath = resourcePath("bqsr1.sam")
val readsFilepath = testFile("bqsr1.sam")

// The following fastq files were generated by Picard's SamToFastq

Expand All @@ -45,8 +45,8 @@ class Adam2FastqSuite extends ADAMFunSuite {

// VALIDATION_STRINGENCY=SILENT is necessary since they are unpaired reads and this matches the ADAM default

val fastq1Path = resourcePath("bqsr1-r1.fq")
val fastq2Path = resourcePath("bqsr1-r2.fq")
val fastq1Path = testFile("bqsr1-r1.fq")
val fastq2Path = testFile("bqsr1-r2.fq")

val outputDir = Files.createTempDir()
val outputFastqR1File = outputDir.getAbsolutePath + "/bqsr1-r1.fq"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class FlagStatSuite extends ADAMFunSuite {

sparkTest("Standard FlagStat test") {

val inputpath = resourcePath("NA12878.sam")
val inputpath = testFile("NA12878.sam")
val argLine = "%s".format(inputpath).split("\\s+")

val args: FlagStatArgs = Args4j.apply[FlagStatArgs](argLine)
Expand Down
2 changes: 1 addition & 1 deletion adam-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<reportsDirectory>${project.build.directory}/scalatest-reports</reportsDirectory>
<junitxml>.</junitxml>
<filereports>ADAMTestSuite.txt</filereports>
<!--
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ConsensusGeneratorFromReadsSuite extends ADAMFunSuite {
val cg = new ConsensusGeneratorFromReads

def artificial_reads: RDD[AlignmentRecord] = {
val path = resourcePath("artificial.sam")
val path = testFile("artificial.sam")
sc.loadAlignments(path).rdd
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class FastaConverterSuite extends ADAMFunSuite {
assert(convertedFragmentSequence2 === fastaFragmentSequence2)
}

val chr1File = resourcePath("human_g1k_v37_chr1_59kb.fasta")
val chr1File = testFile("human_g1k_v37_chr1_59kb.fasta")

sparkTest("convert reference fasta file") {
//Loading "human_g1k_v37_chr1_59kb.fasta"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import scala.collection.JavaConversions._

class VariantContextConverterSuite extends ADAMFunSuite {
val dictionary = {
val path = resourcePath("dict_with_accession.dict")
val path = testFile("dict_with_accession.dict")
SequenceDictionary(SAMFileReader.getSequenceDictionary(new File(path)))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class SequenceDictionarySuite extends ADAMFunSuite {
}

test("Convert from SAM sequence dictionary file (with extra fields)") {
val path = resourcePath("dict_with_accession.dict")
val path = testFile("dict_with_accession.dict")
val ssd = SAMFileReader.getSequenceDictionary(new File(path))

val chr1 = ssd.getSequence("1") // Validate that extra fields are parsed
Expand All @@ -55,7 +55,7 @@ class SequenceDictionarySuite extends ADAMFunSuite {
}

test("merge into existing dictionary") {
val path = resourcePath("dict_with_accession.dict")
val path = testFile("dict_with_accession.dict")
val ssd = SAMFileReader.getSequenceDictionary(new File(path))

val asd = SequenceDictionary(ssd)
Expand All @@ -68,7 +68,7 @@ class SequenceDictionarySuite extends ADAMFunSuite {
}

test("Convert from SAM sequence dictionary and back") {
val path = resourcePath("dict_with_accession.dict")
val path = testFile("dict_with_accession.dict")
val ssd = SAMFileReader.getSequenceDictionary(new File(path))
val asd = SequenceDictionary(ssd)
ssd.assertSameDictionary(SequenceDictionary.toSAMSequenceDictionary(asd))
Expand Down Expand Up @@ -212,7 +212,7 @@ class SequenceDictionarySuite extends ADAMFunSuite {
}

test("load sequence dictionary from VCF file") {
val path = resourcePath("small.vcf")
val path = testFile("small.vcf")
val fileReader = new VCFFileReader(new File(path), false)
val sd = SequenceDictionary.fromVCFHeader(fileReader.getFileHeader)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class FieldEnumerationSuite extends ADAMFunSuite {
}

sparkTest("Simple projection on Read works") {
val readsFilepath = resourcePath("reads12.sam")
val readsFilepath = testFile("reads12.sam")
val readsParquetFilepath = tmpFile("reads12.adam")

// Convert the reads12.sam file into a parquet file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ case class TestSaveArgs(var outputPath: String) extends ADAMSaveAnyArgs {
class ADAMContextSuite extends ADAMFunSuite {

sparkTest("sc.loadParquet should not fail on unmapped reads") {
val readsFilepath = resourcePath("unmapped.sam")
val readsFilepath = testFile("unmapped.sam")

// Convert the reads12.sam file into a parquet file
val bamReads: RDD[AlignmentRecord] = sc.loadAlignments(readsFilepath).rdd
Expand All @@ -58,7 +58,7 @@ class ADAMContextSuite extends ADAMFunSuite {
//load an existing file from the resources and save it as an ADAM file.
//This way we are not dependent on the ADAM format (as we would if we used a pre-made ADAM file)
//but we are dependent on the unmapped.sam file existing, maybe I should make a new one
val readsFilepath = resourcePath("unmapped.sam")
val readsFilepath = testFile("unmapped.sam")
val bamReads = sc.loadAlignments(readsFilepath)
//save it as an Adam file so we can test the Adam loader
val bamReadsAdamFile = new File(Files.createTempDir(), "bamReads.adam")
Expand All @@ -72,19 +72,19 @@ class ADAMContextSuite extends ADAMFunSuite {
}

sparkTest("can read a small .SAM file") {
val path = resourcePath("small.sam")
val path = testFile("small.sam")
val reads: RDD[AlignmentRecord] = sc.loadAlignments(path).rdd
assert(reads.count() === 20)
}

sparkTest("can read a small .SAM with all attribute tag types") {
val path = resourcePath("tags.sam")
val path = testFile("tags.sam")
val reads: RDD[AlignmentRecord] = sc.loadAlignments(path).rdd
assert(reads.count() === 7)
}

sparkTest("can filter a .SAM file based on quality") {
val path = resourcePath("small.sam")
val path = testFile("small.sam")
val reads: RDD[AlignmentRecord] = sc.loadAlignments(path)
.rdd
.filter(a => (a.getReadMapped && a.getMapq > 30))
Expand Down Expand Up @@ -251,7 +251,7 @@ class ADAMContextSuite extends ADAMFunSuite {
}

sparkTest("can read a small .vcf file") {
val path = resourcePath("small.vcf")
val path = testFile("small.vcf")

val vcs = sc.loadGenotypes(path).toVariantContextRDD.rdd.collect.sortBy(_.position)
assert(vcs.size === 5)
Expand All @@ -265,44 +265,44 @@ class ADAMContextSuite extends ADAMFunSuite {
}

sparkTest("can read a gzipped .vcf file") {
val path = resourcePath("test.vcf.gz")
val path = testFile("test.vcf.gz")
val vcs = sc.loadVcf(path)
assert(vcs.rdd.count === 6)
}

sparkTest("can read a BGZF gzipped .vcf file with .gz file extension") {
val path = resourcePath("test.vcf.bgzf.gz")
val path = testFile("test.vcf.bgzf.gz")
val vcs = sc.loadVcf(path)
assert(vcs.rdd.count === 6)
}

sparkTest("can read a BGZF gzipped .vcf file with .bgz file extension") {
val path = resourcePath("test.vcf.bgz")
val path = testFile("test.vcf.bgz")
val vcs = sc.loadVcf(path)
assert(vcs.rdd.count === 6)
}

ignore("can read an uncompressed BCFv2.2 file") { // see https://github.com/samtools/htsjdk/issues/507
val path = resourcePath("test.uncompressed.bcf")
val path = testFile("test.uncompressed.bcf")
val vcs = sc.loadVcf(path)
assert(vcs.rdd.count === 6)
}

ignore("can read a BGZF compressed BCFv2.2 file") { // see https://github.com/samtools/htsjdk/issues/507
val path = resourcePath("test.compressed.bcf")
val path = testFile("test.compressed.bcf")
val vcs = sc.loadVcf(path)
assert(vcs.rdd.count === 6)
}

sparkTest("loadIndexedVcf with 1 ReferenceRegion") {
val path = resourcePath("bqsr1.vcf")
val path = testFile("bqsr1.vcf")
val refRegion = ReferenceRegion("22", 16097644, 16098647)
val vcs = sc.loadIndexedVcf(path, refRegion)
assert(vcs.rdd.count == 17)
}

sparkTest("loadIndexedVcf with multiple ReferenceRegions") {
val path = resourcePath("bqsr1.vcf")
val path = testFile("bqsr1.vcf")
val refRegion1 = ReferenceRegion("22", 16050678, 16050822)
val refRegion2 = ReferenceRegion("22", 16097644, 16098647)
val vcs = sc.loadIndexedVcf(path, Iterable(refRegion1, refRegion2))
Expand All @@ -311,7 +311,7 @@ class ADAMContextSuite extends ADAMFunSuite {

(1 to 4) foreach { testNumber =>
val inputName = "interleaved_fastq_sample%d.ifq".format(testNumber)
val path = ClassLoader.getSystemClassLoader.getResource(inputName).getFile
val path = testFile(inputName)

sparkTest("import records from interleaved FASTQ: %d".format(testNumber)) {

Expand All @@ -335,7 +335,7 @@ class ADAMContextSuite extends ADAMFunSuite {

(1 to 4) foreach { testNumber =>
val inputName = "fastq_sample%d.fq".format(testNumber)
val path = ClassLoader.getSystemClassLoader.getResource(inputName).getFile
val path = testFile(inputName)

sparkTest("import records from single ended FASTQ: %d".format(testNumber)) {

Expand All @@ -357,7 +357,7 @@ class ADAMContextSuite extends ADAMFunSuite {
}

sparkTest("filter on load using the filter2 API") {
val path = resourcePath("bqsr1.vcf")
val path = testFile("bqsr1.vcf")

val variants = sc.loadVariants(path)
assert(variants.rdd.count === 681)
Expand All @@ -372,7 +372,7 @@ class ADAMContextSuite extends ADAMFunSuite {
}

sparkTest("saveAsParquet with file path") {
val inputPath = resourcePath("small.sam")
val inputPath = testFile("small.sam")
val reads = sc.loadAlignments(inputPath)
val outputPath = tmpLocation()
reads.saveAsParquet(outputPath)
Expand All @@ -381,7 +381,7 @@ class ADAMContextSuite extends ADAMFunSuite {
}

sparkTest("saveAsParquet with file path, block size, page size") {
val inputPath = resourcePath("small.sam")
val inputPath = testFile("small.sam")
val reads = sc.loadAlignments(inputPath)
val outputPath = tmpLocation()
reads.saveAsParquet(outputPath, 1024, 2048)
Expand All @@ -390,7 +390,7 @@ class ADAMContextSuite extends ADAMFunSuite {
}

sparkTest("saveAsParquet with save args") {
val inputPath = resourcePath("small.sam")
val inputPath = testFile("small.sam")
val reads = sc.loadAlignments(inputPath)
val outputPath = tmpLocation()
reads.saveAsParquet(TestSaveArgs(outputPath))
Expand All @@ -399,7 +399,7 @@ class ADAMContextSuite extends ADAMFunSuite {
}

sparkTest("read a gzipped fasta file") {
val inputPath = resourcePath("chr20.250k.fa.gz")
val inputPath = testFile("chr20.250k.fa.gz")
val contigFragments: RDD[NucleotideContigFragment] = sc.loadFasta(inputPath, 10000L)
.rdd
.sortBy(_.getFragmentNumber.toInt)
Expand All @@ -422,15 +422,15 @@ class ADAMContextSuite extends ADAMFunSuite {

sparkTest("loadIndexedBam with 1 ReferenceRegion") {
val refRegion = ReferenceRegion("chr2", 100, 101)
val path = resourcePath("sorted.bam")
val path = testFile("sorted.bam")
val reads = sc.loadIndexedBam(path, refRegion)
assert(reads.rdd.count == 1)
}

sparkTest("loadIndexedBam with multiple ReferenceRegions") {
val refRegion1 = ReferenceRegion("chr2", 100, 101)
val refRegion2 = ReferenceRegion("3", 10, 17)
val path = resourcePath("sorted.bam")
val path = testFile("sorted.bam")
val reads = sc.loadIndexedBam(path, Iterable(refRegion1, refRegion2))
assert(reads.rdd.count == 2)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class GenomicPositionPartitionerSuite extends ADAMFunSuite {
}

sparkTest("test that simple partitioning works okay on a reasonable set of ADAMRecords") {
val filename = resourcePath("reads12.sam")
val filename = testFile("reads12.sam")
val parts = 1

val dict = sc.loadDictionary[AlignmentRecord](filename)
Expand Down
Loading

0 comments on commit ee02423

Please sign in to comment.