Skip to content

Commit

Permalink
take nuc degenerate sequence into array of possible sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
bhofmei committed Nov 1, 2016
1 parent fa5233a commit fbc47f6
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
40 changes: 40 additions & 0 deletions js/Store/Util.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
define('NucleotideDensityPlugin/Store/Util',[
'dojo/_base/declare',
'dojo/_base/array',
'dojo/_base/lang',
'dojo/json',
'dojo/text!plugins/NucleotideDensityPlugin/nucleotide_table.json'
],
function(
declare,
array,
lang,
JSON,
nucleotidetable
){
var Util;
var ntable = JSON.parse(nucleotidetable);
Util = {

_transformNuc: function(inStr){
var n = inStr.length;
var outAr = [''];
var i;
for(i=0; i < n; i++){
var p = inStr.charAt(i).toUpperCase();
var v=ntable[p];
var newAr= [];
array.forEach(outAr, function(item){
var m = array.map(v,function(nuc){
return item+nuc;
});
newAr.push.apply(newAr, m);
});

outAr = newAr;
}
return outAr;
}
}
return Util;
});
18 changes: 18 additions & 0 deletions nucleotide_table.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"A": ["A"],
"C": ["C"],
"G": ["G"],
"T": ["T"],
"U": ["T"],
"R": ["A", "G"],
"Y": ["C", "T"],
"S": ["C", "G"],
"W": ["A", "T"],
"K": ["G", "T"],
"M": ["A", "C"],
"B": ["C", "G", "T"],
"D": ["A", "G", "T"],
"H": ["A", "C", "T"],
"V": ["A", "C", "G"],
"N": ["A", "C", "G", "T"]
}

0 comments on commit fbc47f6

Please sign in to comment.