biod / sambamba

Tools for working with SAM/BAM data
http://thebird.nl/blog/D_Dragon.html
GNU General Public License v2.0
565 stars 105 forks source link

Support filtering of absolute template length #479

Closed tolot27 closed 1 year ago

tolot27 commented 3 years ago

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.

pjotrp commented 2 years ago

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 commented 1 year ago

Reject.