Skip to content

Commit

Permalink
get reverse complement of sequence and get all possibilities (forward…
Browse files Browse the repository at this point in the history
… and reverse for degenerate sequence)
  • Loading branch information
bhofmei committed Nov 1, 2016
1 parent e0cbdc0 commit 8c49693
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions js/Store/Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,32 @@ Util = {
outAr = newAr;
}
return outAr;
},

_reverseComplement: function(inStr){
var baseAr = ['A','C','G','T'];
var out = '';
var i,k;
for(i=0; i < inStr.length; i++){
k = array.indexOf(baseAr, inStr.charAt(i).toUpperCase());
if(k===-1)
out = 'X'+out;
else
out = baseAr[3-k] + out;
}
return out;
},

getPossibilities: function(inStr){
// first get forward possibilities
var nucAr = Util._transformNuc(inStr);
// get reverse
var revAr = array.map(nucAr, function(x){
return Util._reverseComplement(x);
});
// combine
nucAr.push.apply(nucAr, revAr);
return nucAr;
}
}
return Util;
Expand Down

0 comments on commit 8c49693

Please sign in to comment.