Go Back   SEQanswers > Bioinformatics > Bioinformatics

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bowtie --sam option - includes non-aligned reads? ledsall Bioinformatics 3 02-24-2013 12:31 AM
From sam file, how to the mate aligned or not? fabrice Bioinformatics 2 08-09-2011 10:37 AM
Right way to convert splice-aligned Solexa reads (s_?_export.txt) to SAM format jorgebm Bioinformatics 0 09-23-2010 06:58 AM
Question on SAMtools variations calling of a BFAST-aligned SAM file? Ling Bioinformatics 4 02-02-2010 06:26 PM
Quality values for aligned reads in .sam file arnkas Bioinformatics 2 11-08-2009 03:41 PM

Thread Tools
Old 08-03-2012, 02:10 PM   #1
Location: California

Join Date: Nov 2009
Posts: 13
Default Obtain file from Bowtie containing only aligned reads in SAM format

Hi, I have been using bowtie with the -S option to align reads to a reference sequence, and get SAM file as the output.

What I want is to get ONLY the aligned reads in the output. Instead I get all of the reads, both aligned and unaligned, in a huge sam file.

I do not see an option to do this. I see an option to create an additional file of aligned reads, but it is not in sam format.

Does anyone know how to do this?

shanebrubaker is offline   Reply With Quote
Old 08-03-2012, 02:13 PM   #2
Location: Seattle, WA

Join Date: Mar 2009
Posts: 87

You will have to post-process your SAM file after bowtie:

I want to get `unique' alignments from SAM/BAM.

We prefer to say an alignment is `reliable' rather than `unique' as `uniqueness' is not well defined in general cases. You can get reliable alignments by setting a threshold on mapping quality:
samtools view -bq 1 aln.bam > aln-reliable.bam
You may want to set a more stringent threshold to get more reliable alignments.
mnkyboy is offline   Reply With Quote
Old 08-04-2012, 10:28 AM   #3
Senior Member
Location: San Diego

Join Date: May 2008
Posts: 912

You should be in SAM format as little as possible, because it's so huge. You should be piping your bowtie output into samtools, and converting them into bams on the fly.

bowtie -S whatever | samtools view -bSF4 - > mapped.bam

-b means that you want to output to be .bam -S means that the input is .sam -F4 means that reads that have the 4 flag will not be included. That'll be the mapped reads.
swbarnes2 is offline   Reply With Quote

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 07:58 AM.

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