Question: Extraction Of Desired Alignments From Sam File
0
gravatar for Raghav
6.0 years ago by
Raghav100
Allahabad, India
Raghav100 wrote:

hello every one,

after running bowtie2 by using "bowtie2-align -f AT_ref -f GAC.fasta -S 1.sam" and got the details summery 616571 reads; of these:

616571 (100.00%) were unpaired; of these:

180433 (29.26%) aligned 0 times

306495 (49.71%) aligned exactly 1 time

129643 (21.03%) aligned >1 times,

as I guess, my chimeric reads would be in 129643 (21.03%) aligned >1 times out of 616571 reads; but I am not be able to extract these alignments from my output sam file. I don't know how to write syntax for this purpose. please suggest me.

thank you

bowtie2 sam • 1.9k views
ADD COMMENTlink modified 6.0 years ago by bow780 • written 6.0 years ago by Raghav100
1

The bowtie2 executable is actually a Perl wrapper script that calls the compiled bowtie2-align binary. It is recommended that you always run the bowtie2 wrapper and not run bowtie2-align directly.

ADD REPLYlink written 6.0 years ago by Ido Tamir5.0k
1
gravatar for bow
6.0 years ago by
bow780
Netherlands
bow780 wrote:

Here's one way to extract duplicate alignments from a SAM file.

Note that I'm assuming duplicate alignments == SAM records with the same QNAME

samtools view -F 0x4 input.sam | cut -f1 | sort | uniq -d | grep -F -f - input.sam

I haven't tested this, but you should do samtools view input.sam | cut -f1 | sort | uniq -d | wc -l first, to see if you get the same counts for duplicate reads as bowtie2's. If it's not the same, try playing around with the -f and/or -F flag to filter the reads first (I'm using -F 0x4 already to filter out unmapped reads).

ADD COMMENTlink modified 6.0 years ago • written 6.0 years ago by bow780
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1172 users visited in the last hour