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

Fix code style warnings by IDE

parent 483fe407
......@@ -72,8 +72,8 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference {
/** Sample specific files to add to summary */
def summaryFiles: Map[String, File] = {
preProcessBam match {
case Some(preProcessBam) => Map("preProcessBam" -> preProcessBam)
case _ => Map()
case Some(b) => Map("preProcessBam" -> b)
case _ => Map()
}
}
......@@ -88,9 +88,9 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference {
/** Library specific files to add to the summary */
def summaryFiles: Map[String, File] = {
(bamFile, preProcessBam) match {
case (Some(bamFile), Some(preProcessBam)) => Map("bamFile" -> bamFile, "preProcessBam" -> preProcessBam)
case (Some(bamFile), _) => Map("bamFile" -> bamFile)
case _ => Map()
case (Some(b), Some(pb)) => Map("bamFile" -> b, "preProcessBam" -> pb)
case (Some(b), _) => Map("bamFile" -> b)
case _ => Map()
}
}
......@@ -116,10 +116,9 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference {
case (false, true) => // Starting from bam file
config("bam_to_fastq", default = false).asBoolean match {
case true => makeMapping // bam file will be converted to fastq
case false => {
case false =>
val file = new File(libDir, sampleId + "-" + libId + ".final.bam")
(None, Some(file), preProcess(file))
}
}
case _ => (None, None, None)
}
......@@ -137,7 +136,7 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference {
mapping.input_R2 = config("R2")
})
case (false, true) => config("bam_to_fastq", default = false).asBoolean match {
case true => {
case true =>
val samToFastq = SamToFastq(qscript, config("bam"),
new File(libDir, sampleId + "-" + libId + ".R1.fastq"),
new File(libDir, sampleId + "-" + libId + ".R2.fastq"))
......@@ -147,8 +146,7 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference {
mapping.input_R1 = samToFastq.fastqR1
mapping.input_R2 = Some(samToFastq.fastqR2)
})
}
case false => {
case false =>
val inputSam = SamReaderFactory.makeDefault.open(config("bam"))
val readGroups = inputSam.getFileHeader.getReadGroups
......@@ -157,7 +155,7 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference {
if (readGroup.getLibrary != libId) logger.warn("Library ID readgroup in bam file is not the same")
readGroup.getSample == sampleId && readGroup.getLibrary == libId
})
inputSam.close
inputSam.close()
if (!readGroupOke) {
if (config("correct_readgroups", default = false).asBoolean) {
......@@ -181,15 +179,13 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference {
bamLn.deps :+= baiLn.output
add(bamLn)
}
}
}
case _ => logger.warn("Sample: " + sampleId + " Library: " + libId + ", no reads found")
}
mapping.foreach(mapping => {
mapping.init
mapping.biopetScript
mapping.init()
mapping.biopetScript()
addAll(mapping.functions) // Add functions of mapping to curent function pool
addSummaryQScript(mapping)
})
......@@ -234,13 +230,13 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference {
}
}
lazy val preProcessBam: Option[File] = addDoublePreProcess(libraries.map(lib => {
lazy val preProcessBam: Option[File] = addDoublePreProcess(libraries.flatMap(lib => {
(lib._2.bamFile, lib._2.preProcessBam) match {
case (_, Some(file)) => Some(file)
case (Some(file), _) => Some(file)
case _ => None
}
}).flatten.toList)
}).toList)
lazy val variantcalling = if (config("single_sample_variantcalling", default = false).asBoolean) {
Some(makeVariantcalling(multisample = true))
......@@ -255,8 +251,8 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference {
bamMetrics.sampleId = Some(sampleId)
bamMetrics.inputBam = preProcessBam.get
bamMetrics.outputDir = sampleDir
bamMetrics.init
bamMetrics.biopetScript
bamMetrics.init()
bamMetrics.biopetScript()
addAll(bamMetrics.functions)
addSummaryQScript(bamMetrics)
......@@ -281,7 +277,7 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript with Reference {
def addMultiSampleJobs(): Unit = {
variantcalling.foreach(vc => {
vc.outputDir = new File(outputDir, "variantcalling")
vc.inputBams = samples.map(_._2.preProcessBam).flatten.toList
vc.inputBams = samples.flatMap(_._2.preProcessBam).toList
vc.init
vc.biopetScript
addAll(vc.functions)
......
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