Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds a barcode option to FastqToBam #936

Merged
merged 5 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/main/scala/com/fulcrumgenomics/fastq/FastqToBam.scala
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ 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( doc="Library or Sample barcode sequence.") val barcode: Option[String] = None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about this further, how would you feel about making this a Seq[String] with default Seq.empty, then joining them with a hyphen? That way folks don't have to do so themselves?

Suggested change
@arg( doc="Library or Sample barcode sequence.") val barcode: Option[String] = None,
@arg( doc="Library or Sample barcode sequence.", minElements=0) val barcode: Seq[String] = Seq.empty,

@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 unit (e.g. '<flowcell-barcode>.<lane>')") val platformUnit: Option[String] = None,
bwlang marked this conversation as resolved.
Show resolved Hide resolved
@arg(doc="Platform model to insert into the group header (ex. miseq, hiseq2500, hiseqX)") val platformModel: Option[String] = None,
@arg(doc="The sequencing center from which the data originated") val sequencingCenter: Option[String] = None,
@arg(doc="Predicted median insert size, to insert into the read group header") val predictedInsertSize: Option[Integer] = None,
Expand Down Expand Up @@ -135,6 +136,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)))
bwlang marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not in an idea, but this could work:

    this.barcode.foreach(bc => rg.setBarcodes(util.Arrays.asList(bc)))
    if (this.barcode.nonEmpty) rg.setBarcodes(...)

rg.setPlatform(this.platform)
this.platformUnit.foreach(pu => rg.setPlatformUnit(pu))
this.sequencingCenter.foreach(cn => rg.setSequencingCenter(cn))
Expand Down
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"),
readGroupId="MyRG",
platform="Illumina",
platformUnit=Some("pee-eww"),
Expand All @@ -291,6 +292,8 @@ class FastqToBamTest extends UnitSpec {
rg.getSample shouldBe "foo"
rg.getLibrary shouldBe "bar"
rg.getReadGroupId shouldBe "MyRG"
rg.getBarcodes() should have size 1
rg.getBarcodes().get(0) shouldBe "TATA"
rg.getPlatform shouldBe "Illumina"
rg.getPlatformUnit shouldBe "pee-eww"
rg.getPlatformModel shouldBe "hiseq2500"
Expand Down