4794 |
07 May 18 |
nicklas |
var Search = function() |
4794 |
07 May 18 |
nicklas |
2 |
{ |
4794 |
07 May 18 |
nicklas |
var search = {}; |
4794 |
07 May 18 |
nicklas |
var debug = 0; |
4794 |
07 May 18 |
nicklas |
5 |
|
4797 |
08 May 18 |
nicklas |
var bugIcons = [ 'bug-yellow.png', 'bug-red.png', 'bomb.png' ]; |
4797 |
08 May 18 |
nicklas |
7 |
|
7209 |
26 May 23 |
nicklas |
var tumors; |
7209 |
26 May 23 |
nicklas |
var normals; |
4794 |
07 May 18 |
nicklas |
var firstLoad = true; |
5001 |
04 Oct 18 |
nicklas |
var numChangedFormElements = 0; |
4794 |
07 May 18 |
nicklas |
12 |
|
4794 |
07 May 18 |
nicklas |
var itemByName = {}; // To keep track of which QiaCubes and LibPlates we have already seen |
6589 |
21 Feb 22 |
nicklas |
var assaysByName = {}; // Maps alignment/genotypecall name -> alignment/genotypecall object |
7209 |
26 May 23 |
nicklas |
var tumorsByPat = {}; // Maps patient name -> [] of tumors for that patient |
4794 |
07 May 18 |
nicklas |
16 |
|
4794 |
07 May 18 |
nicklas |
// Page initialization |
4794 |
07 May 18 |
nicklas |
search.initPage = function() |
4794 |
07 May 18 |
nicklas |
19 |
{ |
4794 |
07 May 18 |
nicklas |
// Step 1 |
4794 |
07 May 18 |
nicklas |
Events.addEventHandler('noFilter', 'change', search.filterOnChange); |
4794 |
07 May 18 |
nicklas |
Events.addEventHandler('highHetFilter', 'change', search.filterOnChange); |
4794 |
07 May 18 |
nicklas |
Events.addEventHandler('libPlateFilter', 'change', search.filterOnChange); |
4794 |
07 May 18 |
nicklas |
Events.addEventHandler('qiaCubeFilter', 'change', search.filterOnChange); |
4797 |
08 May 18 |
nicklas |
Events.addEventHandler('recentFilters', 'change', search.recentFilterOnChange); |
4794 |
07 May 18 |
nicklas |
26 |
|
4817 |
21 May 18 |
nicklas |
Events.addEventHandler('mode-genotype', 'change', search.modeOnChange); |
4817 |
21 May 18 |
nicklas |
Events.addEventHandler('mode-reprocess', 'change', search.modeOnChange); |
4975 |
21 Sep 18 |
nicklas |
Events.addEventHandler('mode-resolve', 'change', search.modeOnChange); |
4817 |
21 May 18 |
nicklas |
30 |
|
5001 |
04 Oct 18 |
nicklas |
Events.addEventHandler('itemTable', 'change', search.changedFormData); |
5001 |
04 Oct 18 |
nicklas |
32 |
|
4817 |
21 May 18 |
nicklas |
Buttons.addClickHandler('goreprocess', search.goReProcess); |
4975 |
21 Sep 18 |
nicklas |
Buttons.addClickHandler('goresolve', search.goResolve); |
4794 |
07 May 18 |
nicklas |
35 |
|
4794 |
07 May 18 |
nicklas |
var url = '../Genotype.servlet?ID='+App.getSessionId(); |
4794 |
07 May 18 |
nicklas |
url += '&cmd=GetFlaggedAlignments'; |
4794 |
07 May 18 |
nicklas |
Wizard.showLoadingAnimation('Loading flagged alignments...'); |
4794 |
07 May 18 |
nicklas |
Wizard.asyncJsonRequest(url, search.onAlignmentsLoaded); |
4794 |
07 May 18 |
nicklas |
40 |
} |
4794 |
07 May 18 |
nicklas |
41 |
|
4794 |
07 May 18 |
nicklas |
search.onAlignmentsLoaded = function(response) |
4794 |
07 May 18 |
nicklas |
43 |
{ |
7209 |
26 May 23 |
nicklas |
tumors = response.tumors; |
7209 |
26 May 23 |
nicklas |
normals = response.normals; |
6589 |
21 Feb 22 |
nicklas |
46 |
|
7209 |
26 May 23 |
nicklas |
for (var itemNo = 0; itemNo < normals.length; itemNo++) |
6589 |
21 Feb 22 |
nicklas |
48 |
{ |
7209 |
26 May 23 |
nicklas |
var item = normals[itemNo]; |
7209 |
26 May 23 |
nicklas |
assaysByName[item.name] = item; |
6589 |
21 Feb 22 |
nicklas |
51 |
} |
6589 |
21 Feb 22 |
nicklas |
52 |
|
4794 |
07 May 18 |
nicklas |
if (firstLoad) |
4794 |
07 May 18 |
nicklas |
54 |
{ |
7209 |
26 May 23 |
nicklas |
if (tumors.length == 0) |
5005 |
04 Oct 18 |
nicklas |
56 |
{ |
5005 |
04 Oct 18 |
nicklas |
Wizard.setFatalError('No flagged alignments available for processing.'); |
5005 |
04 Oct 18 |
nicklas |
return; |
5005 |
04 Oct 18 |
nicklas |
59 |
} |
4794 |
07 May 18 |
nicklas |
search.initFilterLists(); |
4794 |
07 May 18 |
nicklas |
61 |
} |
4794 |
07 May 18 |
nicklas |
else |
4794 |
07 May 18 |
nicklas |
63 |
{ |
4794 |
07 May 18 |
nicklas |
search.updateFilterLists(); |
4794 |
07 May 18 |
nicklas |
65 |
} |
4794 |
07 May 18 |
nicklas |
firstLoad = false; |
4794 |
07 May 18 |
nicklas |
search.primaryAnalysis(); |
4794 |
07 May 18 |
nicklas |
68 |
|
4817 |
21 May 18 |
nicklas |
Doc.show('navigation'); |
4794 |
07 May 18 |
nicklas |
search.updateTable(); |
4794 |
07 May 18 |
nicklas |
71 |
} |
4794 |
07 May 18 |
nicklas |
72 |
|
4794 |
07 May 18 |
nicklas |
73 |
/** |
5001 |
04 Oct 18 |
nicklas |
All changes to form elements will enable a warning when trying to |
5001 |
04 Oct 18 |
nicklas |
go somewhere else. |
5001 |
04 Oct 18 |
nicklas |
76 |
*/ |
5001 |
04 Oct 18 |
nicklas |
search.changedFormData = function(event) |
5001 |
04 Oct 18 |
nicklas |
78 |
{ |
5001 |
04 Oct 18 |
nicklas |
var ctrl = event.target; |
5001 |
04 Oct 18 |
nicklas |
80 |
|
5001 |
04 Oct 18 |
nicklas |
// Check if the control element has changed -- we need different checks for different element types |
5001 |
04 Oct 18 |
nicklas |
var modified = false; |
5001 |
04 Oct 18 |
nicklas |
if (ctrl.tagName == 'INPUT' && ctrl.type == 'text') |
5001 |
04 Oct 18 |
nicklas |
84 |
{ |
5001 |
04 Oct 18 |
nicklas |
// For text elements we can simply compare the current value with the original value |
5001 |
04 Oct 18 |
nicklas |
modified = ctrl.defaultValue != ctrl.value; |
5001 |
04 Oct 18 |
nicklas |
87 |
} |
5001 |
04 Oct 18 |
nicklas |
else if (ctrl.tagName == 'SELECT') |
5001 |
04 Oct 18 |
nicklas |
89 |
{ |
5001 |
04 Oct 18 |
nicklas |
modified = ctrl.value != ''; // Works, since we always have no value for the default selection |
5001 |
04 Oct 18 |
nicklas |
91 |
} |
5001 |
04 Oct 18 |
nicklas |
else if (ctrl.tagName == 'INPUT' && ctrl.type == 'checkbox') |
5001 |
04 Oct 18 |
nicklas |
93 |
{ |
5001 |
04 Oct 18 |
nicklas |
modified = ctrl.checked; // Works, since all checkboxes are unchecked by default |
5001 |
04 Oct 18 |
nicklas |
95 |
} |
5001 |
04 Oct 18 |
nicklas |
96 |
|
5001 |
04 Oct 18 |
nicklas |
// Did the modified status change for the control? |
5001 |
04 Oct 18 |
nicklas |
if (ctrl.modified != modified) |
5001 |
04 Oct 18 |
nicklas |
99 |
{ |
5001 |
04 Oct 18 |
nicklas |
ctrl.modified = modified; |
5001 |
04 Oct 18 |
nicklas |
// We need to apply the class to the parent (<td>) element since <select> elements don't support ::after/::before |
5001 |
04 Oct 18 |
nicklas |
Doc.addOrRemoveClass(ctrl.parentNode, 'modified', modified); |
5001 |
04 Oct 18 |
nicklas |
numChangedFormElements += modified ? 1 : -1; //Update counter for changed elements |
5001 |
04 Oct 18 |
nicklas |
if (numChangedFormElements < 0) numChangedFormElements = 0; // Just to be safe... |
5001 |
04 Oct 18 |
nicklas |
Wizard.setNoConfirmOnFirstStep(numChangedFormElements == 0); |
5001 |
04 Oct 18 |
nicklas |
106 |
} |
5001 |
04 Oct 18 |
nicklas |
107 |
} |
5001 |
04 Oct 18 |
nicklas |
108 |
|
5001 |
04 Oct 18 |
nicklas |
109 |
/** |
4794 |
07 May 18 |
nicklas |
Initialize the QiaCube and LibPlate filter lists. |
4794 |
07 May 18 |
nicklas |
This is done on the first load only. |
4794 |
07 May 18 |
nicklas |
112 |
*/ |
4794 |
07 May 18 |
nicklas |
search.initFilterLists = function() |
4794 |
07 May 18 |
nicklas |
114 |
{ |
4794 |
07 May 18 |
nicklas |
var allQiaCubes = []; |
4794 |
07 May 18 |
nicklas |
var allLibPlates = []; |
4794 |
07 May 18 |
nicklas |
117 |
|
7209 |
26 May 23 |
nicklas |
for (var itemNo = 0; itemNo < tumors.length; itemNo++) |
4794 |
07 May 18 |
nicklas |
119 |
{ |
7209 |
26 May 23 |
nicklas |
var tumor = tumors[itemNo]; |
7209 |
26 May 23 |
nicklas |
var rna = tumor.rna; |
6589 |
21 Feb 22 |
nicklas |
if (rna) |
4794 |
07 May 18 |
nicklas |
123 |
{ |
6589 |
21 Feb 22 |
nicklas |
var qiaCubeRun = rna.QIACUBE_DATE + '#' + rna.QIACUBE_RUN_NO; |
6589 |
21 Feb 22 |
nicklas |
var qiaCubeRunPos = qiaCubeRun + '@' + rna.QIACUBE_POSITION; |
6589 |
21 Feb 22 |
nicklas |
126 |
|
6589 |
21 Feb 22 |
nicklas |
var qiaCube = itemByName[qiaCubeRun]; |
6589 |
21 Feb 22 |
nicklas |
if (!qiaCube) |
4794 |
07 May 18 |
nicklas |
129 |
{ |
6589 |
21 Feb 22 |
nicklas |
qiaCube = new QiaCube(rna.QIACUBE_DATE, rna.QIACUBE_RUN_NO); |
6589 |
21 Feb 22 |
nicklas |
qiaCube.posCount = 1; |
6589 |
21 Feb 22 |
nicklas |
allQiaCubes[allQiaCubes.length] = qiaCube; |
6589 |
21 Feb 22 |
nicklas |
itemByName[qiaCubeRun] = qiaCube; |
4794 |
07 May 18 |
nicklas |
itemByName[qiaCubeRunPos] = qiaCube; |
4794 |
07 May 18 |
nicklas |
135 |
} |
6589 |
21 Feb 22 |
nicklas |
else |
6589 |
21 Feb 22 |
nicklas |
137 |
{ |
6589 |
21 Feb 22 |
nicklas |
if (!itemByName[qiaCubeRunPos]) |
6589 |
21 Feb 22 |
nicklas |
139 |
{ |
6589 |
21 Feb 22 |
nicklas |
qiaCube.posCount++; |
6589 |
21 Feb 22 |
nicklas |
itemByName[qiaCubeRunPos] = qiaCube; |
6589 |
21 Feb 22 |
nicklas |
142 |
} |
6589 |
21 Feb 22 |
nicklas |
143 |
} |
4794 |
07 May 18 |
nicklas |
144 |
} |
4794 |
07 May 18 |
nicklas |
145 |
|
7209 |
26 May 23 |
nicklas |
var lib = tumor.lib; |
6589 |
21 Feb 22 |
nicklas |
if (lib) |
4794 |
07 May 18 |
nicklas |
148 |
{ |
6589 |
21 Feb 22 |
nicklas |
var libPlate = lib.bioWell.bioPlate; |
6589 |
21 Feb 22 |
nicklas |
150 |
|
6589 |
21 Feb 22 |
nicklas |
var plate = itemByName[libPlate.name]; |
6589 |
21 Feb 22 |
nicklas |
if (!plate) |
4794 |
07 May 18 |
nicklas |
153 |
{ |
6589 |
21 Feb 22 |
nicklas |
plate = new LibPlate(libPlate.name); |
6589 |
21 Feb 22 |
nicklas |
plate.posCount = 1; |
6589 |
21 Feb 22 |
nicklas |
allLibPlates[allLibPlates.length] = plate; |
6589 |
21 Feb 22 |
nicklas |
itemByName[libPlate.name] = plate; |
4794 |
07 May 18 |
nicklas |
itemByName[platePos] = plate; |
4794 |
07 May 18 |
nicklas |
159 |
} |
6589 |
21 Feb 22 |
nicklas |
else |
6589 |
21 Feb 22 |
nicklas |
161 |
{ |
6589 |
21 Feb 22 |
nicklas |
var platePos = libPlate.name+'@'+lib.bioWell.location; |
6589 |
21 Feb 22 |
nicklas |
if (!itemByName[platePos]) |
6589 |
21 Feb 22 |
nicklas |
164 |
{ |
6589 |
21 Feb 22 |
nicklas |
plate.posCount++; |
6589 |
21 Feb 22 |
nicklas |
itemByName[platePos] = plate; |
6589 |
21 Feb 22 |
nicklas |
167 |
} |
6589 |
21 Feb 22 |
nicklas |
168 |
} |
4794 |
07 May 18 |
nicklas |
169 |
} |
4794 |
07 May 18 |
nicklas |
170 |
} |
4794 |
07 May 18 |
nicklas |
171 |
|
4794 |
07 May 18 |
nicklas |
// Sort in logical order |
4794 |
07 May 18 |
nicklas |
allQiaCubes.sort(Sort.sortByName); |
4794 |
07 May 18 |
nicklas |
allLibPlates.sort(Sort.sortByName); |
4794 |
07 May 18 |
nicklas |
175 |
|
4794 |
07 May 18 |
nicklas |
var frm = document.forms['reggie']; |
4794 |
07 May 18 |
nicklas |
for (var plateNo = 0; plateNo < allLibPlates.length; plateNo++) |
4794 |
07 May 18 |
nicklas |
178 |
{ |
4794 |
07 May 18 |
nicklas |
var libPlate = allLibPlates[plateNo]; |
4794 |
07 May 18 |
nicklas |
var option = new Option(libPlate.name + " [" + libPlate.posCount + "]", libPlate.name); |
4794 |
07 May 18 |
nicklas |
option.libPlate = libPlate; |
4794 |
07 May 18 |
nicklas |
frm.libPlateFilter[frm.libPlateFilter.length] = option; |
4794 |
07 May 18 |
nicklas |
183 |
} |
4794 |
07 May 18 |
nicklas |
for (var qiaCubeNo = 0; qiaCubeNo < allQiaCubes.length; qiaCubeNo++) |
4794 |
07 May 18 |
nicklas |
185 |
{ |
4794 |
07 May 18 |
nicklas |
var qiaCube = allQiaCubes[qiaCubeNo]; |
4794 |
07 May 18 |
nicklas |
var option = new Option(qiaCube.title + " [" + qiaCube.posCount + "]", qiaCube.name); |
4794 |
07 May 18 |
nicklas |
option.qiaCube = qiaCube; |
4794 |
07 May 18 |
nicklas |
frm.qiaCubeFilter[frm.qiaCubeFilter.length] = option; |
4794 |
07 May 18 |
nicklas |
190 |
} |
4794 |
07 May 18 |
nicklas |
191 |
} |
4794 |
07 May 18 |
nicklas |
192 |
|
4794 |
07 May 18 |
nicklas |
193 |
|
4794 |
07 May 18 |
nicklas |
194 |
/** |
4794 |
07 May 18 |
nicklas |
Update the QiaCube and LibPlate filter lists with new options. |
4794 |
07 May 18 |
nicklas |
This is done after the first load. The options are added to the end of the lists. |
4794 |
07 May 18 |
nicklas |
197 |
*/ |
4794 |
07 May 18 |
nicklas |
search.updateFilterLists = function() |
4794 |
07 May 18 |
nicklas |
199 |
{ |
4794 |
07 May 18 |
nicklas |
var frm = document.forms['reggie']; |
4794 |
07 May 18 |
nicklas |
201 |
|
7209 |
26 May 23 |
nicklas |
for (var itemNo = 0; itemNo < tumors.length; itemNo++) |
4794 |
07 May 18 |
nicklas |
203 |
{ |
7209 |
26 May 23 |
nicklas |
var tumor = tumors[itemNo]; |
7209 |
26 May 23 |
nicklas |
if (tumor.specimen) |
4794 |
07 May 18 |
nicklas |
206 |
{ |
7209 |
26 May 23 |
nicklas |
var rna = tumor.rna; |
4818 |
22 May 18 |
nicklas |
var qiaCubeRun = rna.QIACUBE_DATE + '#' + rna.QIACUBE_RUN_NO; |
4818 |
22 May 18 |
nicklas |
var qiaCubeRunPos = qiaCubeRun + '@' + rna.QIACUBE_POSITION; |
4818 |
22 May 18 |
nicklas |
var qiaCube = itemByName[qiaCubeRun]; |
4818 |
22 May 18 |
nicklas |
if (!qiaCube) |
4818 |
22 May 18 |
nicklas |
212 |
{ |
4818 |
22 May 18 |
nicklas |
qiaCube = new QiaCube(rna.QIACUBE_DATE, rna.QIACUBE_RUN_NO); |
4818 |
22 May 18 |
nicklas |
itemByName[qiaCubeRun] = qiaCube; |
4818 |
22 May 18 |
nicklas |
var option = new Option(qiaCube.title, qiaCube.name); |
4818 |
22 May 18 |
nicklas |
option.qiaCube = qiaCube; |
4818 |
22 May 18 |
nicklas |
frm.qiaCubeFilter[frm.qiaCubeFilter.length] = option; |
4818 |
22 May 18 |
nicklas |
218 |
} |
4794 |
07 May 18 |
nicklas |
219 |
} |
4794 |
07 May 18 |
nicklas |
220 |
|
7209 |
26 May 23 |
nicklas |
var lib = tumor.lib; |
4818 |
22 May 18 |
nicklas |
if (lib) |
4794 |
07 May 18 |
nicklas |
223 |
{ |
4818 |
22 May 18 |
nicklas |
var libPlate = lib.bioWell.bioPlate; |
4818 |
22 May 18 |
nicklas |
var plate = itemByName[libPlate.name]; |
4818 |
22 May 18 |
nicklas |
if (!plate) |
4818 |
22 May 18 |
nicklas |
227 |
{ |
4818 |
22 May 18 |
nicklas |
plate = new LibPlate(libPlate.name); |
4818 |
22 May 18 |
nicklas |
itemByName[libPlate.name] = plate; |
4818 |
22 May 18 |
nicklas |
230 |
|
4818 |
22 May 18 |
nicklas |
var option = new Option(libPlate.name, libPlate.name); |
4818 |
22 May 18 |
nicklas |
option.libPlate = libPlate; |
4818 |
22 May 18 |
nicklas |
frm.libPlateFilter[frm.libPlateFilter.length] = option; |
4818 |
22 May 18 |
nicklas |
234 |
} |
4794 |
07 May 18 |
nicklas |
235 |
} |
4794 |
07 May 18 |
nicklas |
236 |
} |
4794 |
07 May 18 |
nicklas |
237 |
} |
4794 |
07 May 18 |
nicklas |
238 |
|
4794 |
07 May 18 |
nicklas |
239 |
/** |
4794 |
07 May 18 |
nicklas |
Callback when some of the filter options has changed. |
4794 |
07 May 18 |
nicklas |
This method will detect which one was modified, and |
4794 |
07 May 18 |
nicklas |
reset all other filters. Then, it will issue a |
4794 |
07 May 18 |
nicklas |
request to the server to load alignments related to the |
4794 |
07 May 18 |
nicklas |
selected filter. |
4794 |
07 May 18 |
nicklas |
245 |
*/ |
4794 |
07 May 18 |
nicklas |
search.filterOnChange = function(event) |
4794 |
07 May 18 |
nicklas |
247 |
{ |
4794 |
07 May 18 |
nicklas |
var frm = document.forms['reggie']; |
4794 |
07 May 18 |
nicklas |
249 |
|
4794 |
07 May 18 |
nicklas |
var noFilter = Doc.element('noFilter'); |
4794 |
07 May 18 |
nicklas |
var highHet = Doc.element('highHetFilter'); |
4794 |
07 May 18 |
nicklas |
var libPlate = Doc.element('libPlateFilter'); |
4794 |
07 May 18 |
nicklas |
var qiaCube = Doc.element('qiaCubeFilter'); |
4794 |
07 May 18 |
nicklas |
254 |
|
4817 |
21 May 18 |
nicklas |
if (event) |
4817 |
21 May 18 |
nicklas |
256 |
{ |
4817 |
21 May 18 |
nicklas |
if (event.target != noFilter) noFilter.checked = false; |
4817 |
21 May 18 |
nicklas |
if (event.target != highHet) highHet.checked = false; |
4817 |
21 May 18 |
nicklas |
if (event.target != libPlate) libPlate.selectedIndex = 0; |
4817 |
21 May 18 |
nicklas |
if (event.target != qiaCube) qiaCube.selectedIndex = 0; |
4817 |
21 May 18 |
nicklas |
261 |
} |
4817 |
21 May 18 |
nicklas |
262 |
|
5001 |
04 Oct 18 |
nicklas |
if (numChangedFormElements > 0) |
5001 |
04 Oct 18 |
nicklas |
264 |
{ |
5001 |
04 Oct 18 |
nicklas |
if (!confirm('There are unsaved changes. Discard changes?')) return; |
5001 |
04 Oct 18 |
nicklas |
266 |
} |
5001 |
04 Oct 18 |
nicklas |
267 |
|
4794 |
07 May 18 |
nicklas |
var url = '../Genotype.servlet?ID='+App.getSessionId(); |
4794 |
07 May 18 |
nicklas |
url += '&cmd=GetFlaggedAlignments'; |
4794 |
07 May 18 |
nicklas |
270 |
|
4794 |
07 May 18 |
nicklas |
var msg = 'Loading flagged alignments...'; |
4794 |
07 May 18 |
nicklas |
var hasFilter = false; |
4797 |
08 May 18 |
nicklas |
var newRecentFilter = null; |
4794 |
07 May 18 |
nicklas |
if (libPlate.selectedIndex > 0) |
4794 |
07 May 18 |
nicklas |
275 |
{ |
4794 |
07 May 18 |
nicklas |
url += '&libPlateFilter='+encodeURIComponent(libPlate.value); |
4794 |
07 May 18 |
nicklas |
msg = 'Loading alignments related to ' + libPlate.value; |
4794 |
07 May 18 |
nicklas |
hasFilter = true; |
4797 |
08 May 18 |
nicklas |
newRecentFilter = { 'value': 'lp:'+libPlate.value, 'text': libPlate.value }; |
4794 |
07 May 18 |
nicklas |
280 |
} |
4794 |
07 May 18 |
nicklas |
else if (qiaCube.selectedIndex > 0) |
4794 |
07 May 18 |
nicklas |
282 |
{ |
4794 |
07 May 18 |
nicklas |
var qiaCube = frm.qiaCubeFilter[frm.qiaCubeFilter.selectedIndex].qiaCube; |
4794 |
07 May 18 |
nicklas |
url += '&qiaCubeFilter='+encodeURIComponent(qiaCube.name); |
4794 |
07 May 18 |
nicklas |
msg = 'Loading alignments related to QiaCube ' + qiaCube.title; |
4794 |
07 May 18 |
nicklas |
hasFilter = true; |
4797 |
08 May 18 |
nicklas |
newRecentFilter = { 'value': 'qc:'+qiaCube.name, 'text': qiaCube.title }; |
4794 |
07 May 18 |
nicklas |
288 |
} |
4794 |
07 May 18 |
nicklas |
else if (highHet.checked) |
4794 |
07 May 18 |
nicklas |
290 |
{ |
4794 |
07 May 18 |
nicklas |
url += '&highHetFilter=1'; |
4794 |
07 May 18 |
nicklas |
hasFilter = true; |
4794 |
07 May 18 |
nicklas |
293 |
} |
4794 |
07 May 18 |
nicklas |
else |
4794 |
07 May 18 |
nicklas |
295 |
{ |
4794 |
07 May 18 |
nicklas |
noFilter.checked = true; |
4817 |
21 May 18 |
nicklas |
Forms.checkRadio(frm.mode, 'genotype'); |
4794 |
07 May 18 |
nicklas |
298 |
} |
4794 |
07 May 18 |
nicklas |
299 |
|
4970 |
13 Sep 18 |
nicklas |
Wizard.hideGoNextConfirmation(); |
4794 |
07 May 18 |
nicklas |
Wizard.showLoadingAnimation(msg); |
4794 |
07 May 18 |
nicklas |
Wizard.asyncJsonRequest(url, search.onAlignmentsLoaded); |
4794 |
07 May 18 |
nicklas |
303 |
|
4797 |
08 May 18 |
nicklas |
if (newRecentFilter != null) |
4797 |
08 May 18 |
nicklas |
305 |
{ |
4797 |
08 May 18 |
nicklas |
var recentFilter = Doc.element('recentFilters'); |
4797 |
08 May 18 |
nicklas |
for (var i = 0; i < recentFilter.length; i++) |
4797 |
08 May 18 |
nicklas |
308 |
{ |
4797 |
08 May 18 |
nicklas |
if (recentFilter[i].value == newRecentFilter.value) |
4797 |
08 May 18 |
nicklas |
310 |
{ |
4797 |
08 May 18 |
nicklas |
recentFilter.remove(i); |
4797 |
08 May 18 |
nicklas |
break; |
4797 |
08 May 18 |
nicklas |
313 |
} |
4797 |
08 May 18 |
nicklas |
314 |
} |
4797 |
08 May 18 |
nicklas |
recentFilter.add(new Option(newRecentFilter.text, newRecentFilter.value), 1); |
4797 |
08 May 18 |
nicklas |
Doc.show(recentFilter, 'inline'); |
4797 |
08 May 18 |
nicklas |
317 |
} |
4797 |
08 May 18 |
nicklas |
318 |
|
4817 |
21 May 18 |
nicklas |
// Hide buttons while updating and disable mode changes |
4817 |
21 May 18 |
nicklas |
Doc.hide('navigation'); |
4817 |
21 May 18 |
nicklas |
Doc.element('mode-reprocess').disabled = true; |
4817 |
21 May 18 |
nicklas |
Doc.element('mode-resolve').disabled = true; |
4817 |
21 May 18 |
nicklas |
323 |
|
4817 |
21 May 18 |
nicklas |
if (hasFilter && !highHet.checked) |
4794 |
07 May 18 |
nicklas |
325 |
{ |
4797 |
08 May 18 |
nicklas |
search.updateTable(true); |
4794 |
07 May 18 |
nicklas |
327 |
} |
4794 |
07 May 18 |
nicklas |
else |
4794 |
07 May 18 |
nicklas |
329 |
{ |
4794 |
07 May 18 |
nicklas |
Doc.element('itemTable').innerHTML = ''; |
4794 |
07 May 18 |
nicklas |
331 |
} |
4794 |
07 May 18 |
nicklas |
332 |
} |
4794 |
07 May 18 |
nicklas |
333 |
|
4799 |
09 May 18 |
nicklas |
334 |
|
4797 |
08 May 18 |
nicklas |
search.recentFilterOnChange = function(event) |
4797 |
08 May 18 |
nicklas |
336 |
{ |
4797 |
08 May 18 |
nicklas |
var list = event.currentTarget; |
4797 |
08 May 18 |
nicklas |
var value = list.value; |
4797 |
08 May 18 |
nicklas |
var prefix = value.substr(0, 3); |
4797 |
08 May 18 |
nicklas |
list.selectedIndex = 0; |
4797 |
08 May 18 |
nicklas |
if (prefix == 'qc:') |
4797 |
08 May 18 |
nicklas |
342 |
{ |
4797 |
08 May 18 |
nicklas |
Data.set(event.currentTarget, 'qiacuberun', value.substr(3)); |
4797 |
08 May 18 |
nicklas |
search.setQiaCubeFilter(event); |
4797 |
08 May 18 |
nicklas |
345 |
} |
4797 |
08 May 18 |
nicklas |
else if (prefix == 'lp:') |
4797 |
08 May 18 |
nicklas |
347 |
{ |
4797 |
08 May 18 |
nicklas |
Data.set(event.currentTarget, 'libplate', value.substr(3)); |
4797 |
08 May 18 |
nicklas |
search.setLibPlateFilter(event); |
4797 |
08 May 18 |
nicklas |
350 |
} |
4797 |
08 May 18 |
nicklas |
351 |
|
4797 |
08 May 18 |
nicklas |
352 |
} |
4797 |
08 May 18 |
nicklas |
353 |
|
4794 |
07 May 18 |
nicklas |
354 |
/** |
4794 |
07 May 18 |
nicklas |
Event handler for clicking on a QiaCube run, which should |
4794 |
07 May 18 |
nicklas |
enable the filter for that run and re-load alignments |
4794 |
07 May 18 |
nicklas |
related to it. Updating the selected item in the filter list |
4794 |
07 May 18 |
nicklas |
and sending a 'change' event should do the trick. |
4794 |
07 May 18 |
nicklas |
359 |
*/ |
4794 |
07 May 18 |
nicklas |
search.setQiaCubeFilter = function(event) |
4794 |
07 May 18 |
nicklas |
361 |
{ |
4794 |
07 May 18 |
nicklas |
var qiaCubeRun = Data.get(event.currentTarget, 'qiacuberun'); |
4794 |
07 May 18 |
nicklas |
var frm = document.forms['reggie']; |
4794 |
07 May 18 |
nicklas |
Forms.selectListOption(frm.qiaCubeFilter, qiaCubeRun); |
4794 |
07 May 18 |
nicklas |
Events.sendChangeEvent(frm.qiaCubeFilter); |
4794 |
07 May 18 |
nicklas |
366 |
} |
4794 |
07 May 18 |
nicklas |
367 |
|
4794 |
07 May 18 |
nicklas |
368 |
/** |
4794 |
07 May 18 |
nicklas |
Event handler for clicking on a LibPlate, which should |
4794 |
07 May 18 |
nicklas |
enable the filter for that run and re-load alignments |
4794 |
07 May 18 |
nicklas |
related to it. Updating the selected item in the filter list |
4794 |
07 May 18 |
nicklas |
and sending a 'change' event should do the trick. |
4794 |
07 May 18 |
nicklas |
373 |
*/ |
4794 |
07 May 18 |
nicklas |
search.setLibPlateFilter = function(event) |
4794 |
07 May 18 |
nicklas |
375 |
{ |
4794 |
07 May 18 |
nicklas |
var libplate = Data.get(event.currentTarget, 'libplate'); |
4794 |
07 May 18 |
nicklas |
var frm = document.forms['reggie']; |
4794 |
07 May 18 |
nicklas |
Forms.selectListOption(frm.libPlateFilter, libplate); |
4794 |
07 May 18 |
nicklas |
Events.sendChangeEvent(frm.libPlateFilter); |
4794 |
07 May 18 |
nicklas |
380 |
} |
4794 |
07 May 18 |
nicklas |
381 |
|
4794 |
07 May 18 |
nicklas |
382 |
|
4797 |
08 May 18 |
nicklas |
search.updateTable = function(noContextAnalysis) |
4794 |
07 May 18 |
nicklas |
384 |
{ |
4794 |
07 May 18 |
nicklas |
var frm = document.forms['reggie']; |
4794 |
07 May 18 |
nicklas |
386 |
|
4794 |
07 May 18 |
nicklas |
var stepTitle = 'Flagged alignments'; |
4794 |
07 May 18 |
nicklas |
var filter = null; |
4975 |
21 Sep 18 |
nicklas |
var filterType = null; |
4794 |
07 May 18 |
nicklas |
var positionProperty = null; |
4794 |
07 May 18 |
nicklas |
var highHetFilter = false; |
4794 |
07 May 18 |
nicklas |
var qiacubefilter = false; |
4794 |
07 May 18 |
nicklas |
var libplatefilter = false; |
4794 |
07 May 18 |
nicklas |
var qiaCube = null; |
4794 |
07 May 18 |
nicklas |
var libPlate = null; |
4794 |
07 May 18 |
nicklas |
396 |
|
4794 |
07 May 18 |
nicklas |
if (Doc.element('highHetFilter').checked) |
4794 |
07 May 18 |
nicklas |
398 |
{ |
7209 |
26 May 23 |
nicklas |
tumors.sort(Sort.sortTumorsByLibPlatePosition); |
4794 |
07 May 18 |
nicklas |
highHetFilter = true; |
4817 |
21 May 18 |
nicklas |
filter = Filter.hetFilter(65); |
4975 |
21 Sep 18 |
nicklas |
filterType = 'HET'; |
4975 |
21 Sep 18 |
nicklas |
positionProperty = Property.LibPlatePosition; |
4817 |
21 May 18 |
nicklas |
stepTitle = 'Alignments with HET > 65%'; |
4794 |
07 May 18 |
nicklas |
405 |
} |
4794 |
07 May 18 |
nicklas |
else if (frm.qiaCubeFilter.selectedIndex > 0) |
4794 |
07 May 18 |
nicklas |
407 |
{ |
7209 |
26 May 23 |
nicklas |
tumors.sort(Sort.sortTumorsByQiaCubePosition); |
4794 |
07 May 18 |
nicklas |
qiaCube = frm.qiaCubeFilter[frm.qiaCubeFilter.selectedIndex].qiaCube; |
4797 |
08 May 18 |
nicklas |
qiacubefilter = qiaCube.name; |
4794 |
07 May 18 |
nicklas |
filter = Filter.qiaCubeFilter(qiaCube.name); |
4975 |
21 Sep 18 |
nicklas |
filterType = 'QIACUBE'; |
4794 |
07 May 18 |
nicklas |
positionProperty = Property.QiaCubePosition; |
4794 |
07 May 18 |
nicklas |
stepTitle = 'Alignments related to QiaCube ' + qiaCube.title; |
4794 |
07 May 18 |
nicklas |
415 |
} |
4794 |
07 May 18 |
nicklas |
else if (frm.libPlateFilter.selectedIndex > 0) |
4794 |
07 May 18 |
nicklas |
417 |
{ |
7209 |
26 May 23 |
nicklas |
tumors.sort(Sort.sortTumorsByLibPlatePosition); |
4794 |
07 May 18 |
nicklas |
libPlate = frm.libPlateFilter[frm.libPlateFilter.selectedIndex].libPlate; |
4797 |
08 May 18 |
nicklas |
libplatefilter = libPlate.name; |
4794 |
07 May 18 |
nicklas |
filter = Filter.libPlateFilter(libPlate.name); |
4975 |
21 Sep 18 |
nicklas |
filterType = 'LIBPLATE'; |
4794 |
07 May 18 |
nicklas |
positionProperty = Property.LibPlatePosition; |
4794 |
07 May 18 |
nicklas |
stepTitle = 'Alignments related to ' + libPlate.name; |
4794 |
07 May 18 |
nicklas |
425 |
} |
4794 |
07 May 18 |
nicklas |
else |
4794 |
07 May 18 |
nicklas |
427 |
{ |
4794 |
07 May 18 |
nicklas |
// No filter |
7209 |
26 May 23 |
nicklas |
tumors.sort(Sort.sortTumorsByQiaCubePosition); |
4794 |
07 May 18 |
nicklas |
430 |
} |
4794 |
07 May 18 |
nicklas |
431 |
|
4975 |
21 Sep 18 |
nicklas |
if (filter && positionProperty && !noContextAnalysis && !highHetFilter) |
4794 |
07 May 18 |
nicklas |
433 |
{ |
4794 |
07 May 18 |
nicklas |
search.contextAnalysis(filter, positionProperty); |
4794 |
07 May 18 |
nicklas |
435 |
} |
4794 |
07 May 18 |
nicklas |
436 |
|
4794 |
07 May 18 |
nicklas |
var filtered = []; |
4794 |
07 May 18 |
nicklas |
var tbody = []; |
4794 |
07 May 18 |
nicklas |
if (filter) |
4794 |
07 May 18 |
nicklas |
440 |
{ |
4794 |
07 May 18 |
nicklas |
var lastPos = null; |
4817 |
21 May 18 |
nicklas |
var lastStartTb = null; |
7209 |
26 May 23 |
nicklas |
for (var itemNo = 0; itemNo < tumors.length; itemNo++) |
4794 |
07 May 18 |
nicklas |
444 |
{ |
7209 |
26 May 23 |
nicklas |
var tumor = tumors[itemNo]; |
7209 |
26 May 23 |
nicklas |
if (filter(tumor)) |
4794 |
07 May 18 |
nicklas |
447 |
{ |
7209 |
26 May 23 |
nicklas |
filtered[filtered.length] = tumor; |
4817 |
21 May 18 |
nicklas |
var tb = { 'start': 1, 'end': 1 }; // The default is to start a new <tbody> section for each alignment |
7209 |
26 May 23 |
nicklas |
tb.rowspan = tumor.compare ? (tumor.compare.messages.length || 1) : 1; // A <tbody> typically spans over number-or-messages rows |
4817 |
21 May 18 |
nicklas |
tb.tbodyspan = tb.rowspan; |
4794 |
07 May 18 |
nicklas |
tbody[tbody.length] = tb; |
4794 |
07 May 18 |
nicklas |
if (positionProperty) |
4794 |
07 May 18 |
nicklas |
454 |
{ |
7209 |
26 May 23 |
nicklas |
var pos = positionProperty(tumor); |
4794 |
07 May 18 |
nicklas |
if (pos == lastPos) |
4794 |
07 May 18 |
nicklas |
457 |
{ |
4817 |
21 May 18 |
nicklas |
// If we are at the same position, we should not start a new <tbody> section |
4817 |
21 May 18 |
nicklas |
// Adjust properties accordingly |
4794 |
07 May 18 |
nicklas |
tbody[tbody.length-2].end = 0; |
4794 |
07 May 18 |
nicklas |
tb.start = 0; |
4817 |
21 May 18 |
nicklas |
lastStartTb.tbodyspan += tb.rowspan; |
4794 |
07 May 18 |
nicklas |
463 |
} |
4817 |
21 May 18 |
nicklas |
else |
4817 |
21 May 18 |
nicklas |
465 |
{ |
4817 |
21 May 18 |
nicklas |
// New position in the context |
4817 |
21 May 18 |
nicklas |
lastPos = pos; |
4817 |
21 May 18 |
nicklas |
lastStartTb = tb; |
4817 |
21 May 18 |
nicklas |
469 |
} |
4794 |
07 May 18 |
nicklas |
470 |
} |
4794 |
07 May 18 |
nicklas |
471 |
} |
4794 |
07 May 18 |
nicklas |
472 |
} |
4794 |
07 May 18 |
nicklas |
473 |
} |
4794 |
07 May 18 |
nicklas |
else |
4794 |
07 May 18 |
nicklas |
475 |
{ |
7209 |
26 May 23 |
nicklas |
filtered = tumors; |
4794 |
07 May 18 |
nicklas |
477 |
} |
4794 |
07 May 18 |
nicklas |
478 |
|
4794 |
07 May 18 |
nicklas |
var html = ''; |
4818 |
22 May 18 |
nicklas |
480 |
|
4818 |
22 May 18 |
nicklas |
if (filter) |
4818 |
22 May 18 |
nicklas |
482 |
{ |
4818 |
22 May 18 |
nicklas |
html += '<thead class="mode-reprocess"><tr>'; |
4970 |
13 Sep 18 |
nicklas |
html += '<th colspan="4"></th>'; |
4970 |
13 Sep 18 |
nicklas |
html += '<th colspan="3" class="mode-reprocess-header">Remaining quantity</th>'; |
4970 |
13 Sep 18 |
nicklas |
html += '<th colspan="10"></th>'; |
4818 |
22 May 18 |
nicklas |
html += '</tr></thead>'; |
4818 |
22 May 18 |
nicklas |
488 |
} |
4818 |
22 May 18 |
nicklas |
489 |
|
4794 |
07 May 18 |
nicklas |
html += '<thead class="bg-filled-100">'; |
4794 |
07 May 18 |
nicklas |
html += '<tr>'; |
4794 |
07 May 18 |
nicklas |
html += '<th>Patient</th>'; |
4970 |
13 Sep 18 |
nicklas |
html += '<th class="'+(qiacubefilter?'':'mode-genotype')+'">QiaCube</th>'; |
4970 |
13 Sep 18 |
nicklas |
html += '<th class="'+(libplatefilter||highHetFilter?'':'mode-genotype')+'">LibPlate</th>'; |
4794 |
07 May 18 |
nicklas |
html += '<th>HET</th>'; |
4794 |
07 May 18 |
nicklas |
html += '<th>Alignment</th>'; |
4817 |
21 May 18 |
nicklas |
if (filter) |
4817 |
21 May 18 |
nicklas |
498 |
{ |
4817 |
21 May 18 |
nicklas |
html += '<th class="mode-reprocess dottedleft num-col">Specimen<br>(mg)</th>'; |
4817 |
21 May 18 |
nicklas |
html += '<th class="mode-reprocess num-col">Lysate<br>(µl)</th>'; |
4817 |
21 May 18 |
nicklas |
html += '<th class="mode-reprocess num-col">RNA<br>(µg)</th>'; |
4970 |
13 Sep 18 |
nicklas |
html += '<th class="mode-reprocess" id="reprocess-header">Re-process</th>'; |
4981 |
25 Sep 18 |
nicklas |
// Note! "mode-resolve" columns here to get the same order for grouping |
4981 |
25 Sep 18 |
nicklas |
html += '<th class="mode-resolve dottedleft">Ok</th>'; |
4982 |
26 Sep 18 |
nicklas |
html += '<th class="mode-resolve" colspan="2">DoNotUse<span style="float:right;">FutureGT</span></th>'; |
4976 |
24 Sep 18 |
nicklas |
html += '<th class="mode-resolve comment-col">Comment</th>'; |
4976 |
24 Sep 18 |
nicklas |
507 |
|
4970 |
13 Sep 18 |
nicklas |
html += '<th class="mode-reprocess comment-col">Comment</th>'; |
4970 |
13 Sep 18 |
nicklas |
html += '<th class="mode-reprocess flag-col dottedright">Flag</th>'; |
4817 |
21 May 18 |
nicklas |
510 |
} |
4817 |
21 May 18 |
nicklas |
html += '<th></th>'; |
4794 |
07 May 18 |
nicklas |
html += '<th class="dottedleft" colspan="2">Warnings and messages</th>'; |
6589 |
21 Feb 22 |
nicklas |
html += '<th class="dottedleft">Alignment/GenotypeCall</th>'; |
7209 |
26 May 23 |
nicklas |
html += '<th>Pipeline</th>'; |
4794 |
07 May 18 |
nicklas |
html += '<th>HET</th>'; |
4817 |
21 May 18 |
nicklas |
html += '<th class="mode-genotype">QiaCube</th>'; |
7209 |
26 May 23 |
nicklas |
html += '<th class="mode-genotype">Plate/Chip</th>'; |
4794 |
07 May 18 |
nicklas |
html += '<th>Patient</th>'; |
4794 |
07 May 18 |
nicklas |
html += '</tr>'; |
4794 |
07 May 18 |
nicklas |
html += '</thead>'; |
4794 |
07 May 18 |
nicklas |
521 |
|
4794 |
07 May 18 |
nicklas |
var numListed = 0; |
4794 |
07 May 18 |
nicklas |
for (var itemNo = 0; itemNo < filtered.length; itemNo++) |
4794 |
07 May 18 |
nicklas |
524 |
{ |
7209 |
26 May 23 |
nicklas |
var tumor = filtered[itemNo]; |
7209 |
26 May 23 |
nicklas |
var cmp = tumor.compare; |
7209 |
26 May 23 |
nicklas |
var lib = tumor.lib; |
7209 |
26 May 23 |
nicklas |
var rna = tumor.rna; |
7209 |
26 May 23 |
nicklas |
var lys = tumor.lysate; |
7209 |
26 May 23 |
nicklas |
var sp = tumor.specimen; |
4976 |
24 Sep 18 |
nicklas |
var recommendReprocess = false; |
4976 |
24 Sep 18 |
nicklas |
var recommendDoNotUse = false; |
4817 |
21 May 18 |
nicklas |
533 |
|
4818 |
22 May 18 |
nicklas |
var libPlate = lib ? lib.bioWell.bioPlate : null; |
4794 |
07 May 18 |
nicklas |
numListed++; |
4794 |
07 May 18 |
nicklas |
536 |
|
4794 |
07 May 18 |
nicklas |
var tb = tbody[itemNo] || { 'start': 1, 'end': 1 }; |
4980 |
25 Sep 18 |
nicklas |
var rowspan = tb.rowspan || (cmp ? cmp.messages.length : 0) || 1; |
4817 |
21 May 18 |
nicklas |
var tbodySpan = tb.tbodyspan || rowspan; |
4794 |
07 May 18 |
nicklas |
540 |
|
4794 |
07 May 18 |
nicklas |
if (!tb.start) |
4794 |
07 May 18 |
nicklas |
542 |
{ |
4817 |
21 May 18 |
nicklas |
html += '<tr class="dotted-above">'; |
4794 |
07 May 18 |
nicklas |
544 |
} |
4817 |
21 May 18 |
nicklas |
else |
4817 |
21 May 18 |
nicklas |
546 |
{ |
4976 |
24 Sep 18 |
nicklas |
// Try to give a re-process recommendation based on the assumption that the |
4976 |
24 Sep 18 |
nicklas |
// current alignment is incorrect. We look for other alignments from the same |
4976 |
24 Sep 18 |
nicklas |
// patient and specimen but with either a different RNA or Library |
7209 |
26 May 23 |
nicklas |
if (filter && tumor.flagged && !tumor.QC_GENOTYPE_VERIFIED && sp) |
4976 |
24 Sep 18 |
nicklas |
551 |
{ |
4976 |
24 Sep 18 |
nicklas |
recommendReprocess = true; |
7209 |
26 May 23 |
nicklas |
var otherTumors = tumorsByPat[sp.patientName]; |
7209 |
26 May 23 |
nicklas |
for (var otherNo = 0; otherNo < otherTumors.length; otherNo++) |
4976 |
24 Sep 18 |
nicklas |
555 |
{ |
7209 |
26 May 23 |
nicklas |
var otherT = otherTumors[otherNo]; |
7209 |
26 May 23 |
nicklas |
if (otherT.bugged && otherT.buglevel > 0) continue; // Ignore items that we "know" to be incorrect |
4976 |
24 Sep 18 |
nicklas |
558 |
|
7209 |
26 May 23 |
nicklas |
var sameLib = otherT.lib && otherT.lib.id == lib.id; |
7209 |
26 May 23 |
nicklas |
var sameRNA = otherT.rna && otherT.rna.id == rna.id; |
7209 |
26 May 23 |
nicklas |
var sameSp = otherT.specimen && otherT.specimen.id == sp.id; |
4976 |
24 Sep 18 |
nicklas |
if (sameSp) |
4976 |
24 Sep 18 |
nicklas |
563 |
{ |
4976 |
24 Sep 18 |
nicklas |
if (!sameRNA && qiacubefilter || !sameLib && (libplatefilter || highHetFilter)) |
4976 |
24 Sep 18 |
nicklas |
565 |
{ |
4976 |
24 Sep 18 |
nicklas |
recommendReprocess = false; |
4976 |
24 Sep 18 |
nicklas |
567 |
} |
4976 |
24 Sep 18 |
nicklas |
if (!sameLib && highHetFilter) recommendDoNotUse = true; |
4976 |
24 Sep 18 |
nicklas |
569 |
} |
4976 |
24 Sep 18 |
nicklas |
570 |
} |
4976 |
24 Sep 18 |
nicklas |
571 |
} |
4976 |
24 Sep 18 |
nicklas |
572 |
|
7209 |
26 May 23 |
nicklas |
html += '<tbody class="highlight'+(recommendReprocess ? ' recommend-reprocess' : '')+(recommendDoNotUse ? ' recommend-donotuse' : '')+'" id="section.'+tumor.tmpId+'"><tr>'; |
4818 |
22 May 18 |
nicklas |
html += '<td rowspan="'+tbodySpan+'">'+(sp ? HTMLHelper.colorMatch(sp.patientName, null, 'Click to highlight this patient') : '')+'</td>'; |
4970 |
13 Sep 18 |
nicklas |
html += '<td rowspan="'+tbodySpan+'" class="'+(qiacubefilter?'':'mode-genotype')+'">'+(sp ? HTMLHelper.qiaCubeLink(rna.QIACUBE_DATE, rna.QIACUBE_RUN_NO, rna.QIACUBE_POSITION, qiacubefilter, false) : '')+'</td>'; |
4975 |
21 Sep 18 |
nicklas |
if (!qiacubefilter) |
4817 |
21 May 18 |
nicklas |
577 |
{ |
4818 |
22 May 18 |
nicklas |
html += '<td rowspan="'+tbodySpan+'">'+(libPlate ? HTMLHelper.libPlateLink(libPlate.name, lib.bioWell.location, libplatefilter, false):'')+'</td>'; |
4817 |
21 May 18 |
nicklas |
579 |
} |
4817 |
21 May 18 |
nicklas |
580 |
} |
4794 |
07 May 18 |
nicklas |
581 |
|
7209 |
26 May 23 |
nicklas |
var tmp = search.getAlignmentHtml(tumor); |
4794 |
07 May 18 |
nicklas |
583 |
|
4975 |
21 Sep 18 |
nicklas |
if (qiacubefilter) |
4794 |
07 May 18 |
nicklas |
585 |
{ |
4975 |
21 Sep 18 |
nicklas |
html += '<td rowspan="'+rowspan+'" class="mode-genotype">'+(libPlate ? HTMLHelper.libPlateLink(libPlate.name, lib.bioWell.location, libplatefilter, false):'')+'</td>'; |
4794 |
07 May 18 |
nicklas |
587 |
} |
7209 |
26 May 23 |
nicklas |
html += '<td rowspan="'+rowspan+'">'+Reggie.formatNumber(tumor.QC_GENOTYPE_HET_PCT, '%', -1)+'</td>'; |
4817 |
21 May 18 |
nicklas |
html += '<td rowspan="'+rowspan+'" class="text-col">'+tmp.name+'</td>'; |
4970 |
13 Sep 18 |
nicklas |
if (filter) |
4817 |
21 May 18 |
nicklas |
591 |
{ |
4970 |
13 Sep 18 |
nicklas |
if (tb.start) |
4970 |
13 Sep 18 |
nicklas |
593 |
{ |
4970 |
13 Sep 18 |
nicklas |
html += '<td rowspan="'+tbodySpan+'" class="mode-reprocess dottedleft num-col">'+(sp ? Reggie.formatNumber(sp.remainingQuantity/1000, null, 1, 1) : '')+'</td>'; |
4970 |
13 Sep 18 |
nicklas |
html += '<td rowspan="'+tbodySpan+'" class="mode-reprocess num-col">'+(lys ? Math.round(lys.remainingQuantity) : '')+'</td>'; |
4970 |
13 Sep 18 |
nicklas |
html += '<td rowspan="'+tbodySpan+'" class="mode-reprocess num-col">'+(sp ? Reggie.formatNumber(rna.remainingQuantity, null, 2, 2) : '')+'</td>'; |
7209 |
26 May 23 |
nicklas |
html += '<td rowspan="'+tbodySpan+'" class="mode-reprocess reprocess-col editable">'+(sp ? HTMLHelper.reprocessOptions(tumor, recommendReprocess) : '')+'</td>'; |
4975 |
21 Sep 18 |
nicklas |
598 |
|
7209 |
26 May 23 |
nicklas |
html += '<td rowspan="'+tbodySpan+'" class="mode-resolve dottedleft editable">'+(sp ? HTMLHelper.okToUseOptions(tumor, filterType) : '')+'</td>'; |
7209 |
26 May 23 |
nicklas |
html += '<td rowspan="'+tbodySpan+'" class="mode-resolve editable">'+(sp ? HTMLHelper.resolveOptions(tumor, filterType, tbodySpan==rowspan) : '')+'</td>'; |
7209 |
26 May 23 |
nicklas |
html += '<td rowspan="'+tbodySpan+'" class="mode-resolve editable">'+(sp ? HTMLHelper.futureGtOptions(tumor, filterType) : '')+'</td>'; |
7209 |
26 May 23 |
nicklas |
html += '<td rowspan="'+tbodySpan+'" class="mode-resolve comment-col dottedright editable">'+(sp ? HTMLHelper.resolveComment(tumor) : '')+'</td>'; |
4970 |
13 Sep 18 |
nicklas |
603 |
} |
4970 |
13 Sep 18 |
nicklas |
604 |
|
7209 |
26 May 23 |
nicklas |
var flagged = tumor.flagged; |
7209 |
26 May 23 |
nicklas |
var isTumor = tumor.name; |
7209 |
26 May 23 |
nicklas |
html += '<td rowspan="'+rowspan+'" class="mode-reprocess comment-col editable">'+(isTumor ? HTMLHelper.qcCommentInput(tumor) : '')+'</td>'; |
7209 |
26 May 23 |
nicklas |
html += '<td rowspan="'+rowspan+'" class="mode-reprocess flag-col dottedright editable">'+(isTumor && sp && !flagged ? HTMLHelper.qcFlagCheckbox(tumor) : '')+'</td>'; |
4817 |
21 May 18 |
nicklas |
609 |
} |
4817 |
21 May 18 |
nicklas |
html += '<td rowspan="'+rowspan+'" class="icon-col">'+tmp.icons+'</td>'; |
4817 |
21 May 18 |
nicklas |
611 |
|
4817 |
21 May 18 |
nicklas |
html += '<td rowspan="'+rowspan+'" class="dottedleft bg-messages">'+tmp.tooltip+'</td>'; |
4794 |
07 May 18 |
nicklas |
// The first message is on the main <tr> |
4818 |
22 May 18 |
nicklas |
if (cmp && cmp.messages.length > 0) |
4794 |
07 May 18 |
nicklas |
615 |
{ |
4794 |
07 May 18 |
nicklas |
var msg = cmp.messages[0]; |
7209 |
26 May 23 |
nicklas |
html += search.getMessageHtml(msg, tumor, assaysByName, qiacubefilter, libplatefilter); |
4794 |
07 May 18 |
nicklas |
618 |
} |
4794 |
07 May 18 |
nicklas |
else |
4794 |
07 May 18 |
nicklas |
620 |
{ |
7209 |
26 May 23 |
nicklas |
html += '<td class="bg-messages"></td><td class="dottedleft" colspan="6"></td>'; |
4794 |
07 May 18 |
nicklas |
622 |
} |
4817 |
21 May 18 |
nicklas |
html += '</tr>'; |
4794 |
07 May 18 |
nicklas |
624 |
|
4794 |
07 May 18 |
nicklas |
// If there are more messages, add more <tr> |
4818 |
22 May 18 |
nicklas |
if (cmp) |
4794 |
07 May 18 |
nicklas |
627 |
{ |
4818 |
22 May 18 |
nicklas |
for (var mNo = 1; mNo < cmp.messages.length; mNo++) |
4818 |
22 May 18 |
nicklas |
629 |
{ |
4818 |
22 May 18 |
nicklas |
var msg = cmp.messages[mNo]; |
7209 |
26 May 23 |
nicklas |
html += '<tr>'+search.getMessageHtml(msg, tumor, assaysByName, qiacubefilter, libplatefilter) + '</tr>'; |
4818 |
22 May 18 |
nicklas |
632 |
} |
4794 |
07 May 18 |
nicklas |
633 |
} |
4794 |
07 May 18 |
nicklas |
634 |
|
4794 |
07 May 18 |
nicklas |
if (tb.end) |
4794 |
07 May 18 |
nicklas |
636 |
{ |
4794 |
07 May 18 |
nicklas |
html += '</tbody>'; |
4794 |
07 May 18 |
nicklas |
638 |
} |
4794 |
07 May 18 |
nicklas |
639 |
} |
4794 |
07 May 18 |
nicklas |
640 |
|
5005 |
04 Oct 18 |
nicklas |
if (numListed == 0) |
5005 |
04 Oct 18 |
nicklas |
642 |
{ |
5005 |
04 Oct 18 |
nicklas |
html += '<tbody><tr><td colspan="20">No alignments matched the filter</td></tr></tbody>'; |
5005 |
04 Oct 18 |
nicklas |
Doc.element('mode-genotype').checked = true; |
5005 |
04 Oct 18 |
nicklas |
645 |
} |
5005 |
04 Oct 18 |
nicklas |
646 |
|
4794 |
07 May 18 |
nicklas |
Doc.element('itemTable').innerHTML = html; |
4794 |
07 May 18 |
nicklas |
Doc.element('step-1-title').innerHTML = stepTitle + ' (' + numListed + ')'; |
4794 |
07 May 18 |
nicklas |
649 |
|
4794 |
07 May 18 |
nicklas |
Doc.show('step-1'); |
4817 |
21 May 18 |
nicklas |
651 |
|
5005 |
04 Oct 18 |
nicklas |
var enableReprocess = numListed > 0 && filter && !noContextAnalysis; |
4975 |
21 Sep 18 |
nicklas |
var enableResolve = enableReprocess; |
4817 |
21 May 18 |
nicklas |
Doc.element('mode-reprocess').disabled = !enableReprocess; |
4975 |
21 Sep 18 |
nicklas |
Doc.element('mode-resolve').disabled = !enableResolve; |
4817 |
21 May 18 |
nicklas |
search.modeOnChange(); |
4794 |
07 May 18 |
nicklas |
657 |
|
4794 |
07 May 18 |
nicklas |
var cs = document.getElementsByClassName('case-summary'); |
4794 |
07 May 18 |
nicklas |
for (var i = 0; i < cs.length; i++) |
4794 |
07 May 18 |
nicklas |
660 |
{ |
5019 |
10 Oct 18 |
nicklas |
Events.addEventHandler(cs[i], 'click', Reggie.openCaseSummaryPopupOnEvent); |
4794 |
07 May 18 |
nicklas |
662 |
} |
4794 |
07 May 18 |
nicklas |
663 |
|
4794 |
07 May 18 |
nicklas |
var lnk = document.getElementsByClassName('qiacube-link'); |
4794 |
07 May 18 |
nicklas |
for (var i = 0; i < lnk.length; i++) |
4794 |
07 May 18 |
nicklas |
666 |
{ |
4794 |
07 May 18 |
nicklas |
Events.addEventHandler(lnk[i], 'click', search.setQiaCubeFilter); |
4794 |
07 May 18 |
nicklas |
668 |
} |
4794 |
07 May 18 |
nicklas |
var lnk = document.getElementsByClassName('libplate-link'); |
4794 |
07 May 18 |
nicklas |
for (var i = 0; i < lnk.length; i++) |
4794 |
07 May 18 |
nicklas |
671 |
{ |
4794 |
07 May 18 |
nicklas |
Events.addEventHandler(lnk[i], 'click', search.setLibPlateFilter); |
4794 |
07 May 18 |
nicklas |
673 |
} |
4794 |
07 May 18 |
nicklas |
674 |
|
4794 |
07 May 18 |
nicklas |
var cm = document.getElementsByClassName('colormatch'); |
4794 |
07 May 18 |
nicklas |
for (var i = 0; i < cm.length; i++) |
4794 |
07 May 18 |
nicklas |
677 |
{ |
4794 |
07 May 18 |
nicklas |
Events.addEventHandler(cm[i], 'click', search.colorMatch); |
4794 |
07 May 18 |
nicklas |
679 |
} |
4975 |
21 Sep 18 |
nicklas |
680 |
|
4980 |
25 Sep 18 |
nicklas |
var options = document.getElementsByClassName('reprocess-options'); |
4980 |
25 Sep 18 |
nicklas |
for (var i = 0; i < options.length; i++) |
4980 |
25 Sep 18 |
nicklas |
683 |
{ |
4980 |
25 Sep 18 |
nicklas |
Events.addEventHandler(options[i], 'change', search.reprocessOptionOnChange); |
4980 |
25 Sep 18 |
nicklas |
685 |
} |
4980 |
25 Sep 18 |
nicklas |
686 |
|
4975 |
21 Sep 18 |
nicklas |
var options = document.getElementsByClassName('donotuse-options'); |
4975 |
21 Sep 18 |
nicklas |
for (var i = 0; i < options.length; i++) |
4975 |
21 Sep 18 |
nicklas |
689 |
{ |
4975 |
21 Sep 18 |
nicklas |
Events.addEventHandler(options[i], 'change', search.doNotUseOptionOnChange); |
4975 |
21 Sep 18 |
nicklas |
691 |
} |
4975 |
21 Sep 18 |
nicklas |
692 |
|
4975 |
21 Sep 18 |
nicklas |
var checks = document.getElementsByClassName('oktouse'); |
4975 |
21 Sep 18 |
nicklas |
for (var i = 0; i < checks.length; i++) |
4975 |
21 Sep 18 |
nicklas |
695 |
{ |
4975 |
21 Sep 18 |
nicklas |
Events.addEventHandler(checks[i], 'change', search.okToUseOnChange); |
4975 |
21 Sep 18 |
nicklas |
697 |
} |
5001 |
04 Oct 18 |
nicklas |
698 |
|
5001 |
04 Oct 18 |
nicklas |
// Reset the change detection flags. |
5001 |
04 Oct 18 |
nicklas |
Wizard.setNoConfirmOnFirstStep(true); |
5001 |
04 Oct 18 |
nicklas |
numChangedFormElements = 0; |
4794 |
07 May 18 |
nicklas |
702 |
} |
4794 |
07 May 18 |
nicklas |
703 |
|
4794 |
07 May 18 |
nicklas |
704 |
|
4794 |
07 May 18 |
nicklas |
705 |
/** |
4794 |
07 May 18 |
nicklas |
Primary analysis of of problems related to alignments that |
4794 |
07 May 18 |
nicklas |
can be determined without knowledge of context and without need |
4794 |
07 May 18 |
nicklas |
to find information about related (same patient) alignments. |
4794 |
07 May 18 |
nicklas |
709 |
*/ |
4794 |
07 May 18 |
nicklas |
search.primaryAnalysis = function() |
4794 |
07 May 18 |
nicklas |
711 |
{ |
4794 |
07 May 18 |
nicklas |
// Reset this mapping, since we are only interested in alignments in the |
4794 |
07 May 18 |
nicklas |
// current context (eg. QiaCube run or LibPlate) |
7209 |
26 May 23 |
nicklas |
tumorsByPat = {}; |
4794 |
07 May 18 |
nicklas |
715 |
|
7209 |
26 May 23 |
nicklas |
for (var itemNo = 0; itemNo < tumors.length; itemNo++) |
4794 |
07 May 18 |
nicklas |
717 |
{ |
7209 |
26 May 23 |
nicklas |
var tumor = tumors[itemNo]; |
4818 |
22 May 18 |
nicklas |
719 |
|
4794 |
07 May 18 |
nicklas |
// Reset bug info |
7209 |
26 May 23 |
nicklas |
tumor.tmpId = itemNo; // Just to give each item a unique identified that we can use in gui form elements |
7209 |
26 May 23 |
nicklas |
tumor.bugged = 0; |
7209 |
26 May 23 |
nicklas |
tumor.buglevel = 0; |
7209 |
26 May 23 |
nicklas |
tumor.bugText = []; |
4980 |
25 Sep 18 |
nicklas |
725 |
|
4818 |
22 May 18 |
nicklas |
// We need to be able to lookup alignments by name and patient name |
7209 |
26 May 23 |
nicklas |
if (!tumor.specimen) |
4821 |
23 May 18 |
nicklas |
728 |
{ |
7209 |
26 May 23 |
nicklas |
tumor.bugText[tumor.bugText.length] = 'External'; |
4821 |
23 May 18 |
nicklas |
730 |
} |
4823 |
24 May 18 |
nicklas |
else |
4821 |
23 May 18 |
nicklas |
732 |
{ |
7209 |
26 May 23 |
nicklas |
var patName = tumor.specimen.patientName; |
7209 |
26 May 23 |
nicklas |
var tumorsForPat = tumorsByPat[patName] || []; |
7209 |
26 May 23 |
nicklas |
if (tumorsForPat.length == 0) tumorsByPat[patName] = tumorsForPat; |
7209 |
26 May 23 |
nicklas |
tumorsForPat[tumorsForPat.length] = tumor; |
4818 |
22 May 18 |
nicklas |
737 |
} |
7209 |
26 May 23 |
nicklas |
if (tumor.name) |
4823 |
24 May 18 |
nicklas |
739 |
{ |
7209 |
26 May 23 |
nicklas |
assaysByName[tumor.name] = tumor; |
7209 |
26 May 23 |
nicklas |
if (tumor.QC_GENOTYPE_STATUS != 'Checked') |
4823 |
24 May 18 |
nicklas |
742 |
{ |
7209 |
26 May 23 |
nicklas |
tumor.bugText[tumor.bugText.length] = 'Genotyping is disabled for this alignment'; |
4823 |
24 May 18 |
nicklas |
744 |
} |
4823 |
24 May 18 |
nicklas |
745 |
} |
4823 |
24 May 18 |
nicklas |
else |
4823 |
24 May 18 |
nicklas |
747 |
{ |
7209 |
26 May 23 |
nicklas |
tumor.bugText[tumor.bugText.length] = tumor.lib ? |
4823 |
24 May 18 |
nicklas |
'No alignment from this Library' : 'No alignment from this RNA'; |
7209 |
26 May 23 |
nicklas |
var libOrRna = tumor.lib || tumor.rna || {}; |
4980 |
25 Sep 18 |
nicklas |
// Copy DO_NOT_USE information to make it easier to handle in other places |
7209 |
26 May 23 |
nicklas |
tumor.DO_NOT_USE = libOrRna.DO_NOT_USE; |
7209 |
26 May 23 |
nicklas |
tumor.DO_NOT_USE_COMMENT = libOrRna.DO_NOT_USE_COMMENT |
4823 |
24 May 18 |
nicklas |
754 |
} |
4818 |
22 May 18 |
nicklas |
755 |
|
7209 |
26 May 23 |
nicklas |
var cmp = tumor.compare; |
4818 |
22 May 18 |
nicklas |
if (cmp) |
4818 |
22 May 18 |
nicklas |
758 |
{ |
4818 |
22 May 18 |
nicklas |
if (cmp.hasVerifiedMismatch) |
4818 |
22 May 18 |
nicklas |
760 |
{ |
7209 |
26 May 23 |
nicklas |
tumor.bugged = 1; |
7209 |
26 May 23 |
nicklas |
if (tumor.QC_GENOTYPE_VERIFIED) |
4818 |
22 May 18 |
nicklas |
763 |
{ |
4818 |
22 May 18 |
nicklas |
// This is strange -- two VERIFIED alignments with a mismatch!! |
7209 |
26 May 23 |
nicklas |
tumor.buglevel = 2; |
7209 |
26 May 23 |
nicklas |
tumor.bugText[tumor.bugText.length] = 'Verified × 2 mismatch!!'; |
4818 |
22 May 18 |
nicklas |
767 |
} |
4818 |
22 May 18 |
nicklas |
else |
4818 |
22 May 18 |
nicklas |
769 |
{ |
7209 |
26 May 23 |
nicklas |
tumor.buglevel = 1; |
7209 |
26 May 23 |
nicklas |
tumor.bugText[tumor.bugText.length] = 'Verified mismatch'; |
4818 |
22 May 18 |
nicklas |
772 |
} |
4818 |
22 May 18 |
nicklas |
773 |
} |
4818 |
22 May 18 |
nicklas |
774 |
} |
4818 |
22 May 18 |
nicklas |
775 |
|
7209 |
26 May 23 |
nicklas |
if (tumor.QC_GENOTYPE_HET_PCT > 65 && !tumor.QC_GENOTYPE_VERIFIED) |
4797 |
08 May 18 |
nicklas |
777 |
{ |
7209 |
26 May 23 |
nicklas |
tumor.bugged = 1; |
7209 |
26 May 23 |
nicklas |
tumor.buglevel = 1; |
7209 |
26 May 23 |
nicklas |
tumor.bugText[tumor.bugText.length] = 'High HET'; |
4797 |
08 May 18 |
nicklas |
781 |
} |
4980 |
25 Sep 18 |
nicklas |
782 |
|
7209 |
26 May 23 |
nicklas |
if (tumor.DO_NOT_USE) |
4980 |
25 Sep 18 |
nicklas |
784 |
{ |
5024 |
15 Oct 18 |
nicklas |
var doNotUseFlags = {}; |
7209 |
26 May 23 |
nicklas |
doNotUseFlags[tumor.DO_NOT_USE] = 1; |
7209 |
26 May 23 |
nicklas |
tumor.bugText[tumor.bugText.length] = search.doNotUseMessage(tumor); |
7209 |
26 May 23 |
nicklas |
search.addDoNotUseMessageIfDifferent(tumor, tumor.lib, doNotUseFlags); |
7209 |
26 May 23 |
nicklas |
search.addDoNotUseMessageIfDifferent(tumor, tumor.rna, doNotUseFlags); |
7209 |
26 May 23 |
nicklas |
search.addDoNotUseMessageIfDifferent(tumor, tumor.lysate, doNotUseFlags); |
7209 |
26 May 23 |
nicklas |
search.addDoNotUseMessageIfDifferent(tumor, tumor.specimen, doNotUseFlags); |
7209 |
26 May 23 |
nicklas |
if (!tumor.bugged) |
4980 |
25 Sep 18 |
nicklas |
793 |
{ |
7209 |
26 May 23 |
nicklas |
tumor.bugged = 1; |
7209 |
26 May 23 |
nicklas |
tumor.buglevel = 1; |
4980 |
25 Sep 18 |
nicklas |
796 |
} |
4980 |
25 Sep 18 |
nicklas |
797 |
} |
4980 |
25 Sep 18 |
nicklas |
798 |
|
4997 |
03 Oct 18 |
nicklas |
// Copy information about current re-processing flag to the 'alignment' object to make it easier to find later |
4997 |
03 Oct 18 |
nicklas |
var currentReProcess = null; |
7209 |
26 May 23 |
nicklas |
if (tumor.specimen && tumor.specimen.AutoProcessing == 'ReProcess') |
4997 |
03 Oct 18 |
nicklas |
802 |
{ |
4997 |
03 Oct 18 |
nicklas |
currentReProcess = 'Specimen'; |
4997 |
03 Oct 18 |
nicklas |
804 |
} |
7209 |
26 May 23 |
nicklas |
else if (tumor.lysate && tumor.lysate.AutoProcessing == 'ReProcess') |
4997 |
03 Oct 18 |
nicklas |
806 |
{ |
4997 |
03 Oct 18 |
nicklas |
currentReProcess = 'Lysate'; |
4997 |
03 Oct 18 |
nicklas |
808 |
} |
7209 |
26 May 23 |
nicklas |
else if (tumor.rna && tumor.rna.AutoProcessing == 'ReProcess') |
4997 |
03 Oct 18 |
nicklas |
810 |
{ |
4997 |
03 Oct 18 |
nicklas |
currentReProcess = 'RNA'; |
4997 |
03 Oct 18 |
nicklas |
812 |
} |
7209 |
26 May 23 |
nicklas |
tumor.currentReProcess = currentReProcess; |
4794 |
07 May 18 |
nicklas |
814 |
} |
4794 |
07 May 18 |
nicklas |
815 |
} |
4794 |
07 May 18 |
nicklas |
816 |
|
5024 |
15 Oct 18 |
nicklas |
search.doNotUseMessage = function(item) |
5024 |
15 Oct 18 |
nicklas |
818 |
{ |
5024 |
15 Oct 18 |
nicklas |
return '<span class="donotuse">['+Strings.encodeTags(item.DO_NOT_USE)+']</span> ' + Strings.encodeTags(item.DO_NOT_USE_COMMENT); |
5024 |
15 Oct 18 |
nicklas |
820 |
} |
4794 |
07 May 18 |
nicklas |
821 |
|
5024 |
15 Oct 18 |
nicklas |
// Add 'bugtext' messages about DO_NOT_USE, but only one message for each reason |
7209 |
26 May 23 |
nicklas |
search.addDoNotUseMessageIfDifferent = function(tumor, item, doNotUseFlags) |
5024 |
15 Oct 18 |
nicklas |
824 |
{ |
5416 |
09 May 19 |
nicklas |
if (item && item.DO_NOT_USE && !doNotUseFlags[item.DO_NOT_USE]) |
5024 |
15 Oct 18 |
nicklas |
826 |
{ |
5024 |
15 Oct 18 |
nicklas |
doNotUseFlags[item.DO_NOT_USE] = 1; |
7209 |
26 May 23 |
nicklas |
tumor.bugText[tumor.bugText.length] = search.doNotUseMessage(item); |
5024 |
15 Oct 18 |
nicklas |
829 |
} |
5024 |
15 Oct 18 |
nicklas |
830 |
} |
5024 |
15 Oct 18 |
nicklas |
831 |
|
4794 |
07 May 18 |
nicklas |
832 |
/** |
4794 |
07 May 18 |
nicklas |
Analysis of problems related to a given context (eg. a QiaCube or LibPlate). |
4794 |
07 May 18 |
nicklas |
The context is given by a all alignments matching the given filter. |
4794 |
07 May 18 |
nicklas |
835 |
|
4794 |
07 May 18 |
nicklas |
1. For each alignment in the context we will search for a LOW_MISMATCH warning. |
4794 |
07 May 18 |
nicklas |
2. A LOW_MISMATCH means that we have two similar alignments that have different patients (very unlikely!) |
4794 |
07 May 18 |
nicklas |
3. So, we take that other patient and search for other alignments in the given context that |
4794 |
07 May 18 |
nicklas |
have the same patient. |
4794 |
07 May 18 |
nicklas |
4. If we find another alignment this could be a possible mixup with that position. |
4794 |
07 May 18 |
nicklas |
841 |
*/ |
4794 |
07 May 18 |
nicklas |
search.contextAnalysis = function(filter, positionProperty) |
4794 |
07 May 18 |
nicklas |
843 |
{ |
7209 |
26 May 23 |
nicklas |
for (var itemNo = 0; itemNo < tumors.length; itemNo++) |
4794 |
07 May 18 |
nicklas |
845 |
{ |
7209 |
26 May 23 |
nicklas |
var tumor = tumors[itemNo]; |
7209 |
26 May 23 |
nicklas |
if (!tumor.compare) continue; // No alignment/genotype data in this position, skip ahead |
4818 |
22 May 18 |
nicklas |
848 |
|
7209 |
26 May 23 |
nicklas |
var filterValue = filter(tumor); |
4794 |
07 May 18 |
nicklas |
if (filterValue == null) continue; // Not in the given context |
4794 |
07 May 18 |
nicklas |
851 |
|
7209 |
26 May 23 |
nicklas |
var cmp = tumor.compare; |
4794 |
07 May 18 |
nicklas |
var possiblePositions = []; |
4794 |
07 May 18 |
nicklas |
var possiblePats = []; |
4794 |
07 May 18 |
nicklas |
855 |
|
4794 |
07 May 18 |
nicklas |
for (var mNo = 0; mNo < cmp.messages.length; mNo++) |
4794 |
07 May 18 |
nicklas |
857 |
{ |
4794 |
07 May 18 |
nicklas |
var msg = cmp.messages[mNo]; |
4794 |
07 May 18 |
nicklas |
if (msg.category != 'LOW_MISMATCH') continue; // We are only interested in 'LOW_MISMATCH' warnings |
4794 |
07 May 18 |
nicklas |
860 |
|
6589 |
21 Feb 22 |
nicklas |
var otherA = assaysByName[msg.otherAssay]; |
6589 |
21 Feb 22 |
nicklas |
if (!otherA) continue; |
6589 |
21 Feb 22 |
nicklas |
if (otherA.bugged && otherA.buglevel > 0) continue; // The other assay is a known problem, so we ignore it here |
4794 |
07 May 18 |
nicklas |
864 |
|
4794 |
07 May 18 |
nicklas |
// If the other alignment is in the same context it may not be useful unless it is a verified alignment |
4794 |
07 May 18 |
nicklas |
if (filter(otherA) && !otherA.QC_GENOTYPE_VERIFIED) continue; |
4794 |
07 May 18 |
nicklas |
867 |
|
4794 |
07 May 18 |
nicklas |
// This is our candidate patient |
4794 |
07 May 18 |
nicklas |
var otherPat = otherA.specimen.patientName; |
4797 |
08 May 18 |
nicklas |
870 |
|
4794 |
07 May 18 |
nicklas |
// Find alignments in the same context for the candiate patient |
7209 |
26 May 23 |
nicklas |
var tumorsForPat = tumorsByPat[otherPat] || []; |
7209 |
26 May 23 |
nicklas |
for (var i = 0; i < tumorsForPat.length; i++) |
4794 |
07 May 18 |
nicklas |
874 |
{ |
7209 |
26 May 23 |
nicklas |
var otherB = tumorsForPat[i]; |
4794 |
07 May 18 |
nicklas |
var posB = positionProperty(otherB); |
4794 |
07 May 18 |
nicklas |
if (filter(otherB) && possiblePositions.indexOf(posB) == -1) |
4794 |
07 May 18 |
nicklas |
878 |
{ |
4794 |
07 May 18 |
nicklas |
// Save the position (eg, Plate coordinate or QiaCube position) |
4794 |
07 May 18 |
nicklas |
possiblePositions[possiblePositions.length] = posB; |
4794 |
07 May 18 |
nicklas |
881 |
} |
4794 |
07 May 18 |
nicklas |
882 |
} |
4794 |
07 May 18 |
nicklas |
if (possiblePats.indexOf(otherPat) == -1) possiblePats[possiblePats.length] = otherPat; |
4794 |
07 May 18 |
nicklas |
884 |
} |
4794 |
07 May 18 |
nicklas |
885 |
|
4794 |
07 May 18 |
nicklas |
if (possiblePositions.length > 0) |
4794 |
07 May 18 |
nicklas |
887 |
{ |
4794 |
07 May 18 |
nicklas |
// If we have found other positions, we report them to the user |
7209 |
26 May 23 |
nicklas |
tumor.bugged = 1; |
4794 |
07 May 18 |
nicklas |
var text = 'Is this from '; |
4794 |
07 May 18 |
nicklas |
for (var posNo = 0; posNo < possiblePositions.length; posNo++) |
4794 |
07 May 18 |
nicklas |
892 |
{ |
4794 |
07 May 18 |
nicklas |
var pos = possiblePositions[posNo]; |
4794 |
07 May 18 |
nicklas |
if (posNo > 0) text += posNo == possiblePositions.length-1 ? ' or ' : ', '; |
4794 |
07 May 18 |
nicklas |
text += HTMLHelper.colorMatch(filterValue + '@' + pos, '@'+pos, 'Click to highlight this position'); |
4794 |
07 May 18 |
nicklas |
896 |
} |
4799 |
09 May 18 |
nicklas |
text += '/'; |
4799 |
09 May 18 |
nicklas |
for (var patNo = 0; patNo < possiblePats.length; patNo++) |
4799 |
09 May 18 |
nicklas |
899 |
{ |
4799 |
09 May 18 |
nicklas |
var pat = possiblePats[patNo]; |
4799 |
09 May 18 |
nicklas |
if (patNo > 0) text += patNo == possiblePats.length-1 ? ' or ' : ', '; |
4799 |
09 May 18 |
nicklas |
text += HTMLHelper.colorMatch(pat, null, 'Click to highlight this patient'); |
4799 |
09 May 18 |
nicklas |
903 |
} |
4794 |
07 May 18 |
nicklas |
text += '?'; |
7209 |
26 May 23 |
nicklas |
tumor.bugText[tumor.bugText.length] = text; |
4794 |
07 May 18 |
nicklas |
906 |
} |
4794 |
07 May 18 |
nicklas |
else if (possiblePats.length > 0) |
4794 |
07 May 18 |
nicklas |
908 |
{ |
4794 |
07 May 18 |
nicklas |
// We found a low mismatch but not any other sample with the same patient |
4794 |
07 May 18 |
nicklas |
// The mixup is probably not in the selected context |
4794 |
07 May 18 |
nicklas |
var text = 'Could not find sample related to '; |
4794 |
07 May 18 |
nicklas |
for (var patNo = 0; patNo < possiblePats.length; patNo++) |
4794 |
07 May 18 |
nicklas |
913 |
{ |
4794 |
07 May 18 |
nicklas |
var pat = possiblePats[patNo]; |
4794 |
07 May 18 |
nicklas |
if (patNo > 0) text += patNo == possiblePats.length-1 ? ' or ' : ', '; |
4794 |
07 May 18 |
nicklas |
text += HTMLHelper.colorMatch(pat, null, 'Click to highlight this patient'); |
4794 |
07 May 18 |
nicklas |
917 |
} |
7209 |
26 May 23 |
nicklas |
tumor.bugText[tumor.bugText.length] = text; |
4794 |
07 May 18 |
nicklas |
919 |
} |
4794 |
07 May 18 |
nicklas |
920 |
} |
4794 |
07 May 18 |
nicklas |
921 |
|
4794 |
07 May 18 |
nicklas |
922 |
} |
4794 |
07 May 18 |
nicklas |
923 |
|
4794 |
07 May 18 |
nicklas |
924 |
/** |
4794 |
07 May 18 |
nicklas |
EVent handler for highlighting related items with the same |
4794 |
07 May 18 |
nicklas |
colormatch tag. For all items tagged with 'colormatch' we highlight |
4794 |
07 May 18 |
nicklas |
all elements with the same 'match' value as the clicked element. |
4799 |
09 May 18 |
nicklas |
Two different colors are supported by holding down CTRL, ALT or SHIFT |
4797 |
08 May 18 |
nicklas |
while clicking. |
4794 |
07 May 18 |
nicklas |
930 |
*/ |
4794 |
07 May 18 |
nicklas |
search.colorMatch = function(event) |
4794 |
07 May 18 |
nicklas |
932 |
{ |
4799 |
09 May 18 |
nicklas |
var toMatch = Data.get(event.currentTarget, 'match'); |
4797 |
08 May 18 |
nicklas |
var specialKey = event.altKey || event.ctrlKey || event.shiftKey; |
4797 |
08 May 18 |
nicklas |
var matchedClass = specialKey ? 'colormatched-2' : 'colormatched'; |
4794 |
07 May 18 |
nicklas |
var cm = document.getElementsByClassName('colormatch'); |
4799 |
09 May 18 |
nicklas |
var add = !event.currentTarget.classList.contains(matchedClass); |
4794 |
07 May 18 |
nicklas |
for (var i = 0; i < cm.length; i++) |
4794 |
07 May 18 |
nicklas |
939 |
{ |
4794 |
07 May 18 |
nicklas |
var e = cm[i]; |
4797 |
08 May 18 |
nicklas |
Doc.addOrRemoveClass(e, matchedClass, Data.get(e, 'match') == toMatch && add); |
4794 |
07 May 18 |
nicklas |
942 |
} |
4794 |
07 May 18 |
nicklas |
943 |
} |
4794 |
07 May 18 |
nicklas |
944 |
|
4980 |
25 Sep 18 |
nicklas |
945 |
/** |
4980 |
25 Sep 18 |
nicklas |
Display a warning icon if the selected re-process option is marked 'donotuse'. |
4980 |
25 Sep 18 |
nicklas |
947 |
*/ |
4980 |
25 Sep 18 |
nicklas |
search.reprocessOptionOnChange = function(event) |
4980 |
25 Sep 18 |
nicklas |
949 |
{ |
4980 |
25 Sep 18 |
nicklas |
var opt = event.currentTarget[event.currentTarget.selectedIndex]; |
4980 |
25 Sep 18 |
nicklas |
var tmpId = event.currentTarget.id.replace('reprocess.', ''); |
4980 |
25 Sep 18 |
nicklas |
Doc.addOrRemoveClass('section.'+tmpId, 'reprocess-warning', opt.classList.contains('donotuse')); |
4980 |
25 Sep 18 |
nicklas |
953 |
} |
4980 |
25 Sep 18 |
nicklas |
954 |
|
4975 |
21 Sep 18 |
nicklas |
// Enable/disable the DoNotUse list depending on if the OkToUse is checked or not |
4975 |
21 Sep 18 |
nicklas |
search.okToUseOnChange = function(event) |
4975 |
21 Sep 18 |
nicklas |
957 |
{ |
4975 |
21 Sep 18 |
nicklas |
var tmpId = event.currentTarget.id.replace('oktouse.', ''); |
4975 |
21 Sep 18 |
nicklas |
var doNotUseList = Doc.element('donotuse.'+tmpId); |
4981 |
25 Sep 18 |
nicklas |
var futureGtCheck = Doc.element('futuregt.'+tmpId); |
4975 |
21 Sep 18 |
nicklas |
var commentField = Doc.element('resolvecomment.'+tmpId); |
4975 |
21 Sep 18 |
nicklas |
if (event.currentTarget.checked) |
4975 |
21 Sep 18 |
nicklas |
963 |
{ |
4975 |
21 Sep 18 |
nicklas |
doNotUseList.selectedIndex = 0; |
5001 |
04 Oct 18 |
nicklas |
Events.sendChangeEvent(doNotUseList); |
4975 |
21 Sep 18 |
nicklas |
Doc.removeClass(doNotUseList, 'required'); |
4975 |
21 Sep 18 |
nicklas |
Doc.removeClass(commentField, 'required'); |
4975 |
21 Sep 18 |
nicklas |
doNotUseList.disabled = true; |
4981 |
25 Sep 18 |
nicklas |
futureGtCheck.disabled = true; |
4975 |
21 Sep 18 |
nicklas |
970 |
} |
4975 |
21 Sep 18 |
nicklas |
else |
4975 |
21 Sep 18 |
nicklas |
972 |
{ |
4975 |
21 Sep 18 |
nicklas |
Doc.addClass(doNotUseList, 'required'); |
4975 |
21 Sep 18 |
nicklas |
doNotUseList.disabled = false; |
4975 |
21 Sep 18 |
nicklas |
975 |
} |
4975 |
21 Sep 18 |
nicklas |
976 |
} |
4975 |
21 Sep 18 |
nicklas |
977 |
|
4975 |
21 Sep 18 |
nicklas |
978 |
|
4975 |
21 Sep 18 |
nicklas |
// Mark the corresponding comment field as required if the DoNotUse flag is going to be set |
4975 |
21 Sep 18 |
nicklas |
search.doNotUseOptionOnChange = function(event) |
4975 |
21 Sep 18 |
nicklas |
981 |
{ |
4975 |
21 Sep 18 |
nicklas |
var tmpId = event.currentTarget.id.replace('donotuse.', ''); |
4975 |
21 Sep 18 |
nicklas |
var value = event.currentTarget.value; |
4981 |
25 Sep 18 |
nicklas |
var futureGtCheck = Doc.element('futuregt.'+tmpId); |
5001 |
04 Oct 18 |
nicklas |
if (value == '') |
5001 |
04 Oct 18 |
nicklas |
986 |
{ |
5001 |
04 Oct 18 |
nicklas |
futureGtCheck.checked = false; |
5001 |
04 Oct 18 |
nicklas |
Events.sendChangeEvent(futureGtCheck); |
5001 |
04 Oct 18 |
nicklas |
989 |
} |
4981 |
25 Sep 18 |
nicklas |
futureGtCheck.disabled = value == ''; |
4975 |
21 Sep 18 |
nicklas |
var commentField = Doc.element('resolvecomment.'+tmpId); |
4975 |
21 Sep 18 |
nicklas |
Doc.addOrRemoveClass(commentField, 'required', value != ''); |
4975 |
21 Sep 18 |
nicklas |
993 |
} |
4975 |
21 Sep 18 |
nicklas |
994 |
|
4799 |
09 May 18 |
nicklas |
search.getAlignmentHtml = function(alignment, refAlignment) |
4794 |
07 May 18 |
nicklas |
996 |
{ |
4794 |
07 May 18 |
nicklas |
var tmp = {}; |
4794 |
07 May 18 |
nicklas |
998 |
|
4818 |
22 May 18 |
nicklas |
var itemName = alignment.name; |
4818 |
22 May 18 |
nicklas |
var suffix = ''; |
4818 |
22 May 18 |
nicklas |
var markedName = refAlignment ? HTMLHelper.tagCommonPartOfName(refAlignment.name, itemName) : null; |
4794 |
07 May 18 |
nicklas |
1002 |
|
4818 |
22 May 18 |
nicklas |
if (!itemName) |
4818 |
22 May 18 |
nicklas |
1004 |
{ |
4818 |
22 May 18 |
nicklas |
var subtype = null; |
4818 |
22 May 18 |
nicklas |
if (alignment.lib) |
4818 |
22 May 18 |
nicklas |
1007 |
{ |
4818 |
22 May 18 |
nicklas |
itemName = alignment.lib.name; |
4818 |
22 May 18 |
nicklas |
subtype = 'Library'; |
4818 |
22 May 18 |
nicklas |
1010 |
} |
4818 |
22 May 18 |
nicklas |
else if (alignment.rna) |
4818 |
22 May 18 |
nicklas |
1012 |
{ |
4818 |
22 May 18 |
nicklas |
itemName = alignment.rna.name; |
4818 |
22 May 18 |
nicklas |
subtype = 'RNA'; |
4818 |
22 May 18 |
nicklas |
1015 |
} |
4818 |
22 May 18 |
nicklas |
markedName = itemName; |
4818 |
22 May 18 |
nicklas |
if (subtype) |
4818 |
22 May 18 |
nicklas |
1018 |
{ |
4818 |
22 May 18 |
nicklas |
suffix = ' <span class="itemsubtype">('+subtype+')</span>'; |
4818 |
22 May 18 |
nicklas |
1020 |
} |
4818 |
22 May 18 |
nicklas |
1021 |
} |
4818 |
22 May 18 |
nicklas |
1022 |
|
4818 |
22 May 18 |
nicklas |
tmp.name = HTMLHelper.colorMatch(itemName, markedName, 'Click to highlight this item') + suffix; |
4818 |
22 May 18 |
nicklas |
1024 |
|
4794 |
07 May 18 |
nicklas |
var icons = ''; |
4794 |
07 May 18 |
nicklas |
var tooltip = ''; |
4794 |
07 May 18 |
nicklas |
1027 |
|
4818 |
22 May 18 |
nicklas |
if (alignment.specimen) |
4794 |
07 May 18 |
nicklas |
1029 |
{ |
4818 |
22 May 18 |
nicklas |
tmp.name += '<img src="../images/case_summary.png" class="link case-summary" data-name="'+Strings.encodeTags(itemName)+'" title="Show case summary">'; |
4818 |
22 May 18 |
nicklas |
1031 |
} |
4970 |
13 Sep 18 |
nicklas |
if (alignment.QC_GENOTYPE_COMMENT) |
4970 |
13 Sep 18 |
nicklas |
1033 |
{ |
4970 |
13 Sep 18 |
nicklas |
icons += '<img src="../images/comment.png" title="'+Strings.encodeTags(alignment.QC_GENOTYPE_COMMENT)+'">'; |
4970 |
13 Sep 18 |
nicklas |
1035 |
} |
4980 |
25 Sep 18 |
nicklas |
if (alignment.DO_NOT_USE) |
4980 |
25 Sep 18 |
nicklas |
1037 |
{ |
4980 |
25 Sep 18 |
nicklas |
icons += '<img src="../images/donotuse.png" title="DoNotUse-'+Strings.encodeTags(alignment.DO_NOT_USE+': '+alignment.DO_NOT_USE_COMMENT)+'">'; |
4980 |
25 Sep 18 |
nicklas |
1039 |
} |
4997 |
03 Oct 18 |
nicklas |
if (alignment.currentReProcess) |
4997 |
03 Oct 18 |
nicklas |
1041 |
{ |
4997 |
03 Oct 18 |
nicklas |
icons += '<img src="../images/reprocess.png" title="Re-processing is scheduled from '+alignment.currentReProcess+'">'; |
4997 |
03 Oct 18 |
nicklas |
1043 |
} |
4997 |
03 Oct 18 |
nicklas |
1044 |
|
4975 |
21 Sep 18 |
nicklas |
if (alignment.flagged) |
4818 |
22 May 18 |
nicklas |
1046 |
{ |
4975 |
21 Sep 18 |
nicklas |
// We need this class to search for flagged alignments on the "right" side of the table (see goResolve() method) |
4975 |
21 Sep 18 |
nicklas |
var cls = refAlignment ? 'paired-alignment' : 'primary-alignment'; |
4975 |
21 Sep 18 |
nicklas |
icons += '<img src="../images/flag.png" title="This alignment is already flagged" class="'+cls+'" data-id="'+alignment.id+'">'; |
4794 |
07 May 18 |
nicklas |
1050 |
} |
4794 |
07 May 18 |
nicklas |
if (alignment.QC_GENOTYPE_VERIFIED) |
4794 |
07 May 18 |
nicklas |
1052 |
{ |
4794 |
07 May 18 |
nicklas |
var img = alignment.QC_GENOTYPE_VERIFIED == 'Lysate' ? 'gt-verified-lysate.png' : 'gt-verified.png'; |
4794 |
07 May 18 |
nicklas |
tooltip = Strings.encodeTags('Verified by '+alignment.QC_GENOTYPE_VERIFIED); |
4794 |
07 May 18 |
nicklas |
icons += '<img src="../images/'+img+'" title="'+tooltip+'">'; |
4794 |
07 May 18 |
nicklas |
1056 |
} |
4797 |
08 May 18 |
nicklas |
if (alignment.bugged) |
4794 |
07 May 18 |
nicklas |
1058 |
{ |
4797 |
08 May 18 |
nicklas |
var img = bugIcons[alignment.buglevel]; |
4981 |
25 Sep 18 |
nicklas |
// .replace will strip simple HTML tags |
4981 |
25 Sep 18 |
nicklas |
var imgTitle = alignment.buglevel > 0 && alignment.bugText.length > 0 ? alignment.bugText[0].replace(/<\/?[^>]+(>|$)/g, '') : ''; |
4797 |
08 May 18 |
nicklas |
icons += '<img src="../images/'+img+'" title="'+imgTitle+'">'; |
4797 |
08 May 18 |
nicklas |
1063 |
} |
4818 |
22 May 18 |
nicklas |
if (alignment.bugText && alignment.bugText.length > 0) |
4797 |
08 May 18 |
nicklas |
1065 |
{ |
4794 |
07 May 18 |
nicklas |
tooltip = alignment.bugText.join('<br>'); |
4794 |
07 May 18 |
nicklas |
1067 |
} |
4794 |
07 May 18 |
nicklas |
1068 |
|
4794 |
07 May 18 |
nicklas |
tmp.icons = icons; |
4794 |
07 May 18 |
nicklas |
tmp.tooltip = tooltip; |
4794 |
07 May 18 |
nicklas |
return tmp; |
4794 |
07 May 18 |
nicklas |
1072 |
} |
4794 |
07 May 18 |
nicklas |
1073 |
|
6589 |
21 Feb 22 |
nicklas |
search.getMessageHtml = function(message, aligned, assaysByName, qiacubefilter, libplatefilter) |
4794 |
07 May 18 |
nicklas |
1075 |
{ |
4794 |
07 May 18 |
nicklas |
var html = ''; |
4797 |
08 May 18 |
nicklas |
var msgClass= "bg-messages"; |
6589 |
21 Feb 22 |
nicklas |
if (message.otherAssay) |
4794 |
07 May 18 |
nicklas |
1079 |
{ |
6589 |
21 Feb 22 |
nicklas |
var otherAssay = assaysByName[message.otherAssay]; |
6589 |
21 Feb 22 |
nicklas |
var tmp = search.getAlignmentHtml(otherAssay, aligned); |
7209 |
26 May 23 |
nicklas |
html += '<td class="dottedleft text-col">'; |
4794 |
07 May 18 |
nicklas |
html += tmp.name+tmp.icons; |
7209 |
26 May 23 |
nicklas |
html += '</td>'; |
7209 |
26 May 23 |
nicklas |
html += '<td>'+HTMLHelper.shortPipeline(otherAssay.PIPELINE)+'</td>'; |
6589 |
21 Feb 22 |
nicklas |
if (otherAssay) |
4794 |
07 May 18 |
nicklas |
1087 |
{ |
6589 |
21 Feb 22 |
nicklas |
if (otherAssay.buglevel == 1 && (qiacubefilter || libplatefilter)) msgClass += ' ignored-mismatch'; |
6589 |
21 Feb 22 |
nicklas |
html += '<td>'+Reggie.formatNumber(otherAssay.QC_GENOTYPE_HET_PCT, '%', -1)+'</td>'; |
6589 |
21 Feb 22 |
nicklas |
var rna = otherAssay.rna || {}; |
6590 |
21 Feb 22 |
nicklas |
var dna = otherAssay.dna || {}; |
6590 |
21 Feb 22 |
nicklas |
var lib = otherAssay.lib; |
6590 |
21 Feb 22 |
nicklas |
var chip = otherAssay.chip; |
6589 |
21 Feb 22 |
nicklas |
var specimen = otherAssay.specimen || {}; |
4794 |
07 May 18 |
nicklas |
1095 |
|
4817 |
21 May 18 |
nicklas |
html += '<td class="mode-genotype">'+HTMLHelper.qiaCubeLink(rna.QIACUBE_DATE, rna.QIACUBE_RUN_NO, rna.QIACUBE_POSITION, qiacubefilter, false)+'</td>'; |
6590 |
21 Feb 22 |
nicklas |
html += '<td class="mode-genotype">'; |
6590 |
21 Feb 22 |
nicklas |
if (lib) |
6590 |
21 Feb 22 |
nicklas |
1099 |
{ |
6590 |
21 Feb 22 |
nicklas |
var libWell = lib.bioWell || {}; |
6590 |
21 Feb 22 |
nicklas |
var libPlate = libWell.bioPlate || {}; |
6590 |
21 Feb 22 |
nicklas |
html += HTMLHelper.libPlateLink(libPlate.name, libWell.location, libplatefilter, false); |
6590 |
21 Feb 22 |
nicklas |
1103 |
} |
6590 |
21 Feb 22 |
nicklas |
else if (chip) |
6590 |
21 Feb 22 |
nicklas |
1105 |
{ |
6592 |
21 Feb 22 |
nicklas |
html += HTMLHelper.beadChipLink(chip.name, dna.BeadChipPosition); |
6590 |
21 Feb 22 |
nicklas |
1107 |
} |
7209 |
26 May 23 |
nicklas |
else if (dna && dna.bioWell) |
7209 |
26 May 23 |
nicklas |
1109 |
{ |
7209 |
26 May 23 |
nicklas |
var dnaWell = dna.bioWell || {}; |
7209 |
26 May 23 |
nicklas |
var dnaPlate = dnaWell.bioPlate || {}; |
7209 |
26 May 23 |
nicklas |
html += HTMLHelper.platePos(dnaPlate.name, dnaWell.location); |
7209 |
26 May 23 |
nicklas |
1113 |
} |
6590 |
21 Feb 22 |
nicklas |
html += '</td>'; |
6589 |
21 Feb 22 |
nicklas |
html += '<td>'+HTMLHelper.colorMatch(specimen.patientName, null, 'Click to highlight this patient')+'</td>'; |
4794 |
07 May 18 |
nicklas |
1116 |
} |
4794 |
07 May 18 |
nicklas |
1117 |
} |
4794 |
07 May 18 |
nicklas |
else |
4794 |
07 May 18 |
nicklas |
1119 |
{ |
7209 |
26 May 23 |
nicklas |
html += '<td class="dottedleft" colspan="6"></td>'; |
4794 |
07 May 18 |
nicklas |
1121 |
} |
4797 |
08 May 18 |
nicklas |
html = '<td class="' + msgClass+ '" title="'+(message.messageTooltip || '')+'">'+Strings.encodeTags(message.message) + '</td>' + html; |
4794 |
07 May 18 |
nicklas |
return html; |
4794 |
07 May 18 |
nicklas |
1124 |
} |
4794 |
07 May 18 |
nicklas |
1125 |
|
4817 |
21 May 18 |
nicklas |
search.modeOnChange = function() |
4817 |
21 May 18 |
nicklas |
1127 |
{ |
4817 |
21 May 18 |
nicklas |
var frm = document.forms['reggie']; |
4818 |
22 May 18 |
nicklas |
var mode = Forms.getCheckedRadio(frm.mode).value; |
4817 |
21 May 18 |
nicklas |
Data.set('itemTable', 'mode', mode); |
4817 |
21 May 18 |
nicklas |
Doc.showHide('goreprocess', mode == 'reprocess'); |
4975 |
21 Sep 18 |
nicklas |
Doc.showHide('goresolve', mode == 'resolve'); |
4970 |
13 Sep 18 |
nicklas |
Wizard.hideGoNextConfirmation(); |
4817 |
21 May 18 |
nicklas |
1134 |
} |
4817 |
21 May 18 |
nicklas |
1135 |
|
4817 |
21 May 18 |
nicklas |
search.goReProcess = function() |
4817 |
21 May 18 |
nicklas |
1137 |
{ |
4970 |
13 Sep 18 |
nicklas |
Wizard.hideGoNextConfirmation(); |
4970 |
13 Sep 18 |
nicklas |
Doc.hide('wizard-status'); |
4817 |
21 May 18 |
nicklas |
var frm = document.forms['reggie']; |
4970 |
13 Sep 18 |
nicklas |
var items = []; |
7209 |
26 May 23 |
nicklas |
for (var itemNo = 0; itemNo < tumors.length; itemNo++) |
4817 |
21 May 18 |
nicklas |
1143 |
{ |
7209 |
26 May 23 |
nicklas |
var tumor = tumors[itemNo]; |
4970 |
13 Sep 18 |
nicklas |
1145 |
|
4970 |
13 Sep 18 |
nicklas |
// Get the form elements for this item |
7209 |
26 May 23 |
nicklas |
var listE = Doc.element('reprocess.'+tumor.tmpId); |
7209 |
26 May 23 |
nicklas |
var flagE = Doc.element('flag.'+tumor.tmpId); |
7209 |
26 May 23 |
nicklas |
var commentE = Doc.element('comment.'+tumor.tmpId); |
4970 |
13 Sep 18 |
nicklas |
1150 |
|
7209 |
26 May 23 |
nicklas |
var item = { 'id': tumor.id }; |
4970 |
13 Sep 18 |
nicklas |
var changed = false; |
4970 |
13 Sep 18 |
nicklas |
1153 |
|
4970 |
13 Sep 18 |
nicklas |
// Check if a re-processing option was selected |
4970 |
13 Sep 18 |
nicklas |
if (listE && listE.value) |
4817 |
21 May 18 |
nicklas |
1156 |
{ |
4970 |
13 Sep 18 |
nicklas |
changed = true; |
4970 |
13 Sep 18 |
nicklas |
if (listE.value == 'specimen') |
4817 |
21 May 18 |
nicklas |
1159 |
{ |
7209 |
26 May 23 |
nicklas |
item.reprocess = {'type': 'SAMPLE', 'id': tumor.specimen.id }; |
4817 |
21 May 18 |
nicklas |
1161 |
} |
4970 |
13 Sep 18 |
nicklas |
else if (listE.value == 'lysate') |
4817 |
21 May 18 |
nicklas |
1163 |
{ |
7209 |
26 May 23 |
nicklas |
item.reprocess = {'type': 'EXTRACT', 'id': tumor.lysate.id }; |
4817 |
21 May 18 |
nicklas |
1165 |
} |
4970 |
13 Sep 18 |
nicklas |
else if (listE.value == 'rna') |
4817 |
21 May 18 |
nicklas |
1167 |
{ |
7209 |
26 May 23 |
nicklas |
item.reprocess = {'type': 'EXTRACT', 'id': tumor.rna.id }; |
4817 |
21 May 18 |
nicklas |
1169 |
} |
4817 |
21 May 18 |
nicklas |
1170 |
} |
4970 |
13 Sep 18 |
nicklas |
if (flagE && flagE.checked) |
4970 |
13 Sep 18 |
nicklas |
1172 |
{ |
4970 |
13 Sep 18 |
nicklas |
changed = true; |
4970 |
13 Sep 18 |
nicklas |
item.flag = true; |
4970 |
13 Sep 18 |
nicklas |
1175 |
} |
7209 |
26 May 23 |
nicklas |
if (commentE && Strings.trim(commentE.value) != Strings.trim(tumor.QC_GENOTYPE_COMMENT)) |
4970 |
13 Sep 18 |
nicklas |
1177 |
{ |
4970 |
13 Sep 18 |
nicklas |
changed = true; |
4970 |
13 Sep 18 |
nicklas |
item.comment = commentE.value; |
4970 |
13 Sep 18 |
nicklas |
1180 |
} |
4970 |
13 Sep 18 |
nicklas |
1181 |
|
4970 |
13 Sep 18 |
nicklas |
if (changed) items[items.length] = item; |
4817 |
21 May 18 |
nicklas |
1183 |
} |
4817 |
21 May 18 |
nicklas |
1184 |
|
4970 |
13 Sep 18 |
nicklas |
if (items.length == 0) |
4817 |
21 May 18 |
nicklas |
1186 |
{ |
4970 |
13 Sep 18 |
nicklas |
Wizard.showGoNextConfirmation(false, 'No changes have been made!'); |
4817 |
21 May 18 |
nicklas |
return; |
4817 |
21 May 18 |
nicklas |
1189 |
} |
4817 |
21 May 18 |
nicklas |
1190 |
|
4970 |
13 Sep 18 |
nicklas |
Doc.addClass('step-1', 'disabled'); |
4970 |
13 Sep 18 |
nicklas |
Doc.hide('navigation'); |
4970 |
13 Sep 18 |
nicklas |
1193 |
|
4970 |
13 Sep 18 |
nicklas |
1194 |
|
4970 |
13 Sep 18 |
nicklas |
// Include filter settings in the registration URL so that a new list can be generated |
4970 |
13 Sep 18 |
nicklas |
var highHet = Doc.element('highHetFilter'); |
4970 |
13 Sep 18 |
nicklas |
var libPlate = Doc.element('libPlateFilter'); |
4970 |
13 Sep 18 |
nicklas |
var qiaCube = Doc.element('qiaCubeFilter'); |
4970 |
13 Sep 18 |
nicklas |
1199 |
|
4817 |
21 May 18 |
nicklas |
var url = '../Genotype.servlet?ID='+App.getSessionId(); |
4817 |
21 May 18 |
nicklas |
url += '&cmd=ReprocessItems'; |
4970 |
13 Sep 18 |
nicklas |
if (libPlate.selectedIndex > 0) |
4970 |
13 Sep 18 |
nicklas |
1203 |
{ |
4970 |
13 Sep 18 |
nicklas |
url += '&libPlateFilter='+encodeURIComponent(libPlate.value); |
4970 |
13 Sep 18 |
nicklas |
1205 |
} |
4970 |
13 Sep 18 |
nicklas |
else if (qiaCube.selectedIndex > 0) |
4970 |
13 Sep 18 |
nicklas |
1207 |
{ |
4970 |
13 Sep 18 |
nicklas |
url += '&qiaCubeFilter='+encodeURIComponent(qiaCube.value); |
4970 |
13 Sep 18 |
nicklas |
1209 |
} |
4970 |
13 Sep 18 |
nicklas |
else if (highHet.checked) |
4970 |
13 Sep 18 |
nicklas |
1211 |
{ |
4970 |
13 Sep 18 |
nicklas |
url += '&highHetFilter=1'; |
4970 |
13 Sep 18 |
nicklas |
1213 |
} |
4817 |
21 May 18 |
nicklas |
1214 |
|
4817 |
21 May 18 |
nicklas |
var submitInfo = {}; |
4970 |
13 Sep 18 |
nicklas |
submitInfo.items = items; |
4970 |
13 Sep 18 |
nicklas |
Wizard.showLoadingAnimation('Saving changes...'); |
4817 |
21 May 18 |
nicklas |
Wizard.asyncJsonRequest(url, search.reprocessResults, 'POST', JSON.stringify(submitInfo)); |
4817 |
21 May 18 |
nicklas |
1219 |
} |
4794 |
07 May 18 |
nicklas |
1220 |
|
4817 |
21 May 18 |
nicklas |
search.reprocessResults = function(response) |
4817 |
21 May 18 |
nicklas |
1222 |
{ |
4970 |
13 Sep 18 |
nicklas |
search.onAlignmentsLoaded(response); |
4970 |
13 Sep 18 |
nicklas |
Doc.show('navigation'); |
4970 |
13 Sep 18 |
nicklas |
Doc.removeClass('step-1', 'disabled'); |
4817 |
21 May 18 |
nicklas |
Wizard.showFinalMessage(response.messages); |
4817 |
21 May 18 |
nicklas |
1227 |
} |
4817 |
21 May 18 |
nicklas |
1228 |
|
4975 |
21 Sep 18 |
nicklas |
1229 |
|
4975 |
21 Sep 18 |
nicklas |
search.goResolve = function() |
4975 |
21 Sep 18 |
nicklas |
1231 |
{ |
5017 |
09 Oct 18 |
nicklas |
var verifyCheck = Doc.element('verifyGoNext'); |
5017 |
09 Oct 18 |
nicklas |
var acceptPartial = verifyCheck !=null && verifyCheck.checked; |
5017 |
09 Oct 18 |
nicklas |
1234 |
|
4975 |
21 Sep 18 |
nicklas |
Wizard.hideGoNextConfirmation(); |
4975 |
21 Sep 18 |
nicklas |
Doc.hide('wizard-status'); |
4975 |
21 Sep 18 |
nicklas |
var frm = document.forms['reggie']; |
4975 |
21 Sep 18 |
nicklas |
// We generate a list of items that should either be marked as DoNotUse or OkToUse |
4975 |
21 Sep 18 |
nicklas |
var items = []; |
4975 |
21 Sep 18 |
nicklas |
// This list will are flagged alignements that have a relation to the items in the above list |
4975 |
21 Sep 18 |
nicklas |
// The are potential candidates to be unflagged due to not having any more issues with other alignments |
4975 |
21 Sep 18 |
nicklas |
var flaggedPairs = []; |
4975 |
21 Sep 18 |
nicklas |
var numInvalid = 0; |
5017 |
09 Oct 18 |
nicklas |
var numCanAllowIfPartial = 0; |
5017 |
09 Oct 18 |
nicklas |
1245 |
|
7209 |
26 May 23 |
nicklas |
for (var itemNo = 0; itemNo < tumors.length; itemNo++) |
4975 |
21 Sep 18 |
nicklas |
1247 |
{ |
7209 |
26 May 23 |
nicklas |
var tumor = tumors[itemNo]; |
4975 |
21 Sep 18 |
nicklas |
1249 |
|
4975 |
21 Sep 18 |
nicklas |
// Assume that selection is valid |
7209 |
26 May 23 |
nicklas |
Doc.removeClass('section.'+tumor.tmpId, 'invalid'); |
4975 |
21 Sep 18 |
nicklas |
1252 |
|
4975 |
21 Sep 18 |
nicklas |
// Get the form elements for this item |
7209 |
26 May 23 |
nicklas |
var okToUse = Doc.element('oktouse.'+tumor.tmpId); |
7209 |
26 May 23 |
nicklas |
var doNotUse = Doc.element('donotuse.'+tumor.tmpId); |
7209 |
26 May 23 |
nicklas |
var futureGt = Doc.element('futuregt.'+tumor.tmpId); |
7209 |
26 May 23 |
nicklas |
var comment = Doc.element('resolvecomment.'+tumor.tmpId); |
4975 |
21 Sep 18 |
nicklas |
1258 |
|
4975 |
21 Sep 18 |
nicklas |
var item = null; |
4975 |
21 Sep 18 |
nicklas |
if (doNotUse) |
4975 |
21 Sep 18 |
nicklas |
1261 |
{ |
4975 |
21 Sep 18 |
nicklas |
if (okToUse && okToUse.checked) |
4975 |
21 Sep 18 |
nicklas |
1263 |
{ |
4975 |
21 Sep 18 |
nicklas |
if (okToUse.value == 'ok-rna') |
4975 |
21 Sep 18 |
nicklas |
1265 |
{ |
7209 |
26 May 23 |
nicklas |
item = {'type': 'EXTRACT', 'id': tumor.rna.id, 'okToUse': true, 'sort': 6 }; |
4975 |
21 Sep 18 |
nicklas |
1267 |
} |
4975 |
21 Sep 18 |
nicklas |
else if (okToUse.value == 'ok-library') |
4975 |
21 Sep 18 |
nicklas |
1269 |
{ |
7209 |
26 May 23 |
nicklas |
item = {'type': 'EXTRACT', 'id': tumor.lib.id, 'okToUse': true, 'sort': 7 }; |
4975 |
21 Sep 18 |
nicklas |
1271 |
} |
4975 |
21 Sep 18 |
nicklas |
1272 |
} |
4975 |
21 Sep 18 |
nicklas |
else if (doNotUse.value == 'specimen') |
4975 |
21 Sep 18 |
nicklas |
1274 |
{ |
7209 |
26 May 23 |
nicklas |
item = {'type': 'SAMPLE', 'id': tumor.specimen.id, 'doNotUse': 'Specimen', 'sort': 1 }; |
4975 |
21 Sep 18 |
nicklas |
1276 |
} |
4975 |
21 Sep 18 |
nicklas |
else if (doNotUse.value == 'lysate') |
4975 |
21 Sep 18 |
nicklas |
1278 |
{ |
7209 |
26 May 23 |
nicklas |
item = {'type': 'EXTRACT', 'id': tumor.lysate.id, 'doNotUse': 'Lysate', 'sort': 2 }; |
4975 |
21 Sep 18 |
nicklas |
1280 |
} |
4975 |
21 Sep 18 |
nicklas |
else if (doNotUse.value == 'rna') |
4975 |
21 Sep 18 |
nicklas |
1282 |
{ |
7209 |
26 May 23 |
nicklas |
item = {'type': 'EXTRACT', 'id': tumor.rna.id, 'doNotUse': 'RNA', 'sort': 3 }; |
4975 |
21 Sep 18 |
nicklas |
1284 |
} |
4982 |
26 Sep 18 |
nicklas |
else if (doNotUse.value == 'prenormalized') |
4982 |
26 Sep 18 |
nicklas |
1286 |
{ |
7209 |
26 May 23 |
nicklas |
item = {'type': 'EXTRACT', 'id': tumor.preNormalizedRna.id, 'doNotUse': 'PreNormalizedRNA', 'sort': 4 }; |
4982 |
26 Sep 18 |
nicklas |
1288 |
} |
4975 |
21 Sep 18 |
nicklas |
else if (doNotUse.value == 'library') |
4975 |
21 Sep 18 |
nicklas |
1290 |
{ |
7209 |
26 May 23 |
nicklas |
item = {'type': 'EXTRACT', 'id': tumor.lib.id, 'doNotUse': 'Library', 'sort': 5 }; |
4975 |
21 Sep 18 |
nicklas |
1292 |
} |
7209 |
26 May 23 |
nicklas |
else if (tumor.flagged && doNotUse.classList.contains('required')) |
4975 |
21 Sep 18 |
nicklas |
1294 |
{ |
4975 |
21 Sep 18 |
nicklas |
// A flagged item must have a specific option selected (when filtered on QiaCube or LibPlate) |
5017 |
09 Oct 18 |
nicklas |
numCanAllowIfPartial++; |
5017 |
09 Oct 18 |
nicklas |
if (!acceptPartial) |
5017 |
09 Oct 18 |
nicklas |
1298 |
{ |
7209 |
26 May 23 |
nicklas |
Doc.addClass('section.'+tumor.tmpId, 'invalid'); |
5017 |
09 Oct 18 |
nicklas |
numInvalid++; |
5017 |
09 Oct 18 |
nicklas |
1301 |
} |
4975 |
21 Sep 18 |
nicklas |
1302 |
} |
4981 |
25 Sep 18 |
nicklas |
if (doNotUse.value && futureGt) |
4981 |
25 Sep 18 |
nicklas |
1304 |
{ |
4981 |
25 Sep 18 |
nicklas |
item.futureGt = futureGt.checked; |
4981 |
25 Sep 18 |
nicklas |
1306 |
} |
4975 |
21 Sep 18 |
nicklas |
1307 |
} |
4975 |
21 Sep 18 |
nicklas |
if (item && comment) |
4975 |
21 Sep 18 |
nicklas |
1309 |
{ |
4975 |
21 Sep 18 |
nicklas |
item.comment = Strings.trim(comment.value); |
4975 |
21 Sep 18 |
nicklas |
if (item.doNotUse && item.comment == '') |
4975 |
21 Sep 18 |
nicklas |
1312 |
{ |
4975 |
21 Sep 18 |
nicklas |
// A comment must be specified for all items marked with DoNotUse |
7209 |
26 May 23 |
nicklas |
Doc.addClass('section.'+tumor.tmpId, 'invalid'); |
4975 |
21 Sep 18 |
nicklas |
numInvalid++; |
4975 |
21 Sep 18 |
nicklas |
1316 |
} |
4975 |
21 Sep 18 |
nicklas |
1317 |
} |
4975 |
21 Sep 18 |
nicklas |
if (item != null) |
4975 |
21 Sep 18 |
nicklas |
1319 |
{ |
4975 |
21 Sep 18 |
nicklas |
items[items.length] = item; |
4975 |
21 Sep 18 |
nicklas |
1321 |
|
4975 |
21 Sep 18 |
nicklas |
// Find flagged alignments that are related to the selected item |
4975 |
21 Sep 18 |
nicklas |
// We take help from the <tbody> section and look for tags with 'paired-alignment' class |
7209 |
26 May 23 |
nicklas |
var sectR = Doc.element('section.'+tumor.tmpId); |
4975 |
21 Sep 18 |
nicklas |
var flagged = sectR.getElementsByClassName('paired-alignment'); |
4975 |
21 Sep 18 |
nicklas |
for (var fNo = 0; fNo < flagged.length; fNo++) |
4975 |
21 Sep 18 |
nicklas |
1327 |
{ |
4975 |
21 Sep 18 |
nicklas |
flaggedPairs[flaggedPairs.length] = Data.int(flagged[fNo], 'id'); |
4975 |
21 Sep 18 |
nicklas |
1329 |
} |
4975 |
21 Sep 18 |
nicklas |
1330 |
} |
4975 |
21 Sep 18 |
nicklas |
1331 |
} |
4975 |
21 Sep 18 |
nicklas |
1332 |
|
4975 |
21 Sep 18 |
nicklas |
if (numInvalid > 0) |
4975 |
21 Sep 18 |
nicklas |
1334 |
{ |
5017 |
09 Oct 18 |
nicklas |
if (numCanAllowIfPartial > 0) |
5017 |
09 Oct 18 |
nicklas |
1336 |
{ |
5017 |
09 Oct 18 |
nicklas |
Wizard.showGoNextConfirmation(true, 'Mark the checkbox to allow partial registration.', acceptPartial); |
5017 |
09 Oct 18 |
nicklas |
1338 |
} |
4975 |
21 Sep 18 |
nicklas |
Wizard.notifyError(); |
4975 |
21 Sep 18 |
nicklas |
return; |
4975 |
21 Sep 18 |
nicklas |
1341 |
} |
4975 |
21 Sep 18 |
nicklas |
1342 |
|
4975 |
21 Sep 18 |
nicklas |
if (items.length == 0) |
4975 |
21 Sep 18 |
nicklas |
1344 |
{ |
4975 |
21 Sep 18 |
nicklas |
Wizard.showGoNextConfirmation(false, 'No changes have been made!'); |
4975 |
21 Sep 18 |
nicklas |
return; |
4975 |
21 Sep 18 |
nicklas |
1347 |
} |
5017 |
09 Oct 18 |
nicklas |
1348 |
|
4975 |
21 Sep 18 |
nicklas |
Doc.addClass('step-1', 'disabled'); |
4975 |
21 Sep 18 |
nicklas |
Doc.hide('navigation'); |
4975 |
21 Sep 18 |
nicklas |
1351 |
|
4975 |
21 Sep 18 |
nicklas |
// Include filter settings in the registration URL so that a new list can be generated |
4975 |
21 Sep 18 |
nicklas |
var highHet = Doc.element('highHetFilter'); |
4975 |
21 Sep 18 |
nicklas |
var libPlate = Doc.element('libPlateFilter'); |
4975 |
21 Sep 18 |
nicklas |
var qiaCube = Doc.element('qiaCubeFilter'); |
4975 |
21 Sep 18 |
nicklas |
1356 |
|
4975 |
21 Sep 18 |
nicklas |
var url = '../Genotype.servlet?ID='+App.getSessionId(); |
4975 |
21 Sep 18 |
nicklas |
url += '&cmd=ResolveProblems'; |
4975 |
21 Sep 18 |
nicklas |
if (libPlate.selectedIndex > 0) |
4975 |
21 Sep 18 |
nicklas |
1360 |
{ |
4975 |
21 Sep 18 |
nicklas |
url += '&libPlateFilter='+encodeURIComponent(libPlate.value); |
4975 |
21 Sep 18 |
nicklas |
1362 |
} |
4975 |
21 Sep 18 |
nicklas |
else if (qiaCube.selectedIndex > 0) |
4975 |
21 Sep 18 |
nicklas |
1364 |
{ |
4975 |
21 Sep 18 |
nicklas |
url += '&qiaCubeFilter='+encodeURIComponent(qiaCube.value); |
4975 |
21 Sep 18 |
nicklas |
1366 |
} |
4975 |
21 Sep 18 |
nicklas |
else if (highHet.checked) |
4975 |
21 Sep 18 |
nicklas |
1368 |
{ |
4975 |
21 Sep 18 |
nicklas |
url += '&highHetFilter=1'; |
4975 |
21 Sep 18 |
nicklas |
1370 |
} |
4975 |
21 Sep 18 |
nicklas |
1371 |
|
4978 |
24 Sep 18 |
nicklas |
// Sort items in the "correct" order. All DoNotUse items before OkToUse |
4978 |
24 Sep 18 |
nicklas |
// and Specimen -> Lysate -> RNA -> Library |
4978 |
24 Sep 18 |
nicklas |
// This will prevent prevent problems with non-deterministic result if |
4978 |
24 Sep 18 |
nicklas |
// selecting, for example, "Specimen" and "RNA" from the same parent-child chain |
4978 |
24 Sep 18 |
nicklas |
// With sorting the highest level (Specimen) wins |
4978 |
24 Sep 18 |
nicklas |
items.sort(Sort.sortDoNotUseItems); |
4978 |
24 Sep 18 |
nicklas |
1378 |
|
4975 |
21 Sep 18 |
nicklas |
var submitInfo = {}; |
4975 |
21 Sep 18 |
nicklas |
submitInfo.items = items; |
4975 |
21 Sep 18 |
nicklas |
submitInfo.paired = flaggedPairs; |
4975 |
21 Sep 18 |
nicklas |
1382 |
|
4975 |
21 Sep 18 |
nicklas |
Wizard.showLoadingAnimation('Saving changes...'); |
4975 |
21 Sep 18 |
nicklas |
Wizard.asyncJsonRequest(url, search.resolveResults, 'POST', JSON.stringify(submitInfo)); |
4975 |
21 Sep 18 |
nicklas |
1385 |
} |
4975 |
21 Sep 18 |
nicklas |
1386 |
|
4975 |
21 Sep 18 |
nicklas |
search.resolveResults = function(response) |
4975 |
21 Sep 18 |
nicklas |
1388 |
{ |
4975 |
21 Sep 18 |
nicklas |
search.onAlignmentsLoaded(response); |
4975 |
21 Sep 18 |
nicklas |
Doc.show('navigation'); |
4975 |
21 Sep 18 |
nicklas |
Doc.removeClass('step-1', 'disabled'); |
4975 |
21 Sep 18 |
nicklas |
Wizard.showFinalMessage(response.messages); |
4975 |
21 Sep 18 |
nicklas |
1393 |
} |
4975 |
21 Sep 18 |
nicklas |
1394 |
|
4794 |
07 May 18 |
nicklas |
return search; |
4794 |
07 May 18 |
nicklas |
1396 |
}(); |
4794 |
07 May 18 |
nicklas |
1397 |
|
4794 |
07 May 18 |
nicklas |
Doc.onLoad(Search.initPage); |
4794 |
07 May 18 |
nicklas |
1399 |
|
4794 |
07 May 18 |
nicklas |
1400 |
/** |
4794 |
07 May 18 |
nicklas |
Represents a QiaCube in the QiaCube filter list. |
4794 |
07 May 18 |
nicklas |
The date and run number is the important information. |
4794 |
07 May 18 |
nicklas |
1403 |
*/ |
4794 |
07 May 18 |
nicklas |
function QiaCube(date, runNo) |
4794 |
07 May 18 |
nicklas |
1405 |
{ |
4794 |
07 May 18 |
nicklas |
this.date = date; |
4794 |
07 May 18 |
nicklas |
this.runNo = runNo; |
4794 |
07 May 18 |
nicklas |
this.name = date + '#' + runNo; |
4794 |
07 May 18 |
nicklas |
this.title = Reggie.reformatDate(date) + '#' + runNo; |
4794 |
07 May 18 |
nicklas |
1410 |
} |
4794 |
07 May 18 |
nicklas |
1411 |
|
4794 |
07 May 18 |
nicklas |
1412 |
/** |
4794 |
07 May 18 |
nicklas |
Represents a LibPlate in the LibPlate filter list. |
4794 |
07 May 18 |
nicklas |
The name is the only important information. |
4794 |
07 May 18 |
nicklas |
1415 |
*/ |
4794 |
07 May 18 |
nicklas |
function LibPlate(name) |
4794 |
07 May 18 |
nicklas |
1417 |
{ |
4794 |
07 May 18 |
nicklas |
this.name = name; |
4794 |
07 May 18 |
nicklas |
1419 |
} |
4794 |
07 May 18 |
nicklas |
1420 |
|
4794 |
07 May 18 |
nicklas |
// Placeholder for various sort functions |
4794 |
07 May 18 |
nicklas |
var Sort = function() |
4794 |
07 May 18 |
nicklas |
1423 |
{ |
4794 |
07 May 18 |
nicklas |
var sort = {}; |
4794 |
07 May 18 |
nicklas |
1425 |
|
4794 |
07 May 18 |
nicklas |
// Sort items by name |
4794 |
07 May 18 |
nicklas |
sort.sortByName = function(a, b) |
4794 |
07 May 18 |
nicklas |
1428 |
{ |
4794 |
07 May 18 |
nicklas |
return a.name == b.name ? 0 : (a.name < b.name ? -1 : 1); |
4794 |
07 May 18 |
nicklas |
1430 |
} |
4794 |
07 May 18 |
nicklas |
1431 |
|
7209 |
26 May 23 |
nicklas |
// Sort tumors by patient name |
4794 |
07 May 18 |
nicklas |
// If they are equals sort by alignment name |
7209 |
26 May 23 |
nicklas |
sort.sortTumorsByPatientName = function(a, b) |
4794 |
07 May 18 |
nicklas |
1435 |
{ |
4821 |
23 May 18 |
nicklas |
var patA = a.specimen ? a.specimen.patientName : 'zz'+(a.name || a.rna.name); |
4821 |
23 May 18 |
nicklas |
var patB = b.specimen ? b.specimen.patientName : 'zz'+(b.name || b.rna.name); |
4794 |
07 May 18 |
nicklas |
return patA == patB ? sort.sortByName(a, b) : (patA < patB ? -1 : 1); |
4794 |
07 May 18 |
nicklas |
1439 |
} |
4794 |
07 May 18 |
nicklas |
1440 |
|
7209 |
26 May 23 |
nicklas |
// Sort tumors by LibPlate position (columns before rows) |
7209 |
26 May 23 |
nicklas |
sort.sortTumorsByLibPlatePosition = function(a, b) |
4794 |
07 May 18 |
nicklas |
1443 |
{ |
4821 |
23 May 18 |
nicklas |
var plateA = a.lib ? a.lib.bioWell.bioPlate.name : 'zz'+(a.name || a.rna.name); |
4821 |
23 May 18 |
nicklas |
var plateB = b.lib ? b.lib.bioWell.bioPlate.name : 'zz'+(b.name || b.rna.name); |
4794 |
07 May 18 |
nicklas |
1446 |
|
4794 |
07 May 18 |
nicklas |
if (plateA != plateB) return plateA < plateB ? -1 : 1; |
4794 |
07 May 18 |
nicklas |
1448 |
|
4794 |
07 May 18 |
nicklas |
var posA = a.lib.bioWell; |
4794 |
07 May 18 |
nicklas |
var posB = b.lib.bioWell; |
4794 |
07 May 18 |
nicklas |
if (posA.column != posB.column) return posA.column < posB.column ? -1 : 1; |
4794 |
07 May 18 |
nicklas |
1452 |
|
4794 |
07 May 18 |
nicklas |
return posA.row < posB.row ? -1 : 1; |
4794 |
07 May 18 |
nicklas |
1454 |
} |
4794 |
07 May 18 |
nicklas |
1455 |
|
7209 |
26 May 23 |
nicklas |
// Sort tumors by QiaCube position |
7209 |
26 May 23 |
nicklas |
sort.sortTumorsByQiaCubePosition = function(a, b) |
4794 |
07 May 18 |
nicklas |
1458 |
{ |
4794 |
07 May 18 |
nicklas |
var qiaCubeA = a.rna.QIACUBE_DATE + '#' + a.rna.QIACUBE_RUN_NO; |
4794 |
07 May 18 |
nicklas |
var qiaCubeB = b.rna.QIACUBE_DATE + '#' + b.rna.QIACUBE_RUN_NO; |
4794 |
07 May 18 |
nicklas |
1461 |
|
4794 |
07 May 18 |
nicklas |
if (qiaCubeA != qiaCubeB) return qiaCubeA < qiaCubeB ? -1 : 1; |
4794 |
07 May 18 |
nicklas |
1463 |
|
4794 |
07 May 18 |
nicklas |
var posA = a.rna.QIACUBE_POSITION; |
4794 |
07 May 18 |
nicklas |
var posB = b.rna.QIACUBE_POSITION; |
4982 |
26 Sep 18 |
nicklas |
if (posA != posB) return posA < posB ? -1 : 1; |
4982 |
26 Sep 18 |
nicklas |
1467 |
|
5024 |
15 Oct 18 |
nicklas |
// Sort flagged before not flagged |
5024 |
15 Oct 18 |
nicklas |
if (a.flagged != b.flagged) return a.flagged ? -1 : 1; |
5024 |
15 Oct 18 |
nicklas |
1470 |
|
4982 |
26 Sep 18 |
nicklas |
// Critical, sort pre-normalized RNA before regular RNA to |
4982 |
26 Sep 18 |
nicklas |
// enable the 'PreNormalizedRNA' option in the 'DoNotUse' selection list |
4982 |
26 Sep 18 |
nicklas |
if (a.preNormalizedRna && !b.preNormalizedRna) return -1; |
4982 |
26 Sep 18 |
nicklas |
if (b.preNormalizedRna && !a.preNormalizedRna) return 1; |
4982 |
26 Sep 18 |
nicklas |
1475 |
|
4982 |
26 Sep 18 |
nicklas |
return sort.sortByName(a, b); |
4794 |
07 May 18 |
nicklas |
1477 |
} |
4794 |
07 May 18 |
nicklas |
1478 |
|
4978 |
24 Sep 18 |
nicklas |
// Sort items that are sent for "DoNotUse" or "OkToUse" by the 'sort' propert. |
4978 |
24 Sep 18 |
nicklas |
sort.sortDoNotUseItems = function(a, b) |
4978 |
24 Sep 18 |
nicklas |
1481 |
{ |
4978 |
24 Sep 18 |
nicklas |
return a.sort == b.sort ? a.id - b.id : a.sort - b.sort; |
4978 |
24 Sep 18 |
nicklas |
1483 |
} |
4978 |
24 Sep 18 |
nicklas |
1484 |
|
4794 |
07 May 18 |
nicklas |
return sort; |
4794 |
07 May 18 |
nicklas |
1486 |
}(); |
4794 |
07 May 18 |
nicklas |
1487 |
|
4794 |
07 May 18 |
nicklas |
//Placeholder for various filter functions |
4794 |
07 May 18 |
nicklas |
var Filter = function() |
4794 |
07 May 18 |
nicklas |
1490 |
{ |
4794 |
07 May 18 |
nicklas |
var filter = {}; |
4794 |
07 May 18 |
nicklas |
1492 |
|
4794 |
07 May 18 |
nicklas |
// Creates a filter that accepts alignments related to |
4794 |
07 May 18 |
nicklas |
// the given QiaCube run. The filter value should |
4794 |
07 May 18 |
nicklas |
// be formatted as <date>#<runNo> |
4794 |
07 May 18 |
nicklas |
filter.qiaCubeFilter = function(qiaCubeRun) |
4794 |
07 May 18 |
nicklas |
1497 |
{ |
6589 |
21 Feb 22 |
nicklas |
return function(assay) |
4794 |
07 May 18 |
nicklas |
1499 |
{ |
6589 |
21 Feb 22 |
nicklas |
var rna = assay.rna; |
6589 |
21 Feb 22 |
nicklas |
return rna && qiaCubeRun == rna.QIACUBE_DATE + '#' + rna.QIACUBE_RUN_NO ? qiaCubeRun : null; |
4794 |
07 May 18 |
nicklas |
1502 |
} |
4794 |
07 May 18 |
nicklas |
1503 |
} |
4794 |
07 May 18 |
nicklas |
1504 |
|
4794 |
07 May 18 |
nicklas |
// Creates a filter that accepts alignments related |
4794 |
07 May 18 |
nicklas |
// to the given LibPlate. The filter value is the name |
4794 |
07 May 18 |
nicklas |
// of the plate, |
4794 |
07 May 18 |
nicklas |
filter.libPlateFilter = function(libPlateName) |
4794 |
07 May 18 |
nicklas |
1509 |
{ |
6589 |
21 Feb 22 |
nicklas |
return function(assay) |
4794 |
07 May 18 |
nicklas |
1511 |
{ |
6589 |
21 Feb 22 |
nicklas |
return assay.lib && libPlateName == assay.lib.bioWell.bioPlate.name ? libPlateName : null; |
4794 |
07 May 18 |
nicklas |
1513 |
} |
4794 |
07 May 18 |
nicklas |
1514 |
} |
4794 |
07 May 18 |
nicklas |
1515 |
|
4817 |
21 May 18 |
nicklas |
// Creates a filter that accepts alignments with a HET |
4817 |
21 May 18 |
nicklas |
// percentage above the specified limit |
4817 |
21 May 18 |
nicklas |
filter.hetFilter = function(hetLimit) |
4817 |
21 May 18 |
nicklas |
1519 |
{ |
6589 |
21 Feb 22 |
nicklas |
return function(assay) |
4817 |
21 May 18 |
nicklas |
1521 |
{ |
6589 |
21 Feb 22 |
nicklas |
return assay.QC_GENOTYPE_HET_PCT > hetLimit; |
4817 |
21 May 18 |
nicklas |
1523 |
} |
4817 |
21 May 18 |
nicklas |
1524 |
} |
4817 |
21 May 18 |
nicklas |
1525 |
|
4794 |
07 May 18 |
nicklas |
return filter; |
4794 |
07 May 18 |
nicklas |
1527 |
}(); |
4794 |
07 May 18 |
nicklas |
1528 |
|
4794 |
07 May 18 |
nicklas |
// Placeholder for various functions that help us get a property from an alignment |
4794 |
07 May 18 |
nicklas |
var Property = function() |
4794 |
07 May 18 |
nicklas |
1531 |
{ |
4794 |
07 May 18 |
nicklas |
var property = {}; |
4794 |
07 May 18 |
nicklas |
1533 |
|
4794 |
07 May 18 |
nicklas |
// Get the QiaCube position from the alignment |
4794 |
07 May 18 |
nicklas |
property.QiaCubePosition = function(alignment) |
4794 |
07 May 18 |
nicklas |
1536 |
{ |
4794 |
07 May 18 |
nicklas |
return alignment.rna.QIACUBE_POSITION; |
4794 |
07 May 18 |
nicklas |
1538 |
} |
4794 |
07 May 18 |
nicklas |
1539 |
|
4794 |
07 May 18 |
nicklas |
// Get the LibPlate position from the alignment |
4794 |
07 May 18 |
nicklas |
property.LibPlatePosition = function(alignment) |
4794 |
07 May 18 |
nicklas |
1542 |
{ |
4794 |
07 May 18 |
nicklas |
return alignment.lib.bioWell.location; |
4794 |
07 May 18 |
nicklas |
1544 |
} |
4794 |
07 May 18 |
nicklas |
1545 |
|
4794 |
07 May 18 |
nicklas |
return property; |
4794 |
07 May 18 |
nicklas |
1547 |
}(); |
4794 |
07 May 18 |
nicklas |
1548 |
|
4794 |
07 May 18 |
nicklas |
1549 |
/** |
4794 |
07 May 18 |
nicklas |
Helper functions for generating various HTML outputs. |
4794 |
07 May 18 |
nicklas |
1551 |
*/ |
4794 |
07 May 18 |
nicklas |
var HTMLHelper = function() |
4794 |
07 May 18 |
nicklas |
1553 |
{ |
4794 |
07 May 18 |
nicklas |
var helper = {}; |
4794 |
07 May 18 |
nicklas |
1555 |
|
4794 |
07 May 18 |
nicklas |
var colorMatchTargets = {}; |
4794 |
07 May 18 |
nicklas |
var colorMatchIndex = 0; |
4794 |
07 May 18 |
nicklas |
1558 |
|
7209 |
26 May 23 |
nicklas |
var SHORT_PIPELINE = { |
7209 |
26 May 23 |
nicklas |
'RNAseq/Hisat/StringTie': 'RNAseq', |
7209 |
26 May 23 |
nicklas |
'DNA/Normal/WGS': 'WGS/Normal', |
7209 |
26 May 23 |
nicklas |
'DNA/Genotyping': 'Genotyping' |
7209 |
26 May 23 |
nicklas |
1563 |
}; |
7209 |
26 May 23 |
nicklas |
1564 |
|
4794 |
07 May 18 |
nicklas |
1565 |
/** |
4794 |
07 May 18 |
nicklas |
Create the link for a QiaCube run. It will typically show the date#run@pos |
4794 |
07 May 18 |
nicklas |
and will also output colormatch functionality for either the entire QiaCube run |
4794 |
07 May 18 |
nicklas |
or the position (in filtered view) |
4794 |
07 May 18 |
nicklas |
1569 |
*/ |
4797 |
08 May 18 |
nicklas |
helper.qiaCubeLink = function(qiaCubeDate, qiaCubeRun, qiaCubePos, filterValue, shortForm) |
4794 |
07 May 18 |
nicklas |
1571 |
{ |
6589 |
21 Feb 22 |
nicklas |
if (!qiaCubeDate) return ''; |
4794 |
07 May 18 |
nicklas |
var runId = qiaCubeDate+'#'+qiaCubeRun; |
4794 |
07 May 18 |
nicklas |
var runPosId = runId+'@'+qiaCubePos; |
4794 |
07 May 18 |
nicklas |
var html = ''; |
4794 |
07 May 18 |
nicklas |
if (!shortForm) |
4794 |
07 May 18 |
nicklas |
1577 |
{ |
4794 |
07 May 18 |
nicklas |
html += '<span class="link qiacube-link" data-qiacuberun="'+runId+'" title="Filter on this QiaCube run">'; |
4794 |
07 May 18 |
nicklas |
html += Reggie.reformatDate(qiaCubeDate) + '#' + qiaCubeRun; |
4794 |
07 May 18 |
nicklas |
html += '</span>'; |
4794 |
07 May 18 |
nicklas |
1581 |
} |
4794 |
07 May 18 |
nicklas |
html += '@'+qiaCubePos; |
4797 |
08 May 18 |
nicklas |
var isFiltered = filterValue == runId; |
4794 |
07 May 18 |
nicklas |
return HTMLHelper.colorMatch(isFiltered ? runPosId : runId, html, isFiltered ? 'Click to highlight this position' : 'Click to highlight this QiaCube'); |
4794 |
07 May 18 |
nicklas |
1585 |
} |
4794 |
07 May 18 |
nicklas |
1586 |
|
4794 |
07 May 18 |
nicklas |
1587 |
/** |
4794 |
07 May 18 |
nicklas |
Create the link for a LibPlate position. It will typically show the name and position |
4794 |
07 May 18 |
nicklas |
and will also output colormatch functionality for either the entire LibPlate |
4794 |
07 May 18 |
nicklas |
or the position (in filtered view). |
4794 |
07 May 18 |
nicklas |
1591 |
*/ |
4797 |
08 May 18 |
nicklas |
helper.libPlateLink = function(libPlateName, libPlatePos, filterValue, shortForm) |
4794 |
07 May 18 |
nicklas |
1593 |
{ |
6589 |
21 Feb 22 |
nicklas |
if (!libPlateName) return ''; |
4794 |
07 May 18 |
nicklas |
var html = ''; |
4794 |
07 May 18 |
nicklas |
if (!shortForm) |
4794 |
07 May 18 |
nicklas |
1597 |
{ |
4794 |
07 May 18 |
nicklas |
html = '<span class="link libplate-link" data-libplate="'+libPlateName+'" title="Filter on this plate">'; |
4794 |
07 May 18 |
nicklas |
html += Strings.encodeTags(libPlateName); |
4794 |
07 May 18 |
nicklas |
html += '</span> '; |
4794 |
07 May 18 |
nicklas |
1601 |
} |
4794 |
07 May 18 |
nicklas |
html += libPlatePos; |
4797 |
08 May 18 |
nicklas |
var isFiltered = filterValue == libPlateName; |
4794 |
07 May 18 |
nicklas |
return HTMLHelper.colorMatch(isFiltered ? libPlateName+'@'+libPlatePos : libPlateName, html, isFiltered ? 'Click to highlight this position' : 'Click to highlight this LibPlate'); |
4794 |
07 May 18 |
nicklas |
1605 |
} |
7209 |
26 May 23 |
nicklas |
1606 |
|
7209 |
26 May 23 |
nicklas |
1607 |
/** |
7209 |
26 May 23 |
nicklas |
Output unlinked plate position. |
7209 |
26 May 23 |
nicklas |
1609 |
*/ |
7209 |
26 May 23 |
nicklas |
helper.platePos = function(plateName, platePos) |
7209 |
26 May 23 |
nicklas |
1611 |
{ |
7209 |
26 May 23 |
nicklas |
if (!plateName) return ''; |
7209 |
26 May 23 |
nicklas |
var html = Strings.encodeTags(plateName)+' '+Strings.encodeTags(platePos); |
7209 |
26 May 23 |
nicklas |
return HTMLHelper.colorMatch(plateName, html, 'Click to highlight this Plate'); |
7209 |
26 May 23 |
nicklas |
1615 |
} |
7209 |
26 May 23 |
nicklas |
1616 |
|
4794 |
07 May 18 |
nicklas |
1617 |
|
6592 |
21 Feb 22 |
nicklas |
helper.beadChipLink = function(beadChipName, beadChipPosition) |
6590 |
21 Feb 22 |
nicklas |
1619 |
{ |
6592 |
21 Feb 22 |
nicklas |
if (!beadChipName) return ''; |
6592 |
21 Feb 22 |
nicklas |
var html = Strings.encodeTags(beadChipName)+' '+Strings.encodeTags(beadChipPosition); |
6592 |
21 Feb 22 |
nicklas |
return HTMLHelper.colorMatch(beadChipName, html, 'Click to highlight this BeadChip'); |
6590 |
21 Feb 22 |
nicklas |
1623 |
} |
6590 |
21 Feb 22 |
nicklas |
1624 |
|
4799 |
09 May 18 |
nicklas |
1625 |
/** |
7209 |
26 May 23 |
nicklas |
Due to space constrains we display a shorter version of the pipeline annotation. |
7209 |
26 May 23 |
nicklas |
1627 |
*/ |
7209 |
26 May 23 |
nicklas |
helper.shortPipeline = function(pipeline) |
7209 |
26 May 23 |
nicklas |
1629 |
{ |
7209 |
26 May 23 |
nicklas |
return SHORT_PIPELINE[pipeline] || Strings.encodeTags(pipeline); |
7209 |
26 May 23 |
nicklas |
1631 |
} |
7209 |
26 May 23 |
nicklas |
1632 |
|
7209 |
26 May 23 |
nicklas |
1633 |
/** |
4799 |
09 May 18 |
nicklas |
Return 'name2' with markup indicating which parts of the name |
4799 |
09 May 18 |
nicklas |
are common with 'name1'. |
4799 |
09 May 18 |
nicklas |
1636 |
*/ |
4799 |
09 May 18 |
nicklas |
helper.tagCommonPartOfName = function(name1, name2) |
4799 |
09 May 18 |
nicklas |
1638 |
{ |
4799 |
09 May 18 |
nicklas |
var n1 = name1.split('.'); |
4799 |
09 May 18 |
nicklas |
var n2 = name2.split('.'); |
4799 |
09 May 18 |
nicklas |
var i = 0; |
4799 |
09 May 18 |
nicklas |
1642 |
|
4799 |
09 May 18 |
nicklas |
var common = ''; |
4799 |
09 May 18 |
nicklas |
var sep = '.'; |
4799 |
09 May 18 |
nicklas |
while (i < n1.length && i < n2.length && n1[i] == n2[i]) |
4799 |
09 May 18 |
nicklas |
1646 |
{ |
4799 |
09 May 18 |
nicklas |
common += n1[i] + sep; |
4799 |
09 May 18 |
nicklas |
i++; |
4799 |
09 May 18 |
nicklas |
1649 |
} |
4799 |
09 May 18 |
nicklas |
1650 |
|
4799 |
09 May 18 |
nicklas |
var diff = ''; |
4799 |
09 May 18 |
nicklas |
sep = ''; |
4799 |
09 May 18 |
nicklas |
while (i < n2.length) |
4799 |
09 May 18 |
nicklas |
1654 |
{ |
4799 |
09 May 18 |
nicklas |
diff += sep + n2[i]; |
4799 |
09 May 18 |
nicklas |
i++; |
4799 |
09 May 18 |
nicklas |
sep = '.'; |
4799 |
09 May 18 |
nicklas |
1658 |
} |
4799 |
09 May 18 |
nicklas |
1659 |
|
4799 |
09 May 18 |
nicklas |
var html = ''; |
4799 |
09 May 18 |
nicklas |
if (common.length > 0) html += '<span class="commonpart">'+Strings.encodeTags(common)+'</span>'; |
4799 |
09 May 18 |
nicklas |
if (diff.length > 0) html += '<span class="diffpart">'+Strings.encodeTags(diff)+'</span>'; |
4799 |
09 May 18 |
nicklas |
return html; |
4799 |
09 May 18 |
nicklas |
1664 |
} |
4799 |
09 May 18 |
nicklas |
1665 |
|
4799 |
09 May 18 |
nicklas |
1666 |
|
4794 |
07 May 18 |
nicklas |
// Creates a "ColorMatch" tag for the given text |
4794 |
07 May 18 |
nicklas |
helper.colorMatch = function(plainText, formattedText, tooltip) |
4794 |
07 May 18 |
nicklas |
1669 |
{ |
4794 |
07 May 18 |
nicklas |
var target = colorMatchTargets[plainText]; |
4794 |
07 May 18 |
nicklas |
if (!target) |
4794 |
07 May 18 |
nicklas |
1672 |
{ |
4794 |
07 May 18 |
nicklas |
colorMatchIndex++; |
4794 |
07 May 18 |
nicklas |
target = 'CM'+colorMatchIndex; |
4794 |
07 May 18 |
nicklas |
colorMatchTargets[plainText] = target; |
4794 |
07 May 18 |
nicklas |
1676 |
} |
4794 |
07 May 18 |
nicklas |
if (!formattedText) formattedText = Strings.encodeTags(plainText); |
4794 |
07 May 18 |
nicklas |
1678 |
|
4794 |
07 May 18 |
nicklas |
var html = '<span class="colormatch" data-match="'+target+'"'; |
4794 |
07 May 18 |
nicklas |
if (tooltip) html += ' title="'+tooltip+'"'; |
4794 |
07 May 18 |
nicklas |
html += '>'+formattedText+'</span>'; |
4794 |
07 May 18 |
nicklas |
return html; |
4794 |
07 May 18 |
nicklas |
1683 |
} |
4794 |
07 May 18 |
nicklas |
1684 |
|
4817 |
21 May 18 |
nicklas |
1685 |
|
4976 |
24 Sep 18 |
nicklas |
helper.reprocessOptions = function(aligned, recommendReprocess) |
4817 |
21 May 18 |
nicklas |
1687 |
{ |
4820 |
22 May 18 |
nicklas |
var id = 'reprocess.'+aligned.tmpId; |
4976 |
24 Sep 18 |
nicklas |
var title = ''; |
4976 |
24 Sep 18 |
nicklas |
1690 |
|
5001 |
04 Oct 18 |
nicklas |
var html = ''; |
4980 |
25 Sep 18 |
nicklas |
html += '<select id="'+id+'" class="reprocess-options" name="'+id+'" '+(recommendReprocess? 'title="Re-processing is recommended"':'')+'>'; |
4998 |
03 Oct 18 |
nicklas |
if (!aligned.currentReProcess) html += '<option value="" selected> '; |
4998 |
03 Oct 18 |
nicklas |
html += helper.reprocessOption('Specimen', 'specimen', aligned.currentReProcess, aligned.specimen.DO_NOT_USE); |
4998 |
03 Oct 18 |
nicklas |
html += helper.reprocessOption('Lysate', 'lysate', aligned.currentReProcess, aligned.lysate.DO_NOT_USE); |
4998 |
03 Oct 18 |
nicklas |
html += helper.reprocessOption('RNA', 'rna', aligned.currentReProcess, aligned.rna.DO_NOT_USE); |
5001 |
04 Oct 18 |
nicklas |
html += '</select>'; |
4817 |
21 May 18 |
nicklas |
1698 |
|
4997 |
03 Oct 18 |
nicklas |
if (aligned.currentReProcess != null) |
4817 |
21 May 18 |
nicklas |
1700 |
{ |
4997 |
03 Oct 18 |
nicklas |
html += '<img src="../images/info.png" title="Re-processing is already scheduled from '+aligned.currentReProcess+'">'; |
4817 |
21 May 18 |
nicklas |
1702 |
} |
4817 |
21 May 18 |
nicklas |
1703 |
|
4817 |
21 May 18 |
nicklas |
return html; |
4817 |
21 May 18 |
nicklas |
1705 |
} |
4817 |
21 May 18 |
nicklas |
1706 |
|
4980 |
25 Sep 18 |
nicklas |
helper.reprocessOption = function(text, value, currentReProcess, doNotUse) |
4980 |
25 Sep 18 |
nicklas |
1708 |
{ |
4980 |
25 Sep 18 |
nicklas |
var opt = '<option '; |
4980 |
25 Sep 18 |
nicklas |
if (currentReProcess==text) |
4980 |
25 Sep 18 |
nicklas |
1711 |
{ |
4980 |
25 Sep 18 |
nicklas |
opt += 'value="" selected'; |
4980 |
25 Sep 18 |
nicklas |
1713 |
} |
4980 |
25 Sep 18 |
nicklas |
else |
4980 |
25 Sep 18 |
nicklas |
1715 |
{ |
4980 |
25 Sep 18 |
nicklas |
opt += 'value="'+value+'"'; |
4980 |
25 Sep 18 |
nicklas |
1717 |
} |
4980 |
25 Sep 18 |
nicklas |
if (doNotUse) opt += ' class="donotuse" title="'+text+' is marked as DoNotUse"'; |
4980 |
25 Sep 18 |
nicklas |
opt += '>'+text; |
4980 |
25 Sep 18 |
nicklas |
if (doNotUse) opt += ' (!)'; |
4980 |
25 Sep 18 |
nicklas |
return opt; |
4980 |
25 Sep 18 |
nicklas |
1722 |
} |
4980 |
25 Sep 18 |
nicklas |
1723 |
|
4970 |
13 Sep 18 |
nicklas |
helper.qcCommentInput = function(aligned) |
4970 |
13 Sep 18 |
nicklas |
1725 |
{ |
4970 |
13 Sep 18 |
nicklas |
var id = 'comment.'+aligned.tmpId; |
4970 |
13 Sep 18 |
nicklas |
html = '<input type="text" id="'+id+'" name="'+id+'" value="'+Strings.encodeTags(aligned.QC_GENOTYPE_COMMENT)+'">'; |
4970 |
13 Sep 18 |
nicklas |
return html; |
4970 |
13 Sep 18 |
nicklas |
1729 |
} |
4970 |
13 Sep 18 |
nicklas |
1730 |
|
4970 |
13 Sep 18 |
nicklas |
helper.qcFlagCheckbox = function(aligned) |
4970 |
13 Sep 18 |
nicklas |
1732 |
{ |
4970 |
13 Sep 18 |
nicklas |
var id = 'flag.'+aligned.tmpId; |
4970 |
13 Sep 18 |
nicklas |
html = '<input type="checkbox" id="'+id+'" name="'+id+'">'; |
4970 |
13 Sep 18 |
nicklas |
return html; |
4970 |
13 Sep 18 |
nicklas |
1736 |
} |
4970 |
13 Sep 18 |
nicklas |
1737 |
|
4981 |
25 Sep 18 |
nicklas |
helper.okToUseOptions = function(aligned, filterType) |
4981 |
25 Sep 18 |
nicklas |
1739 |
{ |
4981 |
25 Sep 18 |
nicklas |
var html = ''; |
4981 |
25 Sep 18 |
nicklas |
if (aligned.flagged && !aligned.DO_NOT_USE) |
4981 |
25 Sep 18 |
nicklas |
1742 |
{ |
4981 |
25 Sep 18 |
nicklas |
var idOkToUse = 'oktouse.'+aligned.tmpId; |
4981 |
25 Sep 18 |
nicklas |
var okValue = filterType == 'QIACUBE' ? 'ok-rna' : 'ok-library'; |
4981 |
25 Sep 18 |
nicklas |
html += '<input type="checkbox" value="'+okValue+'" id="'+idOkToUse+'" name="'+idOkToUse+'" class="oktouse" title="Check this to indicate that the flagged item is ok to use.">'; |
4981 |
25 Sep 18 |
nicklas |
1746 |
} |
4981 |
25 Sep 18 |
nicklas |
return html; |
4981 |
25 Sep 18 |
nicklas |
1748 |
} |
4981 |
25 Sep 18 |
nicklas |
1749 |
|
4975 |
21 Sep 18 |
nicklas |
1750 |
/** |
4975 |
21 Sep 18 |
nicklas |
We generate a checkbox (if the item is flagged) and a |
4975 |
21 Sep 18 |
nicklas |
selection list with "DoNotUse" options. |
4975 |
21 Sep 18 |
nicklas |
1753 |
*/ |
5018 |
10 Oct 18 |
nicklas |
helper.resolveOptions = function(aligned, filterType, singleAlignment) |
4975 |
21 Sep 18 |
nicklas |
1755 |
{ |
4975 |
21 Sep 18 |
nicklas |
var html = ''; |
5024 |
15 Oct 18 |
nicklas |
var idDoNotUse = 'donotuse.'+aligned.tmpId; |
5024 |
15 Oct 18 |
nicklas |
var cls = aligned.flagged && filterType != 'HET' ? 'required' : ''; |
5024 |
15 Oct 18 |
nicklas |
1759 |
|
5024 |
15 Oct 18 |
nicklas |
html += '<select id="'+idDoNotUse+'" name="'+idDoNotUse+'" class="donotuse-options '+cls+'">'; |
5024 |
15 Oct 18 |
nicklas |
html += '<option value=""> '; |
5024 |
15 Oct 18 |
nicklas |
if (filterType != 'QIACUBE' || singleAlignment) |
4975 |
21 Sep 18 |
nicklas |
1763 |
{ |
5024 |
15 Oct 18 |
nicklas |
html += '<option value="library">Library'; |
4975 |
21 Sep 18 |
nicklas |
1765 |
} |
5024 |
15 Oct 18 |
nicklas |
if (aligned.preNormalizedRna) |
4975 |
21 Sep 18 |
nicklas |
1767 |
{ |
5024 |
15 Oct 18 |
nicklas |
html += '<option value="prenormalized">PreNormalizedRNA'; |
4975 |
21 Sep 18 |
nicklas |
1769 |
} |
5024 |
15 Oct 18 |
nicklas |
html += '<option value="rna">RNA'; |
5024 |
15 Oct 18 |
nicklas |
html += '<option value="lysate">Lysate'; |
5024 |
15 Oct 18 |
nicklas |
html += '<option value="specimen">Specimen'; |
5024 |
15 Oct 18 |
nicklas |
html += '</select>'; |
4975 |
21 Sep 18 |
nicklas |
1774 |
|
4975 |
21 Sep 18 |
nicklas |
return html; |
4975 |
21 Sep 18 |
nicklas |
1776 |
} |
4981 |
25 Sep 18 |
nicklas |
1777 |
|
4981 |
25 Sep 18 |
nicklas |
helper.futureGtOptions = function(aligned, filterType) |
4981 |
25 Sep 18 |
nicklas |
1779 |
{ |
4981 |
25 Sep 18 |
nicklas |
var html = ''; |
5024 |
15 Oct 18 |
nicklas |
var idFutureGt = 'futuregt.'+aligned.tmpId; |
5024 |
15 Oct 18 |
nicklas |
html += '<input type="checkbox" id="'+idFutureGt+'" name="'+idFutureGt+'" disabled title="Check this to use the alignment in future genotype checks.">'; |
4981 |
25 Sep 18 |
nicklas |
return html; |
4981 |
25 Sep 18 |
nicklas |
1784 |
} |
4975 |
21 Sep 18 |
nicklas |
1785 |
|
4981 |
25 Sep 18 |
nicklas |
1786 |
|
4975 |
21 Sep 18 |
nicklas |
helper.resolveComment = function(aligned) |
4975 |
21 Sep 18 |
nicklas |
1788 |
{ |
4980 |
25 Sep 18 |
nicklas |
var html = ''; |
5024 |
15 Oct 18 |
nicklas |
var id = 'resolvecomment.'+aligned.tmpId; |
5024 |
15 Oct 18 |
nicklas |
html += '<input type="text" id="'+id+'" name="'+id+'" value="'+Strings.encodeTags(aligned.QC_GENOTYPE_COMMENT)+'">'; |
4975 |
21 Sep 18 |
nicklas |
return html; |
4975 |
21 Sep 18 |
nicklas |
1793 |
} |
4975 |
21 Sep 18 |
nicklas |
1794 |
|
4975 |
21 Sep 18 |
nicklas |
1795 |
|
4794 |
07 May 18 |
nicklas |
return helper; |
4794 |
07 May 18 |
nicklas |
1797 |
}(); |