sambamba icon indicating copy to clipboard operation
sambamba copied to clipboard

Support filtering of absolute template length

Open tolot27 opened this issue 4 years ago • 1 comments

This PR adds support for filtering absolute template length.

Currently, only positive template length values can be filtered, i. e. with sambamba view -S -F "template_length < 8000". Using "template_length < 8000 AND template_length > -8000" results in the following error:

sambamba-view: invalid symbol in input stream at position 23

The PR computes the absolute value of the template_length before comparison.

tolot27 avatar Jun 16 '21 09:06 tolot27

Hi @tolot27. Thanks for the patch and sorry for being late in picking it up. I have a question. According to the BAM specs template_length can be negative. Taking the absolute value will impact queries that test for tlen less than zero. Would it not be better to import std.math (like you did), but allow the CLI parameter to change to something like:

abs(template_length) < 8000

?

pjotrp avatar Jan 15 '22 12:01 pjotrp

Reject.

pjotrp avatar Aug 14 '23 12:08 pjotrp