Commit 83b6e834 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Added samtools flagstat

parent fcaea52d
package nl.lumc.sasc.biopet.function.samtools
import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
abstract class Samtools extends BiopetCommandLineFunction {
executeble = config("exe", "samtools", "samtools")
override def versionCommand = executeble
override val versionRegex = """Version: (.*)""".r
override val versionExitcode = List(0,1)
}
\ No newline at end of file
package nl.lumc.sasc.biopet.function.samtools
import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.sting.commandline.{Input, Output}
import java.io.File
class SamtoolsFlagstat(val root:Configurable) extends Samtools {
@Input(doc="Bam File")
var input: File = _
@Output(doc="output File")
var output: File = _
def cmdLine = required(executeble) + required("flagstat") + required(input) + " > " + required(output)
}
object SamtoolsFlagstat {
def apply(root:Configurable, input:File, output:File) : SamtoolsFlagstat = {
val flagstat = new SamtoolsFlagstat(root)
flagstat.input = input
flagstat.output = output
return 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.substring(0, inputFile.lastIndexOf(".bam")) + ".flagstat"
}
\ No newline at end of file
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