Skip to content

Instantly share code, notes, and snippets.

@femontanha
Created November 13, 2017 01:14
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 femontanha/0fad4219ed6edb1ee4c53b1552c32f7c to your computer and use it in GitHub Desktop.
Save femontanha/0fad4219ed6edb1ee4c53b1552c32f7c to your computer and use it in GitHub Desktop.
DNAStrand
function DNAStrand(dna) {
return dna.replace(/./g, function(c) {
return DNAStrand.pairs[c]
})
}
// OR
function DNAStrand(dna) {
return dna.split('').map((item) => pairs[item]).join('')
}
DNAStrand.pairs = {
A: 'T',
T: 'A',
C: 'G',
}
// e.g
DNAStrand('AAAAA')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment