Last active
August 29, 2015 14:05
-
-
Save wulab/fff1b37da295c778728a to your computer and use it in GitHub Desktop.
My solution to https://gist.github.com/vrybas/ec210d4ee934d26d39c6
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
class String | |
def translate(from_str, to_str) | |
IO.popen(["python", "-c", <<-CMD.gsub(/^\s{6}/,"")]) { |f| f.read.chomp } | |
import string | |
print '#{self}'.translate(string.maketrans('#{from_str}','#{to_str}')) | |
CMD | |
end | |
end | |
class Complement | |
def self.of_dna(dna) | |
dna.translate('GCTA','CGAU') | |
end | |
def self.of_rna(rna) | |
rna.translate('CGAU','GCTA') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment