-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: speed improvements for primer pair hit building from single pri…
…mer hits (#99) Closes #94 1. `OffTargetDetector._to_amplicons` signature changes from ``` def _to_amplicons(lefts: list[BwaHit], rights: list[BwaHit], max_len: int) -> list[Span]: ``` to ``` def _to_amplicons( positive_hits: list[BwaHit], negative_hits: list[BwaHit], max_len: int, strand: Strand ) -> list[Span]: ``` - Amplicons are built from a list of single primer hits on the positive strand and a list of single primer hits on the negative strand. - New parameter `strand` is used to set the `strand` attribute on each of the returned `Span`s for the amplicon hits. - Validates that all positive hits are on the positive strand and all negative hits are on the negative strand. - Validates that all hits are on the same reference (e.g. contig/chr). 2. The existing unit test for `OffTargetDetector.to_amplicons` is split into two, one where no error should be raised, and one where a `ValueError` should be raised, with expected error messages. 3. `OffTargetDetector._build_off_target_result` does not change signature. - exits early setting `pass = False` to the returned `OffTargetResult` if there are too many hits for either the left or the right primer. - hits are separated by reference (e.g. contig/chr), left/right, and strand (positive/negative) using defaultdict collections - this enables passing hits that are on the same strand and in the correct relative orientation to each other to `_to_amplicons`, along with a known amplicon strand - positive when the positive hits are from the left primer of a pair and the negative hits are from the right primer, and negative in the inverse. - the full set of left and right primer hits are still returned if `OffTargetDetector._keep_primer_spans` is `True`. 4. Unit test for `OffTargetDetector._build_off_target_result` is added.
- Loading branch information
Showing
2 changed files
with
272 additions
and
53 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
Oops, something went wrong.