Skip to content

Commit f0fed8e

Browse files
committed
test: cover terminal and non-terminal + in updateClippingInformation
Add a positive regression case for a terminal + segment with a clipping attribute, and a negative case asserting the non-terminal + precondition fires. Also reflow the read-structure paragraph in DemuxFastqs so the source no longer wraps mid-clause. Both per PR #1157 review feedback.
1 parent 92d5e90 commit f0fed8e

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

src/main/scala/com/fulcrumgenomics/fastq/DemuxFastqs.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,10 @@ object DemuxFastqs {
245245
|4. `S` identifies a set of bases that should be skipped or ignored
246246
|
247247
|At most one `<number><operator>` pair in a read structure may use a `+` sign in place of the number to denote
248-
|"all remaining bases", and it may appear at any position in the read structure. This is useful if, e.g.,
249-
|fastqs have been trimmed and contain reads of varying length. Both reads must have template bases. Any
250-
|molecular identifiers will be concatenated using
251-
|the `-` delimiter and placed in the given SAM record tag (`RX` by default). Similarly, the sample barcode bases
252-
|from the given read will be placed in the `BC` tag.
248+
|"all remaining bases", and it may appear at any position in the read structure. This is useful if, e.g., fastqs
249+
|have been trimmed and contain reads of varying length. Both reads must have template bases. Any molecular
250+
|identifiers will be concatenated using the `-` delimiter and placed in the given SAM record tag (`RX` by default).
251+
|Similarly, the sample barcode bases from the given read will be placed in the `BC` tag.
253252
|
254253
|Metadata about the samples should be given in either an Illumina Experiment Manager sample sheet or a metadata CSV
255254
|file. Formats are described in detail below.

src/test/scala/com/fulcrumgenomics/umi/ExtractUmisFromBamTest.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,5 +447,17 @@ class ExtractUmisFromBamTest extends UnitSpec with OptionValues {
447447
record("XT") = 40
448448
ExtractUmisFromBam.updateClippingInformation(record, Some("XT"), ReadStructure("20T10M70T"))
449449
record[Int]("XT") shouldBe 30
450+
451+
// terminal `+` is the only positive `+` case allowed; clip should shift by the same 10 as `10M90T`
452+
record("XT") = 50
453+
ExtractUmisFromBam.updateClippingInformation(record, Some("XT"), ReadStructure("10M+T"))
454+
record[Int]("XT") shouldBe 40
455+
456+
// a non-terminal `+` cannot be combined with a clipping attribute, since translating the clip
457+
// position would require knowing the read length
458+
record("XT") = 30
459+
an[Exception] should be thrownBy {
460+
ExtractUmisFromBam.updateClippingInformation(record, Some("XT"), ReadStructure("10M+M5T"))
461+
}
450462
}
451463
}

0 commit comments

Comments
 (0)