SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
fastest solution to get bam2fastq done memento Bioinformatics 34 05-31-2014 03:51 AM
bam2fastq wangli RNA Sequencing 0 04-19-2012 08:20 AM

Reply
 
Thread Tools
Old 10-26-2012, 09:01 AM   #1
Zapages
Member
 
Location: NJ

Join Date: Oct 2012
Posts: 94
Default Bam2FastQ help

Hi guys,

I am new here. I am trying to use Bam2Fastq convert a very large (~7 GB) bam file to a fastq file, but whenever I try to do this, I get this weird message.

Basically I am trying to extract only aligned reads from a bam file, using this site as my guide: http://davetang.org/wiki/tiki-index....ls#Basic_usage

If that is not possible. If it is possible to convert the whole file to fastq will be good as well.

What I enter in Command Prompt
Code:
bam2fastq -o blah_aligned.fastq --no-unaligned Bamfilename.bam
The message I get:
Code:
The sequences in the BAM file are marked as Paired, but a single output
file is specified.  Ensure that the output filename (--output) includes
a # symbol to be replaced with the read number
If you could kindly help. I will really appreciate it. Thank you.

-Zapages
Zapages is offline   Reply With Quote
Old 10-26-2012, 10:22 AM   #2
kmcarr
Senior Member
 
Location: USA, Midwest

Join Date: May 2008
Posts: 1,168
Default

Run the command

Code:
bam2fastq -o blah_aligned_R#.fastq --no-unaligned Bamfilename.bam
This will create two output files blah_aligned_R1.fastq and blah_aligned_R2.fastq containing read #1 and read #2 of the read pairs respectively.
kmcarr is offline   Reply With Quote
Old 10-26-2012, 12:27 PM   #3
swbarnes2
Senior Member
 
Location: San Diego

Join Date: May 2008
Posts: 912
Default

Yeah, the program is trying to do the right thing in giving you two separate fastq files, but you told it only one fastq, and it doesn't like that.

If you want only aligned reads, use samtools view -bF 4 to filter your .bam first.
swbarnes2 is offline   Reply With Quote
Old 10-28-2012, 07:41 AM   #4
Zapages
Member
 
Location: NJ

Join Date: Oct 2012
Posts: 94
Default

Thank you guys^

Quote:
Originally Posted by swbarnes2 View Post
Yeah, the program is trying to do the right thing in giving you two separate fastq files, but you told it only one fastq, and it doesn't like that.

If you want only aligned reads, use samtools view -bF 4 to filter your .bam first.
I have used bamview and Bamseek to see the sequence that we are interested in are present. Everything lines up with the sequence that we are interested.

Anyway should I sort with samtools. I think the bam file is already aligned, but I am not too sure.

How do you sort in with sam tools?

Last edited by Zapages; 10-28-2012 at 07:45 AM.
Zapages is offline   Reply With Quote
Old 10-30-2012, 03:18 AM   #5
maubp
Peter (Biopython etc)
 
Location: Dundee, Scotland, UK

Join Date: Jul 2009
Posts: 1,542
Default

Quote:
Originally Posted by swbarnes2 View Post
Yeah, the program is trying to do the right thing in giving you two separate fastq files, but you told it only one fastq, and it doesn't like that.
That's rather frustrating - two paired FASTQ files is only the 'right thing' for some tools, others prefer a single interleaved FASTQ file (which makes piping streams much easier!).
maubp 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 05:08 AM.


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