Filter mapped reads by minimun match size in percentage

26 views
Skip to first unread message

IÑIGO OYARZUN LAFUENTE

unread,
Oct 9, 2020, 5:56:38 AM10/9/20
to NGLess
Hello NGLess develope team,

I have been trying to play around with the "min_match_size" argument in the mapping step of this script:
igc_mapped_post = select(igc_mapped) using |mr|:
    mr = mr.filter(min_match_size=45, min_identity_pc=95, action={drop})
    if not mr.flag({mapped}):
        discard

My goal is to make this argument obey a percentage instead a fixed number to make it fair for all the reads, no matter their size, as well as make it comparable with other software I am using. I have tried it first in this way:
igc_mapped = map(input, reference='igc', mode_all=True)
igc_mapped_post = select(igc_mapped) using |mr|:
    read = as_reads(mr)
    coverage_needed = len(read) * 0.9

    mr = mr.filter(min_match_size=coverage_needed, min_identity_pc=95, action={drop})
    if not mr.flag({mapped}):
        discard
But these errors jumped out:
Bad type in function call (function 'as_reads' expects NGLMappedReadSet got NGLMappedRead). for "read = as_reads(mr)"
List expected. Type Just NGLReadSet provided. for "len(read)"
variable "min_match_size". Expected NGLInteger got NGLDouble. for "min_match_size=coverage_needed" because coverage_needed is a float number instead of integer (I guess)

I have tried many possibilities but all of them ended up with similar errors about the variable type required. I run out of ideas to try so, before start learning bash to create a module, I wanted to ask you if you know any way implemented in NGLess to do this.

Thank you very much, best regards.
Iñigo.


Luis Pedro Coelho

unread,
Oct 12, 2020, 4:26:17 AM10/12/20
to NGLess List
Dear Iñigo,

What you are asking for is quite reasonable, but there is currently no way to do it that I can think of.

I made this into an issue, though, so the suggestion does not get lost in the mailing-list.


Best
Luis

Luis Pedro Coelho | Fudan University | http://luispedro.org
--
You received this message because you are subscribed to the Google Groups "NGLess" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ngless+un...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages