Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • oiiio
    Senior Member
    • Jan 2011
    • 105

    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...
  • maubp
    Peter (Biopython etc)
    • Jul 2009
    • 1544

    #2
    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

    Comment

    • maasha
      Senior Member
      • Apr 2009
      • 153

      #3
      With Biopieces you can do:

      Code:
      read_454 -i test.fna -q test.fna.qual | write_fastq -o test.fq -x

      Comment

      • TonyBrooks
        Senior Member
        • Jun 2009
        • 303

        #4
        This has already been covered in a previous post

        Discussion of next-gen sequencing related bioinformatics: resources, algorithms, open source efforts, etc

        Comment

        • maubp
          Peter (Biopython etc)
          • Jul 2009
          • 1544

          #5
          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, 05:13 AM. Reason: typo

          Comment

          • TonyBrooks
            Senior Member
            • Jun 2009
            • 303

            #6
            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:

            Discussion of next-gen sequencing related bioinformatics: resources, algorithms, open source efforts, etc


            Check out post #17

            Comment

            • essvee
              Member
              • Apr 2011
              • 11

              #7
              You can also use galaxy... under NGS: QC and Manipulation there is a tool called 'Combine FASTA and QUAL into FASTQ'

              Comment

              • oiiio
                Senior Member
                • Jan 2011
                • 105

                #8
                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.

                Comment

                • xApple
                  Member
                  • Feb 2012
                  • 12

                  #9
                  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, 07:04 AM.

                  Comment

                  • mossman
                    Junior Member
                    • Jan 2016
                    • 2

                    #10
                    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

                    Comment

                    Latest Articles

                    Collapse

                    ad_right_rmr

                    Collapse

                    News

                    Collapse

                    Topics Statistics Last Post
                    Started by SEQadmin2, Today, 10:09 AM
                    0 responses
                    8 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, Yesterday, 08:59 AM
                    0 responses
                    14 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 06-02-2026, 12:03 PM
                    0 responses
                    22 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 06-02-2026, 11:40 AM
                    0 responses
                    19 views
                    0 reactions
                    Last Post SEQadmin2  
                    Working...