Question: How to filter unique reads from sam file?
0
gravatar for Medhat
4.7 years ago by
Medhat8.5k
Texas
Medhat8.5k wrote:

How to extract unique mapped reads from sam alignment file of pair end reads

The mapping was done using bowtie2.

there is different posts for the same topic suggesting to use the 11 , 12 columns AS and XS 

others say Unique alignments in bowtie2 have MAPQ>=2

and which option shall I use for bowtie2 to get an option like -m from bowtie ?

 

 

ADD COMMENTlink modified 4.7 years ago by Renesh1.7k • written 4.7 years ago by Medhat8.5k
3
gravatar for Devon Ryan
4.7 years ago by
Devon Ryan92k
Freiburg, Germany
Devon Ryan92k wrote:

It depends on how unique unique should be. The only reliable way to select only alignments for which the next best alignment has a lower score is by comparing the AS and XS tags (when they're the same, the MAPQ will be 0 or 1, though the MAPQ can also be 1 if these tags differ). Having said all of that, you're better off filtering at a MAPQ of 5 or so for most purposes.

There is no equivalent of -m in bowtie2 and there's no exact way to implement it in post-processing if you were to use -a.

ADD COMMENTlink written 4.7 years ago by Devon Ryan92k

So there is no way for bowtie2 to map the unique reads from the start " and -k option also will not do the job" 

ADD REPLYlink written 4.7 years ago by Medhat8.5k

Yeah, -k isn't really a substitute, since if it has more than what you specify with -k then it'll just won't report some of them, rather than suppressing all of them. Perhaps bowtie2 sets NH appropriately in that case, but I rather doubt it.

ADD REPLYlink written 4.7 years ago by Devon Ryan92k

Actually, you probably could just post-process the output of -a, though that's likely going to be slow.
 

ADD REPLYlink written 4.7 years ago by Devon Ryan92k
2
gravatar for Brice Sarver
4.7 years ago by
Brice Sarver3.2k
United States
Brice Sarver3.2k wrote:

This post basically covers everything: Bowtie2, -M Alignment/Reporting Mode

It includes discussion of the different -k options and the different columns that are added when a read is identified as multiply mapped.

ADD COMMENTlink written 4.7 years ago by Brice Sarver3.2k
1
gravatar for Renesh
4.7 years ago by
Renesh1.7k
United States
Renesh1.7k wrote:

To find unique alignment from bowtie2, you can check the NH flag option in sam file. The unique alignment will have flag NH:i:1.

ADD COMMENTlink written 4.7 years ago by Renesh1.7k

+1 Indeed, this is more convenient than comparing AS and XS tags (at least assuming one means "has a second best alignment with an inferior score to the best alignment" by "unique").

ADD REPLYlink written 4.7 years ago by Devon Ryan92k

Haven't used bowtie2 for a while but if I remember correctly Bowtie2 doesn't generate "NH:" tag for reads in the SAM file. I usually go with concordantly mapped paired-end reads using "YT:Z:CP" tag rather than using MAPQ to extract reliable alignments. 

ADD REPLYlink modified 4.7 years ago • written 4.7 years ago by Ashutosh Pandey11k

no such NH flag Best Way To Get Truly Unique Reads In Bowtie/Sam?

ADD REPLYlink written 4.7 years ago by Medhat8.5k
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: 1078 users visited in the last hour