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

Added scala docs

parent e3cf080d
......@@ -25,6 +25,10 @@ import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import scala.collection.mutable
import scala.io.Source
/**
* Extension for sickle
* Based on version 1.33
*/
class Sickle(val root: Configurable) extends BiopetCommandLineFunction with Summarizable {
@Input(doc = "R1 input")
var input_R1: File = _
......@@ -57,10 +61,12 @@ class Sickle(val root: Configurable) extends BiopetCommandLineFunction with Summ
override val versionRegex = """sickle version (.*)""".r
override def versionCommand = executable + " --version"
/** Sets qualityType is still empty */
override def beforeGraph {
if (qualityType.isEmpty) qualityType = Some(defaultQualityType)
}
/** Return command to execute */
def cmdLine = {
var cmd: String = required(executable)
if (input_R2 != null) {
......@@ -81,6 +87,7 @@ class Sickle(val root: Configurable) extends BiopetCommandLineFunction with Summ
" > " + required(output_stats)
}
/** returns stats map for summary */
def summaryStats: Map[String, Any] = {
val pairKept = """FastQ paired records kept: (\d*) \((\d*) pairs\)""".r
val singleKept = """FastQ single records kept: (\d*) \(from PE1: (\d*), from PE2: (\d*)\)""".r
......@@ -108,6 +115,7 @@ class Sickle(val root: Configurable) extends BiopetCommandLineFunction with Summ
stats.toMap
}
/** Merge stats incase of chunking */
override def resolveSummaryConflict(v1: Any, v2: Any, key: String): Any = {
(v1, v2) match {
case (v1: Int, v2: Int) => v1 + v2
......
......@@ -21,6 +21,7 @@ import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
/** Extension for stampy */
class Stampy(val root: Configurable) extends BiopetCommandLineFunction {
@Input(doc = "FastQ file R1", shortName = "R1")
var R1: File = _
......@@ -68,12 +69,14 @@ class Stampy(val root: Configurable) extends BiopetCommandLineFunction {
override def versionCommand = executable + " --help"
/** Sets readgroup when not set yet */
override def beforeGraph: Unit = {
super.beforeGraph
require(readgroup != null)
}
def cmdLine: String = {
/** Returns command to execute */
def cmdLine = {
var cmd: String = required(executable) +
optional("-t", nCoresRequest) +
conditional(solexa, "--solexa") +
......@@ -99,6 +102,6 @@ class Stampy(val root: Configurable) extends BiopetCommandLineFunction {
" -h " + required(hash) +
" -o " + required(output) +
" -M " + required(R1) + optional(R2)
return cmd
cmd
}
}
......@@ -21,6 +21,9 @@ import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Argument, Input, Output }
/**
* Extension for STAR
*/
class Star(val root: Configurable) extends BiopetCommandLineFunction {
@Input(doc = "The reference file for the bam files.", required = false)
var reference: File = new File(config("reference"))
......@@ -62,6 +65,7 @@ class Star(val root: Configurable) extends BiopetCommandLineFunction {
override val defaultVmem = "6G"
override val defaultThreads = 8
/** Sets output files for the graph */
override def beforeGraph() {
if (outFileNamePrefix != null && !outFileNamePrefix.endsWith(".")) outFileNamePrefix += "."
val prefix = if (outFileNamePrefix != null) outputDir + outFileNamePrefix else outputDir
......@@ -77,7 +81,8 @@ class Star(val root: Configurable) extends BiopetCommandLineFunction {
}
}
def cmdLine: String = {
/** Returns command to execute */
def cmdLine = {
var cmd: String = required("cd", outputDir) + "&&" + required(executable)
if (runmode != null && runmode == "genomeGenerate") { // Create index
cmd += required("--runMode", runmode) +
......@@ -91,11 +96,22 @@ class Star(val root: Configurable) extends BiopetCommandLineFunction {
optional("--outFileNamePrefix", outFileNamePrefix)
if (sjdbOverhang > 0) cmd += optional("--sjdbOverhang", sjdbOverhang)
return cmd
cmd
}
}
object Star {
/**
* Create default star
* @param configurable root object
* @param R1 R1 fastq file
* @param R2 R2 fastq file
* @param outputDir Outputdir for Star
* @param isIntermediate
* @param deps Deps to add to wait on run
* @return Return Star
*
*/
def apply(configurable: Configurable, R1: File, R2: File, outputDir: File, isIntermediate: Boolean = false, deps: List[File] = Nil): Star = {
val star = new Star(configurable)
star.R1 = R1
......@@ -107,7 +123,22 @@ object Star {
return star
}
def _2pass(configurable: Configurable, R1: File, R2: File, outputDir: File, isIntermediate: Boolean = false, deps: List[File] = Nil): (File, List[Star]) = {
/**
* returns Star with 2pass star method
* @param configurable root object
* @param R1 R1 fastq file
* @param R2 R2 fastq file
* @param outputDir Outputdir for Star
* @param isIntermediate
* @param deps Deps to add to wait on run
* @return Return Star
*/
def _2pass(configurable: Configurable,
R1: File,
R2: File,
outputDir: File,
isIntermediate: Boolean = false,
deps: List[File] = Nil): (File, List[Star]) = {
val starCommand_pass1 = Star(configurable, R1, if (R2 != null) R2 else null, new File(outputDir, "aln-pass1"))
starCommand_pass1.isIntermediate = isIntermediate
starCommand_pass1.deps = deps
......
......@@ -21,6 +21,9 @@ import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Argument, Input, Output }
/**
* Extension for TopHad
*/
class TopHat(val root: Configurable) extends BiopetCommandLineFunction {
@Input(doc = "FastQ file R1", shortName = "R1")
var R1: File = _
......@@ -70,11 +73,10 @@ class TopHat(val root: Configurable) extends BiopetCommandLineFunction {
}
def cmdLine: String = {
var cmd: String = required(executable) +
required(executable) +
optional("-p", nCoresRequest) +
"--no-convert-bam" +
required(bowtie_index) +
required(R1) + optional(R2)
return cmd
}
}
......@@ -7,6 +7,7 @@ import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Output, Input }
/**
* Extension for VariantEffectPredictor
* Created by ahbbollen on 15-1-15.
*/
class VariantEffectPredictor(val root: Configurable) extends BiopetCommandLineFunction {
......@@ -134,6 +135,7 @@ class VariantEffectPredictor(val root: Configurable) extends BiopetCommandLineFu
}
}
/** Returns command to execute */
def cmdLine = required(executable) +
required(vep_script) +
required("-i", input) +
......
......@@ -27,6 +27,7 @@ class WigToBigWig(val root: Configurable) extends BiopetCommandLineFunction {
var clip: Boolean = config("clip", default = false)
var unc: Boolean = config("unc", default = false)
/** Returns command to execute */
def cmdLine = required(executable) +
optional("-blockSize=", blockSize, spaceSeparated = false) +
optional("-itemsPerSlot=", itemsPerSlot, spaceSeparated = false) +
......
......@@ -20,6 +20,7 @@ import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import java.io.File
/** Extension for zcat */
class Zcat(val root: Configurable) extends BiopetCommandLineFunction {
@Input(doc = "Zipped file")
var input: File = _
......@@ -29,10 +30,12 @@ class Zcat(val root: Configurable) extends BiopetCommandLineFunction {
executable = config("exe", default = "zcat")
/** Returns command to execute */
def cmdLine = required(executable) + required(input) + " > " + required(output)
}
object Zcat {
/** Returns a default zcat */
def apply(root: Configurable, input: File, output: File): Zcat = {
val zcat = new Zcat(root)
zcat.input = input
......
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