Make ampliconclip primer counts output deterministic#2081
Merged
Conversation
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.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
ampliconstatsuses 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. (ampliconclipcould 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.)