SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert fastq from NCBI SRA to fasta and qual? kmkocot Bioinformatics 7 10-09-2012 10:15 AM
converting consensus fastq to fasta zlu Bioinformatics 18 08-17-2011 10:11 AM
Split fastq to fasta and qual file? ewilbanks Bioinformatics 8 01-07-2011 03:02 AM
Converting Solexa FASTQ file to unique sequence tags DrD2009 Bioinformatics 16 08-09-2010 12:30 AM
format problem:convert fastq to seq/qual file anyone1985 Bioinformatics 1 04-10-2009 09:27 AM

Reply
 
Thread Tools
Old 01-17-2012, 12:04 PM   #1
oiiio
Senior Member
 
Location: USA

Join Date: Jan 2011
Posts: 104
Default Converting FASTA/qual file pair from 454 to FASTQ

Hi all,

Is there anything out there that can convert FASTA/qual file pairs from 454 to a single FASTQ file? I have seen plenty of tools that do the opposite already in my search...
oiiio is offline   Reply With Quote
Old 01-17-2012, 01:02 PM   #2
maubp
Peter (Biopython etc)
 
Location: Dundee, Scotland, UK

Join Date: Jul 2009
Posts: 1,543
Default

Biopython can a few lines, see "Converting FASTA and QUAL files into FASTQ files" in the tutorial,
Code:
from Bio import SeqIO
from Bio.SeqIO.QualityIO import PairedFastaQualIterator
handle = open("temp.fastq", "w") #w=write
records = PairedFastaQualIterator(open("example.fasta"), open("example.qual"))
count = SeqIO.write(records, handle, "fastq")
handle.close()
print "Converted %i records" % count
maubp is offline   Reply With Quote
Old 01-17-2012, 10:59 PM   #3
maasha
Senior Member
 
Location: Denmark

Join Date: Apr 2009
Posts: 153
Default

With Biopieces you can do:

Code:
read_454 -i test.fna -q test.fna.qual | write_fastq -o test.fq -x
maasha is offline   Reply With Quote
Old 01-18-2012, 01:34 AM   #4
TonyBrooks
Senior Member
 
Location: London

Join Date: Jun 2009
Posts: 298
Default

This has already been covered in a previous post

http://seqanswers.com/forums/showthr...ight=454+FASTQ
TonyBrooks is offline   Reply With Quote
Old 01-18-2012, 02:16 AM   #5
maubp
Peter (Biopython etc)
 
Location: Dundee, Scotland, UK

Join Date: Jul 2009
Posts: 1,543
Default

Quote:
Originally Posted by TonyBrooks View Post
This has already been covered in a previous post

http://seqanswers.com/forums/showthr...ight=454+FASTQ
Relevant, but not quite the same - that thread was about SFF to FASTQ or FASTA+QUAL.

This thread is about FASTA+QUAL to FASTQ.

Last edited by maubp; 01-18-2012 at 05:13 AM. Reason: typo
maubp is offline   Reply With Quote
Old 01-18-2012, 04:47 AM   #6
TonyBrooks
Senior Member
 
Location: London

Join Date: Jun 2009
Posts: 298
Default

Quote:
Originally Posted by maubp View Post
Relevant, but note quite the same - that thread was about SFF to FASTQ or FASTA+QUAL.

This thread is about FASTA+QUAL to FASTQ.
Sorry. There is definitely a thread on FASTA+QUAL to FASTQ though. Someone ended up posting a perl script that did it without the need for any specific software. I just posted the wrong link.

Here it is:

http://seqanswers.com/forums/showthread.php?t=2775

Check out post #17
TonyBrooks is offline   Reply With Quote
Old 01-18-2012, 06:55 AM   #7
essvee
Member
 
Location: Guelph

Join Date: Apr 2011
Posts: 11
Default

You can also use galaxy... under NGS: QC and Manipulation there is a tool called 'Combine FASTA and QUAL into FASTQ'
essvee is offline   Reply With Quote
Old 01-18-2012, 08:20 AM   #8
oiiio
Senior Member
 
Location: USA

Join Date: Jan 2011
Posts: 104
Default

Thanks everyone. I ended up using the maubp's biopython suggestion and it is working great. Sorry I didn't see the other thread earlier, it is titled 'fastq sequence converter' and I must have skipped over it.
oiiio is offline   Reply With Quote
Old 09-13-2012, 06:47 AM   #9
xApple
Member
 
Location: Behind you.

Join Date: Feb 2012
Posts: 12
Default

Taking on maubp's suggestion and making a better script to place in your ~/bin folder:

Code:
#!/usr/bin/env python

"""
Convert FASTA + QUAL file pairs to a single FASTQ file
http://seqanswers.com/forums/showthread.php?t=16925

You can use this script from the shell like this::
$ ./fasta_to_fastaq reads.fna reads.qual reads.fastq
"""

# The libraries we need #
import sys, os
from Bio import SeqIO
from Bio.SeqIO.QualityIO import PairedFastaQualIterator
# Get the shell arguments #
fa_path = sys.argv[1]
qa_path = sys.argv[2]
fq_path = sys.argv[3]
# Check that the paths are valid #
if not os.path.exists(fa_path): raise Exception("No file at %s." % fa_path)
if not os.path.exists(qa_path): raise Exception("No file at %s." % qa_path)
# Do it #
with open(fq_path, "w") as handle:
    records = PairedFastaQualIterator(open(fa_path), open(qa_path))
    count = SeqIO.write(records, handle, "fastq")
# Report success #
print "Converted %i records" % count

Last edited by xApple; 09-13-2012 at 08:04 AM.
xApple is offline   Reply With Quote
Old 01-01-2016, 04:55 PM   #10
mossman
Junior Member
 
Location: Missouri

Join Date: Jan 2016
Posts: 2
Default FASTA to FASTQ

Many thanks to all - was looking for something specific to a Mac but I can use several of these suggestions - my first post and it was a definite help for me - again many thanks
mossman 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 06:18 PM.


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