Created
January 15, 2009 22:52
-
-
Save drio/47683 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include Math | |
def chr_to_phred(s) | |
s.each_byte {|c| printf "%d,", (c-33) } | |
end | |
def chr_to_phred_chr(c) | |
#s.each_byte {|c| printf "%d,", (c-33) } | |
q = (10 * (log(1 + 10 ** (c - 64) / 10.0)) / log(10)).to_i | |
(((q <= 93) ? q : 93) + 33).chr | |
end | |
def slx_to_phred(s) | |
s.each_byte {|c| chr_to_phred_chr(c) } | |
end | |
f_exp = "HWI-EAS306_8277_FC307V5_PE 1 1 9 486 1 AAGGTGATGTGCTTGCTACCGNTAACAATACTGTAGGCATGGGTGATGCTGGTATTAAATCTGCCATTCAAGGCT aaaaaaaaaaaabaaaaaaaUE[aaaaaaaaaaaaaaabaaaaaaaabaaaaaaaaaaaabaaabbaba`]]aaa phi.fa 3031 F 21A53 101 0 0 N Y" | |
f_seq = "HWI-EAS306_8277_FC307V5_PE:1:1:9:486/1:AAGGTGATGTGCTTGCTACCGNTAACAATACTGTAGGCATGGGTGATGCTGGTATTAAATCTGCCATTCAAGGCT:aaaaaaaaaaaabaaaaaaaUE[aaaaaaaaaaaaaaabaaaaaaaabaaaaaaaaaaaabaaabbaba`]]aaa" | |
bar = f_seq.split(":") | |
seq = bar[5] | |
p_qual = bar[6] | |
slx_qual = f_exp.split[7] | |
#to_phred('a'[0]) | |
puts p_qual | |
slx_to_phred(slx_qual) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment