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

Switch to functions

parent 8b557e11
package nl.lumc.sasc.biopet.pipelines.flexiprep package nl.lumc.sasc.biopet.pipelines.flexiprep
import nl.lumc.sasc.biopet.core.config.Configurable import nl.lumc.sasc.biopet.core.config.Configurable
import nl.lumc.sasc.biopet.function.Sha1sum
import nl.lumc.sasc.biopet.function.fastq.Cutadapt
import nl.lumc.sasc.biopet.function.fastq.Fastqc import nl.lumc.sasc.biopet.function.fastq.Fastqc
import nl.lumc.sasc.biopet.function.fastq.Sickle
import nl.lumc.sasc.biopet.pipelines.flexiprep.scripts.FastqSync
import nl.lumc.sasc.biopet.pipelines.flexiprep.scripts.Seqstat
import org.broadinstitute.gatk.queue.function.InProcessFunction import org.broadinstitute.gatk.queue.function.InProcessFunction
import org.broadinstitute.gatk.utils.commandline.{ Input, Output, Argument } import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import java.io.File import java.io.File
import argonaut._, Argonaut._ import argonaut._, Argonaut._
import scalaz._, Scalaz._ import scalaz._, Scalaz._
...@@ -11,59 +16,59 @@ import scalaz._, Scalaz._ ...@@ -11,59 +16,59 @@ import scalaz._, Scalaz._
class FlexiprepSummary(val root: Configurable) extends InProcessFunction with Configurable { class FlexiprepSummary(val root: Configurable) extends InProcessFunction with Configurable {
this.analysisName = getClass.getSimpleName this.analysisName = getClass.getSimpleName
@Input(doc = "Seq stat files R1", required=true) @Input(doc="deps")
var seqstatR1: List[File] = Nil var deps: List[File] = Nil
@Input(doc = "Seq stat files R2", required=false) @Output(doc = "Summary output", required=true)
var seqstatR2: List[File] = Nil var out: File = _
@Input(doc = "Seq stat files R1 after", required=false)
var seqstatR1after: List[File] = Nil
@Input(doc = "Seq stat files R2 after", required=false)
var seqstatR2after: List[File] = Nil
@Input(doc = "sha1 files R1", required=true)
var sha1R1: File = _
@Input(doc = "sha1 files R2", required=false)
var sha1R2: File = _
@Input(doc = "sha1 files R1 after", required=false) class Chunk {
var sha1R1after: File = _ var seqstatR1: Seqstat = _
var seqstatR2: Seqstat = _
var seqstatR1after: Seqstat = _
var seqstatR2after: Seqstat = _
var cutadaptR1: Cutadapt = _
var cutadaptR2: Cutadapt = _
var fastqSync: FastqSync = _
var sickle: Sickle = _
}
@Input(doc = "sha1 files R2 after", required=false) var chunks: Map[String, Chunk] = Map()
var sha1R2after: File = _
@Input(doc = "Clip stat files R1", required=false) def addSeqstat(seqstat:Seqstat, R2:Boolean = false, after:Boolean = false, chunk:String=""): Seqstat = {
var clipstatR1: List[File] = Nil if (!chunks.contains(chunk)) chunks += (chunk -> new Chunk)
if (!R2 && !after) chunks(chunk).seqstatR1 = seqstat
else if (!R2 && after) chunks(chunk).seqstatR1after = seqstat
else if (R2 && !after) chunks(chunk).seqstatR2 = seqstat
else if (R2 && after) chunks(chunk).seqstatR2after = seqstat
deps ::= seqstat.out
return seqstat
}
@Input(doc = "Clip stat files R2", required=false) def addCutadapt(cutadapt:Cutadapt, R2:Boolean = false, chunk:String=""): Cutadapt = {
var clipstatR2: List[File] = Nil if (!chunks.contains(chunk)) chunks += (chunk -> new Chunk)
if (!R2) chunks(chunk).cutadaptR1 = cutadapt
else chunks(chunk).cutadaptR2 = cutadapt
//TODO: stats file of cutadapt
return cutadapt
}
@Input(doc = "Trim stat files", required=false)
var trimstats: List[File] = Nil
@Input(doc = "Sync stat files", required=false)
var syncstats: List[File] = Nil
@Output(doc = "Summary output", required=true) var sha1R1: Sha1sum = _
var out: File = _ var sha1R2: Sha1sum = _
var sha1R1after: Sha1sum = _
var sha1R2after: Sha1sum = _
@Argument(doc = "fastqc files R1", required=true)
var fastqcR1: Fastqc = _ var fastqcR1: Fastqc = _
@Argument(doc = "fastqc files R2", required=false)
var fastqcR2: Fastqc = _ var fastqcR2: Fastqc = _
@Argument(doc = "fastqc files R1 after", required=false)
var fastqcR1after: Fastqc = _ var fastqcR1after: Fastqc = _
@Argument(doc = "fastqc files R2 after", required=false)
var fastqcR2after: Fastqc = _ var fastqcR2after: Fastqc = _
@Argument(doc = "Flexiprep Pipeline", required=true) var flexiprep: Flexiprep = root.asInstanceOf[Flexiprep]
var flexiprep: Flexiprep = _
var clipping = true var clipping = true
var trimming = true var trimming = true
...@@ -74,58 +79,29 @@ class FlexiprepSummary(val root: Configurable) extends InProcessFunction with Co ...@@ -74,58 +79,29 @@ class FlexiprepSummary(val root: Configurable) extends InProcessFunction with Co
trimming = !flexiprep.skipTrim trimming = !flexiprep.skipTrim
paired = flexiprep.paired paired = flexiprep.paired
fastqcSummary(fastqcR1)
if (paired) fastqcSummary(fastqcR2)
sha1Summary(sha1R1)
if (paired) sha1Summary(sha1R2)
seqstatSummary(seqstatR1)
if (paired) seqstatSummary(seqstatR2)
if (clipping) {
clipstatSummary(clipstatR1)
if (paired) {
clipstatSummary(clipstatR2)
syncstatSummary(syncstats)
}
}
if (trimming) trimstatSummary(trimstats)
if (clipping || trimming) {
fastqcSummary(fastqcR1after)
if (paired) fastqcSummary(fastqcR2after)
sha1Summary(sha1R1after)
if (paired) sha1Summary(sha1R2after)
seqstatSummary(seqstatR1after)
if (paired) seqstatSummary(seqstatR2after)
}
} }
def seqstatSummary(files: List[File]): Json = { def seqstatSummary(): Json = {
//TODO //TODO
return null return null
} }
def sha1Summary(file:File): Json = { def sha1Summary(): Json = {
//TODO //TODO
return null return null
} }
def fastqcSummary(fastqc:Fastqc): Json = { def fastqcSummary(): Json = {
//TODO //TODO
return null return null
} }
def clipstatSummary(files: List[File]): Json = { def clipstatSummary(): Json = {
//TODO //TODO
return null return null
} }
def syncstatSummary(files: List[File]): Json = { def syncstatSummary(): Json = {
//TODO //TODO
return null return null
} }
def trimstatSummary(files: List[File]): Json = { def trimstatSummary(): Json = {
//TODO //TODO
return null return null
} }
......
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