Skip to content

Instantly share code, notes, and snippets.

@JoshCheek
Created August 13, 2016 22:55
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 JoshCheek/9784b6c2995d5bf1b05977eafd65fa39 to your computer and use it in GitHub Desktop.
Save JoshCheek/9784b6c2995d5bf1b05977eafd65fa39 to your computer and use it in GitHub Desktop.
Central Dogma of Molecular Biology (https://vimeo.com/178754362)
# https://vimeo.com/178754362
# Central Dogma of Molecular Biology
# DNA --transcription--> RNA --translation--> proteins (which give us traits... and other stuff :)
# DNA is an arbitrarily long sequence of 4 molecules
# whose initials whose initials are A, T, G, and C
# A pairs with T
# C pairs with G
A = 'A' # => "A"
T = 'T' # => "T"
G = 'G' # => "G"
C = 'C' # => "C"
# RNA is an arbitrarily long sequence of 4 molecules
# whose initials whose initials are A, U, G, and C
U = 'U'
# Transcription maps DNA into RNA via a protein named "RNA Polymerase"
def transcribe(dna)
dna.map do |nucleotide|
case nucleotide
when 'A' then 'A'
when 'T' then 'U'
when 'C' then 'C'
when 'G' then 'G'
end
end
end
dna = [T, C, A, G, G, T] # => ["T", "C", "A", "G", "G", "T"]
rna = transcribe dna # => ["U", "C", "A", "G", "G", "U"]
# Translation maps every 3 RNA nucleotides into an amino acid
# and that "array" of amino acids is what makes a protein
# The 3 RNA nucleotides are called a "codon"
def translation(rna)
rna.each_slice(3).map do |codon|
if codon == ["U", "C", "A"]
'Serine'
elsif codon == ["G", "G", "U"]
'Glycine'
else raise codon.inspect
end
end
end
amino_acids = translation rna # => ["Serine", "Glycine"]
# Finally, the amino acids "fold" up based on chemistry
# that folded up amino acid strand is our protein
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment