Skip to content

Instantly share code, notes, and snippets.

@nikhilmetrani
Created April 15, 2018 22:24
Show Gist options
  • Save nikhilmetrani/dc64338e88784cdb1d714e82c409072b to your computer and use it in GitHub Desktop.
Save nikhilmetrani/dc64338e88784cdb1d714e82c409072b to your computer and use it in GitHub Desktop.
Pairing DNA Nucleotides
// http://fig.cox.miami.edu/~cmallery/150/gene/chargaff.htm
const pairDNA = (() => {
const basePairs = { A: 'T', T: 'A', C: 'G', G: 'C' };
return dnaStr => dnaStr.split('').reduce((acc, nuc) => [...acc, [nuc, basePairs[nuc]]], []);
})();
pairDNA("GCG");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment