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
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.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.utils.commandline.{ Input, Output, Argument }
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import java.io.File
import argonaut._, Argonaut._
import scalaz._, Scalaz._
......@@ -11,59 +16,59 @@ import scalaz._, Scalaz._
class FlexiprepSummary(val root: Configurable) extends InProcessFunction with Configurable {
this.analysisName = getClass.getSimpleName
@Input(doc = "Seq stat files R1", required=true)
var seqstatR1: List[File] = Nil
@Input(doc="deps")
var deps: List[File] = Nil
@Input(doc = "Seq stat files R2", required=false)
var seqstatR2: List[File] = Nil
@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 = _
@Output(doc = "Summary output", required=true)
var out: File = _
@Input(doc = "sha1 files R1 after", required=false)
var sha1R1after: File = _
class Chunk {
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 sha1R2after: File = _
var chunks: Map[String, Chunk] = Map()
@Input(doc = "Clip stat files R1", required=false)
var clipstatR1: List[File] = Nil
def addSeqstat(seqstat:Seqstat, R2:Boolean = false, after:Boolean = false, chunk:String=""): Seqstat = {
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)
var clipstatR2: List[File] = Nil
def addCutadapt(cutadapt:Cutadapt, R2:Boolean = false, chunk:String=""): Cutadapt = {
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 out: File = _
var sha1R1: Sha1sum = _
var sha1R2: Sha1sum = _
var sha1R1after: Sha1sum = _
var sha1R2after: Sha1sum = _
@Argument(doc = "fastqc files R1", required=true)
var fastqcR1: Fastqc = _
@Argument(doc = "fastqc files R2", required=false)
var fastqcR2: Fastqc = _
@Argument(doc = "fastqc files R1 after", required=false)
var fastqcR1after: Fastqc = _
@Argument(doc = "fastqc files R2 after", required=false)
var fastqcR2after: Fastqc = _
@Argument(doc = "Flexiprep Pipeline", required=true)
var flexiprep: Flexiprep = _
var flexiprep: Flexiprep = root.asInstanceOf[Flexiprep]
var clipping = true
var trimming = true
......@@ -74,58 +79,29 @@ class FlexiprepSummary(val root: Configurable) extends InProcessFunction with Co
trimming = !flexiprep.skipTrim
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
return null
}
def sha1Summary(file:File): Json = {
def sha1Summary(): Json = {
//TODO
return null
}
def fastqcSummary(fastqc:Fastqc): Json = {
def fastqcSummary(): Json = {
//TODO
return null
}
def clipstatSummary(files: List[File]): Json = {
def clipstatSummary(): Json = {
//TODO
return null
}
def syncstatSummary(files: List[File]): Json = {
def syncstatSummary(): Json = {
//TODO
return null
}
def trimstatSummary(files: List[File]): Json = {
def trimstatSummary(): Json = {
//TODO
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