Seqanswers Leaderboard Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • ewilbanks
    Member
    • Mar 2009
    • 83

    Split fastq to fasta and qual file?

    Hi all,

    Does anyone have or know about good scripts to split a sanger format fastq file into the corresponding fasta and qual file?? I have a dataset that I'd like to quality trim with LUCY but I can't figure out how to get it split apart! I've tried using the app on the galaxy page -- but its producing weird errors that I don't understand. Any help much appreciated!!

    -Lizzy
  • maasha
    Senior Member
    • Apr 2009
    • 153

    #2
    This can be done with Biopieces (www.biopieces.org):

    Code:
    read_fastq -i test.fq | write_454 -o test.fna -q test.fna.qual -x

    Cheers,


    Martin

    Comment

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

      #3
      In Biopython the simplest way to do it is like this:

      Code:
      from Bio import SeqIO
      SeqIO.convert("example.fastq", "fastq", "example.fasta", "fasta")
      SeqIO.convert("example.fastq", "fastq", "example.qual", "qual")
      You can be more cunning if you want to avoid making two passes through the FASTQ, but the above should be pretty fast anyway.

      See also http://dx.doi.org/10.1093/nar/gkp1137 - I'd have suggested using EMBOSS seqret which can do FASTQ to FASTA, but I don't think it supports the QUAL format.

      Comment

      • ewilbanks
        Member
        • Mar 2009
        • 83

        #4
        thank you!! The Biopython script did the trick-- even for a python newbie!

        Comment

        • ewilbanks
          Member
          • Mar 2009
          • 83

          #5
          Do you know how to use Biopython to do the reverse? Fasta +qual = fastq?

          Comment

          • maasha
            Senior Member
            • Apr 2009
            • 153

            #6
            Well, Biopieces can do that as well:

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

            In fact, Biopieces can also trim sequences based on quality scores by using trim_seq:


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


            Martin
            Last edited by maasha; 01-06-2011, 10:36 AM.

            Comment

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

              #7
              Originally posted by ewilbanks View Post
              Do you know how to use Biopython to do the reverse? Fasta +qual = fastq?
              Since you asked, yes, most easily done with the PairedFastaQualIterator function in the Bio.SeqIO.QualityIO module:

              Code:
              from Bio import SeqIO
              from Bio.SeqIO.QualityIO import PairedFastaQualIterator
              rec_iter = PairedFastaQualIterator(open("Quality/example.fasta"),
                                                 open("Quality/example.qual"))
              SeqIO.write(rec_iter, "Quality/temp.fastq", "fastq")
              This isn't quite as easy as the reverse since we need to take two input files and read over them in sync - and the high level functions in Bio.SeqIO are all intended for just one file. This example is based on the example in the documentation here:

              Comment

              • ewilbanks
                Member
                • Mar 2009
                • 83

                #8
                Thanks everyone!

                @maasha, I'll have to check it out! Does trim_seq accept sanger format qualities or only Solexa?

                Comment

                • maasha
                  Senior Member
                  • Apr 2009
                  • 153

                  #9
                  trim_seq works on Illumina type qualities.

                  read_fastq and read_454 convert to Illumina type qualities per default. Phred scores are automagically detected and converted. If you have Solexa scores there is a switch.

                  write_fastq output Illumina type qualities.

                  write_454 automagically convertes to decimal scores.



                  Cheers,


                  Martin

                  Comment

                  Latest Articles

                  Collapse

                  • seqadmin
                    Pathogen Surveillance with Advanced Genomic Tools
                    by seqadmin




                    The COVID-19 pandemic highlighted the need for proactive pathogen surveillance systems. As ongoing threats like avian influenza and newly emerging infections continue to pose risks, researchers are working to improve how quickly and accurately pathogens can be identified and tracked. In a recent SEQanswers webinar, two experts discussed how next-generation sequencing (NGS) and machine learning are shaping efforts to monitor viral variation and trace the origins of infectious...
                    03-24-2025, 11:48 AM
                  • seqadmin
                    New Genomics Tools and Methods Shared at AGBT 2025
                    by seqadmin


                    This year’s Advances in Genome Biology and Technology (AGBT) General Meeting commemorated the 25th anniversary of the event at its original venue on Marco Island, Florida. While this year’s event didn’t include high-profile musical performances, the industry announcements and cutting-edge research still drew the attention of leading scientists.

                    The Headliner
                    The biggest announcement was Roche stepping back into the sequencing platform market. In the years since...
                    03-03-2025, 01:39 PM

                  ad_right_rmr

                  Collapse

                  News

                  Collapse

                  Topics Statistics Last Post
                  Started by seqadmin, 03-20-2025, 05:03 AM
                  0 responses
                  49 views
                  0 reactions
                  Last Post seqadmin  
                  Started by seqadmin, 03-19-2025, 07:27 AM
                  0 responses
                  57 views
                  0 reactions
                  Last Post seqadmin  
                  Started by seqadmin, 03-18-2025, 12:50 PM
                  0 responses
                  50 views
                  0 reactions
                  Last Post seqadmin  
                  Started by seqadmin, 03-03-2025, 01:15 PM
                  0 responses
                  201 views
                  0 reactions
                  Last Post seqadmin  
                  Working...