-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate set_pair_info and _set_mate_info for set_mate_info (#202)
I notice we have two implementations for setting mate info on a pair of alignments. I've refactored for the following reasons: - [`set_pair_info()`](https://github.com/fulcrumgenomics/fgpyo/blob/3680b4fe1fe3d8686172e05dbf9c5043fa51ae1a/fgpyo/sam/__init__.py#L700-L731): - Unnecessarily disallows unmapped reads - Uses `assert` instead of `raise`, which can be turned off at runtime - Does not set mate quality tag ([`MQ`](https://samtools.github.io/hts-specs/SAMtags.pdf)) - Does not set mate score tag ([`ms`](https://www.htslib.org/doc/samtools-fixmate.html)) - Defaults proper pair status to `True` (it's easy to forget to change this) - Forces you to override the "properly paired" status with True/False - [`_set_mate_info()`](https://github.com/fulcrumgenomics/fgpyo/blob/3680b4fe1fe3d8686172e05dbf9c5043fa51ae1a/fgpyo/sam/builder.py#L267-L329): - Looks like a direct translation of [HTSJDK's implementation](https://github.com/samtools/htsjdk/blob/c31bc92c24bc4e9552b2a913e52286edf8f8ab96/src/main/java/htsjdk/samtools/SamPairUtil.java#L206-L287) (it can be simpler with pysam) - Does not always cleanup mate cigar tag ([`MC`](https://samtools.github.io/hts-specs/SAMtags.pdf)) - Does not set mate quality tag ([`MQ`](https://samtools.github.io/hts-specs/SAMtags.pdf)) - Does not set mate score tag ([`ms`](https://www.htslib.org/doc/samtools-fixmate.html)) - Forces a reset of properly paired status Now we have: - [`set_pair_info()`](https://github.com/fulcrumgenomics/fgpyo/blob/1e066132a0fdc9af8e3b4c5dbd1633881e9f4c08/fgpyo/sam/__init__.py#L872-L884): annotated as _**deprecated**_ to avoid an API break - [`set_mate_info()`](https://github.com/fulcrumgenomics/fgpyo/blob/1e066132a0fdc9af8e3b4c5dbd1633881e9f4c08/fgpyo/sam/__init__.py#L807-L837): a more useful function for setting mate info on alignments - ~[`set_as_pairs()`](https://github.com/fulcrumgenomics/fgpyo/blob/1e066132a0fdc9af8e3b4c5dbd1633881e9f4c08/fgpyo/sam/__init__.py#L840-L869): this behavior was in `set_pair_info()` so it is now a sole function~ Questions? - ~Is it worth keeping `set_as_pairs()`? What was the motivation for this functionality?~ - Since we are still pre-v1, can we remove `set_pair_info()` without deprecating first? Along the way I found a bug in `SamBuilder.add_pair()` and fixed that too.
- Loading branch information
Showing
6 changed files
with
506 additions
and
348 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.