Skip to content

Commit

Permalink
[ADAM-1834] Add proper extensions for SAM/BAM/CRAM output formats.
Browse files Browse the repository at this point in the history
Resolves #1834.
  • Loading branch information
fnothaft committed Dec 16, 2017
1 parent d213820 commit a96155d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ADAMBAMOutputFormat[K]
readSAMHeaderFrom(path, conf)

// now that we have the header set, we need to make a record reader
return new KeyIgnoringBAMRecordWriter[K](getDefaultWorkFile(context, ""),
return new KeyIgnoringBAMRecordWriter[K](getDefaultWorkFile(context, ".bam"),
header,
true,
context)
Expand Down Expand Up @@ -84,7 +84,7 @@ class ADAMBAMOutputFormatHeaderLess[K]
readSAMHeaderFrom(path, conf)

// now that we have the header set, we need to make a record reader
return new KeyIgnoringBAMRecordWriter[K](getDefaultWorkFile(context, ""),
return new KeyIgnoringBAMRecordWriter[K](getDefaultWorkFile(context, ".bam"),
header,
false,
context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ADAMCRAMOutputFormat[K]
readSAMHeaderFrom(path, conf)

// now that we have the header set, we need to make a record reader
return new KeyIgnoringCRAMRecordWriter[K](getDefaultWorkFile(context, ""),
return new KeyIgnoringCRAMRecordWriter[K](getDefaultWorkFile(context, ".cram"),
header,
true,
context)
Expand Down Expand Up @@ -84,7 +84,7 @@ class ADAMCRAMOutputFormatHeaderLess[K]
readSAMHeaderFrom(path, conf)

// now that we have the header set, we need to make a record reader
return new KeyIgnoringCRAMRecordWriter[K](getDefaultWorkFile(context, ""),
return new KeyIgnoringCRAMRecordWriter[K](getDefaultWorkFile(context, ".cram"),
header,
false,
context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ADAMSAMOutputFormat[K]
readSAMHeaderFrom(path, conf)

// now that we have the header set, we need to make a record reader
return new KeyIgnoringSAMRecordWriter(getDefaultWorkFile(context, ""),
return new KeyIgnoringSAMRecordWriter(getDefaultWorkFile(context, ".sam"),
header,
true,
context)
Expand All @@ -71,7 +71,7 @@ class ADAMSAMOutputFormatHeaderLess[K]
readSAMHeaderFrom(path, conf)

// now that we have the header set, we need to make a record reader
return new KeyIgnoringSAMRecordWriter(getDefaultWorkFile(context, ""),
return new KeyIgnoringSAMRecordWriter(getDefaultWorkFile(context, ".sam"),
header,
false,
context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ class AlignmentRecordRDDSuite extends ADAMFunSuite {
ardd.saveAsSam(tempFile.toAbsolutePath.toString + "/reads12.sam",
asType = Some(SAMFormat.SAM))

val rdd12B = sc.loadBam(tempFile.toAbsolutePath.toString + "/reads12.sam/part-r-00000")
val rdd12B = sc.loadBam(tempFile.toAbsolutePath.toString + "/reads12.sam/part-r-00000.sam")

assert(rdd12B.rdd.count() === rdd12A.rdd.count())

Expand Down Expand Up @@ -358,7 +358,7 @@ class AlignmentRecordRDDSuite extends ADAMFunSuite {
asSingleFile = false,
isSorted = true)

val rddB = sc.loadBam(tempFile + "/part-r-00000")
val rddB = sc.loadBam(tempFile + "/part-r-00000.cram")

assert(rddB.rdd.count() === rddA.rdd.count())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class ParallelFileMergerSuite extends ADAMFunSuite {

val fs = FileSystem.get(sc.hadoopConfiguration)
val filesToMerge = (Seq(outPath + "_head") ++ (0 until 4).map(i => {
outPath + "_tail/part-r-0000%d".format(i)
outPath + "_tail/part-r-0000%d.sam".format(i)
})).map(new Path(_))
.map(p => (p.toString, 0L, fs.getFileStatus(p).getLen().toLong - 1L))

Expand All @@ -179,7 +179,7 @@ class ParallelFileMergerSuite extends ADAMFunSuite {

val fs = FileSystem.get(sc.hadoopConfiguration)
val filesToMerge = (Seq(outPath + "_head") ++ (0 until 4).map(i => {
outPath + "_tail/part-r-0000%d".format(i)
outPath + "_tail/part-r-0000%d.bam".format(i)
})).map(new Path(_))
.map(p => (p.toString, 0L, fs.getFileStatus(p).getLen().toLong - 1L))

Expand All @@ -206,7 +206,7 @@ class ParallelFileMergerSuite extends ADAMFunSuite {

val fs = FileSystem.get(sc.hadoopConfiguration)
val filesToMerge = (Seq(outPath + "_head") ++ (0 until 4).map(i => {
outPath + "_tail/part-r-0000%d".format(i)
outPath + "_tail/part-r-0000%d.cram".format(i)
})).map(new Path(_))
.map(p => (p.toString, 0L, fs.getFileStatus(p).getLen().toLong - 1L))

Expand Down

0 comments on commit a96155d

Please sign in to comment.