The user can specify error rate globally with --error-rate, but they can also override it per-region with ~.
# match with a 0.2 error rate
if read matches [_ AGCTAGCTAG~0.2 _] => count!('contains primer')
Currently, the user can also specify match mode globally with --match-mode, but they cannot override it per-region; this would be a useful feature for fine-tuning the matching behaviour where necessary. Even though this would make these patterns more verbose, it would only be for niche scenarios where the user needs to specify fine-grained match semantics.
if read matches [_ GGG::{mode='all'} _ AAA::{mode='first'} _] => count!('match')
TTTTTTTGGGTTTTTTTTGGGTTTTTTAAATTTTTAAATTTTT
a ^^^.................^^^
b ^^^......^^^
c ^^^.........................^^^
d ^^^..............^^^
For this read, only the matches {a, b} are identified; all occurrences of GGG are matched, but only the first occurrence of AAA.
Maybe a more practical example, this could be used to specify matching to the end of a poly(A) tail:
# extract everything from the first occurrence of a primer to the end of a >=16bp poly(A) tail.
if read matches [_ trimmed:(AGCTAGCTAG::{error=0.2, mode='first'} _ AAAAAAAAAAAAAAAA::{error=0, mode='last'}) _ ] =>
trimmed.out!('out.fq')
By using a struct for these annotations, we would allow for both mode and distance to be specified with GGG::{error=0.2, mode='all'}, and allow for future extensions to what can be annotated in this way. Existing syntax GGG~0.2 could be retained but treated as sugar for GGG::{error=0.2}. The double-colon :: is just a first thought of course; alternative syntax ideas welcome.
The user can specify error rate globally with
--error-rate, but they can also override it per-region with~.Currently, the user can also specify match mode globally with
--match-mode, but they cannot override it per-region; this would be a useful feature for fine-tuning the matching behaviour where necessary. Even though this would make these patterns more verbose, it would only be for niche scenarios where the user needs to specify fine-grained match semantics.For this read, only the matches
{a, b}are identified; all occurrences ofGGGare matched, but only the first occurrence ofAAA.Maybe a more practical example, this could be used to specify matching to the end of a poly(A) tail:
By using a struct for these annotations, we would allow for both mode and distance to be specified with
GGG::{error=0.2, mode='all'}, and allow for future extensions to what can be annotated in this way. Existing syntaxGGG~0.2could be retained but treated as sugar forGGG::{error=0.2}. The double-colon::is just a first thought of course; alternative syntax ideas welcome.