diff --git a/src/main/scala/com/fulcrumgenomics/fastq/FastqToBam.scala b/src/main/scala/com/fulcrumgenomics/fastq/FastqToBam.scala index 7a99ad20e..01e3f6998 100644 --- a/src/main/scala/com/fulcrumgenomics/fastq/FastqToBam.scala +++ b/src/main/scala/com/fulcrumgenomics/fastq/FastqToBam.scala @@ -97,6 +97,7 @@ class FastqToBam @arg( doc="Read group ID to use in the file header.") val readGroupId: String = "A", @arg( doc="The name of the sequenced sample.") val sample: String, @arg( doc="The name/ID of the sequenced library.") val library: String, + @arg(flag='b', doc="Library or Sample barcode sequence.") val barcode: Option[String] = None, @arg( doc="Sequencing Platform.") val platform: String = "illumina", @arg(doc="Platform unit (e.g. '..')") val platformUnit: Option[String] = None, @arg(doc="Platform model to insert into the group header (ex. miseq, hiseq2500, hiseqX)") val platformModel: Option[String] = None, @@ -136,6 +137,7 @@ class FastqToBam val rg = new SAMReadGroupRecord(this.readGroupId) rg.setSample(sample) rg.setLibrary(library) + this.barcode.foreach(bc => rg.setBarcodes(util.Arrays.asList(bc))) rg.setPlatform(this.platform) this.platformUnit.foreach(pu => rg.setPlatformUnit(pu)) this.sequencingCenter.foreach(cn => rg.setSequencingCenter(cn)) diff --git a/src/test/scala/com/fulcrumgenomics/fastq/FastqToBamTest.scala b/src/test/scala/com/fulcrumgenomics/fastq/FastqToBamTest.scala index 888cf2560..7941e681c 100644 --- a/src/test/scala/com/fulcrumgenomics/fastq/FastqToBamTest.scala +++ b/src/test/scala/com/fulcrumgenomics/fastq/FastqToBamTest.scala @@ -270,6 +270,7 @@ class FastqToBamTest extends UnitSpec { output=bam, sample="foo", library="bar", + barcode=Some("TATA-GAGA"), //note that when passed a single string with a - separator like this, htsjdk prouduces two barcodes via getBarcodes() readGroupId="MyRG", platform="Illumina", platformUnit=Some("pee-eww"), @@ -291,6 +292,9 @@ class FastqToBamTest extends UnitSpec { rg.getSample shouldBe "foo" rg.getLibrary shouldBe "bar" rg.getReadGroupId shouldBe "MyRG" + rg.getBarcodes() should have size 2 + rg.getBarcodes().get(0) shouldBe "TATA" + rg.getBarcodes().get(1) shouldBe "GAGA" rg.getPlatform shouldBe "Illumina" rg.getPlatformUnit shouldBe "pee-eww" rg.getPlatformModel shouldBe "hiseq2500"