SEQanswers

Go Back   SEQanswers > Applications Forums > RNA Sequencing



Similar Threads
Thread Thread Starter Forum Replies Last Post
sorting a BAM produces a smaller file than the original oiiio Bioinformatics 18 09-28-2015 11:57 AM
cuffmerge produces too many isoforms secda1 Bioinformatics 5 05-22-2013 11:13 AM
Sorting BAM by chromosome produces a much larger file. aramadhan Bioinformatics 6 01-21-2013 07:11 AM
BWA produces odd alignment results dandyrilla Bioinformatics 2 11-27-2011 11:28 PM
Samtools pipeline produces many indels Hkins552 Bioinformatics 2 06-17-2011 04:30 AM

Reply
 
Thread Tools
Old 02-27-2013, 05:23 AM   #1
atma_weapon
Member
 
Location: madrid

Join Date: May 2012
Posts: 11
Default gsnap produces more reads than fastq

hello, i am running gsnap with rna seq data against a reference genome:

gsnap -m 10 -B 5 -t 8 -A sam -d GENOME seqs.fastq > res.sam

but strangely, the output sam file contains more reads than the original fastq files:

$ cat seqs.fastq | echo $((`wc -l`/4))
3776979

$ cat res.sam | grep -v '^ *@' | wc -l
6009141



and I don't understand what that means....

thank you
atma_weapon is offline   Reply With Quote
Old 02-27-2013, 05:41 AM   #2
twaddlac
Member
 
Location: Pittsburgh, PA

Join Date: Feb 2011
Posts: 49
Default

I'm not familiar with gsnap but it seems like there could be a few factors, the most likely one being your grep command. When I try to find out how many alignments have been reported I use the command:
Code:
cut -f1 out.sam | sort | uniq | wc -l
That way you don't count nonspecific alignments. That being said, your SAM file may contain multiple alignments for many reads. There should be a flag to control how many alignments per read are reported but if not there are ways around it. I hop this helps!
twaddlac is offline   Reply With Quote
Old 02-27-2013, 06:53 AM   #3
severin
Genome Informatics Facility
 
Location: Iowa @isugif

Join Date: Sep 2009
Posts: 105
Default

Quote:
Originally Posted by twaddlac View Post
I'm not familiar with gsnap but it seems like there could be a few factors, the most likely one being your grep command. When I try to find out how many alignments have been reported I use the command:
Code:
cut -f1 out.sam | sort | uniq | wc -l
That way you don't count nonspecific alignments. That being said, your SAM file may contain multiple alignments for many reads. There should be a flag to control how many alignments per read are reported but if not there are ways around it. I hop this helps!
Besides mapping to multiple locations, the sam file also has a header that can contain many lines and throw off your count.
severin is offline   Reply With Quote
Old 02-27-2013, 07:21 AM   #4
twaddlac
Member
 
Location: Pittsburgh, PA

Join Date: Feb 2011
Posts: 49
Default

Quote:
Originally Posted by severin View Post
Besides mapping to multiple locations, the sam file also has a header that can contain many lines and throw off your count.
I forgot to mention, to omit the header lines you should do
Code:
grep -v '^@' out.sam | cut -f1 | sort | uniq | wc -l
If you convert your SAM file to BAM you will:
A) reduce the size of the file (BAM < SAM)
B) view the alignment output without the headers
Code:
samtools view out.bam
To convert the sam file to bam, just do
Code:
samtools view -bS out.sam > out.bam
twaddlac is offline   Reply With Quote
Old 02-27-2013, 11:11 PM   #5
Simon Anders
Senior Member
 
Location: Heidelberg, Germany

Join Date: Feb 2010
Posts: 994
Default

If a read is aligned to multiple location, it appears multiple times in the SAm file. Sort the file by read name, cut to the first coulmn (read name), pipe it through 'uniq', then count again.
Simon Anders is offline   Reply With Quote
Reply

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 03:46 PM.


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