Skip to content
Snippets Groups Projects
Commit 1a5f1520 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Add empty Qiime pipeline

parent 7e7bf6a4
No related branches found
No related tags found
No related merge requests found
......@@ -28,7 +28,6 @@ class Gears(val root: Configurable) extends QScript with MultiSampleQScript { qs
* Method where the multisample jobs should be added, this will be executed only when running the -sample argument is not given.
*/
def addMultiSampleJobs(): Unit = {
}
/**
......@@ -55,6 +54,7 @@ class Gears(val root: Configurable) extends QScript with MultiSampleQScript { qs
lazy val gs = new GearsSingle(qscript)
gs.sampleId = Some(sampleId)
gs.libId = Some(libId)
gs.outputDir = libDir
gs.fastqR1 = config("R1")
gs.fastqR2 = config("R2")
gs.bamFile = config("bam")
......
package nl.lumc.sasc.biopet.pipelines.gears
import nl.lumc.sasc.biopet.core.BiopetQScript
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.queue.QScript
/**
* Created by pjvan_thof on 12/4/15.
*/
class GearsQiimeRatx(val root: Configurable) extends QScript with BiopetQScript {
var fastaR1: File = _
var fastqR2: Option[File] = None
def init() = {
require(fastaR1 != null)
}
def biopetScript() = {
}
}
......@@ -21,6 +21,7 @@ import nl.lumc.sasc.biopet.core.{ PipelineCommand, SampleLibraryTag }
import nl.lumc.sasc.biopet.extensions.kraken.{ Kraken, KrakenReport }
import nl.lumc.sasc.biopet.extensions.picard.SamToFastq
import nl.lumc.sasc.biopet.extensions.samtools.SamtoolsView
import nl.lumc.sasc.biopet.extensions.seqtk.SeqtkSeq
import nl.lumc.sasc.biopet.extensions.tools.KrakenReportToJson
import nl.lumc.sasc.biopet.utils.Logging
import nl.lumc.sasc.biopet.utils.config.Configurable
......@@ -44,6 +45,9 @@ class GearsSingle(val root: Configurable) extends QScript with SummaryQScript wi
@Argument(required = false)
var outputName: String = _
var gearsUseKraken: Boolean = config("gears_use_kraken", default = true)
var gearsUserQiimeRtax: Boolean = config("gear_use_qiime_rtax", default = true)
/** Executed before running the script */
def init(): Unit = {
require(fastqR1.isDefined || bamFile.isDefined, "Please specify fastq-file(s) or bam file")
......@@ -61,9 +65,7 @@ class GearsSingle(val root: Configurable) extends QScript with SummaryQScript wi
if (fastqR1.isDefined) {
fastqR1.foreach(inputFiles :+= InputFile(_))
fastqR2.foreach(inputFiles :+= InputFile(_))
} else {
inputFiles :+= InputFile(bamFile.get)
}
} else inputFiles :+= InputFile(bamFile.get)
}
override def reportClass = {
......@@ -81,7 +83,9 @@ class GearsSingle(val root: Configurable) extends QScript with SummaryQScript wi
case (Some(r1), r2, _) => (r1, r2)
case (_, _, Some(bam)) =>
val extract = new ExtractUnmappedReads(this)
extract.outputDir = outputDir
extract.bamFile = bam
extract.outputName = outputName
extract.init()
extract.biopetScript()
addAll(extract.functions)
......@@ -89,13 +93,25 @@ class GearsSingle(val root: Configurable) extends QScript with SummaryQScript wi
case _ => Logging.addError("Missing input files")
}
val kraken = new GearsKraken(this)
kraken.fastqR1 = r1
kraken.fastqR2 = r2
kraken.init()
kraken.biopetScript()
addAll(kraken.functions)
addSummaryQScript(kraken)
lazy val fastqR1 = fastqToFasta(r1, outputName + ".R1")
lazy val fastqR2 = r2.map(fastqToFasta(_, outputName + ".R2"))
if (gearsUseKraken) {
val kraken = new GearsKraken(this)
kraken.outputDir = new File(outputDir, "kraken")
kraken.fastqR1 = r1
kraken.fastqR2 = r2
kraken.outputName = outputName
kraken.init()
kraken.biopetScript()
addAll(kraken.functions)
addSummaryQScript(kraken)
}
if (gearsUserQiimeRtax) {
val qiimeRatx = new GearsQiimeRatx(this)
}
addSummaryJobs()
}
......@@ -111,6 +127,18 @@ class GearsSingle(val root: Configurable) extends QScript with SummaryQScript wi
(if (bamFile.isDefined) Map("input_bam" -> bamFile.get) else Map()) ++
(if (fastqR1.isDefined) Map("input_R1" -> fastqR1.get) else Map()) ++
outputFiles
def fastqToFasta(file: File, name: String): File = {
val seqtk = new SeqtkSeq(this) {
override def configName = "seqtkseq"
override def fixedValues = Map("A" -> true)
}
seqtk.input = file
seqtk.output = new File(outputDir, name + ".fasta")
seqtk.isIntermediate = true
add(seqtk)
seqtk.output
}
}
/** This object give a default main method to the pipelines */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment