Skip to content

Commit

Permalink
removed hla typing - not good enough
Browse files Browse the repository at this point in the history
  • Loading branch information
lh3 committed Oct 24, 2014
1 parent 7a8019e commit ba3ab0c
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions bwa-postalt.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,42 +203,6 @@ function parse_hit(s, opt)
return h;
}

function type_hla(w)
{
var hla = ["A", "B", "C", "DQA1", "DQB1", "DRB1"];
var hla_hash = {}, a = [], r = [];
for (var i = 0; i < hla.length; ++i) {
hla_hash[hla[i]] = i;
a[i] = [];
}
for (var i = 0; i < w.length; ++i) {
var t = w[i][0].split(/[:\*]/);
var x = hla_hash[t[0]];
if (x != null)
a[x].push([w[i][0], t[1], t[1] + ':' + t[2], w[i][1]]);
}
for (var k = 1; k <= 2; ++k) {
for (var i = 0; i < hla.length; ++i) {
var ai = a[i], m = {};
for (var j = 0; j < ai.length; ++j) {
var key = ai[j][k], val = ai[j][3];
if (m[key] == null) m[key] = [-1, -1.0];
if (m[key][1] < val) m[key] = [j, val];
}
var sum = 0;
for (var x in m) sum += m[x][1];
var max = -1, max2 = -1, max3 = -1, max_x, max_x2, max_x3;
for (var x in m) {
if (max < m[x][1]) max3 = max2, max_x3 = max_x2, max2 = max, max_x2 = max_x, max = m[x][1], max_x = x;
else if (max2 < m[x][1]) max3 = max2, max_x3 = max_x2, max2 = m[x][1], max_x2 = x;
else if (max3 < m[x][1]) max3 = m[x][1], max_x3 = x;
}
r.push([hla[i], k, hla[i]+'*'+max_x, max.toFixed(3), hla[i]+'*'+max_x2, max2.toFixed(3), hla[i]+'*'+max_x3, max3.toFixed(3)]);
}
}
return r;
}

function bwa_postalt(args)
{
var c, opt = { a:1, b:4, o:6, e:1, verbose:3, show_pri:false, update_mapq:true, min_mapq:10, min_sc:90, max_nm_sc:10, show_ev:false, min_pa_ratio:1 };
Expand Down Expand Up @@ -626,12 +590,6 @@ function bwa_postalt(args)
fpout.write(weight_arr[i].join("\t") + '\n');
}
fpout.close();

var r = type_hla(weight_hla);
fpout = new File(opt.pre + '.hla', "w");
for (var i = 0; i < r.length; ++i)
fpout.write(r[i].join("\t") + '\n');
fpout.close();
}
}

Expand Down

0 comments on commit ba3ab0c

Please sign in to comment.