Commit 0a28700b authored by rhpvorderman's avatar rhpvorderman

Merge remote-tracking branch 'remotes/origin/develop' into fix-BIOPET-669

# Conflicts:
#	biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/report/ReportBuilder.scala
#	flexiprep/src/main/resources/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp
#	flexiprep/src/main/resources/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp
#	gears/src/main/scala/nl/lumc/sasc/biopet/pipelines/gears/GearsReport.scala
parents 763f8f4d df582f1a
......@@ -21,10 +21,6 @@ node('local') {
}
}
stage('Report Tests') {
junit '*/target/surefire-reports/*.xml'
}
stage('Check git on changes') {
sh 'if [ $(git diff | wc -l) -eq 0 ]; then true; else echo "[ERROR] Git is not clean anymore after build"; git diff; echo "[ERROR] This might be caused by reformated code, if so run maven locally"; false; fi'
}
......@@ -33,7 +29,7 @@ node('local') {
sh 'mkdocs build --clean --strict'
}
if (currentBuild.result == null || "SUCCESS".equals(currentBuild.result)) {
if (currentBuild.result == null || "SUCCESS" == currentBuild.result) {
currentBuild.result = "SUCCESS"
slackSend(color: '#00FF00', message: "${currentBuild.result}: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)", channel: '#biopet-bot', teamDomain: 'lumc', tokenCredentialId: 'lumc')
} else {
......@@ -41,7 +37,7 @@ node('local') {
}
} catch (e) {
if (currentBuild.result == null || "FAILED".equals(currentBuild.result)) {
if (currentBuild.result == null || "FAILED" == currentBuild.result) {
currentBuild.result = "FAILED"
}
slackSend(color: '#FF0000', message: "${currentBuild.result}: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)", channel: '#biopet-bot', teamDomain: 'lumc', tokenCredentialId: 'lumc')
......
......@@ -31,7 +31,7 @@ class Bam2Wig(val parent: Configurable) extends QScript with BiopetQScript {
def this() = this(null)
@Input(doc = "Input bam file", required = true)
var bamFile: File = null
var bamFile: File = _
def init(): Unit = {
inputFiles :+= new InputFile(bamFile)
......
......@@ -32,7 +32,7 @@ class BamToChromSizesTest extends TestNGSuite with Matchers {
}
@Test
def testChromSizes: Unit = {
def testChromSizes(): Unit = {
val bamFile = new File(resourcePath("/empty.bam"))
val bamToChromSizes = new BamToChromSizes(null)
bamToChromSizes.bamFile = bamFile
......
......@@ -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/>
......
......@@ -48,7 +48,7 @@ class BamMetrics(val parent: Configurable)
override def defaults = Map("bedtoolscoverage" -> Map("sorted" -> true))
/** returns files to store in summary */
def summaryFiles =
def summaryFiles: Map[String, File] =
Map("reference" -> referenceFasta(), "input_bam" -> inputBam) ++
ampliconBedFile.map("amplicon" -> _).toMap ++
ampliconBedFile.map(x => "roi_" + x.getName.stripSuffix(".bed") -> x).toMap
......@@ -58,7 +58,7 @@ class BamMetrics(val parent: Configurable)
Map("amplicon_name" -> ampliconBedFile.collect { case x => x.getName.stripSuffix(".bed") },
"roi_name" -> roiBedFiles.map(_.getName.stripSuffix(".bed")))
override def reportClass = {
override def reportClass: Some[BammetricsReport] = {
val bammetricsReport = new BammetricsReport(this)
bammetricsReport.outputDir = new File(outputDir, "report")
bammetricsReport.summaryDbFile = summaryDbFile
......
......@@ -284,6 +284,9 @@ object BammetricsReport extends ReportBuilder {
.getOrElse(throw new IllegalStateException("Sample must be there"))
val libraryName =
library.flatMap(l => Await.result(summary.getLibraryName(l), Duration.Inf))
if (yKeyList.find(x => map.contains(x) && map(x).isDefined).isEmpty) {
""
}
val yKey = yKeyList.find(x => map.contains(x) && map(x).isDefined).get
val xKey = xKeyList.find(x => map.contains(x) && map(x).isDefined).get
Map(
......@@ -487,7 +490,7 @@ object BammetricsReport extends ReportBuilder {
}
def writeTableToTsv(tsvFile: File, table: Map[String, Array[Any]], firstColumn: String): Unit = {
require(table.map(_._2.size).toList.distinct.size == 1,
require(table.map(_._2.length).toList.distinct.size == 1,
"Not all values has the same number or rows")
val keys = table.keys.filterNot(_ == firstColumn).toList.sorted
val writer = new PrintWriter(tsvFile)
......
......@@ -44,7 +44,7 @@ class BamMetricsTest extends TestNGSuite with Matchers {
}
@DataProvider(name = "bammetricsOptions")
def bammetricsOptions = {
def bammetricsOptions: Array[Array[AnyVal]] = {
val rois = Array(0, 1, 2, 3)
val bool = Array(true, false)
......@@ -57,7 +57,7 @@ class BamMetricsTest extends TestNGSuite with Matchers {
private var dirs: List[File] = Nil
@Test(dataProvider = "bammetricsOptions")
def testBamMetrics(rois: Int, amplicon: Boolean, rna: Boolean, wgs: Boolean) = {
def testBamMetrics(rois: Int, amplicon: Boolean, rna: Boolean, wgs: Boolean): Unit = {
val outputDir = Files.createTempDir()
dirs :+= outputDir
val map = ConfigUtils.mergeMaps(Map("output_dir" -> outputDir,
......@@ -74,8 +74,6 @@ class BamMetricsTest extends TestNGSuite with Matchers {
bammetrics.libId = Some("1")
bammetrics.script()
var regions: Int = rois + (if (amplicon) 1 else 0)
bammetrics.functions.count(_.isInstanceOf[CollectRnaSeqMetrics]) shouldBe (if (rna) 1 else 0)
bammetrics.functions.count(_.isInstanceOf[CollectWgsMetrics]) shouldBe (if (wgs) 1 else 0)
bammetrics.functions.count(_.isInstanceOf[CollectMultipleMetrics]) shouldBe 1
......@@ -86,13 +84,13 @@ class BamMetricsTest extends TestNGSuite with Matchers {
}
// remove temporary run directory all tests in the class have been run
@AfterClass def removeTempOutputDir() = {
@AfterClass def removeTempOutputDir(): Unit = {
dirs.foreach(FileUtils.deleteDirectory)
}
}
object BamMetricsTest {
val inputDir = Files.createTempDir()
val inputDir: File = Files.createTempDir()
val bam = new File(inputDir, "bla.bam")
Files.touch(bam)
......@@ -100,7 +98,7 @@ object BamMetricsTest {
Files.touch(ampliconBed)
def roi(i: Int): File = {
val roi = new File(inputDir, s"roi${i}.bed")
val roi = new File(inputDir, s"roi$i.bed")
Files.touch(roi)
roi
}
......
......@@ -21,9 +21,10 @@ package nl.lumc.sasc.biopet.pipelines.basty
import java.io.File
import nl.lumc.sasc.biopet.core.report.ReportBuilderExtension
import nl.lumc.sasc.biopet.core.{MultiSampleQScript, PipelineCommand}
import nl.lumc.sasc.biopet.extensions.{Cat, Raxml, RunGubbins}
import nl.lumc.sasc.biopet.pipelines.shiva.Shiva
import nl.lumc.sasc.biopet.pipelines.shiva.{Shiva, ShivaReport}
import nl.lumc.sasc.biopet.extensions.tools.BastyGenerateFasta
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.queue.QScript
......@@ -42,7 +43,9 @@ class Basty(val parent: Configurable) extends QScript with MultiSampleQScript {
def variantcallers = List("unifiedgenotyper")
val numBoot = config("boot_runs", default = 100, namespace = "raxml").asInt
val numBoot: Int = config("boot_runs", default = 100, namespace = "raxml").asInt
val executeGubbins: Boolean = config("execute_gubbins", default = true)
override def defaults = Map(
"ploidy" -> 1,
......@@ -51,6 +54,13 @@ class Basty(val parent: Configurable) extends QScript with MultiSampleQScript {
lazy val shiva = new Shiva(qscript)
override def reportClass: Option[ReportBuilderExtension] = {
val shiva = new ShivaReport(this)
shiva.outputDir = new File(outputDir, "report")
shiva.summaryDbFile = summaryDbFile
Some(shiva)
}
def summaryFiles: Map[String, File] = Map()
def summarySettings: Map[String, Any] = Map("boot_runs" -> numBoot)
......@@ -87,17 +97,15 @@ class Basty(val parent: Configurable) extends QScript with MultiSampleQScript {
def init() {
shiva.outputDir = outputDir
shiva.init()
}
def biopetScript() {
shiva.biopetScript()
addAll(shiva.functions)
addSummaryQScript(shiva)
add(shiva)
inputFiles :::= shiva.inputFiles
addSamplesJobs()
addSummaryJobs()
}
def addMultiSampleJobs(): Unit = {
......@@ -186,11 +194,13 @@ class Basty(val parent: Configurable) extends QScript with MultiSampleQScript {
raxmlBi.w = dirSufixRaxml
add(raxmlBi)
val gubbins = new RunGubbins(this)
gubbins.fastafile = concensusVariants
gubbins.startingTree = raxmlBi.getBipartitionsFile
gubbins.outputDirectory = dirSufixGubbins
add(gubbins)
if (executeGubbins) {
val gubbins = new RunGubbins(this)
gubbins.fastafile = concensusVariants
gubbins.startingTree = raxmlBi.getBipartitionsFile
gubbins.outputDirectory = dirSufixGubbins
add(gubbins)
}
}
addTreeJobs(catVariantsSnps.output,
......
......@@ -48,7 +48,7 @@ class BastyTest extends TestNGSuite with Matchers {
}
@DataProvider(name = "bastyOptions")
def bastyOptions = {
def bastyOptions: Array[Array[Any]] = {
for (s1 <- sample1; s2 <- sample2) yield Array("", s1, s2)
}
......@@ -114,7 +114,7 @@ class BastyTest extends TestNGSuite with Matchers {
numberSamples
else 0)
pipeline.functions.count(_.isInstanceOf[BaseRecalibrator]) shouldBe (if (dbsnp && baseRecalibration)
(numberLibs * 2)
numberLibs * 2
else 0)
pipeline.functions.count(_.isInstanceOf[PrintReads]) shouldBe (if (dbsnp && baseRecalibration)
numberLibs
......@@ -125,7 +125,7 @@ class BastyTest extends TestNGSuite with Matchers {
pipeline.summaryFiles shouldBe Map()
pipeline.samples foreach {
case (sampleId, sample) =>
case (_, sample) =>
sample.summarySettings shouldBe Map()
sample.summaryFiles.get("variants_fasta") should not be None
sample.summaryFiles.get("consensus_fasta") should not be None
......@@ -135,7 +135,7 @@ class BastyTest extends TestNGSuite with Matchers {
sample.summaryFiles.get("snps_only_consensus_variants_fasta") should not be None
sample.summaryStats shouldBe Map()
sample.libraries.foreach {
case (libId, lib) =>
case (_, lib) =>
lib.summarySettings shouldBe Map()
lib.summaryFiles shouldBe Map()
lib.summaryStats shouldBe Map()
......@@ -154,14 +154,14 @@ class BastyTest extends TestNGSuite with Matchers {
}
// remove temporary run directory all tests in the class have been run
@AfterClass def removeTempOutputDir() = {
@AfterClass def removeTempOutputDir(): Unit = {
dirs.foreach(FileUtils.deleteDirectory)
}
}
object BastyTest {
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)
......
......@@ -150,10 +150,9 @@ body {
float:right;
width:0;
height:0;
border-color:transparent;
border-style:solid;
border-width:5px 0 5px 5px;
border-left-color:#cccccc;
border: 5px solid transparent;
border-right-width: 0;
border-left-color: #cccccc;
margin-top:5px;
margin-right:-10px;
}
......
......@@ -46,9 +46,7 @@ table[data-sortable] th:after {
vertical-align: inherit;
height: 0;
width: 0;
border-width: 5px;
border-style: solid;
border-color: transparent;
border: 5px solid transparent;
margin-right: 1px;
margin-left: 10px;
float: right;
......
......@@ -31,9 +31,9 @@
<tbody>
#for (file <- files)
<tr><td>${allPipelines.find(_.id == file.pipelineId).map(_.name)}</td>
<td>${file.moduleId.map(id => allModules.find(x => x.pipelineId == file.pipelineId && file.moduleId == id).map(_.name)).flatten.getOrElse(("-"))}</td>
<td>${file.sampleId.map(id => allSamples.find(_.id == id).map(_.name)).flatten.getOrElse(("-"))}</td>
<td>${file.libraryId.map(id => allLibraries.find(_.id == id).map(_.name)).flatten.getOrElse(("-"))}</td>
<td>${file.moduleId.flatMap(id => allModules.find(x => x.pipelineId == file.pipelineId && file.moduleId == id).map(_.name)).getOrElse("-")}</td>
<td>${file.sampleId.flatMap(id => allSamples.find(_.id == id).map(_.name)).getOrElse("-")}</td>
<td>${file.libraryId.flatMap(id => allLibraries.find(_.id == id).map(_.name)).getOrElse("-")}</td>
<td>${file.key}</td>
<td>${file.path}</td>
<td>${file.md5}</td></tr>
......
......@@ -42,7 +42,7 @@
val tabIndex = if (first) " tabindex='-1'" else ""
// val listGroupA = if(subPage._2.subPages.nonEmpty) "list-group-item" else ""
var menuItem: String = "<li class='%s'>".format(listSubmenu) +
val menuItem: String = "<li class='%s'>".format(listSubmenu) +
"<a href='%s' class='%s'%s>".format(href, "", tabIndex) +
"%s".format(subPageName) +
"</a>" +
......@@ -93,7 +93,7 @@
<script language="JavaScript">
<!--
$(document).ready(function() {
Sortable.init()
Sortable.init();
$('body').scrollspy({
target: '.bs-sidebar'
......@@ -135,14 +135,14 @@
<a href="${rootPath}index.html">Home
#if (iPage.subPages.nonEmpty) <b class="caret"></b> #end
</a>
${unescape(createMenu(iPage, Nil, false))}
${unescape(createMenu(iPage, Nil, first = false))}
</li>
#else
<li class="root #if (t == path.size) active #end">
<a href="${rootPath}${path.slice(0,t).mkString("", "/", "/")}index.html">${path( t - 1 )}
#if (getSubPage(path.slice(0, t)).subPages.nonEmpty) <b class="caret"></b> #end
</a>
${unescape(createMenu(getSubPage(path.slice(0, t)), path.slice(0, t), false))}
${unescape(createMenu(getSubPage(path.slice(0, t)), path.slice(0, t), first = false))}
</li>
#end
#end
......
......@@ -60,10 +60,10 @@ trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction =>
}
/**
* This value is used to let you job wait a x number of second after it finish.
* This is ionly used when having storage delay issues
* This value is used to let you job wait a x number of second after it finish.
* This is ionly used when having storage delay issues
*/
var jobDelayTime: Option[Int] = config("job_delay_time")
val jobDelayTime: Option[Int] = config("job_delay_time")
// This overrides the default "sh" from queue. For Biopet the default is "bash"
updateJobRun = {
......@@ -147,9 +147,9 @@ trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction =>
}
private[core] var _inputAsStdin = false
def inputAsStdin = _inputAsStdin
def inputAsStdin: Boolean = _inputAsStdin
private[core] var _outputAsStdout = false
def outputAsStdout = _outputAsStdout
def outputAsStdout: Boolean = _outputAsStdout
/**
* This operator sends stdout to `that` and combine this into 1 command line function
......