Seqanswers Leaderboard Ad



No announcement yet.
  • Filter
  • Time
  • Show
Clear All
new posts

  • Convert fastq from NCBI SRA to fasta and qual?

    Hi all,

    I have downloaded some 454 and Illumina data from the NCBI SRA that is in .fastq format.

    Example 454 data:
    @SRR000072.1 ERBRDQF01EGP9U length=67
    +SRR000072.1 ERBRDQF01EGP9U length=67
    I can't figure out how to convert this data to .fasta and .qual. I checked out this page: but I don't know which type of fastq data it is. At any rate, none of the fastq to fasta converters worked. I also tried the fastq_to_fasta program from this site but it didn't work either. Any assistance in finding a linux-based conversion tool would be greatly appreciated!

    Thank you!

  • #2
    For explaination of differences within the fastq format take a look at this thread:

    I would recommend you to start looking at the script in MAQ.

    Personally, I prefer to use Python for this kind of tasks. for more info see this short article:
    O|B|F News: Working with FASTQ files in Biopython when speed matters


    • #3
      Any FASTQ file from the NCBI SRA seems to already be in the standard Sanger FASTQ format (even if originally from a Solexa/Illumina machine it has been converted). See:

      As Andreas has suggested, you could use Biopython to do FASTQ -> QUAL and FASTQ -> FASTA, these can be done with trivial two line scripts using Biopython 1.52 or later:


      • #4
        Originally posted by kmkocot View Post
        I checked out this page: but ... none of the fastq to fasta converters worked.
        I just commented on the other thread, that looks like a bug in the website with some characters in FASTQ quality strings:
        Discussion of next-gen sequencing related bioinformatics: resources, algorithms, open source efforts, etc


        • #5
          Thanks all! I will look into the biopython scripts.


          • #6
            I have BioPython 1.49 and I found the utilities I need but I'm having trouble. I'm using Ubuntu Linux. I started python from a terminal while in the same directory as my desired input fastq file. I tried the tests recommended in the manual but I'm not sure if they are working correctly. import Bio returned nothing (normal, right?) but print Bio.__version__ returned a syntax error (as did print Bio.149, print Bio.1.49, etc). It wasn't clear to me what I should actually type. Is my version too old?

            Here's the code I used and messages printed to standard output:
            >>> from Bio import SeqIO
            >>> SeqIO.convert("output.fasta", "fasta", "Biomphalaria_glabrata_454.fastq", "fastq")
            Traceback (most recent call last):
              File "<stdin>", line 1, in <module>
            AttributeError: 'module' object has no attribute 'convert'
            Is my version of BioPython too old? I couldn't for the life of me figure out how to install it without synaptic. It kept saying it couldn't find Python.h.



            • #7
              Yes, Biopython 1.49 is too old. You need at least Biopython 1.51 for FASTQ support, and at least Biopython 1.52 for the Bio.SeqIO.convert function:

              Which version of Ubuntu are you using? I'm guessing jaunty from this listing:

              I install Biopython from source on Ubuntu (I currently use Karmic, but used to use Dapper before that which is really old now).

              You need to install the build dependencies, for example the python-dev package which will include the header files like Python.h which you are currently missing. As described on try this first:

              sudo apt-get build-dep python-biopython

              P.S. Once you have this installed, the Bio.SeqIO.convert function takes the input file and format then the output file and format. Your attempted example seems to have this the wrong way round.
              Last edited by maubp; 01-23-2010, 06:43 AM.


              • #8
                Here is a script that you can place in your bin/ directory:

                #!/usr/bin/env python
                Convert single FASTAQ files to FASTA + QUAL file pairs
                You can use this script from the shell like this::
                $ ./fastaq_to_fasta reads.fastq reads.fna reads.qual
                # The libraries we need #
                import sys, os
                from Bio import SeqIO
                # Get the shell arguments #
                fq_path = sys.argv[1]
                fa_path = sys.argv[2]
                qa_path = sys.argv[3]
                # Check that the path is valid #
                if not os.path.exists(fq_path): raise Exception("No file at %s." % fa_path)
                # Do it #
                SeqIO.convert(fq_path, "fastq", qa_path, "qual")
                SeqIO.convert(fq_path, "fastq", fa_path, "fasta")


                Latest Articles


                • seqadmin
                  Best Practices for Single-Cell Sequencing Analysis
                  by seqadmin

                  While isolating and preparing single cells for sequencing was historically the bottleneck, recent technological advancements have shifted the challenge to data analysis. This highlights the rapidly evolving nature of single-cell sequencing. The inherent complexity of single-cell analysis has intensified with the surge in data volume and the incorporation of diverse and more complex datasets. This article explores the challenges in analysis, examines common pitfalls, offers...
                  06-06-2024, 07:15 AM
                • seqadmin
                  Latest Developments in Precision Medicine
                  by seqadmin

                  Technological advances have led to drastic improvements in the field of precision medicine, enabling more personalized approaches to treatment. This article explores four leading groups that are overcoming many of the challenges of genomic profiling and precision medicine through their innovative platforms and technologies.

                  Somatic Genomics
                  “We have such a tremendous amount of genetic diversity that exists within each of us, and not just between us as individuals,”...
                  05-24-2024, 01:16 PM





                Topics Statistics Last Post
                Started by seqadmin, Today, 07:49 AM
                0 responses
                Last Post seqadmin  
                Started by seqadmin, Yesterday, 07:23 AM
                0 responses
                Last Post seqadmin  
                Started by seqadmin, 06-17-2024, 06:54 AM
                0 responses
                Last Post seqadmin  
                Started by seqadmin, 06-14-2024, 07:24 AM
                0 responses
                Last Post seqadmin