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

Added combine reads for GearsSingle

parent ca7bba56
......@@ -2,7 +2,8 @@ package nl.lumc.sasc.biopet.pipelines.gears
import nl.lumc.sasc.biopet.core.SampleLibraryTag
import nl.lumc.sasc.biopet.core.summary.SummaryQScript
import nl.lumc.sasc.biopet.extensions.Flash
import nl.lumc.sasc.biopet.extensions.{Cutadapt, Flash}
import nl.lumc.sasc.biopet.pipelines.flexiprep.Fastqc
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.queue.QScript
......@@ -15,18 +16,59 @@ class CombineReads(val root: Configurable) extends QScript with SummaryQScript w
@Input(doc = "R2 reads in FastQ format", shortName = "R2", required = false)
var fastqR2: File = _
override def fixedValues = Map("flash" -> Map("compress" -> true))
/** Init for pipeline */
def init(): Unit = {
}
private lazy val flash = new Flash(this)
private lazy val forwardPrimers: List[String] = config("forward_primers")
private lazy val reversePrimers: List[String] = config("reverse_primers")
def combinedFastq: File = if ((forwardPrimers :: reversePrimers).nonEmpty)
swapExt(outputDir, flash.combinedFastq, ".fastq.gz", ".clip.fastq.gz")
else flash.combinedFastq
def notCombinedR1Fastq: File = if ((forwardPrimers :: reversePrimers).nonEmpty)
swapExt(outputDir, flash.notCombinedR1, ".fastq.gz", ".clip.fastq.gz")
else flash.notCombinedR1
def notCombinedR2Fastq: File = if ((forwardPrimers :: reversePrimers).nonEmpty)
swapExt(outputDir, flash.notCombinedR2, ".fastq.gz", ".clip.fastq.gz")
else flash.notCombinedR2
/** Pipeline itself */
def biopetScript(): Unit = {
val flash = new Flash(this)
flash.outputDirectory = new File(outputDir, "flash")
flash.fastqR1 = fastqR1
flash.fastqR2 = fastqR2
flash.isIntermediate = (forwardPrimers ::: reversePrimers).nonEmpty
add(flash)
if ((forwardPrimers ::: reversePrimers).nonEmpty) {
val cutadapt = new Cutadapt(this)
cutadapt.fastq_input = flash.combinedFastq
cutadapt.fastq_output = this.combinedFastq
cutadapt.stats_output = swapExt(outputDir, cutadapt.fastq_output, ".fastq.gz", ".stats")
cutadapt.opt_anywhere ++= (forwardPrimers ::: reversePrimers)
add(cutadapt)
addSummarizable(cutadapt, "cutadapt")
}
val combinedFastqc = Fastqc(this, this.combinedFastq, new File(outputDir, "combined_fastqc"))
add(combinedFastqc)
addSummarizable(combinedFastqc, "fastqc_combined")
val notCombinedR1Fastqc = Fastqc(this, this.combinedFastq, new File(outputDir, "not_combined_R1_fastqc"))
add(notCombinedR1Fastqc)
addSummarizable(notCombinedR1Fastqc, "fastqc_not_combined_R1")
val notCombinedR2Fastqc = Fastqc(this, this.combinedFastq, new File(outputDir, "not_combined_R2_fastqc"))
add(notCombinedR2Fastqc)
addSummarizable(notCombinedR2Fastqc, "fastqc_not_combined_R2")
}
/** Must return a map with used settings for this pipeline */
......
......@@ -104,12 +104,12 @@ class GearsSingle(val root: Configurable) extends QScript with SummaryQScript wi
lazy val combinedFastq = {
r2 match {
case Some(r2) =>
val flash = new Flash(this)
flash.outputDirectory = new File(outputDir, "combine_reads_flash")
flash.fastqR1 = r1
flash.fastqR2 = r2
add(flash)
flash.combinedFastq
val combineReads = new CombineReads(this)
combineReads.outputDir = new File(outputDir, "combine_reads")
combineReads.fastqR1 = r1
combineReads.fastqR2 = r2
add(combineReads)
combineReads.combinedFastq
case _ => r1
}
}
......
Markdown is supported
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