Commit a26da971 authored by Mikaël Salson's avatar Mikaël Salson
Browse files

tools.js: Give information on non viewable samples

It also brings valuable information on nb of occurrences of the sequence
parent 4da50543
Pipeline #1325 passed with stages
in 3 minutes and 30 seconds
......@@ -102,6 +102,7 @@ function correctIMGTPositionsForInsertions(data) {
function processCloneDBContents(results) {
var existing_urls = {};
var final_results = {};
var count_non_viewable = 0;
for (var clone in results) {
if (typeof results[clone]['tags'] != 'undefined'
&& typeof results[clone]['tags']['sample_set'] != 'undefined'
......@@ -127,13 +128,19 @@ function processCloneDBContents(results) {
final_results[msg] += results[clone]['occ'];
}
} else {
count_non_viewable += 1;
}
}
} else {
count_non_viewable += 1;
}
}
for (msg in final_results) {
final_results[msg] = final_results[msg]+' clone'+((final_results[msg] == 1) ? '' : 's');
}
if (count_non_viewable > 0)
final_results['Non viewable samples'] = count_non_viewable;
final_results['original'] = results;
return final_results;
}
......
......@@ -85,11 +85,12 @@ QUnit.test("processCloneDBContents", function(assert) {
var results = processCloneDBContents(multipleResults);
assert.equal(results['<a href="?sample_set_id=152&config=1024">152</a> (config)'], '5 clones', "multiple results");
assert.equal(results['<a href="?sample_set_id=15&config=1024">patient</a> (config)'], '3 clones', "multiple results, one entry");
assert.equal(results['Non viewable samples'], 1, "One non viewable sample");
var count = 0;
for (var item in results) {
count += 1;
}
assert.equal(count, 3, "Two results plus original entry");
assert.equal(count, 4, "Two results plus one non-viewable plus original entry");
// Test missing viewable property
var missingViewable = [{'tags': {'sample_set_name': ['patient', null],
......@@ -100,7 +101,7 @@ QUnit.test("processCloneDBContents", function(assert) {
'occ': 3,
'V' : 'IGHV1*02',
'J' : 'IGHJ3*01'}];
assert.deepEqual(processCloneDBContents(missingViewable), {'original': missingViewable},
assert.deepEqual(processCloneDBContents(missingViewable), {'Non viewable samples': 1, 'original': missingViewable},
"processing missingViewable");
});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment