From ca81af8ad38ce04847af194ca77210978acb5040 Mon Sep 17 00:00:00 2001 From: znorgaard Date: Mon, 16 Dec 2024 11:26:19 -0800 Subject: [PATCH] refactor: variable names --- .../fulcrumgenomics/umi/GroupReadsByUmi.scala | 52 +++++++++---------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/src/main/scala/com/fulcrumgenomics/umi/GroupReadsByUmi.scala b/src/main/scala/com/fulcrumgenomics/umi/GroupReadsByUmi.scala index ddbcc9c71..615983593 100644 --- a/src/main/scala/com/fulcrumgenomics/umi/GroupReadsByUmi.scala +++ b/src/main/scala/com/fulcrumgenomics/umi/GroupReadsByUmi.scala @@ -468,17 +468,17 @@ case class TagFamilySizeMetric(family_size: Int, /** * Metrics produced by `GroupReadsByUmi` to describe reads passed through UMI grouping - * @param reads The number of reads accepted for grouping - * @param filteredNonPf The number of non-PF reads - * @param filteredPoorAlignment The number of templates discarded for poor - * @param filteredNsInUmi The number of templates discarded due to one or more Ns in the UMI - * @param filterUmisTooShort The number of templates discarded due to a shorter than expected UMI + * @param sam_records The number of SAM records accepted for grouping. + * @param filtered_non_pf The number of non-PF SAM records. + * @param filtered_poor_alignment The number of SAM records discarded for poor alignment. + * @param filtered_ns_in_umi The number of SAM records discarded due to one or more Ns in the UMI. + * @param filtered_umis_to_short The number of SAM records discarded due to a shorter than expected UMI. */ -case class UmiGroupingMetric(reads: Long, - filteredNonPf: Long, - filteredPoorAlignment: Long, - filteredNsInUmi: Long, - filterUmisTooShort: Long) extends Metric +case class UmiGroupingMetric(sam_records: Long, + filtered_non_pf: Long, + filtered_poor_alignment: Long, + filtered_ns_in_umi: Long, + filtered_umis_to_short: Long) extends Metric /** The strategies implemented by [[GroupReadsByUmi]] to identify reads from the same source molecule.*/ sealed trait Strategy extends EnumEntry { @@ -758,27 +758,25 @@ class GroupReadsByUmi Metric.write(p, ms) } - // Write out UMI grouping metrics - this.groupingMetrics match { - case None => () - case Some(p) => - val groupingMetrics = UmiGroupingMetric( - reads = kept, - filteredNonPf = filteredNonPf, - filteredPoorAlignment = filteredPoorAlignment, - filteredNsInUmi = filteredNsInUmi, - filterUmisTooShort = filterUmisTooShort, - ) - Metric.write(p, groupingMetrics) + // Write out UMI grouping metrics + this.groupingMetrics.foreach { path => + val groupingMetrics = UmiGroupingMetric( + sam_records = kept, + filtered_non_pf = filteredNonPf, + filtered_poor_alignment = filteredPoorAlignment, + filtered_ns_in_umi = filteredNsInUmi, + filtered_umis_to_short = filterUmisTooShort, + ) + Metric.write(path, groupingMetrics) } } private def logStats(): Unit = { - logger.info(f"Accepted $kept%,d reads for grouping.") - if (filteredNonPf > 0) logger.info(f"Filtered out $filteredNonPf%,d non-PF reads.") - logger.info(f"Filtered out $filteredPoorAlignment%,d reads due to mapping issues.") - logger.info(f"Filtered out $filteredNsInUmi%,d reads that contained one or more Ns in their UMIs.") - this.minUmiLength.foreach { _ => logger.info(f"Filtered out $filterUmisTooShort%,d reads that contained UMIs that were too short.") } + logger.info(f"Accepted $kept%,d SAM records for grouping.") + if (filteredNonPf > 0) logger.info(f"Filtered out $filteredNonPf%,d non-PF SAM records.") + logger.info(f"Filtered out $filteredPoorAlignment%,d SAM records due to mapping issues.") + logger.info(f"Filtered out $filteredNsInUmi%,d SAM records that contained one or more Ns in their UMIs.") + this.minUmiLength.foreach { _ => logger.info(f"Filtered out $filterUmisTooShort%,d SAM records that contained UMIs that were too short.") } } /** Consumes the next group of templates with all matching end positions and returns them. */