Skip to content

Commit

Permalink
adds a barcode option to FastqToBam (#936)
Browse files Browse the repository at this point in the history
* adds a barcode option to FastqToBam
fixes #935
  • Loading branch information
bwlang authored Sep 11, 2023
1 parent ab8959d commit 2af51ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/scala/com/fulcrumgenomics/fastq/FastqToBam.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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. '<flowcell-barcode>.<lane>.<sample-barcode>')") val platformUnit: Option[String] = None,
@arg(doc="Platform model to insert into the group header (ex. miseq, hiseq2500, hiseqX)") val platformModel: Option[String] = None,
Expand Down Expand Up @@ -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))
Expand Down
4 changes: 4 additions & 0 deletions src/test/scala/com/fulcrumgenomics/fastq/FastqToBamTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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"
Expand Down

0 comments on commit 2af51ac

Please sign in to comment.