ngsfilter discarding many records as "unidentified"
I am analyzing COI metabarcoding data. When I try to assign sequences to samples following "illuminapairedend", many records (just over half) end up in the "unidentified" file. Although some unidentified records end up with "error=No primer match", most have "error=Cannot assign sequence to a sample". When I look at one such sequence from the aligned fastq, I can start to see why it doesn't end up assigned to a sample: natacctctgggtgaccgaagaaccaaaacaaatgttgatataacactgggtcacctccacctgcaggatcaaaaaaagttgtattgaaatttctatctgttagaagcatcgtaatagctccagctaaaacaggtaatgataaaagcaataatacagctgttattaaaacagaccatgcaaaaagaggtaacttatgcataaataatccttttgttcgcatatttaaaattgtacagataaagttgatagctcctaaaatagaagaagctccagataaatgcaaactaaaaatagctaggtcgactgctggtcctgaatgagaatttccacttgataatggagggtatactgttcaacctgtaccatagcatn
The first 26 nucleotides correspond to the reverse primer's reverse complement, the last 8 to the identifying tag's RC, and the 26 preceding the tag correspond to the forward primer RC. Looking at the reverse complement of the above sequence: natgctatggtacaggttgaacagtataccctccattatcaagtggaaattctcattcaggaccagcagtcgacctagctatttttagtttgcatttatctggagcttcttctattttaggagctatcaactttatctgtacaattttaaatatgcgaacaaaaggattatttatgcataagttacctctttttgcatggtctgttttaataacagctgtattattgcttttatcattacctgttttagctggagctattacgatgcttctaacagatagaaatttcaatacaactttttttgatcctgcaggtggaggtgacccagtgttatatcaacatttgttttggttcttcggtcacccagaggtatn
Now everything looks fine - the first 8 nucleotides are the sample tag (I'm using 7 nucleotides "atgctat" in the ngsfilter text file to get around the "n"), followed by the forward primer, with the reverse primer at the very end. However, when I run the ngsfilter command, the aligned sequence (the first one above) ends up unidentified and looks like this: attatcaagtggaaattctcattcaggaccagcagtcgacctagctatttttagtttgcatttatctggagcttcttctattttaggagctatcaactttatctgtacaattttaaatatgcgaacaaaaggattatttatgcataagttacctctttttgcatggtctgttttaataacagctgtattattgcttttatcattacctgttttagctggagctattacgatgcttctaacagatagaaatttcaatacaactttttttgatcctgcaggtggaggtgacccagtgttatatcaacatttgttt
So, the ngsfilter command managed to use the reverse complement of the aligned record in order to identify the primers, then remove these primers and the identifying tag, and produce the expected 313bp fragment afterward - all of which is great to see. BUT, it did NOT successfully assign the sequence to its sample, even though I can clearly see that the reverse complement of the tag sequence exists in the original record. In addition, looking at this record in the unidentified.fastq, there is an attribute for "forward_tag=atgctat", which matches one of my sample tags from the associated text file. Oddly enough, the attribute of "reverse_tag=gagggta" is also given to this unidentified record, even though I used the "T" operator in the text file for forward primer and tag only. Successfully identified records have "reverse_tag=None" as expected.
It seems the ngsfilter command isn't able to truly recognize the reverse complement of the tag sequence, thus leaving these records unidentified. Is there an obvious workaround to this? Would somehow ensuring the direction of aligned sequences prevent this? Is there an option in either the illuminapairedend or ngsfilter commands that I'm overlooking?