Repository navigation
RFC: samtools merge to use htslib header parser - #259
Closed
SamStudio8 wants to merge 1 commit into
Closed
SamStudio8 wants to merge 1 commit into
SamStudio8 wants to merge 1 commit into
Conversation
Contributor
Author
|
Note the major code duplication between the handling of RG and PG structures in |
Contributor
Author
|
Note also the build will fail as it relies upon the additions in htslib. |
Contributor
Author
|
@jmarshall Just wondering if you've had any thoughts on this PR (and its sister samtools/htslib/pull/116)? I think we're desperately in need of a proper header parser and I'm happy to take this forward with any recommendations and continue maintenance of it as part of samtools as necessary. I should add that this dramatically improves the performance of |
* Previously a regex was performed for each line in the translate->text data to initially locate @rg and @pg lines before another regex would then isolate the identifier and check whether it required translation. IDs matched from these latter expressions would then be checked over the entirity of the growing contents of out->text. * These extensive and expensive searches are no longer required as the various @pg and @rg identifiers have already been isolated when the input files are read in by htslib. * @rg and @pg data are stored in the header in linked lists that can easily be navigated to compare entries in translate and out for matching identifiers without the need for all the use of regular expressions. * Conversion of @rg PG and @pg PP tags has been simplified as these values are also stored in the header's linked lists rather than requiring use of further regular expressions. * Speed performance of merges, especially over large data sets has been dramatically improved.
Contributor
Author
|
I've brought this PR up to date with the current head of |
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.
Following issue #203 I have been experimenting with adding a BAM header parser in htslib and implementing use of its functionality in the reading in of BAM files for
samtools merge, replacing the heavy and inefficient use of regular expressions. Currently this only handles the @rg and @pg lines, whose fields are each stored in a struct, which in turn make up a linked list stored inbam_hdr_t.My C is a little rusty and I imagine my implementation could be simplified and polished somewhat, but I am happy to get some feedback on this as necessary so as I might be able to continue finishing this parser in the right direction.
See also samtools/htslib#116