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

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

parents f4a5bd7a 41b53bd4
node('local') {
try {
timeout(45) {
node('local') {
try {
stage('Init') {
tool 'JDK 8u102'
tool 'Apache Maven 3.3.9'
}
stage('Init') {
tool 'JDK 8u102'
tool 'Apache Maven 3.3.9'
}
stage('Checkout') {
checkout scm
sh 'git submodule update --init --recursive'
}
stage('Checkout') {
checkout scm
sh 'git submodule update --init --recursive'
}
stage('Build and Test') {
withMaven(maven: 'Apache Maven 3.3.9', jdk: 'JDK 8u102') {
sh 'mvn -B -T 2 -Dmaven.test.failure.ignore clean package'
stage('Build and Test') {
withMaven(maven: 'Apache Maven 3.3.9', jdk: 'JDK 8u102') {
sh 'mvn -B -T 2 -Dmaven.test.failure.ignore clean package'
}
}
}
stage('Report Tests') {
junit '*/target/surefire-reports/*.xml'
}
stage('Report Tests') {
junit '*/target/surefire-reports/*.xml'
}
stage('Check Documentation') {
sh 'mkdocs build --clean --strict'
}
stage('Check Documentation') {
sh 'mkdocs build --clean --strict'
}
if(currentBuild.result == null || "SUCCESS".equals(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 {
slackSend (color: '#FFFF00', message: "${currentBuild.result}: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)", channel: '#biopet-bot', teamDomain: 'lumc', tokenCredentialId: 'lumc')
}
if (currentBuild.result == null || "SUCCESS".equals(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 {
slackSend(color: '#FFFF00', message: "${currentBuild.result}: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)", channel: '#biopet-bot', teamDomain: 'lumc', tokenCredentialId: 'lumc')
}
} catch (e) {
if(currentBuild.result == null || "FAILED".equals(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')
} catch (e) {
if (currentBuild.result == null || "FAILED".equals(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')
throw e
throw e
}
}
}
}
\ No newline at end of file
......@@ -75,8 +75,8 @@ class Fastqc(val parent: Configurable) extends BiopetCommandLineFunction with Ve
// otherwise, check if adapters are already present (depending on FastQC version)
case None =>
val defaultAdapters = getVersion match {
case Some("v0.11.2") => Option(new File(fastqcDir + "/Configuration/adapter_list.txt"))
case _ => None
case Some(v) if v.contains("v0.11") => Option(new File(fastqcDir + "/Configuration/adapter_list.txt"))
case _ => None
}
defaultAdapters.collect { case adp => config("adapters", default = adp) }
}
......
......@@ -42,8 +42,19 @@ class DellyCaller(val parent: Configurable) extends BiopetCommandLineFunction wi
var analysistype: String = _
def cmdLine = required(executable) +
"-t" + required(analysistype) +
"-o" + required(outputvcf) +
required(input)
required("-t", analysistype) +
required("-o", outputvcf) +
required(input) +
createEmptyOutputIfNeeded
// when no variants are found then the tool doesn't generate the output file either, in Biopet it's needed that the empty file would be there
private def createEmptyOutputIfNeeded =
s"""
|c=$$?
|if [ $$c -eq 0 ] && [ ! -f $outputvcf ]; then
| echo '##fileformat=VCFv4.2' > $outputvcf
| echo '#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO' >> $outputvcf
|fi
|exit $$c""".stripMargin
}
......@@ -37,6 +37,9 @@ class CatVariants(val parent: Configurable) extends BiopetJavaCommandLineFunctio
@Gather(classOf[org.broadinstitute.gatk.queue.function.scattergather.SimpleTextGatherFunction])
var outputFile: File = _
/** When Gatk's CatVariants has been called with empty VCF-files, then it also outputs an empty file. When this parameter is set to true, then the empty file gets added a valid VCF-file header.*/
var writeHeaderToEmptyOutput: Boolean = false
/** assumeSorted should be true if the input files are already sorted (based on the position of the variants) */
@Argument(fullName = "assumeSorted", shortName = "assumeSorted", doc = "assumeSorted should be true if the input files are already sorted (based on the position of the variants)", required = false, exclusiveOf = "", validation = "")
var assumeSorted: Boolean = _
......@@ -73,5 +76,14 @@ class CatVariants(val parent: Configurable) extends BiopetJavaCommandLineFunctio
optional("--variant_index_type", variant_index_type, spaceSeparated = true, escape = true, format = "%s") +
optional("--variant_index_parameter", variant_index_parameter, spaceSeparated = true, escape = true, format = "%s") +
optional("-l", logging_level, spaceSeparated = true, escape = true, format = "%s") +
optional("-log", log_to_file, spaceSeparated = true, escape = true, format = "%s")
optional("-log", log_to_file, spaceSeparated = true, escape = true, format = "%s") +
(if (writeHeaderToEmptyOutput) s"""
|c=$$?
|if [ $$c -eq 0 ] && [ ! -s $outputFile ]; then
| echo '##fileformat=VCFv4.2' > $outputFile
| echo '#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO' >> $outputFile
|fi
|exit $$c""".stripMargin
else "")
}
......@@ -155,6 +155,8 @@ class Fastqc(root: Configurable) extends nl.lumc.sasc.biopet.extensions.Fastqc(r
*/
def foundAdapters: Set[AdapterSequence] = {
if (dataFile.exists) { // On a dry run this file does not yet exist
val modules = qcModules
/** Returns a list of adapter and/or contaminant sequences known to FastQC */
def getFastqcSeqs(file: Option[File]): Set[AdapterSequence] = file match {
case None => Set.empty[AdapterSequence]
......@@ -170,7 +172,7 @@ class Fastqc(root: Configurable) extends nl.lumc.sasc.biopet.extensions.Fastqc(r
val adapterSet = getFastqcSeqs(adapters)
val contaminantSet = getFastqcSeqs(contaminants)
val foundAdapterNames: Seq[String] = qcModules.get("Overrepresented sequences") match {
val foundAdapterNames: Seq[String] = modules.get("Overrepresented sequences") match {
case None => Seq.empty[String]
case Some(qcModule) =>
for (
......@@ -181,7 +183,7 @@ class Fastqc(root: Configurable) extends nl.lumc.sasc.biopet.extensions.Fastqc(r
// select full sequences from known adapters and contaminants
// based on overrepresented sequences results
val fromKnownList: Set[AdapterSequence] = (adapterSet ++ contaminantSet)
val fromKnownList: Set[AdapterSequence] = contaminantSet
.filter(x => foundAdapterNames.exists(_.startsWith(x.name)))
val fromKnownListRC: Set[AdapterSequence] = if (enableRCtrimming) fromKnownList.map {
......@@ -191,7 +193,7 @@ class Fastqc(root: Configurable) extends nl.lumc.sasc.biopet.extensions.Fastqc(r
// list all sequences found by FastQC
val fastQCFoundSequences: Seq[AdapterSequence] = if (sensitiveAdapterSearch) {
qcModules.get("Overrepresented sequences") match {
modules.get("Overrepresented sequences") match {
case None => Seq.empty
case Some(qcModule) =>
for (
......@@ -199,17 +201,16 @@ class Fastqc(root: Configurable) extends nl.lumc.sasc.biopet.extensions.Fastqc(r
values = line.split("\t") if values.size >= 4
) yield AdapterSequence(values(3), values(0))
}
} else {
Seq.empty
}
} else Seq()
// we only want to keep adapter sequences which are known by FastQC
// sequences such as "Adapter01 (100% over 12bp)" are valid because "Adapter01" is in FastQC
fastQCFoundSequences.filter(x => {
(adapterSet ++ contaminantSet).count(y => x.name.startsWith(y.name)) == 1
})
val foundAdapters = modules.get("Adapter Content").map { x =>
val header = x.lines.head.split("\t").tail.zipWithIndex
val lines = x.lines.tail.map(_.split("\t").tail)
val found = header.filter(h => lines.exists(x => x(h._2).toFloat > 0)).map(_._1)
adapterSet.filter(x => found.contains(x.name))
}
fromKnownList ++ fastQCFoundSequences ++ fromKnownListRC
fromKnownList ++ fastQCFoundSequences ++ fromKnownListRC ++ foundAdapters.getOrElse(Seq())
} else Set()
}
......
......@@ -36,6 +36,7 @@ class Delly(val parent: Configurable) extends SvCaller {
val catVariants = new CatVariants(this)
catVariants.outputFile = new File(dellyDir, sample + ".delly.vcf")
catVariants.isIntermediate = true
catVariants.writeHeaderToEmptyOutput = true
if (del) {
val delly = new DellyCaller(this)
......
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