Question: Extraction Of Desired Alignments From Sam File
gravatar for Raghav
7.1 years ago by
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 • 2.2k views
ADD COMMENTlink modified 7.1 years ago by bow790 • written 7.1 years ago by Raghav100

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 7.1 years ago by Ido Tamir5.0k
gravatar for bow
7.1 years ago by
bow790 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 7.1 years ago • written 7.1 years ago by bow790
Please log in to add an answer.


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