How To Extract Alignment With Mismatches From Bowtie Mapping
0
0
Entering edit mode
10.5 years ago
Chirag Nepal ★ 2.4k

Hey everybody,

I mapped small RNA (18-30 nt) reads using bowtie [outputFile=> acceptedhits.bam] and allowed two mismatches. Now i want to extract only those sequence reads which have either one or two mismatches. Could anyone suggest me how me to extract only those alignments (from bam file) which have mismatches.

I could re-map using no mismatch and subtract it, but i don't think that is a good way to do.

Any help will be appreciated. Thank you for your help in advance !

cheers Chirag

bowtie bam • 4.8k views
ADD COMMENT
3
Entering edit mode

I haven't used bowtie1 in a while, but I would suspect that samtools view -h acceptedhits.bam | grep -v "NM:i:0" | samtools view -bSo filtered.bam - might work.

ADD REPLY
0
Entering edit mode

if one wants to use the sam file and filter based on mismatches , what could be the best way to do?

ADD REPLY
0
Entering edit mode

Honestly, I'd write a short script in python using pysam. Then you have maximum flexibility, even if it's a bit slower.

ADD REPLY

Login before adding your answer.

Traffic: 1950 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6