Expresses a per-variant condition on an annotation field that set membership cannot: non-empty / empty fields and numeric comparisons. Use the result as a condition value inside the annotation_clauses of variant_filter.

annotation_predicate(op, value = NULL)

Arguments

op

Character operator: "nonempty" (not NA and not the empty string), "empty" (NA or the empty string), "in" / "not_in" (set membership), or a numeric comparison "gt", "ge", "lt", "le" (greater / less than, or equal).

value

Comparison value: a single non-missing number for the numeric operators; a non-empty atomic vector for "in" / "not_in"; must be NULL for "nonempty" / "empty".

Value

A glow_annotation_predicate S3 object.

Details

Missing values never satisfy a positive test: NA is FALSE under "gt", "ge", "lt", "le" and "in", and TRUE under "empty" and "not_in". For the numeric operators, character-stored numbers are coerced with as.numeric(); values that do not parse count as missing.

See also

Examples

annotation_predicate("nonempty")
#> GLOWr annotation predicate: nonempty  
annotation_predicate("gt", 20)
#> GLOWr annotation predicate: gt 20 
annotation_predicate("in", c("D", "T"))
#> GLOWr annotation predicate: in D, T