From 6173485e28ddda562a95cd89537e2344798732bd Mon Sep 17 00:00:00 2001
From: Wai Yi Leung <w.y.leung@lumc.nl>
Date: Wed, 11 May 2016 08:35:59 +0200
Subject: [PATCH] Use samplename_suffix to change the sample name

---
 .../sasc/biopet/pipelines/shiva/svcallers/Breakdancer.scala     | 2 +-
 .../nl/lumc/sasc/biopet/pipelines/shiva/svcallers/Clever.scala  | 2 +-
 .../nl/lumc/sasc/biopet/pipelines/shiva/svcallers/Pindel.scala  | 2 +-
 .../lumc/sasc/biopet/pipelines/shiva/svcallers/SvCaller.scala   | 2 ++
 4 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/svcallers/Breakdancer.scala b/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/svcallers/Breakdancer.scala
index f44ec38c9..8d63e1b6b 100644
--- a/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/svcallers/Breakdancer.scala
+++ b/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/svcallers/Breakdancer.scala
@@ -33,7 +33,7 @@ class Breakdancer(val root: Configurable) extends SvCaller {
       val bdcfg = BreakdancerConfig(this, bamFile, new File(breakdancerSampleDir, sample + ".breakdancer.cfg"))
       val breakdancer = BreakdancerCaller(this, bdcfg.output, new File(breakdancerSampleDir, sample + ".breakdancer.tsv"))
       val bdvcf = BreakdancerVCF(this, breakdancer.output, new File(breakdancerSampleDir, sample + ".breakdancer.vcf"),
-        sample = sample + "_bd")
+        sample = sample + sampleNameSuffix)
 
       val compressedVCF = new SortVcf(this)
       compressedVCF.input = bdvcf.output
diff --git a/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/svcallers/Clever.scala b/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/svcallers/Clever.scala
index 3c5dc47bc..992eb6d71 100644
--- a/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/svcallers/Clever.scala
+++ b/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/svcallers/Clever.scala
@@ -33,7 +33,7 @@ class Clever(val root: Configurable) extends SvCaller {
       val cleverVCF = new CleverFixVCF(this)
       cleverVCF.input = clever.outputvcf
       cleverVCF.output = new File(cleverDir, s".${sample}.clever.vcf")
-      cleverVCF.sampleName = sample + "_cl"
+      cleverVCF.sampleName = sample + sampleNameSuffix
       cleverVCF.isIntermediate = true
       add(cleverVCF)
 
diff --git a/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/svcallers/Pindel.scala b/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/svcallers/Pindel.scala
index c83ee46b7..cae8db566 100644
--- a/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/svcallers/Pindel.scala
+++ b/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/svcallers/Pindel.scala
@@ -40,7 +40,7 @@ class Pindel(val root: Configurable) extends SvCaller {
       val configFile: File = new File(pindelDir, sample + ".pindel.cfg")
       val cfg = new PindelConfig(this)
       cfg.input = bamFile
-      cfg.sampleName = sample + "_pd" // pindel suffix
+      cfg.sampleName = sample + sampleNameSuffix
       cfg.output = configFile
       add(cfg)
 
diff --git a/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/svcallers/SvCaller.scala b/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/svcallers/SvCaller.scala
index 14fea623b..fbc3bfedd 100644
--- a/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/svcallers/SvCaller.scala
+++ b/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/svcallers/SvCaller.scala
@@ -30,6 +30,8 @@ trait SvCaller extends QScript with BiopetQScript with Reference {
 
   var inputBams: Map[String, File] = Map.empty
 
+  val sampleNameSuffix: String = config("samplename_suffix", default="")
+
   def outputVCF(sample: String): Option[File] = {
     outputVCFs.get(sample) match {
       case Some(file) => Some(file)
-- 
GitLab