Skip to content

Commit

Permalink
test(preprocessor): strict test to make sure pharmcat_position.vcf an…
Browse files Browse the repository at this point in the history
…d pharmcat_position.uniallelic.vcf have the same content
  • Loading branch information
BinglanLi committed Aug 9, 2024
1 parent 3eebdca commit 0cbb7d0
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions preprocessor/tests/test_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,16 +411,11 @@ def test_prep_pharmcat_positions():
assert tmp_uniallelic.is_file()
assert uniallelic_mtime == tmp_uniallelic.stat().st_mtime

# check whether the uniallelic position file has the same number of positions as the position file
uniallelic_file_lines = helpers.read_vcf(helpers.uniallelic_pharmcat_positions_file, bgzipped=True).split('\n')
n_uniallelic_file_lines: int = len(uniallelic_file_lines)
# note that tmp_uniallelic is the equivalent uniallelic file generated from the pharmcat position file
tmp_uniallelic_lines = helpers.read_vcf(tmp_uniallelic, bgzipped=True).split('\n')
n_tmp_uniallelic_lines: int = len(tmp_uniallelic_lines)
# uniallelic_pharmcat_positions_file should
# have the same number of lines as its equivalent file generated from the pharmcat position file
assert n_uniallelic_file_lines == n_tmp_uniallelic_lines, \
'mismatching numbers of positions between %s and %s' % \
# check whether the uniallelic position file has the same file content as the position file
uniallelic_file_lines = helpers.read_vcf(helpers.uniallelic_pharmcat_positions_file, bgzipped=True)
tmp_uniallelic_lines = helpers.read_vcf(tmp_uniallelic, bgzipped=True)
assert uniallelic_file_lines == tmp_uniallelic_lines, \
'mismatching positions between %s and %s' % \
(helpers.uniallelic_pharmcat_positions_file.name, helpers.pharmcat_positions_file.name)


Expand Down

0 comments on commit 0cbb7d0

Please sign in to comment.