Skip to content

Commit

Permalink
fix: change bwa to bwa-aln-interactive
Browse files Browse the repository at this point in the history
  • Loading branch information
clintval committed Sep 20, 2024
1 parent 9cf576a commit 9ca141c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 32 deletions.
34 changes: 10 additions & 24 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,19 @@ jobs:
with:
python-version: ${{ matrix.PYTHON_VERSION }}

- name: Install poetry
run: |
python -m pip install --upgrade pip
python -m pip install poetry==${{env.POETRY_VERSION}}
- name: Configure poetry
shell: bash
run: poetry config virtualenvs.in-project true

- name: Set up miniconda
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-variant: Miniforge
miniforge-version: latest
channels: conda-forge,bioconda
activate-environment: prymer
Expand All @@ -45,29 +54,6 @@ jobs:
auto-activate-base: false
python-version: ${{ matrix.PYTHON_VERSION }}

- name: Install fulcrumgenomics/bwa
shell: bash -l {0}
run: |
conda activate prymer
pushd bwa
make -j $(nproc)
cp bwa ${CONDA_PREFIX}/bin
popd
- name: Configure poetry and check lock file
shell: bash -l {0}
run: |
conda activate prymer
poetry config virtualenvs.in-project false
poetry check --lock
- name: Poetry install
shell: bash -l {0}
run: |
conda activate prymer
poetry lock --no-update
poetry install --with dev
- name: Unit tests (with doctest and coverage)
shell: bash -l {0}
run: |
Expand Down
1 change: 0 additions & 1 deletion prymer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: prymer
channels:
- bioconda
- conda-forge
- defaults
dependencies:
- bioconda::bwa-aln-interactive=0.7.18
- bioconda::primer3=2.6.1
Expand Down
19 changes: 14 additions & 5 deletions prymer/offtarget/bwa.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
hits in the "XA" tag than the total number hits reported in the "HN". This occurs when BWA finds more
hits than `max_hits` (see `bwt aln -X`).
## Example
Use of this module requires installation of a custom version of BWA named `bwa-aln-interactive`.
See:
- https://github.com/fulcrumgenomics/bwa/tree/interactive_aln
- https://bioconda.github.io/recipes/bwa-aln-interactive/README.html
## Example
```python
>>> from pathlib import Path
Expand Down Expand Up @@ -193,7 +199,10 @@ class BwaAlnInteractive(ExecutableRunner):
the process running and be able to send it chunks of reads periodically and get alignments
back without waiting for a full batch of reads to be sent.
See: https://github.com/fulcrumgenomics/bwa/tree/interactive_aln
See:
- https://bioconda.github.io/recipes/bwa-aln-interactive/README.html
- https://github.com/fulcrumgenomics/bwa/tree/interactive_aln
Attributes:
max_hits: the maximum number of hits to report - if more than this number of seed hits
Expand All @@ -207,7 +216,7 @@ def __init__(
self,
ref: Path,
max_hits: int,
executable: str | Path = "bwa",
executable: str | Path = "bwa-aln-interactive",
max_mismatches: int = 3,
max_mismatches_in_seed: int = 3,
max_gap_opens: int = 0,
Expand All @@ -222,7 +231,7 @@ def __init__(
ref: the path to the reference FASTA, which must be indexed with bwa.
max_hits: the maximum number of hits to report - if more than this number of seed hits
are found, report only the count and not each hit.
executable: string or Path representation of the `bwa` executable path
executable: string or Path representation of the `bwa-aln-interactive` executable path
max_mismatches: the maximum number of mismatches allowed in the full query sequence
max_mismatches_in_seed: the maximum number of mismatches allowed in the seed region
max_gap_opens: the maximum number of gap opens allowed in the full query sequence
Expand Down Expand Up @@ -252,7 +261,7 @@ def __init__(
else:
message = "BWA index file does not exist:\n\t"
message += "\t\n".join(f"{p}" for p in missing_aux_paths)
raise FileNotFoundError(f"{message}\nPlease index with: `bwa index {ref}`")
raise FileNotFoundError(f"{message}\nPlease index with: `{executable_path} index {ref}`")

# -N = non-iterative mode: search for all n-difference hits (slooow)
# -S = output SAM (run samse)
Expand Down
4 changes: 2 additions & 2 deletions prymer/offtarget/offtarget_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class OffTargetResult:

class OffTargetDetector:
"""A class for detecting off-target mappings of primers and primer pairs that uses a custom
version of "bwa aln".
version of "bwa aln" named "bwa-aln-interactive".
The off-target detection is faster and more sensitive than traditional isPCR and in addition can
correctly detect primers that are repetitive and contain many thousands or millions of mappings
Expand All @@ -146,7 +146,7 @@ def __init__(
threads: Optional[int] = None,
keep_spans: bool = True,
keep_primer_spans: bool = True,
executable: str | Path = "bwa",
executable: str | Path = "bwa-aln-interactive",
) -> None:
"""
Args:
Expand Down

0 comments on commit 9ca141c

Please sign in to comment.