Commit a4e47ce4 authored by Wai Yi Leung's avatar Wai Yi Leung
Browse files

Merge branch 'fix-mpileup_to_vcf' into 'develop'

Fix mpileup to vcf

Fix MpileupToVcf to handle multi-nuclitides char better.

Also some refactoring in mapping and flexiprep. R2 should now be a Option[File], also for #133

See merge request !160
parents 6aa0a3d3 70012d38
...@@ -80,7 +80,7 @@ class BamMetrics(val root: Configurable) extends QScript with SummaryQScript wit ...@@ -80,7 +80,7 @@ class BamMetrics(val root: Configurable) extends QScript with SummaryQScript wit
val wgsMetrics = new CollectWgsMetrics(this) val wgsMetrics = new CollectWgsMetrics(this)
wgsMetrics.input = inputBam wgsMetrics.input = inputBam
wgsMetrics.output = swapExt(outputDir, inputBam, ".bam", ".rna.metrics") wgsMetrics.output = swapExt(outputDir, inputBam, ".bam", ".wgs.metrics")
add(wgsMetrics) add(wgsMetrics)
addSummarizable(wgsMetrics, "wgs") addSummarizable(wgsMetrics, "wgs")
......
...@@ -36,4 +36,9 @@ trait BiopetJavaCommandLineFunction extends JavaCommandLineFunction with BiopetC ...@@ -36,4 +36,9 @@ trait BiopetJavaCommandLineFunction extends JavaCommandLineFunction with BiopetC
val finalCmd = executable + cmd.substring(cmd.indexOf(" ")) val finalCmd = executable + cmd.substring(cmd.indexOf(" "))
return cmd return cmd
} }
override def setupRetry(): Unit = {
super.setupRetry()
javaMemoryLimit = memoryLimit
}
} }
...@@ -37,7 +37,7 @@ class Fastqc(val root: Configurable) extends BiopetCommandLineFunction { ...@@ -37,7 +37,7 @@ class Fastqc(val root: Configurable) extends BiopetCommandLineFunction {
@Input(doc = "Fastq file", shortName = "FQ") @Input(doc = "Fastq file", shortName = "FQ")
var fastqfile: File = null var fastqfile: File = null
@Output(doc = "Output", shortName = "out") @Output(doc = "Output", shortName = "out", required = true)
var output: File = null var output: File = null
executable = config("exe", default = "fastqc") executable = config("exe", default = "fastqc")
...@@ -54,6 +54,7 @@ class Fastqc(val root: Configurable) extends BiopetCommandLineFunction { ...@@ -54,6 +54,7 @@ class Fastqc(val root: Configurable) extends BiopetCommandLineFunction {
/** Sets contaminants and adapters when not yet set */ /** Sets contaminants and adapters when not yet set */
override def beforeGraph { override def beforeGraph {
this.jobOutputFile = new File(output.getParentFile, ".fastqc.out")
this.preProcesExecutable this.preProcesExecutable
val fastqcDir = new File(executable).getParent val fastqcDir = new File(executable).getParent
......
...@@ -113,10 +113,10 @@ object Star { ...@@ -113,10 +113,10 @@ object Star {
* @return Return Star * @return Return Star
* *
*/ */
def apply(configurable: Configurable, R1: File, R2: File, outputDir: File, isIntermediate: Boolean = false, deps: List[File] = Nil): Star = { def apply(configurable: Configurable, R1: File, R2: Option[File], outputDir: File, isIntermediate: Boolean = false, deps: List[File] = Nil): Star = {
val star = new Star(configurable) val star = new Star(configurable)
star.R1 = R1 star.R1 = R1
if (R2 != null) star.R2 = R2 R2.foreach(R2 => star.R2 = R2)
star.outputDir = outputDir star.outputDir = outputDir
star.isIntermediate = isIntermediate star.isIntermediate = isIntermediate
star.deps = deps star.deps = deps
...@@ -136,11 +136,11 @@ object Star { ...@@ -136,11 +136,11 @@ object Star {
*/ */
def _2pass(configurable: Configurable, def _2pass(configurable: Configurable,
R1: File, R1: File,
R2: File, R2: Option[File],
outputDir: File, outputDir: File,
isIntermediate: Boolean = false, isIntermediate: Boolean = false,
deps: List[File] = Nil): (File, List[Star]) = { deps: List[File] = Nil): (File, List[Star]) = {
val starCommand_pass1 = Star(configurable, R1, if (R2 != null) R2 else null, new File(outputDir, "aln-pass1")) val starCommand_pass1 = Star(configurable, R1, R2, new File(outputDir, "aln-pass1"))
starCommand_pass1.isIntermediate = isIntermediate starCommand_pass1.isIntermediate = isIntermediate
starCommand_pass1.deps = deps starCommand_pass1.deps = deps
starCommand_pass1.beforeGraph starCommand_pass1.beforeGraph
...@@ -152,7 +152,7 @@ object Star { ...@@ -152,7 +152,7 @@ object Star {
starCommand_reindex.isIntermediate = isIntermediate starCommand_reindex.isIntermediate = isIntermediate
starCommand_reindex.beforeGraph starCommand_reindex.beforeGraph
val starCommand_pass2 = Star(configurable, R1, if (R2 != null) R2 else null, new File(outputDir, "aln-pass2")) val starCommand_pass2 = Star(configurable, R1, R2, new File(outputDir, "aln-pass2"))
starCommand_pass2.genomeDir = starCommand_reindex.outputDir starCommand_pass2.genomeDir = starCommand_reindex.outputDir
starCommand_pass2.isIntermediate = isIntermediate starCommand_pass2.isIntermediate = isIntermediate
starCommand_pass2.deps = deps starCommand_pass2.deps = deps
......
...@@ -36,13 +36,12 @@ class FastqSplitter(val root: Configurable) extends BiopetJavaCommandLineFunctio ...@@ -36,13 +36,12 @@ class FastqSplitter(val root: Configurable) extends BiopetJavaCommandLineFunctio
@Output(doc = "Output fastq files", shortName = "output", required = true) @Output(doc = "Output fastq files", shortName = "output", required = true)
var output: List[File] = Nil var output: List[File] = Nil
override val defaultCoreMemory = 1.0 override val defaultCoreMemory = 4.0
/** /** * Generate command to execute */
* Generate command to execute override def commandLine = super.commandLine +
* @return required("-I", input) +
*/ repeat("-o", output)
override def commandLine = super.commandLine + required("-I", input) + repeat("-o", output)
} }
object FastqSplitter extends ToolCommand { object FastqSplitter extends ToolCommand {
......
...@@ -57,7 +57,7 @@ class FastqSync(val root: Configurable) extends BiopetJavaCommandLineFunction wi ...@@ -57,7 +57,7 @@ class FastqSync(val root: Configurable) extends BiopetJavaCommandLineFunction wi
@Output(doc = "Sync statistics", required = true) @Output(doc = "Sync statistics", required = true)
var outputStats: File = null var outputStats: File = null
override val defaultCoreMemory = 2.0 override val defaultCoreMemory = 4.0
// executed command line // executed command line
override def commandLine = override def commandLine =
......
...@@ -137,7 +137,12 @@ object MpileupToVcf extends ToolCommand { ...@@ -137,7 +137,12 @@ object MpileupToVcf extends ToolCommand {
writer.println("##FORMAT=<ID=ARC,Number=A,Type=Integer,Description=\"Alternetive Reverse Reads\">") writer.println("##FORMAT=<ID=ARC,Number=A,Type=Integer,Description=\"Alternetive Reverse Reads\">")
writer.println("##FORMAT=<ID=GT,Number=1,Type=String,Description=\"Genotype\">") writer.println("##FORMAT=<ID=GT,Number=1,Type=String,Description=\"Genotype\">")
writer.println("#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\t" + commandArgs.sample) writer.println("#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\t" + commandArgs.sample)
val inputStream = if (commandArgs.input != null) Source.fromFile(commandArgs.input).getLines else Source.stdin.getLines val inputStream = if (commandArgs.input != null) {
Source.fromFile(commandArgs.input).getLines
} else {
logger.info("No input file as argument, waiting on stdin")
Source.stdin.getLines
}
class Counts(var forward: Int, var reverse: Int) class Counts(var forward: Int, var reverse: Int)
for ( for (
line <- inputStream; line <- inputStream;
...@@ -146,7 +151,12 @@ object MpileupToVcf extends ToolCommand { ...@@ -146,7 +151,12 @@ object MpileupToVcf extends ToolCommand {
) { ) {
val chr = values(0) val chr = values(0)
val pos = values(1) val pos = values(1)
val ref = values(2) val ref = values(2) match {
case "A" | "T" | "G" | "C" => values(2)
case "a" | "t" | "g" | "c" => values(2).toUpperCase
case "U" | "u" => "T"
case _ => "N"
}
val reads = values(3).toInt val reads = values(3).toInt
val mpileup = values(4) val mpileup = values(4)
val qual = values(5) val qual = values(5)
......
...@@ -48,7 +48,7 @@ class Seqstat(val root: Configurable) extends BiopetJavaCommandLineFunction with ...@@ -48,7 +48,7 @@ class Seqstat(val root: Configurable) extends BiopetJavaCommandLineFunction with
@Output(doc = "Output JSON", shortName = "output", required = true) @Output(doc = "Output JSON", shortName = "output", required = true)
var output: File = null var output: File = null
override val defaultCoreMemory = 1.0 override val defaultCoreMemory = 2.5
override def commandLine = super.commandLine + required("-i", input) + " > " + required(output) override def commandLine = super.commandLine + required("-i", input) + " > " + required(output)
......
...@@ -95,7 +95,7 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with ...@@ -95,7 +95,7 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with
def biopetScript() { def biopetScript() {
runInitialJobs() runInitialJobs()
val out = if (paired) runTrimClip(outputFiles("fastq_input_R1"), outputFiles("fastq_input_R2"), outputDir) val out = if (paired) runTrimClip(outputFiles("fastq_input_R1"), Some(outputFiles("fastq_input_R2")), outputDir)
else runTrimClip(outputFiles("fastq_input_R1"), outputDir) else runTrimClip(outputFiles("fastq_input_R1"), outputDir)
val R1_files = for ((k, v) <- outputFiles if k.endsWith("output_R1")) yield v val R1_files = for ((k, v) <- outputFiles if k.endsWith("output_R1")) yield v
...@@ -130,8 +130,8 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with ...@@ -130,8 +130,8 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with
* @param chunk * @param chunk
* @return * @return
*/ */
def runTrimClip(R1_in: File, outDir: File, chunk: String): (File, File, List[File]) = def runTrimClip(R1_in: File, outDir: File, chunk: String): (File, Option[File], List[File]) =
runTrimClip(R1_in, new File(""), outDir, chunk) runTrimClip(R1_in, None, outDir, chunk)
/** /**
* Adds all chunkable jobs of flexiprep * Adds all chunkable jobs of flexiprep
...@@ -139,8 +139,8 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with ...@@ -139,8 +139,8 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with
* @param outDir * @param outDir
* @return * @return
*/ */
def runTrimClip(R1_in: File, outDir: File): (File, File, List[File]) = def runTrimClip(R1_in: File, outDir: File): (File, Option[File], List[File]) =
runTrimClip(R1_in, new File(""), outDir, "") runTrimClip(R1_in, None, outDir, "")
/** /**
* Adds all chunkable jobs of flexiprep * Adds all chunkable jobs of flexiprep
...@@ -149,7 +149,7 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with ...@@ -149,7 +149,7 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with
* @param outDir * @param outDir
* @return * @return
*/ */
def runTrimClip(R1_in: File, R2_in: File, outDir: File): (File, File, List[File]) = def runTrimClip(R1_in: File, R2_in: Option[File], outDir: File): (File, Option[File], List[File]) =
runTrimClip(R1_in, R2_in, outDir, "") runTrimClip(R1_in, R2_in, outDir, "")
/** /**
...@@ -160,14 +160,14 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with ...@@ -160,14 +160,14 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with
* @param chunkarg * @param chunkarg
* @return * @return
*/ */
def runTrimClip(R1_in: File, R2_in: File, outDir: File, chunkarg: String): (File, File, List[File]) = { def runTrimClip(R1_in: File, R2_in: Option[File], outDir: File, chunkarg: String): (File, Option[File], List[File]) = {
val chunk = if (chunkarg.isEmpty || chunkarg.endsWith("_")) chunkarg else chunkarg + "_" val chunk = if (chunkarg.isEmpty || chunkarg.endsWith("_")) chunkarg else chunkarg + "_"
var results: Map[String, File] = Map() var results: Map[String, File] = Map()
var R1: File = new File(R1_in) var R1 = R1_in
var R2: File = if (paired) new File(R2_in) else null var R2 = R2_in
var deps_R1: List[File] = R1 :: Nil var deps_R1 = R1 :: Nil
var deps_R2: List[File] = if (paired) R2 :: Nil else Nil var deps_R2 = if (paired) R2.get :: Nil else Nil
def deps: List[File] = deps_R1 ::: deps_R2 def deps: List[File] = deps_R1 ::: deps_R2
val seqtkSeq_R1 = SeqtkSeq(this, R1, swapExt(outDir, R1, R1_ext, ".sanger" + R1_ext), fastqc_R1) val seqtkSeq_R1 = SeqtkSeq(this, R1, swapExt(outDir, R1, R1_ext, ".sanger" + R1_ext), fastqc_R1)
...@@ -178,12 +178,12 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with ...@@ -178,12 +178,12 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with
deps_R1 ::= R1 deps_R1 ::= R1
if (paired) { if (paired) {
val seqtkSeq_R2 = SeqtkSeq(this, R2, swapExt(outDir, R2, R2_ext, ".sanger" + R2_ext), fastqc_R2) val seqtkSeq_R2 = SeqtkSeq(this, R2.get, swapExt(outDir, R2.get, R2_ext, ".sanger" + R2_ext), fastqc_R2)
seqtkSeq_R2.isIntermediate = true seqtkSeq_R2.isIntermediate = true
add(seqtkSeq_R2) add(seqtkSeq_R2)
addSummarizable(seqtkSeq_R2, "seqtkSeq_R2") addSummarizable(seqtkSeq_R2, "seqtkSeq_R2")
R2 = seqtkSeq_R2.output R2 = Some(seqtkSeq_R2.output)
deps_R2 ::= R2 deps_R2 ::= R2.get
} }
val seqstat_R1 = Seqstat(this, R1, outDir) val seqstat_R1 = Seqstat(this, R1, outDir)
...@@ -193,7 +193,7 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with ...@@ -193,7 +193,7 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with
addSummarizable(seqstat_R1, "seqstat_R1") addSummarizable(seqstat_R1, "seqstat_R1")
if (paired) { if (paired) {
val seqstat_R2 = Seqstat(this, R2, outDir) val seqstat_R2 = Seqstat(this, R2.get, outDir)
seqstat_R2.isIntermediate = true seqstat_R2.isIntermediate = true
seqstat_R2.deps = deps_R2 seqstat_R2.deps = deps_R2
add(seqstat_R2) add(seqstat_R2)
...@@ -213,31 +213,31 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with ...@@ -213,31 +213,31 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with
outputFiles += ("cutadapt_R1_stats" -> cutadapt_R1.stats_output) outputFiles += ("cutadapt_R1_stats" -> cutadapt_R1.stats_output)
if (paired) { if (paired) {
val cutadapt_R2 = Cutadapt(this, R2, swapExt(outDir, R2, R2_ext, ".clip" + R2_ext)) val cutadapt_R2 = Cutadapt(this, R2.get, swapExt(outDir, R2.get, R2_ext, ".clip" + R2_ext))
outputFiles += ("cutadapt_R2_stats" -> cutadapt_R2.stats_output) outputFiles += ("cutadapt_R2_stats" -> cutadapt_R2.stats_output)
cutadapt_R2.fastqc = fastqc_R2 cutadapt_R2.fastqc = fastqc_R2
cutadapt_R2.isIntermediate = true cutadapt_R2.isIntermediate = true
cutadapt_R2.deps = deps_R2 cutadapt_R2.deps = deps_R2
add(cutadapt_R2) add(cutadapt_R2)
addSummarizable(cutadapt_R2, "clipping_R2") addSummarizable(cutadapt_R2, "clipping_R2")
R2 = cutadapt_R2.fastq_output R2 = Some(cutadapt_R2.fastq_output)
deps_R2 ::= R2 deps_R2 ::= R2.get
val fqSync = new FastqSync(this) val fqSync = new FastqSync(this)
fqSync.refFastq = cutadapt_R1.fastq_input fqSync.refFastq = cutadapt_R1.fastq_input
fqSync.inputFastq1 = cutadapt_R1.fastq_output fqSync.inputFastq1 = cutadapt_R1.fastq_output
fqSync.inputFastq2 = cutadapt_R2.fastq_output fqSync.inputFastq2 = cutadapt_R2.fastq_output
fqSync.outputFastq1 = swapExt(outDir, R1, R1_ext, ".sync" + R1_ext) fqSync.outputFastq1 = swapExt(outDir, R1, R1_ext, ".sync" + R1_ext)
fqSync.outputFastq2 = swapExt(outDir, R2, R2_ext, ".sync" + R2_ext) fqSync.outputFastq2 = swapExt(outDir, R2.get, R2_ext, ".sync" + R2_ext)
fqSync.outputStats = swapExt(outDir, R1, R1_ext, ".sync.stats") fqSync.outputStats = swapExt(outDir, R1, R1_ext, ".sync.stats")
fqSync.deps :::= deps fqSync.deps :::= deps
add(fqSync) add(fqSync)
addSummarizable(fqSync, "fastq_sync") addSummarizable(fqSync, "fastq_sync")
outputFiles += ("syncStats" -> fqSync.outputStats) outputFiles += ("syncStats" -> fqSync.outputStats)
R1 = fqSync.outputFastq1 R1 = fqSync.outputFastq1
R2 = fqSync.outputFastq2 R2 = Some(fqSync.outputFastq2)
deps_R1 ::= R1 deps_R1 ::= R1
deps_R2 ::= R2 deps_R2 ::= R2.get
} }
} }
...@@ -246,9 +246,9 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with ...@@ -246,9 +246,9 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with
sickle.input_R1 = R1 sickle.input_R1 = R1
sickle.output_R1 = swapExt(outDir, R1, R1_ext, ".trim" + R1_ext) sickle.output_R1 = swapExt(outDir, R1, R1_ext, ".trim" + R1_ext)
if (paired) { if (paired) {
sickle.input_R2 = R2 sickle.input_R2 = R2.get
sickle.output_R2 = swapExt(outDir, R2, R2_ext, ".trim" + R2_ext) sickle.output_R2 = swapExt(outDir, R2.get, R2_ext, ".trim" + R2_ext)
sickle.output_singles = swapExt(outDir, R2, R2_ext, ".trim.singles" + R1_ext) sickle.output_singles = swapExt(outDir, R2.get, R2_ext, ".trim.singles" + R1_ext)
} }
sickle.output_stats = swapExt(outDir, R1, R1_ext, ".trim.stats") sickle.output_stats = swapExt(outDir, R1, R1_ext, ".trim.stats")
sickle.deps = deps sickle.deps = deps
...@@ -256,7 +256,7 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with ...@@ -256,7 +256,7 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with
add(sickle) add(sickle)
addSummarizable(sickle, "trimming") addSummarizable(sickle, "trimming")
R1 = sickle.output_R1 R1 = sickle.output_R1
if (paired) R2 = sickle.output_R2 if (paired) R2 = Some(sickle.output_R2)
} }
val seqstat_R1_after = Seqstat(this, R1, outDir) val seqstat_R1_after = Seqstat(this, R1, outDir)
...@@ -265,14 +265,14 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with ...@@ -265,14 +265,14 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with
addSummarizable(seqstat_R1_after, "seqstat_R1_after") addSummarizable(seqstat_R1_after, "seqstat_R1_after")
if (paired) { if (paired) {
val seqstat_R2_after = Seqstat(this, R2, outDir) val seqstat_R2_after = Seqstat(this, R2.get, outDir)
seqstat_R2_after.deps = deps_R2 seqstat_R2_after.deps = deps_R2
add(seqstat_R2_after) add(seqstat_R2_after)
addSummarizable(seqstat_R2_after, "seqstat_R2_after") addSummarizable(seqstat_R2_after, "seqstat_R2_after")
} }
outputFiles += (chunk + "output_R1" -> R1) outputFiles += (chunk + "output_R1" -> R1)
if (paired) outputFiles += (chunk + "output_R2" -> R2) if (paired) outputFiles += (chunk + "output_R2" -> R2.get)
return (R1, R2, deps) return (R1, R2, deps)
} }
......
...@@ -157,26 +157,27 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S ...@@ -157,26 +157,27 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S
var fastq_R1_output: List[File] = Nil var fastq_R1_output: List[File] = Nil
var fastq_R2_output: List[File] = Nil var fastq_R2_output: List[File] = Nil
def removeGz(file: String): String = { def removeGz(file: File): File = {
if (file.endsWith(".gz")) file.substring(0, file.lastIndexOf(".gz")) val absPath = file.getAbsolutePath
else if (file.endsWith(".gzip")) file.substring(0, file.lastIndexOf(".gzip")) if (absPath.endsWith(".gz")) new File(absPath.substring(0, absPath.lastIndexOf(".gz")))
else if (absPath.endsWith(".gzip")) new File(absPath.substring(0, absPath.lastIndexOf(".gzip")))
else file else file
} }
var chunks: Map[File, (String, String)] = Map()
if (chunking) for (t <- 1 to numberChunks.getOrElse(1)) { val chunks: Map[File, (File, Option[File])] = {
val chunkDir = new File(outputDir, "chunks" + File.separator + t) if (chunking) {
chunks += (chunkDir -> (removeGz(chunkDir + input_R1.getName), (for (t <- 1 to numberChunks.getOrElse(1)) yield {
if (paired) removeGz(chunkDir + input_R2.get.getName) else "")) val chunkDir = new File(outputDir, "chunks" + File.separator + t)
(chunkDir -> (removeGz(new File(chunkDir, input_R1.getName)),
if (paired) Some(removeGz(new File(chunkDir, input_R2.get.getName))) else None))
}).toMap
} else if (skipFlexiprep) {
Map(outputDir -> (
extractIfNeeded(input_R1, flexiprep.outputDir),
if (paired) Some(extractIfNeeded(input_R2.get, outputDir)) else None)
)
} else Map(outputDir -> (input_R1, input_R2))
} }
else if (skipFlexiprep) {
chunks += (outputDir -> (
extractIfNeeded(input_R1, flexiprep.outputDir),
if (paired) extractIfNeeded(input_R2.get, outputDir) else "")
)
} else chunks += (outputDir -> (
flexiprep.outputFiles("fastq_input_R1"),
if (paired) flexiprep.outputFiles("fastq_input_R2") else "")
)
if (chunking) { if (chunking) {
val fastSplitter_R1 = new FastqSplitter(this) val fastSplitter_R1 = new FastqSplitter(this)
...@@ -188,7 +189,7 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S ...@@ -188,7 +189,7 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S
if (paired) { if (paired) {
val fastSplitter_R2 = new FastqSplitter(this) val fastSplitter_R2 = new FastqSplitter(this)
fastSplitter_R2.input = input_R2.get fastSplitter_R2.input = input_R2.get
for ((chunkDir, fastqfile) <- chunks) fastSplitter_R2.output :+= fastqfile._2 for ((chunkDir, fastqfile) <- chunks) fastSplitter_R2.output :+= fastqfile._2.get
fastSplitter_R2.isIntermediate = true fastSplitter_R2.isIntermediate = true
add(fastSplitter_R2) add(fastSplitter_R2)
} }
...@@ -205,7 +206,7 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S ...@@ -205,7 +206,7 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S
if (paired) R2 = flexiout._2 if (paired) R2 = flexiout._2
deps = flexiout._3 deps = flexiout._3
fastq_R1_output :+= R1 fastq_R1_output :+= R1
fastq_R2_output :+= R2 R2.foreach(R2 => fastq_R2_output :+= R2)
} }
val outputBam = new File(chunkDir, outputName + ".bam") val outputBam = new File(chunkDir, outputName + ".bam")
...@@ -267,7 +268,7 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S ...@@ -267,7 +268,7 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S
* @param deps * @param deps
* @return * @return
*/ */
def addBwaAln(R1: File, R2: File, output: File, deps: List[File]): File = { def addBwaAln(R1: File, R2: Option[File], output: File, deps: List[File]): File = {
val bwaAlnR1 = new BwaAln(this) val bwaAlnR1 = new BwaAln(this)
bwaAlnR1.fastq = R1 bwaAlnR1.fastq = R1
bwaAlnR1.deps = deps bwaAlnR1.deps = deps
...@@ -277,7 +278,7 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S ...@@ -277,7 +278,7 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S
val samFile: File = if (paired) { val samFile: File = if (paired) {
val bwaAlnR2 = new BwaAln(this) val bwaAlnR2 = new BwaAln(this)
bwaAlnR2.fastq = R2 bwaAlnR2.fastq = R2.get
bwaAlnR2.deps = deps bwaAlnR2.deps = deps
bwaAlnR2.output = swapExt(output.getParent, output, ".bam", ".R2.sai") bwaAlnR2.output = swapExt(output.getParent, output, ".bam", ".R2.sai")
bwaAlnR2.isIntermediate = true bwaAlnR2.isIntermediate = true
...@@ -285,7 +286,7 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S ...@@ -285,7 +286,7 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S
val bwaSampe = new BwaSampe(this) val bwaSampe = new BwaSampe(this)
bwaSampe.fastqR1 = R1 bwaSampe.fastqR1 = R1
bwaSampe.fastqR2 = R2 bwaSampe.fastqR2 = R2.get