Commit 8ca96bb4 authored by Wai Yi Leung's avatar Wai Yi Leung
Browse files

Merge branch 'patch-flagstat_dirs' into 'develop'

Patch flagstat dirs

This fixes the recent update of `ouputDir` from `String` to `File`. There are some `apply` method that are overloaded with both `String` and `File`, causing the pipeline to spew out weird error messages.

@p.j.van_t_hof ~ this is what was causing the weird error earlier.

See merge request !101
parents 9a5a8577 619ed38a
......@@ -69,12 +69,12 @@ class BamMetrics(val root: Configurable) extends QScript with BiopetQScript {
val strictOutputBam = new File(targetDir, inputBam.getName.stripSuffix(".bam") + ".overlap.strict.bam")
add(BedtoolsIntersect(this, inputBam, bedFile, strictOutputBam, minOverlap = config("strictintersectoverlap", default = 1.0)), true)
add(SamtoolsFlagstat(this, strictOutputBam))
add(SamtoolsFlagstat(this, strictOutputBam, targetDir))
add(BiopetFlagstat(this, strictOutputBam, targetDir))
val looseOutputBam = new File(targetDir, inputBam.getName.stripSuffix(".bam") + ".overlap.loose.bam")
add(BedtoolsIntersect(this, inputBam, bedFile, looseOutputBam, minOverlap = config("looseintersectoverlap", default = 0.01)), true)
add(SamtoolsFlagstat(this, looseOutputBam))
add(SamtoolsFlagstat(this, looseOutputBam, targetDir))
add(BiopetFlagstat(this, looseOutputBam, targetDir))
val coverageFile = new File(targetDir, inputBam.getName.stripSuffix(".bam") + ".coverage")
......
......@@ -30,22 +30,10 @@ class SamtoolsFlagstat(val root: Configurable) extends Samtools {
}
object SamtoolsFlagstat {
def apply(root: Configurable, input: File, output: File): SamtoolsFlagstat = {
def apply(root: Configurable, input: File, outputDir: File): SamtoolsFlagstat = {
val flagstat = new SamtoolsFlagstat(root)
flagstat.input = input
flagstat.output = output
return flagstat
flagstat.output = new File(outputDir, input.getName.stripSuffix(".bam") + ".flagstat")
flagstat
}
def apply(root: Configurable, input: File, outputDir: String): SamtoolsFlagstat = {
val dir = if (outputDir.endsWith("/")) outputDir else outputDir + "/"
val outputFile = new File(dir + swapExtension(input.getName))
return apply(root, input, outputFile)
}
def apply(root: Configurable, input: File): SamtoolsFlagstat = {
return apply(root, input, new File(swapExtension(input.getAbsolutePath)))
}
private def swapExtension(inputFile: String) = inputFile.stripSuffix(".bam") + ".flagstat"
}
\ No newline at end of file
......@@ -40,17 +40,11 @@ class BiopetFlagstat(val root: Configurable) extends BiopetJavaCommandLineFuncti
}
object BiopetFlagstat extends ToolCommand {
def apply(root: Configurable, input: File, output: File): BiopetFlagstat = {
val flagstat = new BiopetFlagstat(root)
flagstat.input = input
flagstat.output = output
return flagstat
}
def apply(root: Configurable, input: File, outputDir: String): BiopetFlagstat = {
def apply(root: Configurable, input: File, outputDir: File): BiopetFlagstat = {
val flagstat = new BiopetFlagstat(root)
flagstat.input = input
flagstat.output = new File(outputDir, input.getName.stripSuffix(".bam") + ".biopetflagstat")
return flagstat
flagstat
}
case class Args(inputFile: File = null, region: Option[String] = None) extends AbstractArgs
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment