Skip to content

Make ampliconclip primer counts output deterministic#2081

Merged
whitwham merged 1 commit into
samtools:developfrom
daviesrob:ampliconclip_stats_order
Jul 17, 2024
Merged

Make ampliconclip primer counts output deterministic#2081
whitwham merged 1 commit into
samtools:developfrom
daviesrob:ampliconclip_stats_order

Conversation

@daviesrob

Copy link
Copy Markdown
Member

The primer-counts output was being written with references in the order stored in the hash table, which is pseudo-randomised by the hash function. To get a more stable ordering, keep a list of references in the order they appear in the bed file, and then iterate through that.

ampliconstats uses the same bad file reading code, but already outputs in the order of references in the bam header, so the updated loader allows it to skip building the reference list from the bed file. (ampliconclip could in theory work the same way, but as it doesn't insist that all bed references need to be in the bam header, and outputs zero counts for the missing ones, it's simpler to go with the bed file ordering so the output doesn't change more than it needs to.)

The primer-counts output was being written with references
in the order stored in the hash table, which is pseudo-randomised
by the hash function.  To get a more stable ordering, keep a
list of references in the order they appear in the bed file, and
then iterate through that.

ampliconstats uses the same bad file reading code, but already
outputs in the order of references in the bam header, so the
updated loader allows it to skip building the reference list from
the bad file.  (ampliconclip could in theory work the same way,
but as it doesn't insist that all bed references need to be in the
bam header, and outputs zero counts for the missing ones, it's
simpler to go with the bed file ordering so the output doesn't
change more than it needs to.)
@whitwham whitwham merged commit d0a002f into samtools:develop Jul 17, 2024
@daviesrob daviesrob deleted the ampliconclip_stats_order branch July 18, 2024 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants