Skip to content

fix: Remove spliced alignments from DP calculation #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jun 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 14 additions & 19 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,26 @@ on: [push]

jobs:
test:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
python-version: [ '3.8', '3.9', '3.10' ]

steps:
- uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get --assume-yes install build-essential libcurl4-openssl-dev libz-dev liblzma-dev
python -m pip install --upgrade pip
pip install setuptools wheel
# this is needed by pybedtools
sudo apt-get --assume-yes install bedtools
# install python requirements
pip install -r requirements.txt
- name: Install vafator
run: |
python setup.py bdist_wheel
pip install dist/vafator-*.whl

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install .

- name: Run integration tests
run: |
make clean integration_tests
13 changes: 9 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,24 @@ on:

jobs:
deploy:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: 3.10

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine

- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
twine upload dist/*
42 changes: 24 additions & 18 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,31 @@ on: [push]

jobs:
test:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

strategy:
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
python-version: ['3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel coverage
pip install virtualenv tox==3.26.0 tox-wheel==1.0.0 tox-gh-actions
- name: Build, install and run unit tests
run: |
pip install -r requirements.txt
coverage run -m unittest discover vafator.tests
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install .
pip install coverage codecov

- name: Run tests with coverage
run: |
coverage run -m unittest discover

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ pysam~=0.19.1
cyvcf2~=0.30.14
logzero~=1.7.0
pybedtools~=0.9.0
numpy>=1.20,<2.0
scipy>=1.0.0,<2.0.0
2 changes: 1 addition & 1 deletion vafator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION='2.2.0'
VERSION='2.2.1'


AMBIGUOUS_BASES = ['N', 'M', 'R', 'W', 'S', 'Y', 'K', 'V', 'H', 'D', 'B']
5 changes: 3 additions & 2 deletions vafator/pileups.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
if start > variant_position:
break
if not match:
# TODO: when finds a read with an indel not matching our particular indel it counts it

Check notice on line 151 in vafator/pileups.py

View check run for this annotation

codefactor.io / CodeFactor

vafator/pileups.py#L151

Unresolved comment '# TODO: when finds a read with an indel not matching our particular indel it counts it'. (C100)
pass
elif pileup_read.indel == 0:
# NOTE: considers all reads without indels to be the reference!
Expand Down Expand Up @@ -181,9 +181,10 @@
all_positions = aggregate_list_per_base(bases, pileup.get_query_positions())

if include_ambiguous_bases:
dp = len(bases)
dp = len([b for b in bases if b!= ""])
else:
dp = len([b for b in bases if b not in AMBIGUOUS_BASES])
# remove ambiguous bases and reads where the position is spliced out
dp = len([b for b in bases if b not in AMBIGUOUS_BASES and b != ""])
ac = Counter(bases)
except StopIteration:
# no reads
Expand Down