Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADAM-1834] Add proper extensions for SAM/BAM/CRAM output formats. #1835

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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