/ruby/rna-transcription/complement.rb

1
2
3
4
5
6
7
8
9
10
11
12
class Complement
  @@dna_nucleotides = 'GCTA'
  @@rna_nucleotides = 'CGAU'

  def self.of_dna(nucleotide)
    nucleotide.tr(@@dna_nucleotides, @@rna_nucleotides)
  end

  def self.of_rna(nucleotide)
    nucleotide.tr(@@rna_nucleotides, @@dna_nucleotides)
  end
end

Comments


You're not logged in right now. Please login via GitHub to comment