Commit f535473f authored by Sander Bollen's avatar Sander Bollen
Browse files

Merge branch 'feature-sample_name_check' into 'develop'

Fixes #213

Quick fix for #213 

See merge request !249
parents 2e285818 0832f655
......@@ -18,7 +18,7 @@ package nl.lumc.sasc.biopet.core
import java.io.File
import nl.lumc.sasc.biopet.core.summary.{ Summarizable, SummaryQScript }
import nl.lumc.sasc.biopet.utils.ConfigUtils
import nl.lumc.sasc.biopet.utils.{ Logging, ConfigUtils }
import org.broadinstitute.gatk.utils.commandline.Argument
/** This trait creates a structured way of use multisample pipelines */
......@@ -47,6 +47,8 @@ trait MultiSampleQScript extends SummaryQScript {
/** Adds the library jobs */
final def addAndTrackJobs(): Unit = {
if (nameRegex.findFirstIn(libId) == None)
Logging.addError(s"Library '$libId' $nameError")
currentSample = Some(sampleId)
currentLib = Some(libId)
addJobs()
......@@ -90,6 +92,8 @@ trait MultiSampleQScript extends SummaryQScript {
/** Adds sample jobs */
final def addAndTrackJobs(): Unit = {
if (nameRegex.findFirstIn(sampleId) == None)
Logging.addError(s"Sample '$sampleId' $nameError")
currentSample = Some(sampleId)
addJobs()
qscript.addSummarizable(this, "pipeline", Some(sampleId))
......@@ -129,6 +133,12 @@ trait MultiSampleQScript extends SummaryQScript {
/** Returns a list of all sampleIDs */
protected def sampleIds: Set[String] = ConfigUtils.any2map(globalConfig.map("samples")).keySet
protected lazy val nameRegex = """^[a-zA-Z0-9][a-zA-Z0-9-_]+[a-zA-Z0-9]$""".r
protected lazy val nameError = " name invalid." +
"Name must have at least 3 characters," +
"must begin and end with an alphanumeric character, " +
"and must not have whitespace."
/** Runs addAndTrackJobs method for each sample */
final def addSamplesJobs() {
if (onlySamples.isEmpty || samples.forall(x => onlySamples.contains(x._1))) {
......
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