sambamba syntax for mapped and unmapped reads

91 views
Skip to first unread message

Katherine Chau

unread,
Jun 9, 2021, 9:57:19 AM6/9/21
to sambamba-discussion
If I want to extract all unmapped reads, sources online show the use of "unmapped and mate_is_unmapped" but wouldn't it make more sense to use OR instead of AND?

Can someone clarify this.

So if I want ALL unmapped reads:

sambamba view -f bam -F "unmapped or mate_is_unmapped"

If I want all mapped reads it would just be as simple as adding a "not" before this:

sambamba view -f bam -F "not (unmapped or mate_is_unmapped)"

But would I need to consider changing the "or" to 'and'. Not sure how the logic works here for sambamba.

Thank you!

Jordi Camps

unread,
Aug 17, 2021, 6:48:50 AM8/17/21
to sambamba-discussion
Hello,

I think the main point is to know if you are interested in unmapped reads (as you said) or somehow unmapped pairs.

If you are interested in unmapped reads, you don't need to query for the mate, so the condition would be just "unmapped".
If you are interested in a fully unmapped read pair, then you need to ask for the current read and it's pair to be unpammed: "unmapped and mate_is_unmapped"
If you are interested in read pairs that are not fully mapped (one end mapped but the other end unmapped), then you need to ask for reads which some of the ends are unmapped:  "unmapped or mate_is_unmapped"

For the mapped ones, you musy add "not" in front of the condition, again taking into consideration if you need only reads, or read pairs, and if those read pairs have to be fully mapped of half mapped.
El dia dimecres, 9 de juny de 2021 a les 15:57:19 UTC+2, kdb....@gmail.com va escriure:
Reply all
Reply to author
Forward
0 new messages