Skip to content

Commit b5868de

Browse files
Add some validation tests for FILTER expressions
1 parent 4acd44e commit b5868de

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

tests/test_bcftools_validation.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,22 @@ def run_vcztools(args: str, expect_error=False) -> tuple[str, str]:
9393
"view --no-version -r '20:1230236-' -i 'FMT/DP>3' -s 'NA00002,NA00003'",
9494
"sample.vcf.gz"
9595
),
96+
(
97+
"view --no-version -i 'FILTER=\"VQSRTrancheSNP99.80to100.00\"'",
98+
"1kg_2020_chrM.vcf.gz"
99+
),
100+
(
101+
"view --no-version -i 'FILTER!=\"VQSRTrancheSNP99.80to100.00\"'",
102+
"1kg_2020_chrM.vcf.gz"
103+
),
104+
(
105+
"view --no-version -i 'FILTER~\"VQSRTrancheINDEL99.00to100.00\"'",
106+
"1kg_2020_chrM.vcf.gz"
107+
),
96108
],
97109
# This is necessary when trying to run individual tests, as the arguments above
98110
# make for unworkable command lines
99-
# ids=range(28),
111+
# ids=range(36),
100112
)
101113
# fmt: on
102114
def test_vcf_output(tmp_path, args, vcf_file):
@@ -187,23 +199,23 @@ def test_vcf_output_with_output_option(tmp_path, args, vcf_file):
187199
# Per-sample query tests
188200
(
189201
r"query -f '[%CHROM %POS %SAMPLE %GT %DP %GQ\n]' -i 'FMT/DP>3'",
190-
"sample.vcf.gz"
202+
"sample.vcf.gz",
191203
),
192204
(
193205
r"query -f '[%CHROM %POS %SAMPLE %GT %DP %GQ\n]' -i 'FMT/GQ>30'",
194-
"sample.vcf.gz"
206+
"sample.vcf.gz",
195207
),
196208
(
197209
r"query -f '[%CHROM %POS %SAMPLE %GT %DP %GQ\n]' -i 'FMT/DP>3 & FMT/GQ>30'",
198-
"sample.vcf.gz"
210+
"sample.vcf.gz",
199211
),
200212
(
201213
r"query -f '[%CHROM %POS %SAMPLE %GT %DP %GQ\n]' -i 'FMT/DP>3 && FMT/GQ>30'", # noqa: E501
202-
"sample.vcf.gz"
214+
"sample.vcf.gz",
203215
),
204216
(
205217
r"query -f '[%CHROM %POS %SAMPLE %GT %DP %GQ\n]' -r '20:1230236-' -i 'FMT/DP>3' -s 'NA00002,NA00003'", # noqa: E501
206-
"sample.vcf.gz"
218+
"sample.vcf.gz",
207219
),
208220
],
209221
)

0 commit comments

Comments
 (0)