ngless-toolkit/ngless

Add read_length() to ShortRead type

unode opened this issue · 2 comments

unode commented

This was something that was requested in an offline discussion.

Given a Fastq file with variable read length (e.g. after preprocessing):

mapped = select(mapped) using |mr|:
    mr = mr.filter(min_match_size={read_length}, action={drop})
    if not mr.flag({mapped}):     ^^^^^^^^^^^^^
        discard

here {read_length} could be mr.read_length().

In a paired-end read, does this apply to both mates?

unode commented

In a paired-end read, does this apply to both mates?

Tricky question, but I see your point. I'd say read_length() == forward + reverse.
However from the offline discussion I think the goal was per-read length which would require two methods.

So given this we could have forward_read_length() and reverse_read_length().
However these would not make sense in a single-end context and error'ing there would be inconvenient.

What do you say to return read_length() for forward_read_length() and 0 for reverse_read_length() when in a single-end context?