Skip to content

Instantly share code, notes, and snippets.

@crazyhottommy
Forked from mdozmorov/check_phred.sh
Created May 18, 2019 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crazyhottommy/aa55e4448e7e4d9d6ad9f7de369eecdb to your computer and use it in GitHub Desktop.
Save crazyhottommy/aa55e4448e7e4d9d6ad9f7de369eecdb to your computer and use it in GitHub Desktop.
Check Phred offset
# https://www.biostars.org/p/63225/
FILE=VLI9_AA_S60_L008_R1_001.fastq.gz
zcat $FILE | head -n 40 | awk '{if(NR%4==0) printf("%s",$0);}' | od -A n -t u1 | awk 'BEGIN{min=100;max=0;}{for(i=1;i<=NF;i++) {if($i>max) max=$i; if($i<min) min=$i;}}END{if(max<=74 && min<59) print "Phred+33"; else if(max>73 && min>=64) print "Phred+64"; else if(min>=59 && min<64 && max>73) print "Solexa+64"; else print "Unknown score encoding";}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment