Hello all,
I am trying to extract the mapped reads from a bam file for a specific region.
samtools view -h in.bam "chr1:regionstart-regionend" > out.bam
this gives me all the reads falling into that region. (which contains read that mapped into that region plus reads unmapped into that region)
I am looking for reads that mapped to that specific region. Which options can I include?
Or samtools in unable to do it?
Thank you in advance.
How are you distinguishing between reads that "fall" in a position, from reads that "map" to it?
That is basically I am not able to do it. I am interested in extracting reads mapped in a specific region.
To most of us, there is no difference in what you've done and what you're asking for, so clarification is required. Please elaborate on what the difference is between what you've done and what you're asking for by editing your original post.
Thank you. I added more explanation.
please, stop asking questions and acknowledge the answers (green tick on the left) or comment the answers:
Hello Pierre,
All the posts you pulled here does not answer the question I asked in this post. I have always acknowledged the answer.
Perhaps you're unaware of how to acknowledge answers. There should be a check mark (in addition to up/down arrows) that you as the OP can toggle on/off.
no: eg.: Understanding SAM file format answer is correct but not commented or not flagged as answered.
Got it. Changed it to answer. Thank you.