@@ -140,6 +140,7 @@ def test_vcf_output_with_output_option(tmp_path, args, vcf_file):
140
140
("query --list-samples" , "1kg_2020_chrM.vcf.gz" ),
141
141
(r"query -f 'A\n'" , "sample.vcf.gz" ),
142
142
(r"query -f '%CHROM:%POS\n'" , "sample.vcf.gz" ),
143
+ (r"query -f '[%CHROM %POS %GT\n]'" , "sample.vcf.gz" ),
143
144
(r"query -f '%INFO/DP\n'" , "sample.vcf.gz" ),
144
145
(r"query -f '%AC{0}\n'" , "sample.vcf.gz" ),
145
146
(r"query -f '%REF\t%ALT\n'" , "sample.vcf.gz" ),
@@ -152,8 +153,6 @@ def test_vcf_output_with_output_option(tmp_path, args, vcf_file):
152
153
(r"query -f '%POS\n' -e 'POS=112'" , "sample.vcf.gz" ),
153
154
(r"query -f '[%CHROM\t]\n'" , "sample.vcf.gz" ),
154
155
(r"query -f '[%CHROM\t]\n' -i 'POS=112'" , "sample.vcf.gz" ),
155
- (r"query -f '%CHROM\t%POS\t%REF\t%ALT[\t%SAMPLE=%GT]\n'" , "sample.vcf.gz" ),
156
- (r"query -f 'GQ:[ %GQ] \t GT:[ %GT]\n'" , "sample.vcf.gz" ),
157
156
(r"query -f '[%CHROM:%POS %SAMPLE %GT\n]'" , "sample.vcf.gz" ),
158
157
(r"query -f '[%SAMPLE %GT %DP\n]'" , "sample.vcf.gz" ),
159
158
(
@@ -164,6 +163,18 @@ def test_vcf_output_with_output_option(tmp_path, args, vcf_file):
164
163
r"query -f '[%POS %QUAL\n]' -i'(QUAL > 10 && POS > 100000)'" ,
165
164
"sample.vcf.gz" ,
166
165
),
166
+ # Examples from bcftools query documentation
167
+ (r"query -f '%CHROM %POS %REF %ALT{0}\n'" , "sample.vcf.gz" ),
168
+ (r"query -f '%CHROM\t%POS\t%REF\t%ALT[\t%SAMPLE=%GT]\n'" , "sample.vcf.gz" ),
169
+ (r"query -f 'GQ:[ %GQ] \t GT:[ %GT]\n'" , "sample.vcf.gz" ),
170
+ # POS0 not supported
171
+ # (r"query -f '%CHROM\t%POS0\t%END\t%ID\n'", "sample.vcf.gz"),
172
+ # Filtering on GT not supported
173
+ # (r"query -f [%CHROM:%POS %SAMPLE %GT\n]' -i'GT=\"alt\"'", "sample.vcf.gz"),
174
+ # Indexing not supported in filtering
175
+ # (r"query -f '%AC{1}\n' -i 'AC[1]>10' ", "sample.vcf.gz"),
176
+ # TODO fill-out more of these when supported for more stuff is available
177
+ # in filtering
167
178
],
168
179
)
169
180
def test_output (tmp_path , args , vcf_name ):
@@ -211,10 +222,10 @@ def test_query_arithmethic(tmp_path, expr):
211
222
[
212
223
# Check boolean logic evaluation. Will evaluate this with
213
224
# POS=112, so POS=112 is True and POS!=112 is False
214
- ("POS==112 || POS!=112" , True ),
215
- ("POS==112 && POS!=112" , False ),
225
+ ("POS==112 || POS!=112" , True ),
226
+ ("POS==112 && POS!=112" , False ),
216
227
("POS==112 || POS!=112 && POS!= 112" , True ),
217
- ("(POS==112 || POS!=112) && POS!= 112" , False ),
228
+ ("(POS==112 || POS!=112) && POS!= 112" , False ),
218
229
],
219
230
)
220
231
def test_query_logic_precendence (tmp_path , expr , expected ):
0 commit comments