Skip to content

Instantly share code, notes, and snippets.

@echiesse
Created May 20, 2017 04:45
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 echiesse/b46edc9763bbd3ce4fec1bbc4f78cd9c to your computer and use it in GitHub Desktop.
Save echiesse/b46edc9763bbd3ce4fec1bbc4f78cd9c to your computer and use it in GitHub Desktop.
DNA strand reverse
function strandComplRev(s)
local complements =
{
A = "T",
T = "A",
C = "G",
G = "C",
}
local s2 = ""
for c in string.gmatch(s, ".") do
s2 = complements[c] .. s2
end
return s2
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment