0
|
1 function tsvToTable(data){
|
|
2 var lines = data.split("\n");
|
|
3 var tbl = document.createElement('table');
|
|
4 tbl.className = "result_table";
|
|
5 tbl.border="1"
|
|
6 var thead = document.createElement('thead');
|
|
7 var tr = document.createElement('tr');
|
|
8 tr.className = "evenrowcolor";
|
|
9 var cells = lines[0].split("\t");
|
12
|
10 var cdr3column = 0;
|
0
|
11 for(var a = 0;a < cells.length;++a){
|
12
|
12 if(cells[a] == "CDR3 Sequence" || cells[a] == "CDR3_Sense_Sequence"){
|
|
13 cdr3column = a;
|
|
14 }
|
0
|
15 var td = document.createElement('td');
|
|
16 td.appendChild(document.createTextNode(cells[a]));
|
|
17 tr.appendChild(td);
|
|
18 }
|
|
19 thead.appendChild(tr);
|
|
20 tbl.appendChild(thead);
|
|
21 var tbdy = document.createElement('tbody');
|
|
22
|
|
23 for(var a = 1;a < lines.length;++a){
|
|
24 tr = document.createElement('tr');
|
|
25 var cells = lines[a].split("\t");
|
|
26 if(cells.length == 1){
|
|
27 continue;
|
|
28 }
|
|
29 for(var b = 0;b < cells.length;++b){
|
|
30 td = document.createElement('td');
|
|
31 td.appendChild(document.createTextNode(cells[b]));
|
12
|
32 if(b == cdr3column){
|
|
33 td.setAttribute('style', 'text-align:right');
|
|
34 }
|
0
|
35 tr.appendChild(td)
|
|
36 }
|
|
37 if(a % 2 == 0){
|
|
38 tr.className = "evenrowcolor";
|
|
39 } else {
|
|
40 tr.className = "oddrowcolor";
|
|
41 }
|
|
42 tbdy.appendChild(tr);
|
|
43 }
|
|
44 tbl.appendChild(tbdy);
|
|
45 return tbl;
|
|
46 }
|
|
47
|
|
48 function loadfile(file, patient, type){
|
12
|
49 patient = patient.replace(".", "\\.");
|
0
|
50 $('#hidden_div').load(file, function(){
|
|
51 $('#result_div_' + patient + '_' + type).html(tsvToTable($('#hidden_div').html()));
|
|
52 $('#result_div_' + patient + '_' + type + ' tr').hover(function() {
|
|
53 $(this).addClass('hover');
|
|
54 }, function() {
|
|
55 $(this).removeClass('hover');
|
|
56 });
|
|
57 $('#result_div_' + patient + '_' + type + ' table').addClass('result_table');
|
|
58 //$('#result_div_' + patient + ' tr:odd').addClass("oddrowcolor");
|
|
59 //$('#result_div_' + patient + ' tr:even').addClass("evenrowcolor");
|
|
60 $('#result_div_' + patient + '_' + type + ' table').before( "<a href='" + file + "'>Download " + file.replace(".txt", "") + "</a>" );
|
|
61 });
|
|
62 }
|
|
63
|
|
64 var currentTD = new Array();
|
|
65
|
|
66 $( document ).ready(function() {
|
|
67 $('.summary_table tr').hover(function() {
|
|
68 $(this).addClass('hover');
|
|
69 }, function() {
|
|
70 $(this).removeClass('hover');
|
|
71 });
|
|
72
|
|
73 $('.summary_table tr:odd').addClass("oddrowcolor");
|
|
74 $('.summary_table tr:even').addClass("evenrowcolor");
|
|
75
|
|
76 $('.summary_table td[data-patient]').click(function() {
|
|
77 var tmp = $(this);
|
|
78 if(currentTD[tmp.attr("data-patient")] != null){
|
|
79 currentTD[tmp.attr("data-patient")].removeClass("clicked_summary");
|
|
80 }
|
|
81 currentTD[tmp.attr("data-patient")] = tmp;
|
|
82 currentTD[tmp.attr("data-patient")].addClass("clicked_summary");
|
|
83 });
|
|
84 }); |