Team:Dundee/dnaCodonWorker.js

From 2011.igem.org

(Difference between revisions)
Line 6: Line 6:
function parseData() {
function parseData() {
-
         sequence = sequence.replace(".", "...");
+
         sequence = sequence.replace(/\./g, "...");
var codons = sequence.match(/.{1,3}/g);
var codons = sequence.match(/.{1,3}/g);
for(var i = 0; i < codons.length; i++) {
for(var i = 0; i < codons.length; i++) {

Revision as of 10:17, 25 July 2011

var sequence = ""; self.addEventListener("message", function(e) { sequence = e.data; parseData(); }, false);

function parseData() {

       sequence = sequence.replace(/\./g, "...");

var codons = sequence.match(/.{1,3}/g); for(var i = 0; i < codons.length; i++) { postMessage(codons[i].toUpperCase()); } }