Skip to content

Instantly share code, notes, and snippets.

@estebistec
Created May 16, 2015 15:51
Show Gist options
  • Save estebistec/a363b9105f50af30b17f to your computer and use it in GitHub Desktop.
Save estebistec/a363b9105f50af30b17f to your computer and use it in GitHub Desktop.
find complement strand
(function(export) {
var symbolComplements = {
"A": "T",
"T": "A",
"C": "G",
"G": "C"
};
export.DNA = {
complementStrand: function(strand) {
var complement = '';
if(strand) {
for(index in strand) {
var symbol = strand[index];
complement += symbolComplements[symbol];
}
}
return complement;
}
};
})(window);
console.log(DNA.complementStrand("ATTGC"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment