This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Converting Phred64 fastq to Phred33 fastq

Hi all,

I've been asked to convert some Phred64 fastq files to Phred33 fastq

How can I perform this? Any recommended perl script?

Thank you

The following pipeline works pretty well. Thanks Frank:

  1. install fastq_phred_convert from github
  2. export PERL5LIB=$PERL5LIB:/home/user/fastq_phred_convert/
  3. Copy fastq_33_to_64.pl and fastq_63_to_33.pl to /usr/bin
  4. Use them as the traditional command: perl /usr/bin fastq_63_to_33.pl *input.fastq
phred64 phred33

2 answers

I recommend reformat from BBMap:

reformat.sh in=reads.fq out=reformatted.fq qin=64 qout=33

Hey!

I wrote two little perl scripts which should perform the requested operation. The script is available at https://github.com/greatfireball/fastq_phred_convert.

Just clone the repository

git clone https://github.com/greatfireball/fastq_phred_convert

and run the commands

cd fastq_phred_convert
./fastq_64_to_33.pl input.fq

The output will be written to STDOUT.

In case you need a progress report or find a bug... Just let me know.

Best,
Frank

PS: The other script can be used to convert from a 33 offset to 64 and is called

fastq_64_to_33.pl

Hi Foerster,

How to solve the problem, we can only use the perl script in the fold of /fastq_phred_convert/. We can not use this perl script in the directory of the data storage.

Best regards,

Hey Shicheng Guo,

Given that your data are located at /storage/some/place/input.fq and the perl scripts are located in /home/user/fastq_phred_convert/, you can call the program inside the script folder and redirect the output:

cd /home/user/fastq_phred_convert/
./fastq_33_to_64.pl /storage/some/place/input.fq > /storage/some/place/output.fq

In case you try to run it from the data folder you will receive an error like:

cd /storage/some/place/
/home/user/fastq_phred_convert/astq_33_to_64.pl input.fq > output.fq
Can't locate convert.pm in @INC[...]

So perl can not determine where the module is located. One way to fix this is the environmental variable PERL5LIB, which can be set to hold the location of modules. Just add (in case of bash) the installation folder to its end:

export PERL5LIB=$PERL5LIB:/home/user/fastq_phred_convert/
/home/user/fastq_phred_convert/astq_33_to_64.pl input.fq > output.fq

I will prepare a little fix to the scripts that will solve the problem (hopefully) also. After adding that fix, I will send you a note.

Best,
Frank

The update is available and fixes that issue.

Just go to your repository folder and run git pull

r clone the repository again as suggested in my first post.

Best regards,
Frank

Yes. it works pretty well.

  1. install fastq_phred_convert from github
  2. export PERL5LIB=$PERL5LIB:/home/user/fastq_phred_convert/
  3. copy fastq_33_to_64.pl and fastq_63_to_33.pl to /usr/bin
  4. use them as the traditional command: perl /usr/bin fastq_63_to_33.pl *input.fastq

Log in to answer this question.