From 44ae2951f6a98a4278ab4211ebe4e020e05cb001 Mon Sep 17 00:00:00 2001 From: John Marshall Date: Wed, 7 Jul 2021 12:34:43 +0100 Subject: [PATCH] Add "endpos" filter expression "endpos" is the (1-based inclusive) position of the rightmost mapped base of the read, as measured using the CIGAR string. (bam_endpos() returns 0-based exclusive, which is the same thing.) For unmapped reads, it is the same as "pos". --- sam.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sam.c b/sam.c index 9fcef88c5..b42d6c6d2 100644 --- a/sam.c +++ b/sam.c @@ -1166,6 +1166,14 @@ static int bam_sym_lookup(void *data, char *str, char **end, } break; + case 'e': + if (memcmp(str, "endpos", 6) == 0) { + *end = str+6; + res->d = bam_endpos(b); + return 0; + } + break; + case 'f': if (memcmp(str, "flag", 4) == 0) { str = *end = str+4;