Skip to content

Commit

Permalink
Nucleotides
Browse files Browse the repository at this point in the history
  • Loading branch information
pjotrp committed Apr 30, 2010
1 parent d548e8d commit 8ac4f1f
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README
@@ -0,0 +1,3 @@
A new design for core functionality of the Bioruby project

Pjotr Prins
68 changes: 68 additions & 0 deletions lib/bio2/chemistry/nucleotide.rb
@@ -0,0 +1,68 @@
#
# Nucleotides (abreviated nt) are molecules that, when joined together, make
# up the structural units of RNA and DNA. In addition, nucleotides play
# central roles in metabolism.
#
# The purines are adenine (A) and guanine (G).
# The (complementary) pyrimidines are thymine (T) and cytosine (C).
# In RNA uracil (U) is the complementary pyrimidine of adenine.
#
# >> Bio2::DNA::A.to_s
# => "a"

module Bio2

class Nucleotide
end
class Purine < Nucleotide
end
class Pyrimidine <Nucleotide
end

module DNA
class A < Purine
def to_s()
"a"
end
end
class G < Purine
def to_s()
"g"
end
end
class T < Pyrimidine
def to_s()
"t"
end
end
class C < Pyrimidine
def to_s()
"c"
end
end
end # DNA

module RNA
class A < Purine
def to_s()
"a"
end
end
class G < Purine
def to_s()
"g"
end
end
class U < Pyrimidine
def to_s()
"u"
end
end
class C < Pyrimidine
def to_s()
"c"
end
end
end # RNA

end # Bio2

0 comments on commit 8ac4f1f

Please sign in to comment.