From 6a2a964e1ec462b1461f4baa36d8b1e2b6a326f3 Mon Sep 17 00:00:00 2001 From: Nils Homer Date: Fri, 28 Jul 2023 08:52:52 -0700 Subject: [PATCH] Fix pass-QC in output FASTQ read names (#923) * Fix pass-QC in output FASTQ read names See #922 --- src/main/scala/com/fulcrumgenomics/fastq/DemuxFastqs.scala | 2 +- .../scala/com/fulcrumgenomics/fastq/DemuxFastqsTest.scala | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/scala/com/fulcrumgenomics/fastq/DemuxFastqs.scala b/src/main/scala/com/fulcrumgenomics/fastq/DemuxFastqs.scala index 50815c123..a6d2bbc9c 100644 --- a/src/main/scala/com/fulcrumgenomics/fastq/DemuxFastqs.scala +++ b/src/main/scala/com/fulcrumgenomics/fastq/DemuxFastqs.scala @@ -913,7 +913,7 @@ object OutputType extends FgBioEnum[OutputType] { */ case class ReadInfo(readNumber: Int, passQc: Boolean, internalControl: Boolean, sampleInfo: String, rest: Seq[String]) { override def toString: String = { - val leading = f"$readNumber:${if (passQc) "Y" else "N"}:${if (internalControl) 1 else 0}:$sampleInfo" + val leading = f"$readNumber:${if (passQc) "N" else "Y"}:${if (internalControl) 1 else 0}:$sampleInfo" if (rest.isEmpty) leading else leading + " " + rest.mkString(" ") } } diff --git a/src/test/scala/com/fulcrumgenomics/fastq/DemuxFastqsTest.scala b/src/test/scala/com/fulcrumgenomics/fastq/DemuxFastqsTest.scala index 2f8c07f15..31c314f0c 100644 --- a/src/test/scala/com/fulcrumgenomics/fastq/DemuxFastqsTest.scala +++ b/src/test/scala/com/fulcrumgenomics/fastq/DemuxFastqsTest.scala @@ -1166,7 +1166,7 @@ class DemuxFastqsTest extends UnitSpec with OptionValues with ErrorLogLevel { val standards = FastqStandards() val rec = baseRec.copy(pairedEnd=true, name="Instrument:RunID:FlowCellID:Lane:Tile:X:Y", comment=Some("1:N:0:SampleNumber")).withReadInfo val writer = new FastqRecordWriter(output.resolve("prefix"), pairedEnd=true, fastqStandards=standards) - writer.add(rec).header shouldBe "Instrument:RunID:FlowCellID:Lane:Tile:X:Y:SB:MB 1:N:0:SampleNumber" + writer.add(rec).header shouldBe "Instrument:RunID:FlowCellID:Lane:Tile:X:Y:SB:MB 1:Y:0:SampleNumber" } it should "set the read name to include the sample barcode for single-end" in { @@ -1175,7 +1175,7 @@ class DemuxFastqsTest extends UnitSpec with OptionValues with ErrorLogLevel { val standards = FastqStandards(includeSampleBarcodes=true) val rec = baseRec.copy(pairedEnd=true, name="Instrument:RunID:FlowCellID:Lane:Tile:X:Y", comment=Some("1:N:0:SB")).withReadInfo val writer = new FastqRecordWriter(output.resolve("prefix"), pairedEnd=false, fastqStandards=standards) - writer.add(rec).header shouldBe "Instrument:RunID:FlowCellID:Lane:Tile:X:Y 1:N:0:SB" + writer.add(rec).header shouldBe "Instrument:RunID:FlowCellID:Lane:Tile:X:Y 1:Y:0:SB" } it should "set the read name to include the sample barcode for paired end" in { @@ -1184,7 +1184,7 @@ class DemuxFastqsTest extends UnitSpec with OptionValues with ErrorLogLevel { val standards = FastqStandards(includeSampleBarcodes=true) val rec = baseRec.copy(pairedEnd=true, name="Instrument:RunID:FlowCellID:Lane:Tile:X:Y", comment=Some("1:Y:0:SB1+SB2"), sampleBarcode=Seq("SB1","SB2"), molecularBarcode=Seq("MB1","MB2")).withReadInfo val writer = new FastqRecordWriter(output.resolve("prefix"), pairedEnd=true, fastqStandards=standards) - writer.add(rec).header shouldBe "Instrument:RunID:FlowCellID:Lane:Tile:X:Y 1:Y:0:SB1+SB2" + writer.add(rec).header shouldBe "Instrument:RunID:FlowCellID:Lane:Tile:X:Y 1:N:0:SB1+SB2" } "ReadInfo" should "not be built if there was no comment in the given record when following Illumina standards" in {