@@ -39,7 +39,12 @@ class UnsupportedArraySubscriptError(UnsupportedFilteringFeatureError):
39
39
40
40
class UnsupportedStringsError (UnsupportedFilteringFeatureError ):
41
41
issue = "189"
42
- feature = "String values currently not supported"
42
+ feature = "String values temporarily removed"
43
+
44
+
45
+ class UnsupportedFileReferenceError (UnsupportedFilteringFeatureError ):
46
+ issue = "175"
47
+ feature = "File references"
43
48
44
49
45
50
# The parser and evaluation model here are based on the eval_arith example
@@ -77,6 +82,11 @@ def __init__(self, tokens):
77
82
raise UnsupportedStringsError ()
78
83
79
84
85
+ class FileReference (Constant ):
86
+ def __init__ (self , tokens ):
87
+ raise UnsupportedFileReferenceError ()
88
+
89
+
80
90
class Identifier (EvaluationNode ):
81
91
def __init__ (self , mapper , tokens ):
82
92
self .field_name = mapper (tokens [0 ])
@@ -207,6 +217,10 @@ def make_bcftools_filter_parser(all_fields=None, map_vcf_identifiers=True):
207
217
string = pp .QuotedString ('"' ).set_parse_action (String )
208
218
constant = number | string
209
219
220
+ file_expr = (pp .Literal ("@" ) + pp .Word (pp .printables )).set_parse_action (
221
+ FileReference
222
+ )
223
+
210
224
identifier = pp .common .identifier ()
211
225
vcf_prefixes = pp .Literal ("INFO/" ) | pp .Literal ("FORMAT/" ) | pp .Literal ("FMT/" )
212
226
vcf_identifier = pp .Combine (vcf_prefixes + identifier ) | identifier
@@ -235,7 +249,7 @@ def make_bcftools_filter_parser(all_fields=None, map_vcf_identifiers=True):
235
249
)
236
250
comp_op = pp .oneOf ("< = == > >= <= !=" )
237
251
filter_expression = pp .infix_notation (
238
- constant | indexed_identifier | identifier ,
252
+ constant | indexed_identifier | identifier | file_expr ,
239
253
[
240
254
("-" , 1 , pp .OpAssoc .RIGHT , UnaryMinus ),
241
255
(pp .one_of ("* /" ), 2 , pp .OpAssoc .LEFT , BinaryOperator ),
0 commit comments