Skip to content

Instantly share code, notes, and snippets.

@jasonm
Created July 27, 2008 18:13
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 jasonm/2793 to your computer and use it in GitHub Desktop.
Save jasonm/2793 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'bio'
triplets = %w( 1 2 3 1 2 2 4 2 1 3 2 4 3 1 1 3 4 4 2 4 1 1 1 4 2 3 1)
bases = %w(a c t g)
decoded = []
bases.each do |i|
bases.each do |j|
bases.each do |k|
bases.each do |l|
test_triplets = triplets.map { |base_index|
[i,j,k,l][base_index.to_i - 1]
}.join
candidate = Bio::Sequence.auto(test_triplets).translate
decoded << candidate if candidate =~ /^M.*\*$/
end
end
end
end
puts decoded.uniq.sort
# MIIVEE*K*
# MILVEASN*
# MILVEVLN*
# MIVVEG*K*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment