Convert Phred score 41 to 40
2
0
Entering edit mode
7.4 years ago

I need to convert new data (Illumina 1.8+) to 454 format (old Sanger).

According to this page (http://www.dylanstorey.com/node/54), only difference in these two formats is that new Illumina can have score 41 (letter J), whereas old Sanger goes only up to 40. Is there any tool to convert all 41 scores to 40 (letter I) in fastq?

fastq • 1.9k views
0
Entering edit mode

I think this question has been asked before: Convert Illumina Reads To Sanger Score

0
Entering edit mode

Its not the same question as I am not interested in converting ASCII-64 to Sanger score (ASCII-33). Instead, both my formats are in ASCII-33 (Sanger), just one goes from 0..41 and second from 0..40

2
Entering edit mode
7.4 years ago
xb ▴ 420

Is this what you want?

cat <your-fastq-file> | awk ' {if(NR %4 == 0) {gsub("J","I");print} else {print}}'


If it is a .gz file, use zcat to read it and gzip to zip it back.

1
Entering edit mode
7.4 years ago

If you don't care about converting all the 'J's to 'I's (slightly lowering the scores of some bases), you can use sed:

sed -e '4~4y/J/I/' fastqfile.fastq > fastqfile.illuminaphred.fastq


You can also add the -i option to modify the file in place, without having to copy it to fastqfile.illuminaphred.fastq.