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

Added samtools modules

parent 5af4086c
package nl.lumc.sasc.biopet.extensions.samtools
import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import java.io.File
class SamtoolsMpileup(val root: Configurable) extends Samtools {
@Input(doc = "Bam File")
var input: File = _
@Output(doc = "output File")
var output: File = _
@Input(doc = "Reference fasta")
var reference: File = config("reference")
@Input(doc = "Interval bed")
var intervalBed: File = config("interval_bed")
def cmdBase = required(executable) +
required("mpileup") +
optional("-f", reference) +
optional("-l", intervalBed)
def cmdPipeInput = cmdBase + "-"
def cmdPipe = cmdBase + required(input)
def cmdLine = cmdPipe + " > " + required(output)
}
object SamtoolsMpileup {
def apply(root: Configurable, input: File, output: File): SamtoolsMpileup = {
val mpileup = new SamtoolsMpileup(root)
mpileup.input = input
mpileup.output = output
return mpileup
}
def apply(root: Configurable, input: File, outputDir: String): SamtoolsMpileup = {
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): SamtoolsMpileup = {
return apply(root, input, new File(swapExtension(input.getAbsolutePath)))
}
private def swapExtension(inputFile: String) = inputFile.stripSuffix(".bam") + ".mpileup"
}
\ No newline at end of file
package nl.lumc.sasc.biopet.extensions.samtools
import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import java.io.File
class SamtoolsView(val root: Configurable) extends Samtools {
@Input(doc = "Bam File")
var input: File = _
@Output(doc = "output File")
var output: File = _
var quality: Option[Int] = config("quality")
var b: Boolean = config("b")
var h: Boolean = config("h")
def cmdBase = required(executable) +
required("view") +
optional("-q", quality) +
conditional(b, "-b") +
conditional(h, "-h")
def cmdPipeInput = cmdBase + "-"
def cmdPipe = cmdBase + required(input)
def cmdLine = cmdPipe + " > " + required(output)
}
object SamtoolsView {
def apply(root: Configurable, input: File, output: File): SamtoolsView = {
val view = new SamtoolsView(root)
view.input = input
view.output = output
return view
}
def apply(root: Configurable, input: File, outputDir: String): SamtoolsView = {
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): SamtoolsView = {
return apply(root, input, new File(swapExtension(input.getAbsolutePath)))
}
private def swapExtension(inputFile: String) = inputFile.stripSuffix(".bam") + ".mpileup"
}
\ 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