Go Back   SEQanswers > Bioinformatics > Bioinformatics

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to report only 1 hit read by bowtie2? zhouzaiwei Bioinformatics 2 09-10-2013 10:39 PM
SAM alignment result: match without reference report finfin General 0 07-23-2012 08:07 AM 26% of my sequences match the tag NNNNNNNNNNNN john1923 Bioinformatics 0 07-29-2011 07:42 AM

Thread Tools
Old 03-03-2015, 08:47 AM   #21
Devon Ryan
Location: Freiburg, Germany

Join Date: Jul 2011
Posts: 3,480

Therein lies the problem, there is no single definition of "uniqueness". There are multiple incompatible definitions. Further, if we relax the --score-min settings enough then by some definitions there will never be any unique alignments. This is why MAPQ is a generally more useful concept and you'd be better served just forgetting about the term "unique" in this context.
dpryan is offline   Reply With Quote
Old 03-03-2015, 08:36 PM   #22
Location: lucknow

Join Date: Dec 2013
Posts: 13

Thank you @devon
am@i is offline   Reply With Quote
Old 03-04-2015, 03:03 AM   #23
Junior Member
Location: Bonn, Germany

Join Date: Mar 2015
Posts: 3

Thanks for the help, I will try to figure out how to best solve the issue for my experiments.

I found this, which might be of interest to others trying to understand how bowtie2 assigns scores: link. There are also some interesting thoughts on uniqueness discussed in this and an older blog post.
JPOeyen is offline   Reply With Quote
Old 03-30-2017, 08:01 PM   #24
Junior Member
Location: Mexico City

Join Date: Jan 2012
Posts: 8

Hi all,
This worked for me, but I don't know if it is a general solution. If you set the -k paramenter in Bowtie2 to >=2, you should have at least twice the name of the read in your SAM file. You can use that to remove reads that appear >1 times in the file my_filename.sam. This way you don't have to undertand how Bowtie sets tags and flags.
tail -n +$(expr $(grep "^@" "$prefix.sam" | wc -l | cut -f 1 -d " ") + 1) "$prefix.sam" | sort | cut -f 1 | uniq -cd | cut -d " " -f 8 > "$prefix.toremove"
grep -vwF -f "$prefix.toremove" "$prefix.sam" > "$prefix.unique.sam"
rm "$prefix.toremove"
Comments appreciated.

Last edited by keo; 03-30-2017 at 08:18 PM.
keo is offline   Reply With Quote
Old 10-11-2019, 09:11 AM   #25
Junior Member
Location: Chania Greece

Join Date: Oct 2014
Posts: 2

Originally Posted by dpryan View Post
The presence of an XS auxiliary tag doesn't mean that an alignment isn't unique (n.b., "unique" isn't really a useful term, there's a reason for MAPQ scores). bowtie2 should only count an alignment as not unique if the XS and AS scores are the same.

Note that you're typically best off simply filtering by MAPQ score.
How would you filter with MAPQ score? I have rows with
MAPQ=39 ... AS:i:0 XS:i:0

39 seems like an arbitrary value. In my case, The lines that don't have XS score, have a score of 42.
chefarov is offline   Reply With Quote

bowtie2, unique reads, xs tag

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -8. The time now is 11:49 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO