6441 |
18 Oct 21 |
nicklas |
var GenoType = function() |
6441 |
18 Oct 21 |
nicklas |
2 |
{ |
6441 |
18 Oct 21 |
nicklas |
var gt = {}; |
6441 |
18 Oct 21 |
nicklas |
var debug = 0; |
6441 |
18 Oct 21 |
nicklas |
var selectionIsValid = false; |
6441 |
18 Oct 21 |
nicklas |
var files; |
6441 |
18 Oct 21 |
nicklas |
7 |
|
6441 |
18 Oct 21 |
nicklas |
// Page initialization |
6441 |
18 Oct 21 |
nicklas |
gt.initPage = function() |
6441 |
18 Oct 21 |
nicklas |
10 |
{ |
6441 |
18 Oct 21 |
nicklas |
11 |
|
6441 |
18 Oct 21 |
nicklas |
// Step 1 |
6441 |
18 Oct 21 |
nicklas |
Buttons.addClickHandler('btnBrowse', gt.selectFiles); |
6441 |
18 Oct 21 |
nicklas |
Events.addEventHandler('files', 'base-selected', gt.setFileCallback); |
6441 |
18 Oct 21 |
nicklas |
Events.addEventHandler('files', 'change', gt.filesOnChange); |
6441 |
18 Oct 21 |
nicklas |
Events.addEventHandler('step-1', 'wizard-validate', gt.validateStep1); |
6441 |
18 Oct 21 |
nicklas |
17 |
|
6441 |
18 Oct 21 |
nicklas |
// Step 2 |
6441 |
18 Oct 21 |
nicklas |
Events.addEventHandler('step-2', 'wizard-initialize', gt.initializeStep2); |
6441 |
18 Oct 21 |
nicklas |
20 |
|
6441 |
18 Oct 21 |
nicklas |
// Navigation |
6441 |
18 Oct 21 |
nicklas |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
6441 |
18 Oct 21 |
nicklas |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
6441 |
18 Oct 21 |
nicklas |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
6441 |
18 Oct 21 |
nicklas |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
6441 |
18 Oct 21 |
nicklas |
26 |
|
6441 |
18 Oct 21 |
nicklas |
// Final registration |
6824 |
30 Aug 22 |
nicklas |
//Events.addEventHandler('wizard', 'wizard-submit', gt.submit); |
6441 |
18 Oct 21 |
nicklas |
29 |
|
6441 |
18 Oct 21 |
nicklas |
Wizard.showLoadingAnimation('Loading bioassays...'); |
6441 |
18 Oct 21 |
nicklas |
var url = '../Genotype.servlet?ID='+App.getSessionId(); |
6441 |
18 Oct 21 |
nicklas |
url += '&cmd=PrepareForGenotypeChecks'; |
6441 |
18 Oct 21 |
nicklas |
Wizard.asyncJsonRequest(url, gt.initializeStep1); |
6441 |
18 Oct 21 |
nicklas |
34 |
} |
6441 |
18 Oct 21 |
nicklas |
35 |
|
6441 |
18 Oct 21 |
nicklas |
// --- Step 1 ----------------------------------- |
6441 |
18 Oct 21 |
nicklas |
gt.initializeStep1 = function(response) |
6441 |
18 Oct 21 |
nicklas |
38 |
{ |
6441 |
18 Oct 21 |
nicklas |
var frm = document.forms['reggie']; |
6441 |
18 Oct 21 |
nicklas |
40 |
|
7202 |
25 May 23 |
nicklas |
var msg = response.existingTumorsCount + ' tumors'; |
7202 |
25 May 23 |
nicklas |
if (response.existingNormalsCount) msg += ' and '+response.existingNormalsCount+' normals'; |
6595 |
22 Feb 22 |
nicklas |
Doc.element('alreadyChecked').innerHTML = msg; |
6441 |
18 Oct 21 |
nicklas |
44 |
|
6441 |
18 Oct 21 |
nicklas |
Doc.show('step-1'); |
6441 |
18 Oct 21 |
nicklas |
Doc.show('gonext'); |
6441 |
18 Oct 21 |
nicklas |
47 |
|
6441 |
18 Oct 21 |
nicklas |
frm.files.focus(); |
6441 |
18 Oct 21 |
nicklas |
49 |
} |
6441 |
18 Oct 21 |
nicklas |
50 |
|
6441 |
18 Oct 21 |
nicklas |
gt.validateStep1 = function(event) |
6441 |
18 Oct 21 |
nicklas |
52 |
{ |
6441 |
18 Oct 21 |
nicklas |
if (!selectionIsValid) event.preventDefault(); |
6441 |
18 Oct 21 |
nicklas |
54 |
} |
6441 |
18 Oct 21 |
nicklas |
55 |
|
6441 |
18 Oct 21 |
nicklas |
gt.selectFiles = function() |
6441 |
18 Oct 21 |
nicklas |
57 |
{ |
6441 |
18 Oct 21 |
nicklas |
var frm = document.forms['reggie']; |
6441 |
18 Oct 21 |
nicklas |
if (frm.files.disabled) return; |
6441 |
18 Oct 21 |
nicklas |
60 |
|
6441 |
18 Oct 21 |
nicklas |
var url = '&resetTemporary=1'; |
6597 |
22 Feb 22 |
nicklas |
url += '&tmpfilter:STRING:name='+encodeURIComponent('%.vcf|%.vcf.gz'); |
6441 |
18 Oct 21 |
nicklas |
Dialogs.selectItem('FILE', 'files', 1, url); |
6441 |
18 Oct 21 |
nicklas |
64 |
} |
6441 |
18 Oct 21 |
nicklas |
65 |
|
6441 |
18 Oct 21 |
nicklas |
gt.setFileCallback = function(event) |
6441 |
18 Oct 21 |
nicklas |
67 |
{ |
6441 |
18 Oct 21 |
nicklas |
var frm = document.forms['reggie']; |
6441 |
18 Oct 21 |
nicklas |
var file = event.detail; |
6441 |
18 Oct 21 |
nicklas |
App.debug(event.detail); |
6441 |
18 Oct 21 |
nicklas |
var opt = Reggie.getListOption('files', file.id); |
6441 |
18 Oct 21 |
nicklas |
if (opt) |
6441 |
18 Oct 21 |
nicklas |
73 |
{ |
6441 |
18 Oct 21 |
nicklas |
opt.selected = true; |
6441 |
18 Oct 21 |
nicklas |
75 |
} |
6441 |
18 Oct 21 |
nicklas |
else |
6441 |
18 Oct 21 |
nicklas |
77 |
{ |
6441 |
18 Oct 21 |
nicklas |
var option = gt.createListOption(frm.files.length+1, file, true); |
6441 |
18 Oct 21 |
nicklas |
frm.files[frm.files.length] = option; |
6441 |
18 Oct 21 |
nicklas |
80 |
} |
6441 |
18 Oct 21 |
nicklas |
81 |
|
6456 |
25 Oct 21 |
nicklas |
if (file.remaining == 0) |
6456 |
25 Oct 21 |
nicklas |
83 |
{ |
6456 |
25 Oct 21 |
nicklas |
Events.sendChangeEvent('files'); |
6456 |
25 Oct 21 |
nicklas |
frm.files.focus(); |
6456 |
25 Oct 21 |
nicklas |
86 |
} |
6441 |
18 Oct 21 |
nicklas |
87 |
} |
6441 |
18 Oct 21 |
nicklas |
88 |
|
6441 |
18 Oct 21 |
nicklas |
gt.createListOption = function(index, file, selected) |
6441 |
18 Oct 21 |
nicklas |
90 |
{ |
6441 |
18 Oct 21 |
nicklas |
var name = index+': '+file.name; |
6441 |
18 Oct 21 |
nicklas |
var option = new Option(name, file.id, false, selected); |
6441 |
18 Oct 21 |
nicklas |
option.file = file; |
6441 |
18 Oct 21 |
nicklas |
return option; |
6441 |
18 Oct 21 |
nicklas |
95 |
} |
6441 |
18 Oct 21 |
nicklas |
96 |
|
6441 |
18 Oct 21 |
nicklas |
gt.filesOnChange = function() |
6441 |
18 Oct 21 |
nicklas |
98 |
{ |
6441 |
18 Oct 21 |
nicklas |
var frm = document.forms['reggie']; |
6441 |
18 Oct 21 |
nicklas |
100 |
|
6441 |
18 Oct 21 |
nicklas |
selectionIsValid = false; |
6441 |
18 Oct 21 |
nicklas |
var numSelected = 0; |
6441 |
18 Oct 21 |
nicklas |
Wizard.setInputStatus('files'); |
6441 |
18 Oct 21 |
nicklas |
Wizard.hideGoNextConfirmation(); |
6441 |
18 Oct 21 |
nicklas |
105 |
|
6441 |
18 Oct 21 |
nicklas |
for (var fNo = 0; fNo < frm.files.length; fNo++) |
6441 |
18 Oct 21 |
nicklas |
107 |
{ |
6441 |
18 Oct 21 |
nicklas |
if (frm.files[fNo].selected) |
6441 |
18 Oct 21 |
nicklas |
109 |
{ |
6441 |
18 Oct 21 |
nicklas |
numSelected++; |
6441 |
18 Oct 21 |
nicklas |
111 |
} |
6441 |
18 Oct 21 |
nicklas |
112 |
} |
6441 |
18 Oct 21 |
nicklas |
113 |
|
6441 |
18 Oct 21 |
nicklas |
if (numSelected == 0) |
6441 |
18 Oct 21 |
nicklas |
115 |
{ |
6441 |
18 Oct 21 |
nicklas |
Wizard.setInputStatus('files', 'invalid', 'Select at least one file'); |
6441 |
18 Oct 21 |
nicklas |
return; |
6441 |
18 Oct 21 |
nicklas |
118 |
} |
6441 |
18 Oct 21 |
nicklas |
selectionIsValid = true; |
6441 |
18 Oct 21 |
nicklas |
Wizard.setInputStatus('files', 'valid'); |
6441 |
18 Oct 21 |
nicklas |
121 |
} |
6441 |
18 Oct 21 |
nicklas |
122 |
|
6441 |
18 Oct 21 |
nicklas |
gt.initializeStep2 = function() |
6441 |
18 Oct 21 |
nicklas |
124 |
{ |
6441 |
18 Oct 21 |
nicklas |
var frm = document.forms['reggie']; |
6441 |
18 Oct 21 |
nicklas |
126 |
|
6441 |
18 Oct 21 |
nicklas |
var submitInfo = {}; |
6441 |
18 Oct 21 |
nicklas |
var files = []; |
6441 |
18 Oct 21 |
nicklas |
submitInfo.files = files; |
6441 |
18 Oct 21 |
nicklas |
130 |
|
6441 |
18 Oct 21 |
nicklas |
for (var fNo = 0; fNo < frm.files.length; fNo++) |
6441 |
18 Oct 21 |
nicklas |
132 |
{ |
6441 |
18 Oct 21 |
nicklas |
if (frm.files[fNo].selected) |
6441 |
18 Oct 21 |
nicklas |
134 |
{ |
6441 |
18 Oct 21 |
nicklas |
files[files.length] = { 'id': parseInt(frm.files[fNo].file.id) }; |
6441 |
18 Oct 21 |
nicklas |
136 |
} |
6441 |
18 Oct 21 |
nicklas |
137 |
} |
6441 |
18 Oct 21 |
nicklas |
138 |
|
6441 |
18 Oct 21 |
nicklas |
var url = '../Genotype.servlet?ID='+App.getSessionId(); |
6441 |
18 Oct 21 |
nicklas |
url += '&cmd=GenotypeStandaloneFileCheck'; |
6441 |
18 Oct 21 |
nicklas |
Wizard.showLoadingAnimation('Comparing genotypes...', 'genotypes-progress'); |
6441 |
18 Oct 21 |
nicklas |
Wizard.asyncJsonRequest(url, gt.checkCompleted, 'POST', JSON.stringify(submitInfo)); |
6441 |
18 Oct 21 |
nicklas |
143 |
} |
6441 |
18 Oct 21 |
nicklas |
144 |
|
6441 |
18 Oct 21 |
nicklas |
gt.checkCompleted = function(response) |
6441 |
18 Oct 21 |
nicklas |
146 |
{ |
6441 |
18 Oct 21 |
nicklas |
files = response.files; |
6441 |
18 Oct 21 |
nicklas |
148 |
|
6441 |
18 Oct 21 |
nicklas |
var html = '<table id="compareTable">'; |
6441 |
18 Oct 21 |
nicklas |
html += '<thead class="bg-filled-100">'; |
6441 |
18 Oct 21 |
nicklas |
html += '<tr>'; |
6451 |
22 Oct 21 |
nicklas |
html += '<th colspan="3">Comparisons</th>'; |
6444 |
19 Oct 21 |
nicklas |
html += '<th class="dottedleft" colspan="5">Genotypes</th>'; |
6451 |
22 Oct 21 |
nicklas |
html += '<th class="dottedleft" colspan="5"></th>'; |
6456 |
25 Oct 21 |
nicklas |
html += '<th class="dottedleft"></th>'; |
6441 |
18 Oct 21 |
nicklas |
html += '</tr>'; |
6441 |
18 Oct 21 |
nicklas |
html += '<tr>'; |
6441 |
18 Oct 21 |
nicklas |
html += '<th>Total</th>'; |
6451 |
22 Oct 21 |
nicklas |
html += '<th>Same PAT</th>'; |
6441 |
18 Oct 21 |
nicklas |
html += '<th>Skipped</th>'; |
6441 |
18 Oct 21 |
nicklas |
html += '<th class="dottedleft">File</th>'; |
6441 |
18 Oct 21 |
nicklas |
html += '<th>Total</th>'; |
6444 |
19 Oct 21 |
nicklas |
html += '<th>Usable</th>'; |
6441 |
18 Oct 21 |
nicklas |
html += '<th>HET</th>'; |
6441 |
18 Oct 21 |
nicklas |
html += '<th class="icon-col"></th>'; |
6441 |
18 Oct 21 |
nicklas |
html += '<th class="dottedleft icon-col"></th>'; |
6451 |
22 Oct 21 |
nicklas |
html += '<th colspan="3">Warnings and messages</th>'; |
6441 |
18 Oct 21 |
nicklas |
html += '<th class="icon-col"></th>'; |
6456 |
25 Oct 21 |
nicklas |
html += '<th class="dottedleft comment"></th>'; |
6441 |
18 Oct 21 |
nicklas |
html += '</tr>'; |
6441 |
18 Oct 21 |
nicklas |
html += '</thead>'; |
6441 |
18 Oct 21 |
nicklas |
172 |
|
6441 |
18 Oct 21 |
nicklas |
var htmlNoMessages = ''; |
6441 |
18 Oct 21 |
nicklas |
var htmlNoWarnings = ''; |
6441 |
18 Oct 21 |
nicklas |
175 |
|
6441 |
18 Oct 21 |
nicklas |
for (var fNo = 0; fNo < files.length; fNo++) |
6441 |
18 Oct 21 |
nicklas |
177 |
{ |
6441 |
18 Oct 21 |
nicklas |
var file = files[fNo]; |
6443 |
19 Oct 21 |
nicklas |
var cmp = file.compare; |
6443 |
19 Oct 21 |
nicklas |
var vcf = cmp.vcf; |
6441 |
18 Oct 21 |
nicklas |
181 |
|
6441 |
18 Oct 21 |
nicklas |
var hetPercentage = vcf.gtCount ? Reggie.formatNumber(100*vcf.hetCount/vcf.gtCount, '%', -1) : '-'; |
6441 |
18 Oct 21 |
nicklas |
var rowspan = cmp.messages.length || 1; |
6441 |
18 Oct 21 |
nicklas |
184 |
|
6441 |
18 Oct 21 |
nicklas |
var tmp = '<tbody class="highlight"><tr>'; |
6441 |
18 Oct 21 |
nicklas |
tmp += '<td rowspan="'+rowspan+'">'+cmp.total+'</td>'; |
6451 |
22 Oct 21 |
nicklas |
tmp += '<td rowspan="'+rowspan+'">'+(cmp.samePat || '')+'</td>'; |
6441 |
18 Oct 21 |
nicklas |
tmp += '<td rowspan="'+rowspan+'">'+(cmp.skipped || '')+'</td>'; |
6595 |
22 Feb 22 |
nicklas |
tmp += '<td rowspan="'+rowspan+'" class="dottedleft text-col">'+Strings.encodeTags(file.path)+'</td>'; |
6444 |
19 Oct 21 |
nicklas |
tmp += '<td rowspan="'+rowspan+'">'+vcf.totalCount+'</td>'; |
6441 |
18 Oct 21 |
nicklas |
tmp += '<td rowspan="'+rowspan+'">'+vcf.gtCount+'</td>'; |
6441 |
18 Oct 21 |
nicklas |
tmp += '<td rowspan="'+rowspan+'">'+hetPercentage+'</td>'; |
6441 |
18 Oct 21 |
nicklas |
tmp += '<td rowspan="'+rowspan+'" class="icon-col">'; |
6441 |
18 Oct 21 |
nicklas |
tmp += '<span class="link vcf-link" data-file-id="'+vcf.fileId+'" title="View genotype statistics"><img src="../images/vcf_file.png"></span>'; |
6441 |
18 Oct 21 |
nicklas |
tmp += '</td>'; |
6441 |
18 Oct 21 |
nicklas |
196 |
|
6441 |
18 Oct 21 |
nicklas |
// The first message is on the main <tr> |
6441 |
18 Oct 21 |
nicklas |
var numWarnings = 0; |
6441 |
18 Oct 21 |
nicklas |
if (cmp.messages.length > 0) |
6441 |
18 Oct 21 |
nicklas |
200 |
{ |
6441 |
18 Oct 21 |
nicklas |
var msg = cmp.messages[0]; |
6441 |
18 Oct 21 |
nicklas |
if (msg.warningLevel != 'INFO') numWarnings++; |
6441 |
18 Oct 21 |
nicklas |
tmp += gt.getMessageHtml(msg, file, vcf); |
6441 |
18 Oct 21 |
nicklas |
204 |
} |
6441 |
18 Oct 21 |
nicklas |
else |
6441 |
18 Oct 21 |
nicklas |
206 |
{ |
6441 |
18 Oct 21 |
nicklas |
tmp += '<td class="dottedleft icon-col"></td>'; |
6441 |
18 Oct 21 |
nicklas |
tmp += '<td class="text-col" colspan="2"></td>'; |
6441 |
18 Oct 21 |
nicklas |
tmp += '<td class="icon-col"></td>'; |
6441 |
18 Oct 21 |
nicklas |
210 |
} |
6456 |
25 Oct 21 |
nicklas |
tmp += '<td rowspan="'+rowspan+'" class="dottedleft comment"></td>'; |
6441 |
18 Oct 21 |
nicklas |
tmp += '</tr>'; |
6441 |
18 Oct 21 |
nicklas |
213 |
|
6441 |
18 Oct 21 |
nicklas |
// If there are more messages, add more <tr> |
6441 |
18 Oct 21 |
nicklas |
for (var mNo = 1; mNo < cmp.messages.length; mNo++) |
6441 |
18 Oct 21 |
nicklas |
216 |
{ |
6441 |
18 Oct 21 |
nicklas |
var msg = cmp.messages[mNo]; |
6441 |
18 Oct 21 |
nicklas |
if (msg.warningLevel != 'INFO') numWarnings++; |
6441 |
18 Oct 21 |
nicklas |
tmp += '<tr>'+gt.getMessageHtml(msg, file, vcf) + '</tr>'; |
6441 |
18 Oct 21 |
nicklas |
220 |
} |
6441 |
18 Oct 21 |
nicklas |
tmp += '</tbody>'; |
6441 |
18 Oct 21 |
nicklas |
222 |
|
6441 |
18 Oct 21 |
nicklas |
if (cmp.messages.length == 0) |
6441 |
18 Oct 21 |
nicklas |
224 |
{ |
6441 |
18 Oct 21 |
nicklas |
// No messages are sorted last in the list |
6441 |
18 Oct 21 |
nicklas |
htmlNoMessages += tmp; |
6441 |
18 Oct 21 |
nicklas |
227 |
} |
6441 |
18 Oct 21 |
nicklas |
else if (numWarnings == 0) |
6441 |
18 Oct 21 |
nicklas |
229 |
{ |
6441 |
18 Oct 21 |
nicklas |
// No warnings are sorted in the middle |
6441 |
18 Oct 21 |
nicklas |
htmlNoWarnings += tmp; |
6441 |
18 Oct 21 |
nicklas |
232 |
} |
6441 |
18 Oct 21 |
nicklas |
else |
6441 |
18 Oct 21 |
nicklas |
234 |
{ |
6441 |
18 Oct 21 |
nicklas |
// Items with at least one warning are sorted first |
6441 |
18 Oct 21 |
nicklas |
html += tmp; |
6441 |
18 Oct 21 |
nicklas |
237 |
} |
6441 |
18 Oct 21 |
nicklas |
238 |
} |
6441 |
18 Oct 21 |
nicklas |
239 |
|
6441 |
18 Oct 21 |
nicklas |
html += htmlNoWarnings; |
6441 |
18 Oct 21 |
nicklas |
html += htmlNoMessages; |
6441 |
18 Oct 21 |
nicklas |
html += '</table>'; |
6441 |
18 Oct 21 |
nicklas |
Doc.element('comparisons').innerHTML = html; |
6441 |
18 Oct 21 |
nicklas |
244 |
|
6441 |
18 Oct 21 |
nicklas |
// Add click handler to VCF files |
6441 |
18 Oct 21 |
nicklas |
var clickableItems = document.getElementsByClassName('vcf-link'); |
6441 |
18 Oct 21 |
nicklas |
for (var i = 0; i < clickableItems.length; i++) |
6441 |
18 Oct 21 |
nicklas |
248 |
{ |
6441 |
18 Oct 21 |
nicklas |
Events.addEventHandler(clickableItems[i], 'click', gt.vcfLinkOnClick); |
6441 |
18 Oct 21 |
nicklas |
250 |
} |
6441 |
18 Oct 21 |
nicklas |
251 |
|
6456 |
25 Oct 21 |
nicklas |
// Case summary links |
6456 |
25 Oct 21 |
nicklas |
var cs = document.getElementsByClassName('case-summary'); |
6456 |
25 Oct 21 |
nicklas |
for (var i = 0; i < cs.length; i++) |
6456 |
25 Oct 21 |
nicklas |
255 |
{ |
6456 |
25 Oct 21 |
nicklas |
Events.addEventHandler(cs[i], 'click', Reggie.openCaseSummaryPopupOnEvent); |
6456 |
25 Oct 21 |
nicklas |
257 |
} |
6456 |
25 Oct 21 |
nicklas |
258 |
|
6441 |
18 Oct 21 |
nicklas |
Wizard.setCurrentStep(2); |
6441 |
18 Oct 21 |
nicklas |
Doc.show('step-2'); |
6456 |
25 Oct 21 |
nicklas |
Doc.show('gorestart'); |
6441 |
18 Oct 21 |
nicklas |
262 |
} |
6441 |
18 Oct 21 |
nicklas |
263 |
|
6441 |
18 Oct 21 |
nicklas |
264 |
|
6441 |
18 Oct 21 |
nicklas |
gt.getMessageHtml = function(message, file, vcf) |
6441 |
18 Oct 21 |
nicklas |
266 |
{ |
6441 |
18 Oct 21 |
nicklas |
var level = message.warningLevel; |
6441 |
18 Oct 21 |
nicklas |
var icon = null; |
6441 |
18 Oct 21 |
nicklas |
if (level == 'INFO') |
6441 |
18 Oct 21 |
nicklas |
270 |
{ |
6441 |
18 Oct 21 |
nicklas |
icon = 'ok.png'; |
6441 |
18 Oct 21 |
nicklas |
272 |
} |
6441 |
18 Oct 21 |
nicklas |
else if (level == 'LOW') |
6441 |
18 Oct 21 |
nicklas |
274 |
{ |
6441 |
18 Oct 21 |
nicklas |
icon = 'warning_small.png'; |
6441 |
18 Oct 21 |
nicklas |
276 |
} |
6441 |
18 Oct 21 |
nicklas |
else |
6441 |
18 Oct 21 |
nicklas |
278 |
{ |
6441 |
18 Oct 21 |
nicklas |
icon = 'warning.png'; |
6441 |
18 Oct 21 |
nicklas |
280 |
} |
6441 |
18 Oct 21 |
nicklas |
281 |
|
6441 |
18 Oct 21 |
nicklas |
var html = ''; |
6441 |
18 Oct 21 |
nicklas |
html += '<td class="dottedleft icon-col"><img src="../images/'+icon+'"></td>'; |
6441 |
18 Oct 21 |
nicklas |
html += '<td class="text-col" title="'+(message.messageTooltip || '')+'">'+Strings.encodeTags(message.message) + '</td>'; |
6441 |
18 Oct 21 |
nicklas |
html += '<td class="text-col">'; |
6451 |
22 Oct 21 |
nicklas |
if (message.specimen) |
6451 |
22 Oct 21 |
nicklas |
287 |
{ |
6451 |
22 Oct 21 |
nicklas |
html += Strings.encodeTags(message.specimen.patientName); |
6451 |
22 Oct 21 |
nicklas |
289 |
} |
6451 |
22 Oct 21 |
nicklas |
html += '</td>'; |
6451 |
22 Oct 21 |
nicklas |
html += '<td class="text-col">'; |
6595 |
22 Feb 22 |
nicklas |
if (message.otherAssay) |
6441 |
18 Oct 21 |
nicklas |
293 |
{ |
6595 |
22 Feb 22 |
nicklas |
html += gt.tagCommonPartOfName(file.name, message.otherAssay); |
6595 |
22 Feb 22 |
nicklas |
html += '<span class="link case-summary" data-name="'+Strings.encodeTags(message.otherAssay)+'" title="Show case summary"><img src="../images/case_summary.png"></span>'; |
6441 |
18 Oct 21 |
nicklas |
if (message.DO_NOT_USE) html += '<img src="../images/donotuse.png" title="DoNotUse-'+Strings.encodeTags(message.DO_NOT_USE + ': ' + message.DO_NOT_USE_COMMENT)+'">'; |
6595 |
22 Feb 22 |
nicklas |
if (message.flagged) html += '<img src="../images/flag.png" title="'+Strings.encodeTags(message.otherAssay)+' is already flagged">'; |
6441 |
18 Oct 21 |
nicklas |
if (message.currentVerifiedBy) |
6441 |
18 Oct 21 |
nicklas |
299 |
{ |
6441 |
18 Oct 21 |
nicklas |
var vicon = message.currentVerifiedBy == 'LYSATE' ? 'gt-verified-lysate.png' : 'gt-verified.png'; |
6595 |
22 Feb 22 |
nicklas |
html += '<img src="../images/'+vicon+'" title="'+Strings.encodeTags(message.otherAssay+' is already verified by '+message.currentVerifiedBy)+'">'; |
6441 |
18 Oct 21 |
nicklas |
302 |
} |
6441 |
18 Oct 21 |
nicklas |
303 |
} |
6441 |
18 Oct 21 |
nicklas |
html += '</td>'; |
6441 |
18 Oct 21 |
nicklas |
html += '<td class="icon-col">'; |
6441 |
18 Oct 21 |
nicklas |
if (message.vcf) |
6441 |
18 Oct 21 |
nicklas |
307 |
{ |
6441 |
18 Oct 21 |
nicklas |
html += ' <span class="link vcf-link" data-file-id="'+vcf.fileId+'"'; |
6441 |
18 Oct 21 |
nicklas |
html += ' data-item-id2="'+message.id+'" data-file-id2="'+message.vcf.fileId+'"'; |
6441 |
18 Oct 21 |
nicklas |
html += ' title="Compare genotypes (hold CTRL, ALT or SHIFT to open in a new popup)"><img src="../images/vcf_file.png"></span>'; |
6441 |
18 Oct 21 |
nicklas |
311 |
} |
6441 |
18 Oct 21 |
nicklas |
html += '</td>'; |
6441 |
18 Oct 21 |
nicklas |
return html; |
6441 |
18 Oct 21 |
nicklas |
314 |
} |
6441 |
18 Oct 21 |
nicklas |
315 |
|
6441 |
18 Oct 21 |
nicklas |
316 |
|
6441 |
18 Oct 21 |
nicklas |
gt.tagCommonPartOfName = function(name1, name2) |
6441 |
18 Oct 21 |
nicklas |
318 |
{ |
6441 |
18 Oct 21 |
nicklas |
var n1 = name1.split('.'); |
6441 |
18 Oct 21 |
nicklas |
var n2 = name2.split('.'); |
6441 |
18 Oct 21 |
nicklas |
var i = 0; |
6441 |
18 Oct 21 |
nicklas |
322 |
|
6441 |
18 Oct 21 |
nicklas |
var common = ''; |
6441 |
18 Oct 21 |
nicklas |
var sep = '.'; |
6441 |
18 Oct 21 |
nicklas |
while (i < n1.length && i < n2.length && n1[i] == n2[i]) |
6441 |
18 Oct 21 |
nicklas |
326 |
{ |
6441 |
18 Oct 21 |
nicklas |
common += n1[i] + sep; |
6441 |
18 Oct 21 |
nicklas |
i++; |
6441 |
18 Oct 21 |
nicklas |
329 |
} |
6441 |
18 Oct 21 |
nicklas |
330 |
|
6441 |
18 Oct 21 |
nicklas |
var diff = ''; |
6441 |
18 Oct 21 |
nicklas |
sep = ''; |
6441 |
18 Oct 21 |
nicklas |
while (i < n2.length) |
6441 |
18 Oct 21 |
nicklas |
334 |
{ |
6441 |
18 Oct 21 |
nicklas |
diff += sep + n2[i]; |
6441 |
18 Oct 21 |
nicklas |
i++; |
6441 |
18 Oct 21 |
nicklas |
sep = '.'; |
6441 |
18 Oct 21 |
nicklas |
338 |
} |
6441 |
18 Oct 21 |
nicklas |
339 |
|
6441 |
18 Oct 21 |
nicklas |
return '<span class="commonpart">'+Strings.encodeTags(common)+'</span><span class="diffpart">'+Strings.encodeTags(diff)+'</span>'; |
6441 |
18 Oct 21 |
nicklas |
341 |
} |
6441 |
18 Oct 21 |
nicklas |
342 |
|
6441 |
18 Oct 21 |
nicklas |
gt.vcfLinkOnClick = function(event) |
6441 |
18 Oct 21 |
nicklas |
344 |
{ |
6441 |
18 Oct 21 |
nicklas |
var fileId = Data.int(event.currentTarget, 'file-id'); |
6441 |
18 Oct 21 |
nicklas |
var itemId = Data.get(event.currentTarget, 'item-id'); |
6441 |
18 Oct 21 |
nicklas |
var fileId2 = Data.int(event.currentTarget, 'file-id2'); |
6441 |
18 Oct 21 |
nicklas |
var itemId2 = Data.get(event.currentTarget, 'item-id2'); |
6441 |
18 Oct 21 |
nicklas |
var specialKey = event.altKey || event.ctrlKey || event.shiftKey; |
6441 |
18 Oct 21 |
nicklas |
350 |
|
6441 |
18 Oct 21 |
nicklas |
var url = 'view_genotypes.jsp?ID=' + App.getSessionId(); |
6441 |
18 Oct 21 |
nicklas |
url += '&fileId='+fileId; |
6441 |
18 Oct 21 |
nicklas |
url += '&itemId='+itemId; |
6441 |
18 Oct 21 |
nicklas |
url += '&fileId2='+fileId2; |
6441 |
18 Oct 21 |
nicklas |
url += '&itemId2='+itemId2; |
6441 |
18 Oct 21 |
nicklas |
356 |
|
6441 |
18 Oct 21 |
nicklas |
Dialogs.openPopup(url, (specialKey ? 'ViewVcf'+itemId+itemId2 : 'ViewVcf'), 900, 600); |
6441 |
18 Oct 21 |
nicklas |
358 |
} |
6441 |
18 Oct 21 |
nicklas |
359 |
|
6441 |
18 Oct 21 |
nicklas |
return gt; |
6441 |
18 Oct 21 |
nicklas |
361 |
}(); |
6441 |
18 Oct 21 |
nicklas |
362 |
|
6441 |
18 Oct 21 |
nicklas |
Doc.onLoad(GenoType.initPage); |
6441 |
18 Oct 21 |
nicklas |
364 |
|