Commit 6a83d167 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Add output arg to biopet flagstat

parent f2d40822
...@@ -61,12 +61,18 @@ object BiopetFlagstat extends ToolCommand { ...@@ -61,12 +61,18 @@ object BiopetFlagstat extends ToolCommand {
flagstat flagstat
} }
case class Args(inputFile: File = null, summaryFile: Option[File] = None, region: Option[String] = None) extends AbstractArgs case class Args(inputFile: File = null,
outputFile: Option[File] = None,
summaryFile: Option[File] = None,
region: Option[String] = None) extends AbstractArgs
class OptParser extends AbstractOptParser { class OptParser extends AbstractOptParser {
opt[File]('I', "inputFile") required () valueName "<file>" action { (x, c) => opt[File]('I', "inputFile") required () valueName "<file>" action { (x, c) =>
c.copy(inputFile = x) c.copy(inputFile = x)
} text "input bam file" } text "input bam file"
opt[File]('o', "outputFile") valueName "<file>" action { (x, c) =>
c.copy(outputFile = Some(x))
} text "output file"
opt[File]('s', "summaryFile") valueName "<file>" action { (x, c) => opt[File]('s', "summaryFile") valueName "<file>" action { (x, c) =>
c.copy(summaryFile = Some(x)) c.copy(summaryFile = Some(x))
} text "summary output file" } text "summary output file"
...@@ -151,7 +157,14 @@ object BiopetFlagstat extends ToolCommand { ...@@ -151,7 +157,14 @@ object BiopetFlagstat extends ToolCommand {
writer.close() writer.close()
} }
println(flagstatCollector.report) commandArgs.outputFile match {
case Some(file) => {
val writer = new PrintWriter(file)
writer.println(flagstatCollector.report)
writer.close()
}
case _ => println(flagstatCollector.report)
}
} }
class FlagstatCollector { class FlagstatCollector {
......
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