Create a faster script to populate reference caches.#2231
Merged
Conversation
439a931 to
475f1d9
Compare
Member
|
Your code is indeed faster. Thank you very much. |
Contributor
Author
|
Now you just have to wait for someone who implements it in rust ;-). Thanks for merging! Anyway, if people start complaining about unforeseen bugs, please ping me and I will fix them. I did do the due diligence thing with a test suite and testing various scenarious (larger than memory spool contigs, smaller than memory spool contigs etc.), but no test suite is perfect. |
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.
Yesterday I was in the need of a tool for creating a REF_CACHE for some proprietary software package. It was documented, but links were dead, so I ended up reverse engineering the REF_CACHE script. A few hours later I found out that there is already a perl script in this repository that does the same thing because the REF_CACHE is a samtools thing.
However, this perl script is quite slow, so I decided to contribute back my script so others can benefit from it.
Benchmarks were done on a tmpfs in-memory filesystem for writing. The reference file was pulled through
cata few times so it was also in the memory cache.For reference,
So in this setup colculating the md5sum and copying the file should take roughly 5.7 seconds. When the cache is already populated, no copying is required and the baseline is 4.3 seconds.
The perl script
The perl script takes roughly 1.8 seconds for the copying, which is fair. The rest of the script takes quite long compared to a raw md5sum check.
The python script
Some very slight overhead (1.7 seconds) compared to the raw operations. This is due to the newline removal and upper casing, which require some cost.
The python script is roughly 5 times faster for a new cache and roughly 6 times for an already populated cache. It uses the same CLI and provides the same functionality including the in-memory spooling.
I wouldn't have targeted seq_cache_populate.pl for improvement had I known of it before, but since I did most of the work already I might as well contribute it back and give other users an easier time generating their ref caches.