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

Wrappers are now split in general and specific flexiprep extensions

parent a2275bd4
package nl.lumc.sasc.biopet.extensions
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import java.io.File
import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import nl.lumc.sasc.biopet.core.config.Configurable
class Cutadapt(val root: Configurable) extends BiopetCommandLineFunction {
@Input(doc = "Input fastq file")
var fastq_input: File = _
@Output(doc = "Output fastq file")
var fastq_output: File = _
@Output(doc = "Output statistics file")
var stats_output: File = _
executable = config("exe", default = "cutadapt")
override def versionCommand = executable + " --version"
override val versionRegex = """(.*)""".r
var default_clip_mode: String = config("default_clip_mode", default = "3")
var opt_adapter: Set[String] = Set() + config("adapter")
var opt_anywhere: Set[String] = Set() + config("anywhere")
var opt_front: Set[String] = Set() + config("front")
var opt_discard: Boolean = config("discard")
var opt_minimum_length: String = config("minimum_length", 1)
var opt_maximum_length: String = config("maximum_length")
def cmdLine = required(executable) +
// options
repeat("-a", opt_adapter) +
repeat("-b", opt_anywhere) +
repeat("-g", opt_front) +
conditional(opt_discard, "--discard") +
optional("-m", opt_minimum_length) +
optional("-M", opt_maximum_length) +
// input / output
required(fastq_input) +
required("--output", fastq_output) +
" > " + required(stats_output)
}
\ No newline at end of file
package nl.lumc.sasc.biopet.extensions
import java.io.File
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import nl.lumc.sasc.biopet.core._
import nl.lumc.sasc.biopet.core.config._
class Fastqc(val root: Configurable) extends BiopetCommandLineFunction {
@Input(doc = "Contaminants", required = false)
var contaminants: File = _
@Input(doc = "Fastq file", shortName = "FQ")
var fastqfile: File = _
@Output(doc = "Output", shortName = "out")
var output: File = _
executable = config("exe", default = "fastqc")
var java_exe: String = config("exe", default = "java", submodule = "java")
var kmers: Option[Int] = config("kmers")
var quiet: Boolean = config("quiet")
var noextract: Boolean = config("noextract")
var nogroup: Boolean = config("nogroup")
var extract: Boolean = config("extract", default = true)
override val versionRegex = """FastQC (.*)""".r
override def versionCommand = executable + " --version"
override val defaultThreads = 4
override def afterGraph {
this.checkExecutable
if (contaminants == null) {
val fastqcDir = executable.substring(0, executable.lastIndexOf("/"))
contaminants = new File(fastqcDir + "/Contaminants/contaminant_list.txt")
}
}
def cmdLine = required(executable) +
optional("--java", java_exe) +
optional("--threads", threads) +
optional("--contaminants", contaminants) +
optional("--kmers", kmers) +
conditional(nogroup, "--nogroup") +
conditional(noextract, "--noextract") +
conditional(extract, "--extract") +
conditional(quiet, "--quiet") +
required("-o", output.getParent()) +
required(fastqfile)
}
package nl.lumc.sasc.biopet.extensions.fastq
package nl.lumc.sasc.biopet.extensions
import java.io.File
import scala.io.Source._
import scala.sys.process._
import org.broadinstitute.gatk.utils.commandline.{ Input, Output, Argument }
import argonaut._, Argonaut._
import scalaz._, Scalaz._
import nl.lumc.sasc.biopet.core._
import nl.lumc.sasc.biopet.core.config._
import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
class Sickle(val root: Configurable) extends BiopetCommandLineFunction {
@Input(doc = "R1 input")
......@@ -19,9 +13,6 @@ class Sickle(val root: Configurable) extends BiopetCommandLineFunction {
@Input(doc = "R2 input", required = false)
var input_R2: File = _
@Input(doc = "qualityType file", required = false)
var qualityTypeFile: File = _
@Output(doc = "R1 output")
var output_R1: File = _
......@@ -41,17 +32,12 @@ class Sickle(val root: Configurable) extends BiopetCommandLineFunction {
var defaultQualityType: String = config("defaultqualitytype", default = "sanger")
override val versionRegex = """sickle version (.*)""".r
override def versionCommand = executable + " --version"
override def afterGraph {
if (qualityType == null && defaultQualityType != null) qualityType = defaultQualityType
}
override def versionCommand = executable + " --version"
override def beforeCmd {
qualityType = getQualityTypeFromFile
}
def cmdLine = {
var cmd: String = required(executable)
if (input_R2 != null) {
......@@ -67,26 +53,4 @@ class Sickle(val root: Configurable) extends BiopetCommandLineFunction {
required("-o", output_R1) +
" > " + required(output_stats)
}
def getQualityTypeFromFile: String = {
if (qualityType == null && qualityTypeFile != null) {
if (qualityTypeFile.exists()) {
for (line <- fromFile(qualityTypeFile).getLines) {
var s: String = line.substring(0, line.lastIndexOf("\t"))
return s
}
} else logger.warn("File : " + qualityTypeFile + " does not exist")
}
return null
}
def getSummary: Json = {
return jNull
}
}
object Sickle {
def mergeSummarys(jsons: List[Json]): Json = {
return jNull
}
}
\ No newline at end of file
......@@ -10,7 +10,7 @@
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath nl.lumc.sasc.biopet.pipelines.flexiprep.Flexiprep -R2 bla.fastq.gz -R1 ../input_R1.fastq.bz2 -outputDir /home/pjvan_thof/pipelines/test -config /home/pjvan_thof/pipelines/biopet/flexiprep/examples/test.json -l DEBUG</exec.args>
<exec.args>-classpath %classpath nl.lumc.sasc.biopet.pipelines.flexiprep.Flexiprep -R2 bla.fastq.gz -R1 ../input_R1.fastq.bz2 -outDir /home/pjvan_thof/pipelines/test -config /home/pjvan_thof/pipelines/biopet/flexiprep/examples/test.json -l DEBUG</exec.args>
<exec.executable>java</exec.executable>
<exec.workingdir>/home/pjvan_thof/pipelines/test</exec.workingdir>
</properties>
......@@ -25,7 +25,7 @@
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath nl.lumc.sasc.biopet.pipelines.flexiprep.Flexiprep -R2 bla.fastq.gz -R1 ../input_R1.fastq.bz2 -outputDir /home/pjvan_thof/pipelines/test -config /home/pjvan_thof/pipelines/biopet/flexiprep/examples/test.json -l DEBUG</exec.args>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath nl.lumc.sasc.biopet.pipelines.flexiprep.Flexiprep -R2 bla.fastq.gz -R1 ../input_R1.fastq.bz2 -outDir /home/pjvan_thof/pipelines/test -config /home/pjvan_thof/pipelines/biopet/flexiprep/examples/test.json -l DEBUG</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
<exec.workingdir>/home/pjvan_thof/pipelines/test</exec.workingdir>
......@@ -41,7 +41,7 @@
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath nl.lumc.sasc.biopet.pipelines.flexiprep.Flexiprep -R2 bla.fastq.gz -R1 ../input_R1.fastq.bz2 -outputDir /home/pjvan_thof/pipelines/test -config /home/pjvan_thof/pipelines/biopet/flexiprep/examples/test.json -l DEBUG</exec.args>
<exec.args>-classpath %classpath nl.lumc.sasc.biopet.pipelines.flexiprep.Flexiprep -R2 bla.fastq.gz -R1 ../input_R1.fastq.bz2 -outDir /home/pjvan_thof/pipelines/test -config /home/pjvan_thof/pipelines/biopet/flexiprep/examples/test.json -l DEBUG</exec.args>
<exec.executable>java</exec.executable>
<exec.workingdir>/home/pjvan_thof/pipelines/test</exec.workingdir>
</properties>
......
package nl.lumc.sasc.biopet.extensions.fastq
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.File
import scala.io.Source._
import scala.sys.process._
package nl.lumc.sasc.biopet.pipelines.flexiprep
import scala.io.Source
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import nl.lumc.sasc.biopet.extensions.Ln
import org.broadinstitute.gatk.utils.commandline.{ Input }
import argonaut._, Argonaut._
import scalaz._, Scalaz._
import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import java.io.File
import nl.lumc.sasc.biopet.core.config.Configurable
import nl.lumc.sasc.biopet.extensions.Ln
class Cutadapt(val root: Configurable) extends BiopetCommandLineFunction {
@Input(doc = "Input fastq file")
var fastq_input: File = _
class Cutadapt(root: Configurable) extends nl.lumc.sasc.biopet.extensions.Cutadapt(root) {
@Input(doc = "Fastq contams file", required = false)
var contams_file: File = _
@Output(doc = "Output fastq file")
var fastq_output: File = _
@Output(doc = "Output statistics file")
var stats_output: File = _
executable = config("exe", default = "cutadapt")
override def versionCommand = executable + " --version"
override val versionRegex = """(.*)""".r
var default_clip_mode: String = config("default_clip_mode", default = "3")
var opt_adapter: Set[String] = Set() + config("adapter")
var opt_anywhere: Set[String] = Set() + config("anywhere")
var opt_front: Set[String] = Set() + config("front")
var opt_discard: Boolean = config("discard")
var opt_minimum_length: String = config("minimum_length", 1)
var opt_maximum_length: String = config("maximum_length")
override def beforeCmd() {
super.beforeCmd
getContamsFromFile
}
def cmdLine = {
override def cmdLine = {
if (!opt_adapter.isEmpty || !opt_anywhere.isEmpty || !opt_front.isEmpty) {
analysisName = getClass.getName
required(executable) +
// options
repeat("-a", opt_adapter) +
repeat("-b", opt_anywhere) +
repeat("-g", opt_front) +
conditional(opt_discard, "--discard") +
optional("-m", opt_minimum_length) +
optional("-M", opt_maximum_length) +
// input / output
required(fastq_input) +
required("--output", fastq_output) +
" > " + required(stats_output)
super.cmdLine
} else {
analysisName = getClass.getSimpleName + "-ln"
val lnOut = new Ln(this)
......@@ -67,11 +39,11 @@ class Cutadapt(val root: Configurable) extends BiopetCommandLineFunction {
lnOut.cmd
}
}
def getContamsFromFile {
if (contams_file != null) {
if (contams_file.exists()) {
for (line <- fromFile(contams_file).getLines) {
for (line <- Source.fromFile(contams_file).getLines) {
var s: String = line.substring(line.lastIndexOf("\t") + 1, line.size)
if (default_clip_mode == "3") opt_adapter += s
else if (default_clip_mode == "5") opt_front += s
......@@ -85,7 +57,7 @@ class Cutadapt(val root: Configurable) extends BiopetCommandLineFunction {
} else logger.warn("File : " + contams_file + " does not exist")
}
}
def getSummary: Json = {
return jNull
}
......
package nl.lumc.sasc.biopet.extensions.fastq
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package nl.lumc.sasc.biopet.pipelines.flexiprep
import java.io.File
import nl.lumc.sasc.biopet.core.config.Configurable
import scala.io.Source
import scala.sys.process._
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import argonaut._, Argonaut._
import scalaz._, Scalaz._
import nl.lumc.sasc.biopet.core._
import nl.lumc.sasc.biopet.core.config._
class Fastqc(val root: Configurable) extends BiopetCommandLineFunction {
@Input(doc = "Contaminants", required = false)
var contaminants: File = _
@Input(doc = "Fastq file", shortName = "FQ")
var fastqfile: File = _
@Output(doc = "Output", shortName = "out")
var output: File = _
executable = config("exe", default = "fastqc")
var java_exe: String = config("exe", default = "java", submodule = "java")
var kmers: Option[Int] = config("kmers")
var quiet: Boolean = config("quiet")
var noextract: Boolean = config("noextract")
var nogroup: Boolean = config("nogroup")
var extract: Boolean = config("extract", default = true)
override val versionRegex = """FastQC (.*)""".r
override val defaultThreads = 4
override def afterGraph {
this.checkExecutable
if (contaminants == null) {
val fastqcDir = executable.substring(0, executable.lastIndexOf("/"))
contaminants = new File(fastqcDir + "/Contaminants/contaminant_list.txt")
}
}
override def versionCommand = executable + " --version"
def cmdLine = {
required(executable) +
optional("--java", java_exe) +
optional("--threads", threads) +
optional("--contaminants", contaminants) +
optional("--kmers", kmers) +
conditional(nogroup, "--nogroup") +
conditional(noextract, "--noextract") +
conditional(extract, "--extract") +
conditional(quiet, "--quiet") +
required("-o", output.getParent()) +
required(fastqfile)
}
class Fastqc(root: Configurable) extends nl.lumc.sasc.biopet.extensions.Fastqc(root) {
def getDataBlock(name: String): Array[String] = { // Based on Fastqc v0.10.1
val outputDir = output.getName.stripSuffix(".zip")
val dataFile = new File(outputDir + "/fastqc_data.txt")
......
package nl.lumc.sasc.biopet.pipelines.flexiprep
import scala.util.parsing.json._
import org.broadinstitute.gatk.queue.QScript
import org.broadinstitute.gatk.queue.extensions.gatk._
import org.broadinstitute.gatk.queue.extensions.picard._
import org.broadinstitute.gatk.queue.function._
import org.broadinstitute.gatk.utils.commandline.{ Input, Argument }
import nl.lumc.sasc.biopet.core._
import nl.lumc.sasc.biopet.core.config._
import nl.lumc.sasc.biopet.extensions._
import nl.lumc.sasc.biopet.extensions.fastq._
import nl.lumc.sasc.biopet.core.{BiopetQScript, PipelineCommand}
import nl.lumc.sasc.biopet.core.config.Configurable
import nl.lumc.sasc.biopet.extensions.{Cat, Ln, Pbzip2, Sha1sum, Zcat}
import nl.lumc.sasc.biopet.pipelines.flexiprep.scripts._
class Flexiprep(val root: Configurable) extends QScript with BiopetQScript {
......
......@@ -2,10 +2,7 @@ package nl.lumc.sasc.biopet.pipelines.flexiprep
import nl.lumc.sasc.biopet.core.config.Configurable
import nl.lumc.sasc.biopet.extensions.Sha1sum
import nl.lumc.sasc.biopet.extensions.fastq.Cutadapt
import nl.lumc.sasc.biopet.extensions.fastq.Fastqc
import nl.lumc.sasc.biopet.extensions.fastq.Sickle
import nl.lumc.sasc.biopet.pipelines.flexiprep.scripts.FastqSync
import nl.lumc.sasc.biopet.pipelines.flexiprep.scripts.{ FastqSync, Seqstat }
import nl.lumc.sasc.biopet.pipelines.flexiprep.scripts.Seqstat
import org.broadinstitute.gatk.queue.function.InProcessFunction
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package nl.lumc.sasc.biopet.pipelines.flexiprep
import java.io.File
import nl.lumc.sasc.biopet.core.config.Configurable
import scala.io.Source
import org.broadinstitute.gatk.utils.commandline.{ Input }
import argonaut._, Argonaut._
import scalaz._, Scalaz._
class Sickle(root: Configurable) extends nl.lumc.sasc.biopet.extensions.Sickle(root) {
@Input(doc = "qualityType file", required = false)
var qualityTypeFile: File = _
override def beforeCmd {
super.beforeCmd
qualityType = getQualityTypeFromFile
}
def getQualityTypeFromFile: String = {
if (qualityType == null && qualityTypeFile != null) {
if (qualityTypeFile.exists()) {
for (line <- Source.fromFile(qualityTypeFile).getLines) {
var s: String = line.substring(0, line.lastIndexOf("\t"))
return s
}
} else logger.warn("File : " + qualityTypeFile + " does not exist")
}
return null
}
def getSummary: Json = {
return jNull
}
}
object Sickle {
def mergeSummarys(jsons: List[Json]): Json = {
return jNull
}
}
\ No newline at end of file
......@@ -2,7 +2,7 @@ package nl.lumc.sasc.biopet.pipelines.flexiprep.scripts
import java.io.File
import nl.lumc.sasc.biopet.extensions.fastq.Fastqc
import nl.lumc.sasc.biopet.pipelines.flexiprep.Fastqc
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import argonaut._, Argonaut._
......@@ -32,7 +32,6 @@ class Seqstat(val root: Configurable) extends PythonCommandLineFunction {
case s if (s.contains("Illumina <1.3")) => fmt = "solexa"
case s if (s.contains("Illumina 1.3")) => fmt = "illumina"
case s if (s.contains("Illumina 1.5")) => fmt = "illumina"
//case _ => null
}
}
}
......
......@@ -10,7 +10,7 @@
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath nl.lumc.sasc.biopet.pipelines.mapping.Mapping -R1 /data/DIV5/SASC/pjvan_thof/rig_validation/input/gcat_set_025/gcat_set_025_1.fastq.gz -R2 /data/DIV5/SASC/pjvan_thof/rig_validation/input/gcat_set_025/gcat_set_025_2.fastq.gz -outputDir /home/pjvan_thof/pipelines/test -config /home/pjvan_thof/pipelines/biopet/mapping/examples/test.json -RGLB test -RGSM test -ALN bwa -l DEBUG</exec.args>
<exec.args>-classpath %classpath nl.lumc.sasc.biopet.pipelines.mapping.Mapping -R1 /data/DIV5/SASC/pjvan_thof/rig_validation/input/gcat_set_025/gcat_set_025_1.fastq.gz -R2 /data/DIV5/SASC/pjvan_thof/rig_validation/input/gcat_set_025/gcat_set_025_2.fastq.gz -outDir /home/pjvan_thof/pipelines/test -config /home/pjvan_thof/pipelines/biopet/mapping/examples/test.json -RGLB test -RGSM test -ALN bwa -l DEBUG</exec.args>
<exec.executable>java</exec.executable>
<exec.workingdir>/home/pjvan_thof/pipelines/test</exec.workingdir>
</properties>
......@@ -25,7 +25,7 @@
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath nl.lumc.sasc.biopet.pipelines.mapping.Mapping -R1 /data/DIV5/SASC/pjvan_thof/rig_validation/input/gcat_set_025/gcat_set_025_1.fastq.gz -R2 /data/DIV5/SASC/pjvan_thof/rig_validation/input/gcat_set_025/gcat_set_025_2.fastq.gz -outputDir /home/pjvan_thof/pipelines/test -config /home/pjvan_thof/pipelines/biopet/mapping/examples/test.json -RGLB test -RGSM test -ALN bwa -l DEBUG</exec.args>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath nl.lumc.sasc.biopet.pipelines.mapping.Mapping -R1 /data/DIV5/SASC/pjvan_thof/rig_validation/input/gcat_set_025/gcat_set_025_1.fastq.gz -R2 /data/DIV5/SASC/pjvan_thof/rig_validation/input/gcat_set_025/gcat_set_025_2.fastq.gz -outDir /home/pjvan_thof/pipelines/test -config /home/pjvan_thof/pipelines/biopet/mapping/examples/test.json -RGLB test -RGSM test -ALN bwa -l DEBUG</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
<exec.workingdir>/home/pjvan_thof/pipelines/test</exec.workingdir>
......@@ -41,7 +41,7 @@
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath nl.lumc.sasc.biopet.pipelines.mapping.Mapping -R1 /data/DIV5/SASC/pjvan_thof/rig_validation/input/gcat_set_025/gcat_set_025_1.fastq.gz -R2 /data/DIV5/SASC/pjvan_thof/rig_validation/input/gcat_set_025/gcat_set_025_2.fastq.gz -outputDir /home/pjvan_thof/pipelines/test -config /home/pjvan_thof/pipelines/biopet/mapping/examples/test.json -RGLB test -RGSM test -ALN bwa -l DEBUG</exec.args>
<exec.args>-classpath %classpath nl.lumc.sasc.biopet.pipelines.mapping.Mapping -R1 /data/DIV5/SASC/pjvan_thof/rig_validation/input/gcat_set_025/gcat_set_025_1.fastq.gz -R2 /data/DIV5/SASC/pjvan_thof/rig_validation/input/gcat_set_025/gcat_set_025_2.fastq.gz -outDir /home/pjvan_thof/pipelines/test -config /home/pjvan_thof/pipelines/biopet/mapping/examples/test.json -RGLB test -RGSM test -ALN bwa -l DEBUG</exec.args>
<exec.executable>java</exec.executable>
<exec.workingdir>/home/pjvan_thof/pipelines/test</exec.workingdir>
</properties>
......
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