...
 
Commits (801)
#Files to be included
project.git = true #All scala files tracked by git.
project.excludeFilters = [
"gatk/*"
]
style = default
maxColumn = 100
......@@ -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')
......
......@@ -26,7 +26,7 @@
<parent>
<groupId>nl.lumc.sasc</groupId>
<artifactId>Biopet</artifactId>
<version>0.9.0</version>
<version>0.10.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
......
/**
* Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running
* SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
* should also be able to execute Biopet tools and pipelines.
*
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
* Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running
* SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
* should also be able to execute Biopet tools and pipelines.
*
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
package nl.lumc.sasc.biopet.pipelines.bamtobigwig
import java.io.File
import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.core.{ BiopetQScript, PipelineCommand }
import nl.lumc.sasc.biopet.core.{BiopetQScript, PipelineCommand}
import nl.lumc.sasc.biopet.extensions.WigToBigWig
import nl.lumc.sasc.biopet.extensions.igvtools.IGVToolsCount
import org.broadinstitute.gatk.queue.QScript
/**
* Pipeline to create BigWigle files from a bam file
*
* Created by pjvan_thof on 1/29/15.
*/
* Pipeline to create BigWigle files from a bam file
*
* Created by pjvan_thof on 1/29/15.
*/
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)
......@@ -70,4 +70,4 @@ object Bam2Wig extends PipelineCommand {
bamToBigWig.bamFile = bamFile
bamToBigWig
}
}
\ No newline at end of file
}
/**
* Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running
* SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
* should also be able to execute Biopet tools and pipelines.
*
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
* Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running
* SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
* should also be able to execute Biopet tools and pipelines.
*
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
package nl.lumc.sasc.biopet.pipelines.bamtobigwig
import java.io.{ File, PrintWriter }
import java.io.{File, PrintWriter}
import htsjdk.samtools.SamReaderFactory
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.queue.function.InProcessFunction
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import org.broadinstitute.gatk.utils.commandline.{Input, Output}
import scala.collection.JavaConversions._
/**
* Class to extract chrom.sizes files from a bam file
*
* Created by pjvan_thof on 1/29/15.
*/
* Class to extract chrom.sizes files from a bam file
*
* Created by pjvan_thof on 1/29/15.
*/
class BamToChromSizes(val parent: Configurable) extends InProcessFunction with Configurable {
@Input
var bamFile: File = _
......
/**
* Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running
* SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
* should also be able to execute Biopet tools and pipelines.
*
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
* Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running
* SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
* should also be able to execute Biopet tools and pipelines.
*
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
package nl.lumc.sasc.biopet.pipelines.bamtobigwig
import java.io.File
......@@ -24,21 +24,22 @@ import org.testng.annotations.Test
import scala.io.Source
/**
* Created by pjvanthof on 09/05/16.
*/
* Created by pjvanthof on 09/05/16.
*/
class BamToChromSizesTest extends TestNGSuite with Matchers {
private def resourcePath(p: String): String = {
Paths.get(getClass.getResource(p).toURI).toString
}
@Test
def testChromSizes: Unit = {
def testChromSizes(): Unit = {
val bamFile = new File(resourcePath("/empty.bam"))
val bamToChromSizes = new BamToChromSizes(null)
bamToChromSizes.bamFile = bamFile
bamToChromSizes.chromSizesFile = File.createTempFile("chrom.", ".sizes")
bamToChromSizes.chromSizesFile.deleteOnExit()
bamToChromSizes.run()
Source.fromFile(bamToChromSizes.chromSizesFile).getLines().toList shouldBe List("chrQ\t10000", "chrR\t10000")
Source.fromFile(bamToChromSizes.chromSizesFile).getLines().toList shouldBe List("chrQ\t10000",
"chrR\t10000")
}
}
......@@ -24,7 +24,7 @@
<parent>
<groupId>nl.lumc.sasc</groupId>
<artifactId>Biopet</artifactId>
<version>0.9.0</version>
<version>0.10.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
......@@ -39,7 +39,7 @@
</dependency>
<dependency>
<groupId>nl.lumc.sasc</groupId>
<artifactId>BiopetToolsExtensions</artifactId>
<artifactId>BiopetExtensions</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
......
......@@ -58,7 +58,7 @@
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#alignmentSummaryTable">
<i class="glyphicon glyphicon-eye-open"></i> Show table</button>
#end
<a href="alignmentSummary.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> TSV file</button></a>
<a href="alignmentSummary.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> Data points</button></a>
</div>
#end
<div class="panel-body collapse #if (showTable)in#end" id="alignmentSummaryTable">
......
......@@ -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/>
......
......@@ -56,7 +56,7 @@
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#clippingTable">
<i class="glyphicon glyphicon-eye-open"></i> Show table</button>
#end
<a href="clipping.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i>TSV file</button></a>
<a href="clipping.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> Data points</button></a>
</div>
#end
......
......@@ -58,7 +58,7 @@
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#insertsizeTable">
<i class="glyphicon glyphicon-eye-open"></i>Show table</button>
#end
<a href="insertsize.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i>TSV file</button></a>
<a href="insertsize.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> Data points</button></a>
</div>
#end
......
......@@ -56,7 +56,7 @@
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#mapping_qualityTable">
<i class="glyphicon glyphicon-eye-open"></i> Show table</button>
#end
<a href="mapping_quality.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> TSV file</button></a>
<a href="mapping_quality.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> Data points</button></a>
</div>
#end
......
......@@ -50,7 +50,7 @@
#else
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#rnaTable">Show table</button>
#end
<a href="rna.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i>TSV file</button></a>
<a href="rna.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> Data points</button></a>
</div>
#end
......
......@@ -49,7 +49,7 @@
#else
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#wgsTable">Show table</button>
#end
<a href="wgs.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> TSV file</button></a>
<a href="wgs.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> Data points</button></a>
</div>
#end
......
/**
* Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running
* SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
* should also be able to execute Biopet tools and pipelines.
*
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
* Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running
* SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
* should also be able to execute Biopet tools and pipelines.
*
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
package nl.lumc.sasc.biopet.pipelines.bammetrics
import java.io.File
......@@ -19,9 +19,10 @@ import java.io.File
import nl.lumc.sasc.biopet.utils.config.Configurable
/**
* Created by pjvan_thof on 11/20/15.
*/
* Created by pjvan_thof on 11/20/15.
*/
trait TargetRegions extends Configurable {
/** Bed files for region of interests */
var roiBedFiles: List[File] = config("regions_of_interest", Nil)
......
/**
* Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running
* SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
* should also be able to execute Biopet tools and pipelines.
*
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
* Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running
* SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
* should also be able to execute Biopet tools and pipelines.
*
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
package nl.lumc.sasc.biopet.pipelines.bammetrics.scripts
import java.io.File
......@@ -20,7 +20,7 @@ import nl.lumc.sasc.biopet.core.extensions.PythonCommandLineFunction
import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.core.summary.Summarizable
import nl.lumc.sasc.biopet.utils.ConfigUtils
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import org.broadinstitute.gatk.utils.commandline.{Input, Output}
class CoverageStats(val parent: Configurable) extends PythonCommandLineFunction with Summarizable {
setPythonScript("bedtools_cov_stats.py")
......@@ -39,12 +39,13 @@ class CoverageStats(val parent: Configurable) extends PythonCommandLineFunction
override def defaultCoreMemory = 9.0
def cmdLine = getPythonCommand +
(if (inputAsStdin) " - " else required(input)) +
required("--plot", plot) +
optional("--title", title) +
optional("--subtitle", subTitle) +
" > " + required(output)
def cmdLine: String =
getPythonCommand +
(if (inputAsStdin) " - " else required(input)) +
required("--plot", plot) +
optional("--title", title) +
optional("--subtitle", subTitle) +
" > " + required(output)
def summaryFiles: Map[String, File] = Map("plot" -> plot)
......
/**
* Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running
* SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
* should also be able to execute Biopet tools and pipelines.
*
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
* Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running
* SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
* should also be able to execute Biopet tools and pipelines.
*
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
package nl.lumc.sasc.biopet.pipelines.bammetrics
import java.io.{ File, FileOutputStream }
import java.io.{File, FileOutputStream}
import com.google.common.io.Files
import nl.lumc.sasc.biopet.extensions.picard._
......@@ -25,13 +25,13 @@ import org.apache.commons.io.FileUtils
import org.broadinstitute.gatk.queue.QSettings
import org.scalatest.Matchers
import org.scalatest.testng.TestNGSuite
import org.testng.annotations.{ AfterClass, DataProvider, Test }
import org.testng.annotations.{AfterClass, DataProvider, Test}
/**
* Test class for [[BamMetrics]]
*
* Created by pjvan_thof on 4/30/15.
*/
* Test class for [[BamMetrics]]
*
* Created by pjvan_thof on 4/30/15.
*/
class BamMetricsTest extends TestNGSuite with Matchers {
def initPipeline(map: Map[String, Any]): BamMetrics = {
......@@ -44,26 +44,26 @@ 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)
for (
rois <- rois;
amplicon <- bool;
rna <- bool;
wgs <- bool
) yield Array(rois, amplicon, rna, wgs)
for (rois <- rois;
amplicon <- bool;
rna <- bool;
wgs <- bool) yield Array(rois, amplicon, rna, wgs)
}
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, "rna_metrics" -> rna, "wgs_metrics" -> wgs),
Map(BamMetricsTest.executables.toSeq: _*)) ++
val map = ConfigUtils.mergeMaps(Map("output_dir" -> outputDir,
"rna_metrics" -> rna,
"wgs_metrics" -> wgs),
Map(BamMetricsTest.executables.toSeq: _*)) ++
(if (amplicon) Map("amplicon_bed" -> BamMetricsTest.ampliconBed.getAbsolutePath) else Map()) ++
(if (rna) Map("annotation_refflat" -> "transcripts.refFlat") else Map()) ++
Map("regions_of_interest" -> (1 to rois).map(BamMetricsTest.roi(_).getAbsolutePath).toList)
......@@ -74,24 +74,23 @@ 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
bammetrics.functions.count(_.isInstanceOf[CollectHsMetrics]) shouldBe (if (amplicon) 1 else 0)
bammetrics.functions.count(_.isInstanceOf[CollectTargetedPcrMetrics]) shouldBe (if (amplicon) 1 else 0)
bammetrics.functions.count(_.isInstanceOf[CollectTargetedPcrMetrics]) shouldBe (if (amplicon) 1
else 0)
bammetrics.functions.count(_.isInstanceOf[BamStats]) shouldBe 1
}
// 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)
......@@ -99,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
}
......
......@@ -31,7 +31,7 @@
<parent>
<groupId>nl.lumc.sasc</groupId>
<artifactId>Biopet</artifactId>
<version>0.9.0</version>
<version>0.10.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
......
/**
* Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running
* SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
* should also be able to execute Biopet tools and pipelines.
*
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
* Biopet is built on top of GATK Queue for building bioinformatic
* pipelines. It is mainly intended to support LUMC SHARK cluster which is running
* SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
* should also be able to execute Biopet tools and pipelines.
*
* Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license.
*/
package nl.lumc.sasc.biopet.pipelines.basty
import java.io.{ File, FileOutputStream }
import java.io.{File, FileOutputStream}
import com.google.common.io.Files
import nl.lumc.sasc.biopet.extensions.{ Raxml, RunGubbins }
import nl.lumc.sasc.biopet.extensions.gatk.{ BaseRecalibrator, IndelRealigner, PrintReads, RealignerTargetCreator }
import nl.lumc.sasc.biopet.extensions.{Raxml, RunGubbins}
import nl.lumc.sasc.biopet.extensions.gatk.{
BaseRecalibrator,
IndelRealigner,
PrintReads,
RealignerTargetCreator
}
import nl.lumc.sasc.biopet.extensions.picard.MarkDuplicates
import nl.lumc.sasc.biopet.extensions.tools.{ BastyGenerateFasta, VcfStats }
import nl.lumc.sasc.biopet.utils.{ ConfigUtils, Logging }
import nl.lumc.sasc.biopet.extensions.tools.{BastyGenerateFasta, VcfStats}
import nl.lumc.sasc.biopet.utils.{ConfigUtils, Logging}
import nl.lumc.sasc.biopet.utils.config.Config
import org.apache.commons.io.FileUtils
import org.broadinstitute.gatk.queue.QSettings
import org.scalatest.Matchers
import org.scalatest.testng.TestNGSuite
import org.testng.annotations.{ AfterClass, DataProvider, Test }
import org.testng.annotations.{AfterClass, DataProvider, Test}
/**
* Created by pjvanthof on 27/09/16.
*/
* Created by pjvanthof on 27/09/16.
*/
class BastyTest extends TestNGSuite with Matchers {
def initPipeline(map: Map[String, Any]): Basty = {
new Basty() {
......@@ -43,10 +48,8 @@ class BastyTest extends TestNGSuite with Matchers {
}
@DataProvider(name = "bastyOptions")
def bastyOptions = {
for (
s1 <- sample1; s2 <- sample2
) yield Array("", s1, s2)
def bastyOptions: Array[Array[Any]] = {
for (s1 <- sample1; s2 <- sample2) yield Array("", s1, s2)
}
def sample1 = Array(false, true)
......@@ -73,16 +76,20 @@ class BastyTest extends TestNGSuite with Matchers {
if (sample1) m = ConfigUtils.mergeMaps(BastyTest.sample1, m)
if (sample2) m = ConfigUtils.mergeMaps(BastyTest.sample2, m)
if (dbsnp) m = ConfigUtils.mergeMaps(Map("dbsnp_vcf" -> "test.vcf.gz"), m)
ConfigUtils.mergeMaps(Map(
"multisample_variantcalling" -> multisampleCalling,
"single_sample_variantcalling" -> sampleCalling,
"library_variantcalling" -> libraryCalling,
"use_indel_realigner" -> realign,
"use_base_recalibration" -> baseRecalibration,
"sv_calling" -> svCalling,
"cnv_calling" -> cnvCalling,
"annotation" -> annotation,
"boot_runs" -> bootRuns), m)
ConfigUtils.mergeMaps(
Map(
"multisample_variantcalling" -> multisampleCalling,
"single_sample_variantcalling" -> sampleCalling,
"library_variantcalling" -> libraryCalling,
"use_indel_realigner" -> realign,
"use_base_recalibration" -> baseRecalibration,
"sv_calling" -> svCalling,
"cnv_calling" -> cnvCalling,
"annotation" -> annotation,
"boot_runs" -> bootRuns
),
m
)
}
......@@ -101,17 +108,24 @@ class BastyTest extends TestNGSuite with Matchers {
pipeline.functions.count(_.isInstanceOf[MarkDuplicates]) shouldBe (numberLibs + numberSamples)
// Gatk preprocess
pipeline.functions.count(_.isInstanceOf[IndelRealigner]) shouldBe (if (realign) numberSamples else 0)
pipeline.functions.count(_.isInstanceOf[RealignerTargetCreator]) shouldBe (if (realign) numberSamples else 0)
pipeline.functions.count(_.isInstanceOf[BaseRecalibrator]) shouldBe (if (dbsnp && baseRecalibration) (numberLibs * 2) else 0)
pipeline.functions.count(_.isInstanceOf[PrintReads]) shouldBe (if (dbsnp && baseRecalibration) numberLibs else 0)
pipeline.functions.count(_.isInstanceOf[IndelRealigner]) shouldBe (if (realign) numberSamples
else 0)
pipeline.functions.count(_.isInstanceOf[RealignerTargetCreator]) shouldBe (if (realign)
numberSamples
else 0)
pipeline.functions.count(_.isInstanceOf[BaseRecalibrator]) shouldBe (if (dbsnp && baseRecalibration)
numberLibs * 2
else 0)
pipeline.functions.count(_.isInstanceOf[PrintReads]) shouldBe (if (dbsnp && baseRecalibration)
numberLibs
else 0)
pipeline.summarySettings.get("boot_runs") shouldBe Some(bootRuns.getOrElse(100))
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
......@@ -121,15 +135,15 @@ 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()