Commit 5fafdb64 authored by Peter van 't Hof's avatar Peter van 't Hof

Making PU optional

parent 2c9c7c06
......@@ -37,7 +37,9 @@ import org.broadinstitute.gatk.queue.QScript
import scala.math._
// TODO: documentation
/**
* This pipeline doing a alignment to a given reference genome
*/
class Mapping(val parent: Configurable) extends QScript with SummaryQScript with SampleLibraryTag with Reference {
def this() = this(null)
......@@ -79,7 +81,7 @@ class Mapping(val parent: Configurable) extends QScript with SummaryQScript with
protected var platform: String = config("platform", default = "illumina")
/** Readgroup platform unit */
protected var platformUnit: String = config("platform_unit", default = "na")
protected var platformUnit: Option[String] = config("platform_unit")
/** Readgroup sequencing center */
protected var readgroupSequencingCenter: Option[String] = config("readgroup_sequencing_center")
......@@ -379,7 +381,7 @@ class Mapping(val parent: Configurable) extends QScript with SummaryQScript with
hisat2.R2 = R2
hisat2.rgId = Some(readgroupId)
hisat2.rg +:= s"PL:$platform"
hisat2.rg +:= s"PU:$platformUnit"
platformUnit.foreach(x => hisat2.rg +:= s"PU:$x")
libId match {
case Some(id) => hisat2.rg +:= s"LB:$id"
case otherwise => ;
......@@ -452,7 +454,7 @@ class Mapping(val parent: Configurable) extends QScript with SummaryQScript with
RG += "SM:" + sampleId.get + ","
RG += "LB:" + libId.get + ","
if (readgroupDescription != null) RG += "DS" + readgroupDescription + ","
RG += "PU:" + platformUnit + ","
platformUnit.foreach(x => RG += "PU:" + x + ",")
if (predictedInsertsize.getOrElse(0) > 0) RG += "PI:" + predictedInsertsize.get + ","
if (readgroupSequencingCenter.isDefined) RG += "CN:" + readgroupSequencingCenter.get + ","
if (readgroupDate != null) RG += "DT:" + readgroupDate + ","
......@@ -497,7 +499,7 @@ class Mapping(val parent: Configurable) extends QScript with SummaryQScript with
bowtie2.rgId = Some(readgroupId)
bowtie2.rg +:= ("LB:" + libId.get)
bowtie2.rg +:= ("PL:" + platform)
bowtie2.rg +:= ("PU:" + platformUnit)
platformUnit.foreach(x => bowtie2.rg +:= ("PU:" + x))
bowtie2.rg +:= ("SM:" + sampleId.get)
bowtie2.R1 = R1
bowtie2.R2 = R2
......@@ -554,7 +556,7 @@ class Mapping(val parent: Configurable) extends QScript with SummaryQScript with
addOrReplaceReadGroups.RGID = readgroupId
addOrReplaceReadGroups.RGLB = libId.get
addOrReplaceReadGroups.RGPL = platform
addOrReplaceReadGroups.RGPU = platformUnit
addOrReplaceReadGroups.RGPU = platformUnit.getOrElse(readgroupId)
addOrReplaceReadGroups.RGSM = sampleId.get
if (readgroupSequencingCenter.isDefined) addOrReplaceReadGroups.RGCN = readgroupSequencingCenter.get
if (readgroupDescription.isDefined) addOrReplaceReadGroups.RGDS = readgroupDescription.get
......@@ -568,7 +570,7 @@ class Mapping(val parent: Configurable) extends QScript with SummaryQScript with
var RG: String = "@RG\\t" + "ID:" + readgroupId + "\\t"
RG += "LB:" + libId.get + "\\t"
RG += "PL:" + platform + "\\t"
RG += "PU:" + platformUnit + "\\t"
platformUnit.foreach(x => RG += "PU:" + x + "\\t")
RG += "SM:" + sampleId.get + "\\t"
if (readgroupSequencingCenter.isDefined) RG += "CN:" + readgroupSequencingCenter.get + "\\t"
if (readgroupDescription.isDefined) RG += "DS:" + readgroupDescription.get + "\\t"
......
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