7211 |
29 May 23 |
nicklas |
var GenoType = function() |
7211 |
29 May 23 |
nicklas |
2 |
{ |
7211 |
29 May 23 |
nicklas |
var gt = {}; |
7211 |
29 May 23 |
nicklas |
var debug = 0; |
7211 |
29 May 23 |
nicklas |
var PIPELINE = 'DNA/Normal/WGS'; |
7211 |
29 May 23 |
nicklas |
var selectionIsValid = false; |
7211 |
29 May 23 |
nicklas |
var subtypeAlignedSequences = null; |
7211 |
29 May 23 |
nicklas |
var annotationTypePipeline = null; |
7211 |
29 May 23 |
nicklas |
var alignedSequences; |
7211 |
29 May 23 |
nicklas |
var manuallySelected = []; |
7211 |
29 May 23 |
nicklas |
11 |
|
7211 |
29 May 23 |
nicklas |
// Page initialization |
7211 |
29 May 23 |
nicklas |
gt.initPage = function() |
7211 |
29 May 23 |
nicklas |
14 |
{ |
7217 |
30 May 23 |
nicklas |
PIPELINE = Data.get('page-data', 'pipeline'); |
7211 |
29 May 23 |
nicklas |
16 |
|
7211 |
29 May 23 |
nicklas |
// Step 1 |
7211 |
29 May 23 |
nicklas |
Buttons.addClickHandler('btnSelectAlignedSequences', gt.selectAlignedSequences); |
7211 |
29 May 23 |
nicklas |
Events.addEventHandler('alignedSequences', 'base-selected', gt.setAlignedSequenceCallback); |
7211 |
29 May 23 |
nicklas |
Events.addEventHandler('alignedSequences', 'change', gt.alignedSequencesOnChange); |
7211 |
29 May 23 |
nicklas |
Events.addEventHandler('step-1', 'wizard-validate', gt.validateStep1); |
7211 |
29 May 23 |
nicklas |
22 |
|
7211 |
29 May 23 |
nicklas |
// Step 2 |
7211 |
29 May 23 |
nicklas |
Events.addEventHandler('step-2', 'wizard-initialize', gt.initializeStep2); |
7211 |
29 May 23 |
nicklas |
25 |
|
7211 |
29 May 23 |
nicklas |
// Navigation |
7211 |
29 May 23 |
nicklas |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
7211 |
29 May 23 |
nicklas |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
7211 |
29 May 23 |
nicklas |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
7211 |
29 May 23 |
nicklas |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
7211 |
29 May 23 |
nicklas |
31 |
|
7211 |
29 May 23 |
nicklas |
// Final registration |
7211 |
29 May 23 |
nicklas |
Events.addEventHandler('wizard', 'wizard-submit', gt.submit); |
7211 |
29 May 23 |
nicklas |
34 |
|
7211 |
29 May 23 |
nicklas |
Wizard.showLoadingAnimation('Loading bioassays...'); |
7211 |
29 May 23 |
nicklas |
var url = '../Genotype.servlet?ID='+App.getSessionId(); |
7211 |
29 May 23 |
nicklas |
url += '&cmd=GetAlignedSequencesForGenotypeQc'; |
7211 |
29 May 23 |
nicklas |
url += '&pipeline='+encodeURIComponent(PIPELINE); |
7211 |
29 May 23 |
nicklas |
Wizard.asyncJsonRequest(url, gt.initializeStep1); |
7211 |
29 May 23 |
nicklas |
40 |
} |
7211 |
29 May 23 |
nicklas |
41 |
|
7211 |
29 May 23 |
nicklas |
// --- Step 1 ----------------------------------- |
7211 |
29 May 23 |
nicklas |
gt.initializeStep1 = function(response) |
7211 |
29 May 23 |
nicklas |
44 |
{ |
7211 |
29 May 23 |
nicklas |
var alignedSequences = response.alignedSequences; |
7211 |
29 May 23 |
nicklas |
alignedSequences.sort(Sort.sortByPlatePosition); |
7211 |
29 May 23 |
nicklas |
47 |
|
7211 |
29 May 23 |
nicklas |
var frm = document.forms['reggie']; |
7211 |
29 May 23 |
nicklas |
49 |
|
7211 |
29 May 23 |
nicklas |
var msg = response.existingTumorsCount + ' tumors'; |
7211 |
29 May 23 |
nicklas |
if (response.existingNormalsCount) msg += ' and '+response.existingNormalsCount+' normals'; |
7211 |
29 May 23 |
nicklas |
Doc.element('alreadyChecked').innerHTML = msg; |
7211 |
29 May 23 |
nicklas |
53 |
|
7211 |
29 May 23 |
nicklas |
if (alignedSequences != null && alignedSequences.length > 0) |
7211 |
29 May 23 |
nicklas |
55 |
{ |
7211 |
29 May 23 |
nicklas |
var numNoPatient = 0; |
7211 |
29 May 23 |
nicklas |
for (var asNo=0; asNo < alignedSequences.length; asNo++) |
7211 |
29 May 23 |
nicklas |
58 |
{ |
7211 |
29 May 23 |
nicklas |
var seq = alignedSequences[asNo]; |
7211 |
29 May 23 |
nicklas |
var plate = seq.bioWell ? seq.bioWell.bioPlate : null; |
7211 |
29 May 23 |
nicklas |
if (!seq.patient) numNoPatient++; |
7211 |
29 May 23 |
nicklas |
62 |
|
7219 |
31 May 23 |
nicklas |
var option = gt.createListOption(asNo+1, seq, seq.DO_NOT_USE == null); |
7211 |
29 May 23 |
nicklas |
frm.alignedSequences.options[frm.alignedSequences.length] = option; |
7211 |
29 May 23 |
nicklas |
65 |
} |
7211 |
29 May 23 |
nicklas |
66 |
|
7211 |
29 May 23 |
nicklas |
if (numNoPatient > 0) |
7211 |
29 May 23 |
nicklas |
68 |
{ |
7211 |
29 May 23 |
nicklas |
Wizard.showGoNextConfirmation(true, 'Some alignments have no patient information and will be excluded from the genotype check.'); |
7211 |
29 May 23 |
nicklas |
70 |
} |
7211 |
29 May 23 |
nicklas |
Events.sendChangeEvent('alignedSequences'); |
7211 |
29 May 23 |
nicklas |
72 |
} |
7211 |
29 May 23 |
nicklas |
else |
7211 |
29 May 23 |
nicklas |
74 |
{ |
7211 |
29 May 23 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'invalid', 'No new alignments available for processing'); |
7211 |
29 May 23 |
nicklas |
76 |
} |
7211 |
29 May 23 |
nicklas |
77 |
|
7211 |
29 May 23 |
nicklas |
Doc.show('step-1'); |
7211 |
29 May 23 |
nicklas |
Doc.show('gonext'); |
7211 |
29 May 23 |
nicklas |
80 |
|
7211 |
29 May 23 |
nicklas |
frm.alignedSequences.focus(); |
7211 |
29 May 23 |
nicklas |
82 |
} |
7211 |
29 May 23 |
nicklas |
83 |
|
7211 |
29 May 23 |
nicklas |
gt.validateStep1 = function(event) |
7211 |
29 May 23 |
nicklas |
85 |
{ |
7211 |
29 May 23 |
nicklas |
if (!selectionIsValid) event.preventDefault(); |
7211 |
29 May 23 |
nicklas |
87 |
} |
7211 |
29 May 23 |
nicklas |
88 |
|
7211 |
29 May 23 |
nicklas |
gt.selectAlignedSequences = function() |
7211 |
29 May 23 |
nicklas |
90 |
{ |
7211 |
29 May 23 |
nicklas |
var frm = document.forms['reggie']; |
7211 |
29 May 23 |
nicklas |
if (frm.alignedSequences.disabled) return; |
7211 |
29 May 23 |
nicklas |
93 |
|
7211 |
29 May 23 |
nicklas |
if (subtypeAlignedSequences == null) |
7211 |
29 May 23 |
nicklas |
95 |
{ |
7211 |
29 May 23 |
nicklas |
subtypeAlignedSequences = Reggie.getSubtypeInfo('ALIGNED_SEQUENCES'); |
7211 |
29 May 23 |
nicklas |
97 |
} |
7211 |
29 May 23 |
nicklas |
if (annotationTypePipeline == null) |
7211 |
29 May 23 |
nicklas |
99 |
{ |
7211 |
29 May 23 |
nicklas |
annotationTypePipeline = Reggie.getAnnotationTypeInfo('PIPELINE'); |
7211 |
29 May 23 |
nicklas |
101 |
} |
7211 |
29 May 23 |
nicklas |
102 |
|
7211 |
29 May 23 |
nicklas |
// Reset list |
7211 |
29 May 23 |
nicklas |
manuallySelected = []; |
7211 |
29 May 23 |
nicklas |
var url = '&resetTemporary=1'; |
7211 |
29 May 23 |
nicklas |
url += '&tmpfilter:INT:itemSubtype='+subtypeAlignedSequences.id; |
7211 |
29 May 23 |
nicklas |
url += '&tmpfilter:STRING:'+encodeURIComponent('#')+annotationTypePipeline.id+'='+encodeURIComponent(PIPELINE); |
7211 |
29 May 23 |
nicklas |
Dialogs.selectItem('DERIVEDBIOASSAY', 'alignedSequences', 1, url); |
7211 |
29 May 23 |
nicklas |
109 |
} |
7211 |
29 May 23 |
nicklas |
110 |
|
7211 |
29 May 23 |
nicklas |
gt.setAlignedSequenceCallback = function(event) |
7211 |
29 May 23 |
nicklas |
112 |
{ |
7211 |
29 May 23 |
nicklas |
var ms = event.detail; |
7211 |
29 May 23 |
nicklas |
114 |
|
7211 |
29 May 23 |
nicklas |
var opt = Reggie.getListOption('alignedSequences', ms.id); |
7211 |
29 May 23 |
nicklas |
if (opt) |
7211 |
29 May 23 |
nicklas |
117 |
{ |
7211 |
29 May 23 |
nicklas |
opt.selected = true; |
7211 |
29 May 23 |
nicklas |
119 |
} |
7211 |
29 May 23 |
nicklas |
else |
7211 |
29 May 23 |
nicklas |
121 |
{ |
7211 |
29 May 23 |
nicklas |
manuallySelected[manuallySelected.length] = ms.id; |
7211 |
29 May 23 |
nicklas |
123 |
} |
7211 |
29 May 23 |
nicklas |
124 |
|
7211 |
29 May 23 |
nicklas |
if (ms.remaining == 0 && manuallySelected.length > 0) |
7211 |
29 May 23 |
nicklas |
126 |
{ |
7211 |
29 May 23 |
nicklas |
var url = '../Genotype.servlet?ID='+App.getSessionId(); |
7211 |
29 May 23 |
nicklas |
url += '&cmd=GetAlignedSequencesForGenotypeQc'; |
7211 |
29 May 23 |
nicklas |
url += '&items='+manuallySelected.join(','); |
7211 |
29 May 23 |
nicklas |
Wizard.showLoadingAnimation('Loading bioassays...'); |
7211 |
29 May 23 |
nicklas |
Wizard.asyncJsonRequest(url, gt.manuallySelected); |
7211 |
29 May 23 |
nicklas |
132 |
} |
7211 |
29 May 23 |
nicklas |
else |
7211 |
29 May 23 |
nicklas |
134 |
{ |
7211 |
29 May 23 |
nicklas |
Events.sendChangeEvent('alignedSequences'); |
7211 |
29 May 23 |
nicklas |
136 |
} |
7211 |
29 May 23 |
nicklas |
137 |
|
7211 |
29 May 23 |
nicklas |
138 |
} |
7211 |
29 May 23 |
nicklas |
gt.manuallySelected = function(response) |
7211 |
29 May 23 |
nicklas |
140 |
{ |
7211 |
29 May 23 |
nicklas |
var alignedSequences = response.alignedSequences; |
7211 |
29 May 23 |
nicklas |
var frm = document.forms['reggie']; |
7211 |
29 May 23 |
nicklas |
143 |
|
7211 |
29 May 23 |
nicklas |
if (alignedSequences != null && alignedSequences.length > 0) |
7211 |
29 May 23 |
nicklas |
145 |
{ |
7211 |
29 May 23 |
nicklas |
var offset = frm.alignedSequences.length+1; |
7211 |
29 May 23 |
nicklas |
for (var asNo=0; asNo < alignedSequences.length; asNo++) |
7211 |
29 May 23 |
nicklas |
148 |
{ |
7211 |
29 May 23 |
nicklas |
var as = alignedSequences[asNo]; |
7211 |
29 May 23 |
nicklas |
var option = gt.createListOption(asNo+offset, as, as.DO_NOT_USE == null); |
7211 |
29 May 23 |
nicklas |
frm.alignedSequences.options[frm.alignedSequences.length] = option; |
7211 |
29 May 23 |
nicklas |
152 |
} |
7211 |
29 May 23 |
nicklas |
Events.sendChangeEvent('alignedSequences'); |
7211 |
29 May 23 |
nicklas |
154 |
} |
7211 |
29 May 23 |
nicklas |
155 |
} |
7211 |
29 May 23 |
nicklas |
156 |
|
7211 |
29 May 23 |
nicklas |
gt.createListOption = function(index, alignedItem, selected) |
7211 |
29 May 23 |
nicklas |
158 |
{ |
7211 |
29 May 23 |
nicklas |
var plate = alignedItem.bioWell ? alignedItem.bioWell.bioPlate : null; |
7211 |
29 May 23 |
nicklas |
160 |
|
7211 |
29 May 23 |
nicklas |
var name = (index) + ': '; |
7211 |
29 May 23 |
nicklas |
if (plate) name += plate.name + ' - '; |
7211 |
29 May 23 |
nicklas |
name += alignedItem.name; |
7211 |
29 May 23 |
nicklas |
if (!alignedItem.patient) name += ' (no patient data)'; |
7211 |
29 May 23 |
nicklas |
165 |
|
7211 |
29 May 23 |
nicklas |
var option = new Option(name, alignedItem.id, false, selected && alignedItem.patient); |
7211 |
29 May 23 |
nicklas |
if (!alignedItem.patient) option.disabled = true; |
7211 |
29 May 23 |
nicklas |
option.alignedSequences = alignedItem; |
7211 |
29 May 23 |
nicklas |
return option; |
7211 |
29 May 23 |
nicklas |
170 |
} |
7211 |
29 May 23 |
nicklas |
171 |
|
7211 |
29 May 23 |
nicklas |
172 |
|
7211 |
29 May 23 |
nicklas |
gt.alignedSequencesOnChange = function() |
7211 |
29 May 23 |
nicklas |
174 |
{ |
7211 |
29 May 23 |
nicklas |
var frm = document.forms['reggie']; |
7211 |
29 May 23 |
nicklas |
176 |
|
7211 |
29 May 23 |
nicklas |
selectionIsValid = false; |
7211 |
29 May 23 |
nicklas |
var numSelected = 0; |
7211 |
29 May 23 |
nicklas |
var numDoNotUse = 0; |
7211 |
29 May 23 |
nicklas |
var invalidPipeline = null; |
7211 |
29 May 23 |
nicklas |
Wizard.setInputStatus('alignedSequences'); |
7211 |
29 May 23 |
nicklas |
Wizard.hideGoNextConfirmation(); |
7211 |
29 May 23 |
nicklas |
183 |
|
7211 |
29 May 23 |
nicklas |
for (var asNo = 0; asNo < frm.alignedSequences.length; asNo++) |
7211 |
29 May 23 |
nicklas |
185 |
{ |
7211 |
29 May 23 |
nicklas |
if (frm.alignedSequences[asNo].selected) |
7211 |
29 May 23 |
nicklas |
187 |
{ |
7211 |
29 May 23 |
nicklas |
numSelected++; |
7211 |
29 May 23 |
nicklas |
var as = frm.alignedSequences[asNo].alignedSequences; |
7211 |
29 May 23 |
nicklas |
if (as.DO_NOT_USE) numDoNotUse++; |
7211 |
29 May 23 |
nicklas |
if (as.pipeline && as.pipeline != PIPELINE) |
7211 |
29 May 23 |
nicklas |
192 |
{ |
7211 |
29 May 23 |
nicklas |
invalidPipeline = Strings.encodeTags(as.name+' ('+as.pipeline)+') is not intended for the '+PIPELINE+' pipeline.'; |
7211 |
29 May 23 |
nicklas |
194 |
} |
7211 |
29 May 23 |
nicklas |
195 |
} |
7211 |
29 May 23 |
nicklas |
196 |
} |
7211 |
29 May 23 |
nicklas |
197 |
|
7211 |
29 May 23 |
nicklas |
if (numSelected == 0) |
7211 |
29 May 23 |
nicklas |
199 |
{ |
7211 |
29 May 23 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'invalid', 'Select at least one item'); |
7211 |
29 May 23 |
nicklas |
return; |
7211 |
29 May 23 |
nicklas |
202 |
} |
7211 |
29 May 23 |
nicklas |
if (invalidPipeline) |
7211 |
29 May 23 |
nicklas |
204 |
{ |
7211 |
29 May 23 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'invalid', invalidPipeline); |
7211 |
29 May 23 |
nicklas |
return; |
7211 |
29 May 23 |
nicklas |
207 |
} |
7211 |
29 May 23 |
nicklas |
selectionIsValid = true; |
7211 |
29 May 23 |
nicklas |
if (numDoNotUse > 0) |
7211 |
29 May 23 |
nicklas |
210 |
{ |
7211 |
29 May 23 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'warning', numDoNotUse + ' selected items marked as DoNotUse'); |
7211 |
29 May 23 |
nicklas |
Wizard.showGoNextConfirmation(true, 'Confirm ' + numDoNotUse + ' items marked as DoNotUse'); |
7211 |
29 May 23 |
nicklas |
213 |
} |
7211 |
29 May 23 |
nicklas |
else |
7211 |
29 May 23 |
nicklas |
215 |
{ |
7211 |
29 May 23 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'valid'); |
7211 |
29 May 23 |
nicklas |
217 |
} |
7211 |
29 May 23 |
nicklas |
218 |
} |
7211 |
29 May 23 |
nicklas |
219 |
|
7211 |
29 May 23 |
nicklas |
gt.initializeStep2 = function() |
7211 |
29 May 23 |
nicklas |
221 |
{ |
7211 |
29 May 23 |
nicklas |
var frm = document.forms['reggie']; |
7211 |
29 May 23 |
nicklas |
223 |
|
7211 |
29 May 23 |
nicklas |
var submitInfo = {}; |
7211 |
29 May 23 |
nicklas |
var alignedSequences = []; |
7211 |
29 May 23 |
nicklas |
submitInfo.alignedSequences = alignedSequences; |
7211 |
29 May 23 |
nicklas |
227 |
|
7211 |
29 May 23 |
nicklas |
for (var asNo = 0; asNo < frm.alignedSequences.length; asNo++) |
7211 |
29 May 23 |
nicklas |
229 |
{ |
7211 |
29 May 23 |
nicklas |
if (frm.alignedSequences[asNo].selected) |
7211 |
29 May 23 |
nicklas |
231 |
{ |
7211 |
29 May 23 |
nicklas |
var as = {}; |
7211 |
29 May 23 |
nicklas |
as.id = frm.alignedSequences[asNo].alignedSequences.id; |
7211 |
29 May 23 |
nicklas |
alignedSequences[alignedSequences.length] = as; |
7211 |
29 May 23 |
nicklas |
235 |
} |
7211 |
29 May 23 |
nicklas |
236 |
} |
7211 |
29 May 23 |
nicklas |
237 |
|
7211 |
29 May 23 |
nicklas |
var url = '../Genotype.servlet?ID='+App.getSessionId(); |
7211 |
29 May 23 |
nicklas |
url += '&cmd=GenotypeQcCheck'; |
7211 |
29 May 23 |
nicklas |
url += '&pipeline='+encodeURIComponent(PIPELINE); |
7211 |
29 May 23 |
nicklas |
Wizard.showLoadingAnimation('Comparing genotypes...', 'genotypes-progress'); |
7211 |
29 May 23 |
nicklas |
Wizard.asyncJsonRequest(url, gt.checkCompleted, 'POST', JSON.stringify(submitInfo)); |
7211 |
29 May 23 |
nicklas |
243 |
} |
7211 |
29 May 23 |
nicklas |
244 |
|
7211 |
29 May 23 |
nicklas |
gt.checkCompleted = function(response) |
7211 |
29 May 23 |
nicklas |
246 |
{ |
7211 |
29 May 23 |
nicklas |
alignedSequences = response.alignedSequences; |
7218 |
30 May 23 |
nicklas |
var noFlag = PIPELINE == 'DNA/Tumor/WGS'; |
7211 |
29 May 23 |
nicklas |
249 |
|
7211 |
29 May 23 |
nicklas |
var html = '<table id="compareTable">'; |
7211 |
29 May 23 |
nicklas |
html += '<thead class="bg-filled-100">'; |
7211 |
29 May 23 |
nicklas |
html += '<tr>'; |
7211 |
29 May 23 |
nicklas |
html += '<th colspan="3">Comparisons</th>'; |
7211 |
29 May 23 |
nicklas |
html += '<th class="dottedleft"></th>'; |
7211 |
29 May 23 |
nicklas |
html += '<th colspan="2">ALIGNED_PAIRS</th>'; |
7211 |
29 May 23 |
nicklas |
html += '<th class="dottedleft" colspan="3">Genotypes</th>'; |
7211 |
29 May 23 |
nicklas |
html += '<th class="dottedleft" colspan="2"></th>'; |
7211 |
29 May 23 |
nicklas |
html += '<th class="dottedleft" colspan="4"></th>'; |
7218 |
30 May 23 |
nicklas |
html += '<th class="dottedleft" colspan="'+(noFlag?1:2)+'">Actions</th>'; |
7211 |
29 May 23 |
nicklas |
html += '<th class="dottedleft"></th>'; |
7211 |
29 May 23 |
nicklas |
html += '</tr>'; |
7211 |
29 May 23 |
nicklas |
html += '<tr>'; |
7211 |
29 May 23 |
nicklas |
html += '<th>Total</th>'; |
7211 |
29 May 23 |
nicklas |
html += '<th>Same PAT</th>'; |
7211 |
29 May 23 |
nicklas |
html += '<th>Skipped</th>'; |
7211 |
29 May 23 |
nicklas |
html += '<th class="dottedleft">Plate</th>'; |
7211 |
29 May 23 |
nicklas |
html += '<th>(millions)</th>'; |
7211 |
29 May 23 |
nicklas |
html += '<th>Dup.</th>'; |
7211 |
29 May 23 |
nicklas |
html += '<th class="dottedleft">Total</th>'; |
7211 |
29 May 23 |
nicklas |
html += '<th>HET</th>'; |
7211 |
29 May 23 |
nicklas |
html += '<th class="icon-col"></th>'; |
7211 |
29 May 23 |
nicklas |
html += '<th class="dottedleft">Alignment</th>'; |
7211 |
29 May 23 |
nicklas |
html += '<th class="icon-col"></th>'; |
7211 |
29 May 23 |
nicklas |
html += '<th class="dottedleft icon-col"></th>'; |
7211 |
29 May 23 |
nicklas |
html += '<th colspan="2">Warnings and messages</th>'; |
7211 |
29 May 23 |
nicklas |
html += '<th class="icon-col"></th>'; |
7211 |
29 May 23 |
nicklas |
html += '<th class="dottedleft"><span id="disable" data-prefix="disable" class="interactable link" title="Toggle selection – use CTRL, ALT or SHIFT to clear">Disable</span></th>'; |
7218 |
30 May 23 |
nicklas |
if (!noFlag) html += '<th><span id="flagrna" data-prefix="flag" class="interactable link" title="Toggle selection – use CTRL, ALT or SHIFT to clear">Flag</span></th>'; |
7211 |
29 May 23 |
nicklas |
html += '<th class="dottedleft">Comment</th>'; |
7211 |
29 May 23 |
nicklas |
html += '</tr>'; |
7211 |
29 May 23 |
nicklas |
html += '</thead>'; |
7211 |
29 May 23 |
nicklas |
282 |
|
7211 |
29 May 23 |
nicklas |
var htmlNoMessages = ''; |
7211 |
29 May 23 |
nicklas |
var htmlNoWarnings = ''; |
7213 |
29 May 23 |
nicklas |
var htmlLowWarnings = ''; |
7211 |
29 May 23 |
nicklas |
286 |
|
7211 |
29 May 23 |
nicklas |
for (var aNo = 0; aNo < alignedSequences.length; aNo++) |
7211 |
29 May 23 |
nicklas |
288 |
{ |
7211 |
29 May 23 |
nicklas |
var aligned = alignedSequences[aNo]; |
7211 |
29 May 23 |
nicklas |
var lib = aligned.lib; |
7211 |
29 May 23 |
nicklas |
var dna = aligned.dna; |
7211 |
29 May 23 |
nicklas |
var cmp = aligned.compare; |
7211 |
29 May 23 |
nicklas |
var vcf = cmp.vcf; |
7211 |
29 May 23 |
nicklas |
var plateWell = aligned.bioWell; |
7211 |
29 May 23 |
nicklas |
var alignedReads = aligned.ALIGNED_PAIRS == null ? '-' : Reggie.formatNumber(aligned.ALIGNED_PAIRS/1000000, null, 2); |
7211 |
29 May 23 |
nicklas |
var duplication = aligned.FRACTION_DUPLICATION == null ? '-' : Reggie.formatNumber(100*aligned.FRACTION_DUPLICATION, '%', -1); |
7211 |
29 May 23 |
nicklas |
var hetPercentage = vcf.gtCount ? Reggie.formatNumber(100*vcf.hetCount/vcf.gtCount, '%', -1) : '-'; |
7211 |
29 May 23 |
nicklas |
298 |
|
7211 |
29 May 23 |
nicklas |
var disableChecked = cmp.recommendDisable ? "checked" : ""; |
7211 |
29 May 23 |
nicklas |
var flagChecked = cmp.recommendFlag ? "checked" : ""; |
7211 |
29 May 23 |
nicklas |
301 |
|
7211 |
29 May 23 |
nicklas |
var rowspan = cmp.messages.length || 1; |
7211 |
29 May 23 |
nicklas |
303 |
|
7211 |
29 May 23 |
nicklas |
var tmp = '<tbody class="highlight"><tr>'; |
7211 |
29 May 23 |
nicklas |
tmp += '<td rowspan="'+rowspan+'">'+cmp.total+'</td>'; |
7211 |
29 May 23 |
nicklas |
tmp += '<td rowspan="'+rowspan+'">'+(cmp.samePat || '')+'</td>'; |
7211 |
29 May 23 |
nicklas |
tmp += '<td rowspan="'+rowspan+'">'+(cmp.skipped || '')+'</td>'; |
7211 |
29 May 23 |
nicklas |
tmp += '<td rowspan="'+rowspan+'" class="dottedleft text-col">'+(plateWell ? Strings.encodeTags(plateWell.bioPlate.name + ' ' + plateWell.location) : '-')+'</td>'; |
7211 |
29 May 23 |
nicklas |
tmp += '<td rowspan="'+rowspan+'">'+alignedReads+'</td>'; |
7211 |
29 May 23 |
nicklas |
tmp += '<td rowspan="'+rowspan+'">'+duplication+'</td>'; |
7211 |
29 May 23 |
nicklas |
tmp += '<td rowspan="'+rowspan+'" class="dottedleft">'+vcf.gtCount+'</td>'; |
7211 |
29 May 23 |
nicklas |
tmp += '<td rowspan="'+rowspan+'">'+hetPercentage+'</td>'; |
7211 |
29 May 23 |
nicklas |
tmp += '<td rowspan="'+rowspan+'" class="icon-col">'; |
7211 |
29 May 23 |
nicklas |
tmp += '<span class="link vcf-link" data-file-id="'+vcf.fileId+'" data-item-id="'+aligned.id+'" title="View genotype statistics"><img src="../images/vcf_file.png"></span>'; |
7211 |
29 May 23 |
nicklas |
tmp += '</td>'; |
7211 |
29 May 23 |
nicklas |
tmp += '<td rowspan="'+rowspan+'" class="dottedleft text-col">'+Strings.encodeTags(aligned.name)+'</td>'; |
7211 |
29 May 23 |
nicklas |
tmp += '<td rowspan="'+rowspan+'" class="icon-col"><span class="link case-summary" data-name="'+Strings.encodeTags(aligned.name)+'" title="Show case summary"><img src="../images/case_summary.png"></span></td>'; |
7211 |
29 May 23 |
nicklas |
318 |
|
7211 |
29 May 23 |
nicklas |
// The first message is on the main <tr> |
7213 |
29 May 23 |
nicklas |
var numHighWarnings = 0; |
7213 |
29 May 23 |
nicklas |
var numLowWarnings = 0; |
7211 |
29 May 23 |
nicklas |
if (cmp.messages.length > 0) |
7211 |
29 May 23 |
nicklas |
323 |
{ |
7211 |
29 May 23 |
nicklas |
var msg = cmp.messages[0]; |
7213 |
29 May 23 |
nicklas |
if (msg.warningLevel == 'HIGH') numHighWarnings++; |
7213 |
29 May 23 |
nicklas |
if (msg.warningLevel == 'LOW') numLowWarnings++; |
7211 |
29 May 23 |
nicklas |
tmp += gt.getMessageHtml(msg, aligned, vcf); |
7211 |
29 May 23 |
nicklas |
328 |
} |
7211 |
29 May 23 |
nicklas |
else |
7211 |
29 May 23 |
nicklas |
330 |
{ |
7211 |
29 May 23 |
nicklas |
tmp += '<td class="dottedleft icon-col"></td>'; |
7211 |
29 May 23 |
nicklas |
tmp += '<td class="text-col" colspan="2"></td>'; |
7211 |
29 May 23 |
nicklas |
tmp += '<td class="icon-col"></td>'; |
7211 |
29 May 23 |
nicklas |
334 |
} |
7211 |
29 May 23 |
nicklas |
tmp += '<td rowspan="'+rowspan+'" class="dottedleft"><input type="checkbox" name="disable.'+aligned.id+'" '+disableChecked+'></td>'; |
7218 |
30 May 23 |
nicklas |
if (!noFlag) tmp += '<td rowspan="'+rowspan+'"><input type="checkbox" name="flag.'+aligned.id+'" '+flagChecked+'></td>'; |
7216 |
30 May 23 |
nicklas |
tmp += '<td rowspan="'+rowspan+'" class="dottedleft comment"><input type="text" name="comment.'+aligned.id+'" value="'+Strings.encodeTags(aligned.QC_GENOTYPE_COMMENT || cmp.doNotUseComment)+'"></td>'; |
7211 |
29 May 23 |
nicklas |
tmp += '</tr>'; |
7211 |
29 May 23 |
nicklas |
339 |
|
7211 |
29 May 23 |
nicklas |
// If there are more messages, add more <tr> |
7211 |
29 May 23 |
nicklas |
for (var mNo = 1; mNo < cmp.messages.length; mNo++) |
7211 |
29 May 23 |
nicklas |
342 |
{ |
7211 |
29 May 23 |
nicklas |
var msg = cmp.messages[mNo]; |
7213 |
29 May 23 |
nicklas |
if (msg.warningLevel == 'HIGH') numHighWarnings++; |
7213 |
29 May 23 |
nicklas |
if (msg.warningLevel == 'LOW') numLowWarnings++; |
7211 |
29 May 23 |
nicklas |
tmp += '<tr>'+gt.getMessageHtml(msg, aligned, vcf) + '</tr>'; |
7211 |
29 May 23 |
nicklas |
347 |
} |
7211 |
29 May 23 |
nicklas |
tmp += '</tbody>'; |
7211 |
29 May 23 |
nicklas |
349 |
|
7211 |
29 May 23 |
nicklas |
if (cmp.messages.length == 0) |
7211 |
29 May 23 |
nicklas |
351 |
{ |
7211 |
29 May 23 |
nicklas |
// No messages are sorted last in the list |
7211 |
29 May 23 |
nicklas |
htmlNoMessages += tmp; |
7211 |
29 May 23 |
nicklas |
354 |
} |
7213 |
29 May 23 |
nicklas |
else if (numLowWarnings == 0 && numHighWarnings == 0) |
7211 |
29 May 23 |
nicklas |
356 |
{ |
7211 |
29 May 23 |
nicklas |
// No warnings are sorted in the middle |
7211 |
29 May 23 |
nicklas |
htmlNoWarnings += tmp; |
7211 |
29 May 23 |
nicklas |
359 |
} |
7213 |
29 May 23 |
nicklas |
else if (numHighWarnings == 0) |
7213 |
29 May 23 |
nicklas |
361 |
{ |
7213 |
29 May 23 |
nicklas |
htmlLowWarnings += tmp; |
7213 |
29 May 23 |
nicklas |
363 |
} |
7211 |
29 May 23 |
nicklas |
else |
7211 |
29 May 23 |
nicklas |
365 |
{ |
7211 |
29 May 23 |
nicklas |
// Items with at least one warning are sorted first |
7211 |
29 May 23 |
nicklas |
html += tmp; |
7211 |
29 May 23 |
nicklas |
368 |
} |
7211 |
29 May 23 |
nicklas |
369 |
} |
7211 |
29 May 23 |
nicklas |
370 |
|
7213 |
29 May 23 |
nicklas |
html += htmlLowWarnings; |
7211 |
29 May 23 |
nicklas |
html += htmlNoWarnings; |
7211 |
29 May 23 |
nicklas |
html += htmlNoMessages; |
7211 |
29 May 23 |
nicklas |
html += '</table>'; |
7211 |
29 May 23 |
nicklas |
Doc.element('comparisons').innerHTML = html; |
7211 |
29 May 23 |
nicklas |
376 |
|
7211 |
29 May 23 |
nicklas |
Events.addEventHandler('flagrna', 'click', gt.toggleSelection); |
7211 |
29 May 23 |
nicklas |
Events.addEventHandler('disable', 'click', gt.toggleSelection); |
7211 |
29 May 23 |
nicklas |
379 |
|
7211 |
29 May 23 |
nicklas |
// Add click handler to VCF files |
7211 |
29 May 23 |
nicklas |
var clickableItems = document.getElementsByClassName('vcf-link'); |
7211 |
29 May 23 |
nicklas |
for (var i = 0; i < clickableItems.length; i++) |
7211 |
29 May 23 |
nicklas |
383 |
{ |
7211 |
29 May 23 |
nicklas |
Events.addEventHandler(clickableItems[i], 'click', gt.vcfLinkOnClick); |
7211 |
29 May 23 |
nicklas |
385 |
} |
7211 |
29 May 23 |
nicklas |
386 |
|
7211 |
29 May 23 |
nicklas |
// Case summary links |
7211 |
29 May 23 |
nicklas |
var cs = document.getElementsByClassName('case-summary'); |
7211 |
29 May 23 |
nicklas |
for (var i = 0; i < cs.length; i++) |
7211 |
29 May 23 |
nicklas |
390 |
{ |
7211 |
29 May 23 |
nicklas |
Events.addEventHandler(cs[i], 'click', Reggie.openCaseSummaryPopupOnEvent); |
7211 |
29 May 23 |
nicklas |
392 |
} |
7211 |
29 May 23 |
nicklas |
393 |
|
7211 |
29 May 23 |
nicklas |
Wizard.setCurrentStep(2); |
7211 |
29 May 23 |
nicklas |
Doc.show('step-2'); |
7211 |
29 May 23 |
nicklas |
Doc.show('goregister'); |
7211 |
29 May 23 |
nicklas |
Doc.show('gocancel'); |
7211 |
29 May 23 |
nicklas |
398 |
} |
7211 |
29 May 23 |
nicklas |
399 |
|
7211 |
29 May 23 |
nicklas |
400 |
|
7211 |
29 May 23 |
nicklas |
gt.getMessageHtml = function(message, aligned, vcf) |
7211 |
29 May 23 |
nicklas |
402 |
{ |
7211 |
29 May 23 |
nicklas |
var level = message.warningLevel; |
7211 |
29 May 23 |
nicklas |
var icon = null; |
7211 |
29 May 23 |
nicklas |
if (level == 'INFO') |
7211 |
29 May 23 |
nicklas |
406 |
{ |
7211 |
29 May 23 |
nicklas |
icon = 'ok.png'; |
7211 |
29 May 23 |
nicklas |
408 |
} |
7211 |
29 May 23 |
nicklas |
else if (level == 'LOW') |
7211 |
29 May 23 |
nicklas |
410 |
{ |
7211 |
29 May 23 |
nicklas |
icon = 'warning_small.png'; |
7211 |
29 May 23 |
nicklas |
412 |
} |
7211 |
29 May 23 |
nicklas |
else |
7211 |
29 May 23 |
nicklas |
414 |
{ |
7211 |
29 May 23 |
nicklas |
icon = 'warning.png'; |
7211 |
29 May 23 |
nicklas |
416 |
} |
7211 |
29 May 23 |
nicklas |
417 |
|
7211 |
29 May 23 |
nicklas |
var html = ''; |
7211 |
29 May 23 |
nicklas |
html += '<td class="dottedleft icon-col"><img src="../images/'+icon+'"></td>'; |
7211 |
29 May 23 |
nicklas |
html += '<td class="text-col" title="'+(message.messageTooltip || '')+'">'+Strings.encodeTags(message.message) + '</td>'; |
7211 |
29 May 23 |
nicklas |
html += '<td class="text-col">'; |
7211 |
29 May 23 |
nicklas |
if (message.otherAssay) |
7211 |
29 May 23 |
nicklas |
423 |
{ |
7211 |
29 May 23 |
nicklas |
html += gt.tagCommonPartOfName(aligned.name, message.otherAssay); |
7211 |
29 May 23 |
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)+'">'; |
7211 |
29 May 23 |
nicklas |
if (message.flagged) html += '<img src="../images/flag.png" title="'+Strings.encodeTags(message.otherAssay)+' is already flagged">'; |
7211 |
29 May 23 |
nicklas |
if (message.currentVerifiedBy) |
7211 |
29 May 23 |
nicklas |
428 |
{ |
7211 |
29 May 23 |
nicklas |
var vicon = message.currentVerifiedBy == 'LYSATE' ? 'gt-verified-lysate.png' : 'gt-verified.png'; |
7211 |
29 May 23 |
nicklas |
html += '<img src="../images/'+vicon+'" title="'+Strings.encodeTags(message.otherAssay+' is already verified by '+message.currentVerifiedBy)+'">'; |
7211 |
29 May 23 |
nicklas |
431 |
} |
7211 |
29 May 23 |
nicklas |
432 |
} |
7211 |
29 May 23 |
nicklas |
html += '</td>'; |
7211 |
29 May 23 |
nicklas |
html += '<td class="icon-col">'; |
7211 |
29 May 23 |
nicklas |
if (message.vcf) |
7211 |
29 May 23 |
nicklas |
436 |
{ |
7211 |
29 May 23 |
nicklas |
html += ' <span class="link vcf-link" data-file-id="'+vcf.fileId+'" data-item-id="'+aligned.id+'"'; |
7211 |
29 May 23 |
nicklas |
html += ' data-item-id2="'+message.id+'" data-file-id2="'+message.vcf.fileId+'"'; |
7211 |
29 May 23 |
nicklas |
html += ' title="Compare genotypes (hold CTRL, ALT or SHIFT to open in a new popup)"><img src="../images/vcf_file.png"></span>'; |
7211 |
29 May 23 |
nicklas |
440 |
} |
7211 |
29 May 23 |
nicklas |
html += '</td>'; |
7211 |
29 May 23 |
nicklas |
return html; |
7211 |
29 May 23 |
nicklas |
443 |
} |
7211 |
29 May 23 |
nicklas |
444 |
|
7211 |
29 May 23 |
nicklas |
445 |
|
7211 |
29 May 23 |
nicklas |
gt.tagCommonPartOfName = function(name1, name2) |
7211 |
29 May 23 |
nicklas |
447 |
{ |
7211 |
29 May 23 |
nicklas |
var n1 = name1.split('.'); |
7211 |
29 May 23 |
nicklas |
var n2 = name2.split('.'); |
7211 |
29 May 23 |
nicklas |
var i = 0; |
7211 |
29 May 23 |
nicklas |
451 |
|
7211 |
29 May 23 |
nicklas |
var common = ''; |
7211 |
29 May 23 |
nicklas |
var sep = '.'; |
7211 |
29 May 23 |
nicklas |
while (i < n1.length && i < n2.length && n1[i] == n2[i]) |
7211 |
29 May 23 |
nicklas |
455 |
{ |
7211 |
29 May 23 |
nicklas |
common += n1[i] + sep; |
7211 |
29 May 23 |
nicklas |
i++; |
7211 |
29 May 23 |
nicklas |
458 |
} |
7211 |
29 May 23 |
nicklas |
459 |
|
7211 |
29 May 23 |
nicklas |
var diff = ''; |
7211 |
29 May 23 |
nicklas |
sep = ''; |
7211 |
29 May 23 |
nicklas |
while (i < n2.length) |
7211 |
29 May 23 |
nicklas |
463 |
{ |
7211 |
29 May 23 |
nicklas |
diff += sep + n2[i]; |
7211 |
29 May 23 |
nicklas |
i++; |
7211 |
29 May 23 |
nicklas |
sep = '.'; |
7211 |
29 May 23 |
nicklas |
467 |
} |
7211 |
29 May 23 |
nicklas |
468 |
|
7211 |
29 May 23 |
nicklas |
return '<span class="commonpart">'+Strings.encodeTags(common)+'</span><span class="diffpart">'+Strings.encodeTags(diff)+'</span>'; |
7211 |
29 May 23 |
nicklas |
470 |
} |
7211 |
29 May 23 |
nicklas |
471 |
|
7211 |
29 May 23 |
nicklas |
gt.vcfLinkOnClick = function(event) |
7211 |
29 May 23 |
nicklas |
473 |
{ |
7211 |
29 May 23 |
nicklas |
var fileId = Data.int(event.currentTarget, 'file-id'); |
7211 |
29 May 23 |
nicklas |
var itemId = Data.get(event.currentTarget, 'item-id'); |
7211 |
29 May 23 |
nicklas |
var fileId2 = Data.int(event.currentTarget, 'file-id2'); |
7211 |
29 May 23 |
nicklas |
var itemId2 = Data.get(event.currentTarget, 'item-id2'); |
7211 |
29 May 23 |
nicklas |
var specialKey = event.altKey || event.ctrlKey || event.shiftKey; |
7211 |
29 May 23 |
nicklas |
479 |
|
7211 |
29 May 23 |
nicklas |
var url = '../analysis/view_genotypes.jsp?ID=' + App.getSessionId(); |
7211 |
29 May 23 |
nicklas |
url += '&fileId='+fileId; |
7211 |
29 May 23 |
nicklas |
url += '&itemId='+itemId; |
7211 |
29 May 23 |
nicklas |
url += '&fileId2='+fileId2; |
7211 |
29 May 23 |
nicklas |
url += '&itemId2='+itemId2; |
7211 |
29 May 23 |
nicklas |
485 |
|
7211 |
29 May 23 |
nicklas |
Dialogs.openPopup(url, (specialKey ? 'ViewVcf'+itemId+itemId2 : 'ViewVcf'), 900, 600); |
7211 |
29 May 23 |
nicklas |
487 |
} |
7211 |
29 May 23 |
nicklas |
488 |
|
7211 |
29 May 23 |
nicklas |
gt.toggleSelection = function(event) |
7211 |
29 May 23 |
nicklas |
490 |
{ |
7211 |
29 May 23 |
nicklas |
var prefix = Data.get(event.currentTarget, 'prefix'); |
7211 |
29 May 23 |
nicklas |
var specialKey = event.altKey || event.ctrlKey || event.shiftKey; |
7211 |
29 May 23 |
nicklas |
493 |
|
7211 |
29 May 23 |
nicklas |
var frm = document.forms['reggie']; |
7211 |
29 May 23 |
nicklas |
for (var alignedNo = 0; alignedNo < alignedSequences.length; alignedNo++) |
7211 |
29 May 23 |
nicklas |
496 |
{ |
7211 |
29 May 23 |
nicklas |
var aligned = alignedSequences[alignedNo]; |
7211 |
29 May 23 |
nicklas |
var chk = frm[prefix+'.'+aligned.id]; |
7211 |
29 May 23 |
nicklas |
if (chk && !chk.disabled) |
7211 |
29 May 23 |
nicklas |
500 |
{ |
7211 |
29 May 23 |
nicklas |
chk.checked = specialKey ? false : !chk.checked; |
7211 |
29 May 23 |
nicklas |
502 |
} |
7211 |
29 May 23 |
nicklas |
503 |
} |
7211 |
29 May 23 |
nicklas |
504 |
} |
7211 |
29 May 23 |
nicklas |
505 |
|
7211 |
29 May 23 |
nicklas |
gt.submit = function() |
7211 |
29 May 23 |
nicklas |
507 |
{ |
7211 |
29 May 23 |
nicklas |
var frm = document.forms['reggie']; |
7211 |
29 May 23 |
nicklas |
var submitInfo = {}; |
7211 |
29 May 23 |
nicklas |
var list = []; |
7211 |
29 May 23 |
nicklas |
submitInfo.alignedSequences = list; |
7211 |
29 May 23 |
nicklas |
512 |
|
7211 |
29 May 23 |
nicklas |
for (var aNo = 0; aNo < alignedSequences.length; aNo++) |
7211 |
29 May 23 |
nicklas |
514 |
{ |
7211 |
29 May 23 |
nicklas |
var aligned = alignedSequences[aNo]; |
7211 |
29 May 23 |
nicklas |
var cmp = aligned.compare; |
7211 |
29 May 23 |
nicklas |
517 |
|
7211 |
29 May 23 |
nicklas |
var tmp = {}; |
7211 |
29 May 23 |
nicklas |
tmp.id = aligned.id; |
7216 |
30 May 23 |
nicklas |
tmp.comment = frm['comment.'+aligned.id].value; |
7211 |
29 May 23 |
nicklas |
tmp.disable = frm['disable.'+aligned.id].checked; |
7218 |
30 May 23 |
nicklas |
if (PIPELINE == 'DNA/Normal/WGS') tmp.verifySelf = false; |
7216 |
30 May 23 |
nicklas |
if (tmp.disable && cmp.recommendDoNotUse) |
7216 |
30 May 23 |
nicklas |
524 |
{ |
7216 |
30 May 23 |
nicklas |
tmp.doNotUse = cmp.recommendDoNotUse; |
7216 |
30 May 23 |
nicklas |
tmp.doNotUseComment = cmp.doNotUseComment; |
7216 |
30 May 23 |
nicklas |
527 |
} |
7211 |
29 May 23 |
nicklas |
var verified = []; |
7211 |
29 May 23 |
nicklas |
tmp.verified = verified; |
7211 |
29 May 23 |
nicklas |
var flag = null; |
7218 |
30 May 23 |
nicklas |
if (frm['flag.'+aligned.id] && frm['flag.'+aligned.id].checked) |
7211 |
29 May 23 |
nicklas |
532 |
{ |
7211 |
29 May 23 |
nicklas |
flag = []; |
7211 |
29 May 23 |
nicklas |
tmp.flag = flag; |
7211 |
29 May 23 |
nicklas |
535 |
} |
7211 |
29 May 23 |
nicklas |
for (var mNo = 0; mNo < cmp.messages.length; mNo++) |
7211 |
29 May 23 |
nicklas |
537 |
{ |
7211 |
29 May 23 |
nicklas |
var msg = cmp.messages[mNo]; |
7211 |
29 May 23 |
nicklas |
if (msg.id) |
7211 |
29 May 23 |
nicklas |
540 |
{ |
7215 |
30 May 23 |
nicklas |
if (flag && msg.assayType == 'TUMOR') |
7211 |
29 May 23 |
nicklas |
542 |
{ |
7211 |
29 May 23 |
nicklas |
flag[flag.length] = msg.id; |
7211 |
29 May 23 |
nicklas |
544 |
} |
7211 |
29 May 23 |
nicklas |
if (msg.verifiedBy) |
7211 |
29 May 23 |
nicklas |
546 |
{ |
7211 |
29 May 23 |
nicklas |
verified[verified.length] = { 'id': msg.id, 'verifiedBy': msg.verifiedBy, 'assayType': msg.assayType }; |
7211 |
29 May 23 |
nicklas |
548 |
} |
7211 |
29 May 23 |
nicklas |
549 |
} |
7211 |
29 May 23 |
nicklas |
550 |
} |
7211 |
29 May 23 |
nicklas |
551 |
|
7211 |
29 May 23 |
nicklas |
list[list.length] = tmp; |
7211 |
29 May 23 |
nicklas |
553 |
} |
7211 |
29 May 23 |
nicklas |
554 |
|
7211 |
29 May 23 |
nicklas |
var url = '../Genotype.servlet?ID='+App.getSessionId(); |
7211 |
29 May 23 |
nicklas |
url += '&cmd=RegisterQcCheck'; |
7215 |
30 May 23 |
nicklas |
url += '&pipeline='+encodeURIComponent(PIPELINE); |
7211 |
29 May 23 |
nicklas |
Wizard.showLoadingAnimation('Registering...'); |
7211 |
29 May 23 |
nicklas |
Wizard.asyncJsonRequest(url, gt.submissionResults, 'POST', JSON.stringify(submitInfo)); |
7211 |
29 May 23 |
nicklas |
560 |
} |
7211 |
29 May 23 |
nicklas |
561 |
|
7211 |
29 May 23 |
nicklas |
gt.submissionResults = function(response) |
7211 |
29 May 23 |
nicklas |
563 |
{ |
7211 |
29 May 23 |
nicklas |
Wizard.showFinalMessage(response.messages); |
7211 |
29 May 23 |
nicklas |
Doc.show('gorestart'); |
7211 |
29 May 23 |
nicklas |
566 |
} |
7211 |
29 May 23 |
nicklas |
567 |
|
7211 |
29 May 23 |
nicklas |
return gt; |
7211 |
29 May 23 |
nicklas |
569 |
}(); |
7211 |
29 May 23 |
nicklas |
570 |
|
7211 |
29 May 23 |
nicklas |
// Placeholder for various sort functions |
7211 |
29 May 23 |
nicklas |
var Sort = function() |
7211 |
29 May 23 |
nicklas |
573 |
{ |
7211 |
29 May 23 |
nicklas |
var sort = {}; |
7211 |
29 May 23 |
nicklas |
575 |
|
7211 |
29 May 23 |
nicklas |
// Sort items by name |
7211 |
29 May 23 |
nicklas |
sort.sortByName = function(a, b) |
7211 |
29 May 23 |
nicklas |
578 |
{ |
7211 |
29 May 23 |
nicklas |
return a.name == b.name ? 0 : (a.name < b.name ? -1 : 1); |
7211 |
29 May 23 |
nicklas |
580 |
} |
7211 |
29 May 23 |
nicklas |
581 |
|
7211 |
29 May 23 |
nicklas |
// Sort by Plate position (columns before rows) |
7211 |
29 May 23 |
nicklas |
sort.sortByPlatePosition = function(a, b) |
7211 |
29 May 23 |
nicklas |
584 |
{ |
7211 |
29 May 23 |
nicklas |
var plateA = a.bioWell ? a.bioWell.bioPlate.name : 'zz'+(a.name || a.dna.name); |
7211 |
29 May 23 |
nicklas |
var plateB = b.bioWell ? b.bioWell.bioPlate.name : 'zz'+(b.name || b.dna.name); |
7211 |
29 May 23 |
nicklas |
587 |
|
7211 |
29 May 23 |
nicklas |
if (plateA != plateB) return plateA < plateB ? -1 : 1; |
7211 |
29 May 23 |
nicklas |
589 |
|
7211 |
29 May 23 |
nicklas |
var posA = a.bioWell; |
7211 |
29 May 23 |
nicklas |
var posB = b.bioWell; |
7211 |
29 May 23 |
nicklas |
if (posA.column != posB.column) return posA.column < posB.column ? -1 : 1; |
7211 |
29 May 23 |
nicklas |
593 |
|
7211 |
29 May 23 |
nicklas |
return posA.row < posB.row ? -1 : 1; |
7211 |
29 May 23 |
nicklas |
595 |
} |
7211 |
29 May 23 |
nicklas |
596 |
|
7211 |
29 May 23 |
nicklas |
return sort; |
7211 |
29 May 23 |
nicklas |
598 |
}(); |
7211 |
29 May 23 |
nicklas |
599 |
|
7211 |
29 May 23 |
nicklas |
Doc.onLoad(GenoType.initPage); |
7211 |
29 May 23 |
nicklas |
601 |
|