Commit caf71f04 authored by Peter van 't Hof's avatar Peter van 't Hof

Inspection round pipelines

parent 2540e8fd
......@@ -44,7 +44,7 @@ class CarpTest extends TestNGSuite with Matchers {
}
@DataProvider(name = "carpOptions")
def carpOptions = {
def carpOptions: Array[Array[Any]] = {
val bool = Array(true, false)
for (s1 <- bool; s2 <- bool; s3 <- bool; t <- bool; c <- bool)
......@@ -103,7 +103,7 @@ class CarpTest extends TestNGSuite with Matchers {
}
// remove temporary run directory all tests in the class have been run
@AfterClass def removeTempOutputDir() = {
@AfterClass def removeTempOutputDir(): Unit = {
dirs.filter(_.exists()).foreach { dir =>
try {
FileUtils.deleteDirectory(dir)
......@@ -116,8 +116,8 @@ class CarpTest extends TestNGSuite with Matchers {
}
object CarpTest {
def outputDir = Files.createTempDir()
val inputDir = Files.createTempDir()
def outputDir: File = Files.createTempDir()
val inputDir: File = Files.createTempDir()
def inputTouch(name: String): String = {
val file = new File(inputDir, name)
......
......@@ -26,14 +26,14 @@
val libraries = libId.map(id => allLibraries.filter(_.id == id)).getOrElse(allLibraries)
val settings = summary.getSettingsForLibraries(runId, "flexiprep", keyValues = Map(
"skip_trim" -> List("skip_trim"), "skip_clip" -> List("skip_clip"), "paired" -> List("paired")))
settings.count(_._2.getOrElse("skip_trim", None) == Some(true))
val trimCount = settings.count(_._2.getOrElse("skip_trim", None) == Some(false))
val clipCount = settings.count(_._2.getOrElse("skip_clip", None) == Some(false))
settings.count(_._2.getOrElse("skip_trim", None).contains(true))
val trimCount = settings.count(_._2.getOrElse("skip_trim", None).contains(false))
val clipCount = settings.count(_._2.getOrElse("skip_clip", None).contains(false))
val librariesCount = libraries.size
val paired: Boolean = if (sampleId.isDefined && libId.isDefined)
summary.getSettingKeys(runId, "flexiprep", NoModule, SampleId(sampleId.get), LibraryId(libId.get), keyValues = Map("paired" -> List("paired"))).getOrElse("paired", None) == Some(true)
else settings.count(_._2.getOrElse("paired", None) == Some(true)) >= 1
summary.getSettingKeys(runId, "flexiprep", NoModule, SampleId(sampleId.get), LibraryId(libId.get), keyValues = Map("paired" -> List("paired"))).getOrElse("paired", None).contains(true)
else settings.count(_._2.getOrElse("paired", None).contains(true)) >= 1
}#
#if (showIntro)
<br/>
......@@ -118,7 +118,7 @@
#for (sample <- samples.sortBy(_.name))
#{
val sampleRowspan = {
libraries.filter(_.sampleId == sample.id).size +
libraries.count(_.sampleId == sample.id) +
settings.filter(_._1._1 == sample.id).count(_._2("paired").getOrElse(false) == true)
}
}#
......@@ -130,7 +130,7 @@
#end
</td>
#for (lib <- libraries.filter(_.sampleId == sample.id))
#{ val paired = settings.filter(_._1._1 == sample.id).filter(_._1._2 == lib.id).head._2("paired") == Some(true) }#
#{ val paired = settings.filter(_._1._1 == sample.id).filter(_._1._2 == lib.id).head._2("paired").contains(true) }#
<td #if (paired == true) rowspan="2" #end>
#if (multisample)
<a href="${rootPath}Samples/${sample.name}/Libraries/${lib.name}/index.html">${lib.name}</a>
......
......@@ -21,25 +21,24 @@
"skip_trim" -> List("skip_trim"), "skip_clip" -> List("skip_clip"), "paired" -> List("paired")))
val run = Await.result(summary.getRuns(runId = Some(runId)).map(_.head), Duration.Inf)
val paired: Boolean = settings("paired") == Some(true)
val skipClip: Boolean = settings("skip_clip") == Some(true)
val skipTrim: Boolean = settings("skip_trim") == Some(true)
val paired: Boolean = settings("paired").contains(true)
val skipClip: Boolean = settings("skip_clip").contains(true)
val skipTrim: Boolean = settings("skip_trim").contains(true)
def getPlot(read:String) = {
val file = Await.result(summary.getFile(runId, "flexiprep", read, SampleId(sampleId.get), LibraryId(libId.get), plot), Duration.Inf)
file.collect {
case path => {
case path =>
val file = new File(run.outputDir + File.separator + path.path)
val newFile = new File(outputDir, read + "_" + file.getName)
if (file.exists()) FileUtils.copyFile(file, newFile)
newFile.getName
}
}
}
def plotAvailable(read:String) = {
val file = Await.result(summary.getFile(runId, "flexiprep", read, SampleId(sampleId.get), LibraryId(libId.get), plot), Duration.Inf)
file.map(x => new File(run.outputDir + File.separator + x.path).exists()).getOrElse(false)
file.exists(x => new File(run.outputDir + File.separator + x.path).exists())
}
}#
......
......@@ -12,8 +12,8 @@
<tr><th>Version</th><td>${run.version}</td></tr>
<tr><th>Last commit hash</th><td>${run.commitHash}</td></tr>
<tr><th>Output directory</th><td>${run.outputDir}</td></tr>
<tr><th>Sample ID</th><td>${allSamples.filter(_.id == sampleId.get).headOption.map(_.name)}</td></tr>
<tr><th>Library ID</th><td>${allLibraries.filter(_.id == libId.get).headOption.map(_.name)}</td></tr>
<tr><th>Sample ID</th><td>${allSamples.find(_.id == sampleId.get).map(_.name)}</td></tr>
<tr><th>Library ID</th><td>${allLibraries.find(_.id == libId.get).map(_.name)}</td></tr>
</tbody>
</table>
<br/>
......
......@@ -25,14 +25,14 @@
val libraries = libId.map(id => allLibraries.filter(_.id == id)).getOrElse(allLibraries)
val settings = summary.getSettingsForLibraries(runId, "flexiprep", keyValues = Map(
"skip_trim" -> List("skip_trim"), "skip_clip" -> List("skip_clip"), "paired" -> List("paired")))
settings.count(_._2.getOrElse("skip_trim", None) == Some(true))
val trimCount = settings.count(_._2.getOrElse("skip_trim", None) == Some(false))
val clipCount = settings.count(_._2.getOrElse("skip_clip", None) == Some(false))
settings.count(_._2.getOrElse("skip_trim", None).contains(true))
val trimCount = settings.count(_._2.getOrElse("skip_trim", None).contains(false))
val clipCount = settings.count(_._2.getOrElse("skip_clip", None).contains(false))
val librariesCount = libraries.size
val paired: Boolean = if (sampleId.isDefined && libId.isDefined)
summary.getSettingKeys(runId, "flexiprep", NoModule, SampleId(sampleId.get), LibraryId(libId.get), keyValues = Map("paired" -> List("paired"))).getOrElse("paired", None) == Some(true)
else settings.count(_._2.getOrElse("paired", None) == Some(true)) >= 1
summary.getSettingKeys(runId, "flexiprep", NoModule, SampleId(sampleId.get), LibraryId(libId.get), keyValues = Map("paired" -> List("paired"))).getOrElse("paired", None).contains(true)
else settings.count(_._2.getOrElse("paired", None).contains(true)) >= 1
}#
#if (showIntro)
......@@ -123,7 +123,7 @@
#for (sample <- samples.sortBy(_.name))
#{
val sampleRowspan = {
libraries.filter(_.sampleId == sample.id).size +
libraries.count(_.sampleId == sample.id) +
settings.filter(_._1._1 == sample.id).count(_._2("paired").getOrElse(false) == true)
}
}#
......@@ -135,7 +135,7 @@
#end
</td>
#for (lib <- libraries.filter(_.sampleId == sample.id))
#{ val paired = settings.filter(_._1._1 == sample.id).filter(_._1._2 == lib.id).head._2("paired") == Some(true) }#
#{ val paired = settings.filter(_._1._1 == sample.id).filter(_._1._2 == lib.id).head._2("paired").contains(true) }#
<td #if (paired == true) rowspan="2" #end>
#if (multisample)
<a href="${rootPath}Samples/${sample.name}/Libraries/${lib.name}/index.html">${lib.name}</a>
......
......@@ -32,7 +32,7 @@ class CheckValidateFastq extends InProcessFunction {
var inputLogFile: File = _
/** Exits whenever the input md5sum is not the same as the output md5sum */
def run: Unit = {
def run(): Unit = {
val reader = Source.fromFile(inputLogFile)
reader.getLines().foreach { line =>
......
......@@ -76,11 +76,10 @@ class Cutadapt(root: Configurable, fastqc: Fastqc)
case (adapterSequence: String, adapterStats: Map[_, _]) =>
seqToNameMap.get(adapterSequence) match {
// adapter sequence is found by FastQC
case Some(adapterSeqName) => {
case Some(adapterSeqName) =>
Some(
adapterSeqName ->
Map("sequence" -> adapterSequence, "stats" -> adapterStats.toMap))
}
// adapter sequence is clipped but not found by FastQC ~ should not happen since all clipped adapter
// sequences come from FastQC
case _ =>
......@@ -88,14 +87,14 @@ class Cutadapt(root: Configurable, fastqc: Fastqc)
s"Adapter '$adapterSequence' is clipped but not found by FastQC in '$fastqInput'.")
}
// FastQC found no adapters
case otherwise =>
case _ =>
logger.debug(s"No adapters found for summarizing in '$fastqInput'.")
None
}
// "adapters" key not found ~ something went wrong in our part
case _ =>
throw new RuntimeException(
s"Required key '${adaptersStatsName}' not found in stats entry '${fastqInput}'.")
s"Required key '$adaptersStatsName' not found in stats entry '$fastqInput'.")
}
initStats.updated(adaptersStatsName, adapterCounts)
}
......
......@@ -288,7 +288,7 @@ object Fastqc {
if (filename.endsWith(".fastq")) filename = filename.substring(0, filename.length - 6)
fastqcCommand.getVersion.flatMap(SemanticVersion.getSemanticVersion) match {
case Some(v) if v >= SemanticVersion(0, 11, 4) =>
if (filename.endsWith(".fq")) filename = filename.substring(0, filename.size - 3)
if (filename.endsWith(".fq")) filename = filename.substring(0, filename.length - 3)
case _ =>
}
fastqcCommand.output = new File(outDir, filename + "_fastqc.zip")
......
......@@ -50,7 +50,7 @@ class Flexiprep(val parent: Configurable)
/** Make a final fastq files, by default only when flexiprep is the main pipeline */
var keepQcFastqFiles: Boolean = config("keepQcFastqFiles", default = parent == null)
override def defaults = super.defaults ++ Map("max_threads" -> 4)
override def defaults: Map[String, Any] = super.defaults ++ Map("max_threads" -> 4)
/** Returns files to store in summary */
def summaryFiles: Map[String, File] = {
......
......@@ -37,7 +37,7 @@ class CutadaptTest extends FastqcV0101Test {
caExe
}
@Test def testAdapterFound() = {
@Test def testAdapterFound(): Unit = {
val cutadapt = testCutadaptInst
val adapters = cutadapt.extractClippedAdapters(cutadaptOut)
adapters.keys.size shouldBe 4
......@@ -60,7 +60,7 @@ class CutadaptTest extends FastqcV0101Test {
)
}
@Test def testSummary() = {
@Test def testSummary(): Unit = {
val cutadapt = testCutadaptInst
val summary = cutadapt.summaryStats
......
......@@ -35,14 +35,14 @@ class FastqcV0101Test extends TestNGSuite with Matchers {
// the file doesn't actually exist, we just need it so the outputDir value can be computed correctly
private[flexiprep] val outputv0101: File = resourceFile("v0101.fq_fastqc.zip")
@Test def testOutputDir() = {
@Test def testOutputDir(): Unit = {
val fqc = new Fastqc(null)
fqc.output = outputv0101
fqc.outputDir shouldBe new File(resourceDir, "v0101.fq_fastqc")
}
@Test
def testGcDistro: Unit = {
def testGcDistro(): Unit = {
val fqc = new Fastqc(null)
fqc.output = outputv0101
val x = fqc.gcDistribution.get
......@@ -54,7 +54,7 @@ class FastqcV0101Test extends TestNGSuite with Matchers {
}
@Test def testQcModules() = {
@Test def testQcModules(): Unit = {
val fqc = new Fastqc(null)
fqc.output = outputv0101
// 11 QC modules
......@@ -67,7 +67,7 @@ class FastqcV0101Test extends TestNGSuite with Matchers {
fqc.qcModules.keySet should contain("Kmer Content")
}
@Test def testSingleQcModule() = {
@Test def testSingleQcModule(): Unit = {
val fqc = new Fastqc(null)
fqc.output = outputv0101
fqc.qcModules("Basic Statistics").name should ===("Basic Statistics")
......@@ -75,13 +75,13 @@ class FastqcV0101Test extends TestNGSuite with Matchers {
fqc.qcModules("Basic Statistics").lines.size shouldBe 8
}
@Test def testEncoding() = {
@Test def testEncoding(): Unit = {
val fqc = new Fastqc(null)
fqc.output = outputv0101
fqc.encoding shouldBe "Sanger / Illumina 1.9"
}
@Test def testFoundAdapter() = {
@Test def testFoundAdapter(): Unit = {
val fqc = new Fastqc(null)
fqc.output = outputv0101
fqc.contaminants = Option(resourceFile("fqc_contaminants_v0101.txt"))
......@@ -102,7 +102,7 @@ class FastqcV0101Test extends TestNGSuite with Matchers {
}
@Test def testPerBaseSequenceQuality() = {
@Test def testPerBaseSequenceQuality(): Unit = {
val fqc = new Fastqc(null)
fqc.output = outputv0101
......@@ -111,7 +111,7 @@ class FastqcV0101Test extends TestNGSuite with Matchers {
perBaseSequenceQuality.keys should contain("54-55")
}
@Test def testPerBaseSequenceContent() = {
@Test def testPerBaseSequenceContent(): Unit = {
val fqc = new Fastqc(null)
fqc.output = outputv0101
......@@ -120,7 +120,7 @@ class FastqcV0101Test extends TestNGSuite with Matchers {
perBaseSequenceContent.keys should contain("1")
}
@Test def testSummaryStats() = {
@Test def testSummaryStats(): Unit = {
val fqc = new Fastqc(null)
fqc.output = outputv0101
val summary = fqc.summaryStats
......
......@@ -13,8 +13,8 @@
<tr><th>Version</th><td>${run.version}</td></tr>
<tr><th>Last commit hash</th><td>${run.commitHash}</td></tr>
<tr><th>Output directory</th><td>${run.outputDir}</td></tr>
<tr><th>Sample</th><td>${allSamples.filter(_.id == sampleId.get).headOption.map(_.name)}</td></tr>
<tr><th>Library</th><td>${allLibraries.filter(_.id == libId.get).headOption.map(_.name)}</td></tr>
<tr><th>Sample</th><td>${allSamples.find(_.id == sampleId.get).map(_.name)}</td></tr>
<tr><th>Library</th><td>${allLibraries.find(_.id == libId.get).map(_.name)}</td></tr>
</tbody>
</table>
<br/>
......
......@@ -43,7 +43,7 @@ class ExtractUnmappedReads(val parent: Configurable) extends QScript with Biopet
}
def fastqUnmappedR1 = new File(outputDir, s"$outputName.unmapped.R1.fq.gz")
def fastqUnmappedR2 =
def fastqUnmappedR2: Option[File] =
if (paired) Some(new File(outputDir, s"$outputName.unmapped.R2.fq.gz"))
else None
def fastqUnmappedSingletons = new File(outputDir, s"$outputName.unmapped.singletons.fq.gz")
......
......@@ -30,7 +30,7 @@ import org.broadinstitute.gatk.queue.QScript
class Gears(val parent: Configurable) extends QScript with MultiSampleQScript { qscript =>
def this() = this(null)
override def reportClass = {
override def reportClass: Some[GearsReport] = {
val gearsReport = new GearsReport(this)
gearsReport.outputDir = new File(outputDir, "report")
gearsReport.summaryDbFile = summaryDbFile
......@@ -143,7 +143,8 @@ class Gears(val parent: Configurable) extends QScript with MultiSampleQScript {
lazy val skipFlexiprep: Boolean = config("skip_flexiprep", default = false)
lazy val flexiprep = if (skipFlexiprep) None else Some(new Flexiprep(qscript))
lazy val flexiprep: Option[Flexiprep] =
if (skipFlexiprep) None else Some(new Flexiprep(qscript))
flexiprep.foreach(_.sampleId = Some(sampleId))
flexiprep.foreach(_.libId = Some(libId))
flexiprep.foreach(_.inputR1 = inputR1)
......@@ -155,7 +156,8 @@ class Gears(val parent: Configurable) extends QScript with MultiSampleQScript {
val libraryGears: Boolean = config("library_gears", default = false)
lazy val gearsSingle = if (libraryGears) Some(new GearsSingle(qscript)) else None
lazy val gearsSingle: Option[GearsSingle] =
if (libraryGears) Some(new GearsSingle(qscript)) else None
/** Function that add library jobs */
protected def addJobs(): Unit = {
......@@ -189,8 +191,6 @@ class Gears(val parent: Configurable) extends QScript with MultiSampleQScript {
protected def addJobs(): Unit = {
addPerLibJobs()
val flexipreps = libraries.values.map(_.flexiprep).toList
val mergeR1: File = new File(sampleDir, s"$sampleId.R1.fq.gz")
add(Zcat(qscript, libraries.values.map(_.qcR1).toList) | new Gzip(qscript) > mergeR1)
......
......@@ -132,7 +132,7 @@ object GearsKraken {
val taxs: mutable.Map[String, Any] = mutable.Map()
def addTax(map: Map[String, Any], path: List[String] = Nil): Unit = {
val name = map.get("name").getOrElse("noName").toString
val name = map.getOrElse("name", "noName").toString
val x = path.foldLeft(taxs)(
(a, b) =>
if (a.contains(b)) a(b).asInstanceOf[mutable.Map[String, Any]]
......@@ -144,20 +144,18 @@ object GearsKraken {
if (!x.contains(name)) x += name -> mutable.Map[String, Any]()
map
.get("children")
.getOrElse(List())
.getOrElse("children", List())
.asInstanceOf[List[Any]]
.foreach(x => addTax(x.asInstanceOf[Map[String, Any]], path ::: name :: Nil))
}
summaries.foreach { x =>
addTax(x._2.get("classified").getOrElse(Map()).asInstanceOf[Map[String, Any]])
addTax(x._2.getOrElse("classified", Map()).asInstanceOf[Map[String, Any]])
}
def getValue(sample: String, path: List[String], key: String) = {
path
.foldLeft(
summaries(sample).get("classified").getOrElse(Map()).asInstanceOf[Map[String, Any]]) {
.foldLeft(summaries(sample).getOrElse("classified", Map()).asInstanceOf[Map[String, Any]]) {
(b, a) =>
b.getOrElse("children", List[Map[String, Any]]())
.asInstanceOf[List[Map[String, Any]]]
......
......@@ -44,18 +44,18 @@ class GearsQiimeClosed(val parent: Configurable)
)
)
def init() = {
def init(): Unit = {
require(fastqInput != null)
require(sampleId.isDefined)
}
private var _otuMap: File = _
def otuMap = _otuMap
def otuMap: File = _otuMap
private var _otuTable: File = _
def otuTable = _otuTable
def otuTable: File = _otuTable
def biopetScript() = {
def biopetScript(): Unit = {
val splitLib = new SplitLibrariesFastq(this)
splitLib.input :+= fastqInput
......@@ -149,7 +149,7 @@ object GearsQiimeClosed {
biom("data")
.asInstanceOf[List[List[Any]]]
.map { data =>
val row = data(0).asInstanceOf[Long]
val row = data.head.asInstanceOf[Long]
val column = data(1).asInstanceOf[Long]
val value = data(2).asInstanceOf[Long]
val sample = samples(column.toInt).toString
......
......@@ -37,18 +37,18 @@ class GearsQiimeOpen(val parent: Configurable)
)
)
def init() = {
def init(): Unit = {
require(fastqInput != null)
require(sampleId.isDefined)
}
private var _otuMap: File = _
def otuMap = _otuMap
def otuMap: File = _otuMap
private var _otuTable: File = _
def otuTable = _otuTable
def otuTable: File = _otuTable
def biopetScript() = {
def biopetScript(): Unit = {
val splitLib = new SplitLibrariesFastq(this)
splitLib.input :+= fastqInput
......
......@@ -58,11 +58,11 @@ class GearsQiimeRtax(val parent: Configurable)
)
)
def init() = {
def init(): Unit = {
require(fastqR1 != null)
}
def biopetScript() = {
def biopetScript(): Unit = {
val slfR1 = new SplitLibrariesFastq(this)
slfR1.input :+= fastqR1
......
......@@ -16,13 +16,14 @@ package nl.lumc.sasc.biopet.pipelines.gears
import java.io.File
import nl.lumc.sasc.biopet.core.report.{ MultisampleReportBuilder, ReportBuilderExtension, ReportPage, ReportSection }
import nl.lumc.sasc.biopet.core.report.{MultisampleReportBuilder, ReportBuilderExtension, ReportPage, ReportSection}
import nl.lumc.sasc.biopet.pipelines.flexiprep.FlexiprepReport
import nl.lumc.sasc.biopet.pipelines.gears
import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.Implicts._
import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.{ NoLibrary, NoModule, SampleId }
import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.{NoLibrary, NoModule, SampleId}
import scala.concurrent.{ Await, Future }
import scala.concurrent.{Await, Future}
import scala.concurrent.duration.Duration
/**
......@@ -40,7 +41,7 @@ object GearsReport extends MultisampleReportBuilder {
def reportName = "Gears Report"
override def extFiles = super.extFiles ++ List("js/gears.js", "js/krona-2.0.js", "img/krona/loading.gif", "img/krona/hidden.png", "img/krona/favicon.ico")
override def extFiles: List[gears.GearsReport.ExtFile] = super.extFiles ++ List("js/gears.js", "js/krona-2.0.js", "img/krona/loading.gif", "img/krona/hidden.png", "img/krona/favicon.ico")
.map(x => ExtFile("/nl/lumc/sasc/biopet/pipelines/gears/report/ext/" + x, x))
def indexPage: Future[ReportPage] = Future {
......@@ -51,29 +52,29 @@ object GearsReport extends MultisampleReportBuilder {
val qiimeClosesOtuTable = summary.getFile(runId, "gears", key = "qiime_closed_otu_table")
val qiimeOpenOtuTable = summary.getFile(runId, "gears", key = "qiime_open_otu_table")
val centrifugePage = (if (centrifugeExecuted) Some("Centrifuge analysis" -> Future.successful(ReportPage(List("Non-unique" ->
val centrifugePage = if (centrifugeExecuted) Some("Centrifuge analysis" -> Future.successful(ReportPage(List("Non-unique" ->
Future.successful(ReportPage(List(), List("All mappings" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp",
Map("summaryStatsTag" -> "centrifuge_report")
)), Map()))), List(
"Unique mappings" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp",
Map("summaryStatsTag" -> "centrifuge_unique_report")
)), Map("summaryModuleTag" -> "gearscentrifuge", "centrifugeTag" -> Some("centrifuge")))))
else None)
else None
val krakenPage = (if (krakenExecuted) Some("Kraken analysis" -> Future.successful(ReportPage(List(), List(
val krakenPage = if (krakenExecuted) Some("Kraken analysis" -> Future.successful(ReportPage(List(), List(
"Krona plot" -> Future.successful(ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
))), Map())))
else None)
else None
val qiimeClosedPage = (if (qiimeClosesOtuTable.isDefined) Some("Qiime closed reference analysis" -> Future.successful(ReportPage(List(), List(
val qiimeClosedPage = if (qiimeClosesOtuTable.isDefined) Some("Qiime closed reference analysis" -> Future.successful(ReportPage(List(), List(
"Krona plot" -> Future.successful(ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/qiimeKrona.ssp"
))), Map("biomFile" -> new File(run.outputDir + File.separator + qiimeClosesOtuTable.get.path)))))
else None)
else None
val qiimeOpenPage = (if (qiimeOpenOtuTable.isDefined) Some("Qiime open reference analysis" -> Future.successful(ReportPage(List(), List(
val qiimeOpenPage = if (qiimeOpenOtuTable.isDefined) Some("Qiime open reference analysis" -> Future.successful(ReportPage(List(), List(
"Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/qiimeKrona.ssp"
)), Map("biomFile" -> new File(run.outputDir + File.separator + qiimeOpenOtuTable.get.path)))))
else None)
else None
ReportPage(
List(centrifugePage, krakenPage, qiimeClosedPage, qiimeOpenPage).flatten ::: List(
......@@ -124,8 +125,6 @@ object GearsReport extends MultisampleReportBuilder {
/** Library page */
def libraryPage(sampleId: Int, libId: Int, args: Map[String, Any]): Future[ReportPage] = Future {
val sName = Await.result(summary.getSampleName(sampleId), Duration.Inf)
val lName = Await.result(summary.getLibraryName(libId), Duration.Inf)
val flexiprepExecuted = Await.result(summary.getStatsSize(runId, "flexiprep", sample = sampleId, library = libId), Duration.Inf) >= 1
......
......@@ -30,7 +30,7 @@ class GearsSeqCount(val parent: Configurable)
var fastqInput: File = _
def countFile = swapExt(outputDir, fastqInput, ".fastq.gz", ".counts.txt")
def countFile: File = swapExt(outputDir, fastqInput, ".fastq.gz", ".counts.txt")
/** Init for pipeline */
def init(): Unit = {}
......
......@@ -51,7 +51,7 @@ class GearsSingle(val parent: Configurable)
@Argument(required = false)
var outputName: String = _
def getOutputName = {
def getOutputName: String = {
if (outputName == null) {
sampleId.getOrElse("noName") + libId.map("-" + _).getOrElse("")
} else outputName
......@@ -74,7 +74,7 @@ class GearsSingle(val parent: Configurable)
}
lazy val krakenScript = {
lazy val krakenScript: Option[GearsKraken] = {
if (config("gears_use_kraken", default = false)) {
val kraken = new GearsKraken(this)
kraken.outputDir = new File(outputDir, "kraken")
......@@ -83,7 +83,7 @@ class GearsSingle(val parent: Configurable)
} else None
}
lazy val centrifugeScript = {
lazy val centrifugeScript: Option[GearsCentrifuge] = {
if (config("gears_use_centrifuge", default = true)) {
val centrifuge = new GearsCentrifuge(this)
centrifuge.outputDir = new File(outputDir, "centrifuge")
......@@ -92,7 +92,7 @@ class GearsSingle(val parent: Configurable)
} else None
}
lazy val qiimeRatx = {
lazy val qiimeRatx: Option[GearsQiimeRtax] = {
if (config("gears_use_qiime_rtax", default = false)) {
val qiimeRatx = new GearsQiimeRtax(this)
qiimeRatx.outputDir = new File(outputDir, "qiime_rtax")
......@@ -100,23 +100,23 @@ class GearsSingle(val parent: Configurable)
} else None
}
lazy val qiimeClosed =
lazy val qiimeClosed: Option[GearsQiimeClosed] =
if (config("gears_use_qiime_closed", default = false)) Some(new GearsQiimeClosed(this))
else None
lazy val qiimeOpen =
lazy val qiimeOpen: Option[GearsQiimeOpen] =
if (config("gears_use_qiime_open", default = false)) Some(new GearsQiimeOpen(this)) else None
lazy val seqCount =
lazy val seqCount: Option[GearsSeqCount] =
if (config("gears_use_seq_count", default = false)) Some(new GearsSeqCount(this)) else None
/** Executed before running the script */
def init(): Unit = {
if (fastqR1.isEmpty && !bamFile.isDefined)
if (fastqR1.isEmpty && bamFile.isEmpty)
Logging.addError("Please specify fastq-file(s) or bam file")
if (fastqR1.nonEmpty == bamFile.isDefined)
Logging.addError("Provide either a bam file or a R1/R2 file")
if (fastqR2.nonEmpty && fastqR1.size != fastqR2.size)
Logging.addError("R1 and R2 has not the same number of files")
if (sampleId == null || sampleId == None)
if (sampleId == null || sampleId.isEmpty)
Logging.addError("Missing sample ID on GearsSingle module")
if (!skipFlexiprep) {
......@@ -145,7 +145,7 @@ class GearsSingle(val parent: Configurable)
} else bamFile.foreach(inputFiles :+= InputFile(_))
}
override def reportClass = {
override def reportClass: Some[GearsSingleReport] = {
val gears = new GearsSingleReport(this)
gears.outputDir = new File(outputDir, "report")
gears.summaryDbFile = summaryDbFile
......
......@@ -15,6 +15,7 @@
package nl.lumc.sasc.biopet.pipelines.gears
import nl.lumc.sasc.biopet.core.report._