3158 |
04 Mar 15 |
nicklas |
var Search = function() |
3158 |
04 Mar 15 |
nicklas |
2 |
{ |
3158 |
04 Mar 15 |
nicklas |
var search = {}; |
3158 |
04 Mar 15 |
nicklas |
var debug = 0; |
3158 |
04 Mar 15 |
nicklas |
5 |
|
3158 |
04 Mar 15 |
nicklas |
var flaggedRna; |
3158 |
04 Mar 15 |
nicklas |
7 |
|
3158 |
04 Mar 15 |
nicklas |
// Page initialization |
3158 |
04 Mar 15 |
nicklas |
search.initPage = function() |
3158 |
04 Mar 15 |
nicklas |
10 |
{ |
3158 |
04 Mar 15 |
nicklas |
// Step 1 |
6720 |
03 May 22 |
nicklas |
Events.addEventHandler('labelFilter', 'change', search.filterOnChange); |
3158 |
04 Mar 15 |
nicklas |
Events.addEventHandler('flagFilter', 'change', search.filterOnChange); |
3158 |
04 Mar 15 |
nicklas |
Events.addEventHandler('rnaOriginalFilter', 'change', search.filterOnChange); |
3158 |
04 Mar 15 |
nicklas |
Events.addEventHandler('rnaRemainFilter', 'change', search.filterOnChange); |
3158 |
04 Mar 15 |
nicklas |
Events.addEventHandler('rqsRinFilter', 'change', search.filterOnChange); |
3158 |
04 Mar 15 |
nicklas |
Events.addEventHandler('lysateRemainFilter', 'change', search.filterOnChange); |
3158 |
04 Mar 15 |
nicklas |
Events.addEventHandler('lysateUsedQuantityFilter', 'change', search.filterOnChange); |
3158 |
04 Mar 15 |
nicklas |
Events.addEventHandler('specimenRemainFilter', 'change', search.filterOnChange); |
3158 |
04 Mar 15 |
nicklas |
Events.addEventHandler('libExistsFilter', 'change', search.filterOnChange); |
3158 |
04 Mar 15 |
nicklas |
Events.addEventHandler('rawDataExistsFilter', 'change', search.filterOnChange); |
3158 |
04 Mar 15 |
nicklas |
22 |
|
3162 |
04 Mar 15 |
nicklas |
Buttons.addClickHandler('btnReExtractSpecimen', search.reExtractSpecimen); |
4086 |
07 Sep 16 |
nicklas |
Buttons.addClickHandler('btnReExtractLysate', search.reExtractLysate); |
3162 |
04 Mar 15 |
nicklas |
Buttons.addClickHandler('btnFlagSpecimen', search.flagSpecimen); |
3164 |
04 Mar 15 |
nicklas |
Buttons.addClickHandler('btnReProcessRna', search.reProcessRna); |
3162 |
04 Mar 15 |
nicklas |
Buttons.addClickHandler('btnUnflagRna', search.unflagRna); |
3165 |
05 Mar 15 |
nicklas |
Buttons.addClickHandler('btnNewBioMaterialList', search.newBioMaterialList); |
3158 |
04 Mar 15 |
nicklas |
Buttons.addClickHandler('check_uncheck', search.selectAll); |
3158 |
04 Mar 15 |
nicklas |
30 |
|
3158 |
04 Mar 15 |
nicklas |
// Navigation |
3158 |
04 Mar 15 |
nicklas |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
3158 |
04 Mar 15 |
nicklas |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
3158 |
04 Mar 15 |
nicklas |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
3158 |
04 Mar 15 |
nicklas |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
3158 |
04 Mar 15 |
nicklas |
36 |
|
3158 |
04 Mar 15 |
nicklas |
// Final registration |
3158 |
04 Mar 15 |
nicklas |
Events.addEventHandler('wizard', 'wizard-submit', search.submit); |
3158 |
04 Mar 15 |
nicklas |
39 |
|
3158 |
04 Mar 15 |
nicklas |
var url = '../FlaggedRna.servlet?ID='+App.getSessionId(); |
3158 |
04 Mar 15 |
nicklas |
url += '&cmd=LoadFlaggedRna'; |
3158 |
04 Mar 15 |
nicklas |
Wizard.showLoadingAnimation('Loading flagged RNA...'); |
3158 |
04 Mar 15 |
nicklas |
Wizard.asyncJsonRequest(url, search.onRnaLoaded); |
3158 |
04 Mar 15 |
nicklas |
44 |
} |
3158 |
04 Mar 15 |
nicklas |
45 |
|
3158 |
04 Mar 15 |
nicklas |
search.onRnaLoaded = function(response) |
3158 |
04 Mar 15 |
nicklas |
47 |
{ |
3158 |
04 Mar 15 |
nicklas |
flaggedRna = response.rna; |
3158 |
04 Mar 15 |
nicklas |
if (flaggedRna.length == 0) |
3158 |
04 Mar 15 |
nicklas |
50 |
{ |
3158 |
04 Mar 15 |
nicklas |
Wizard.setFatalError('No flagged RNA available for processing.'); |
3158 |
04 Mar 15 |
nicklas |
return; |
3158 |
04 Mar 15 |
nicklas |
53 |
} |
3158 |
04 Mar 15 |
nicklas |
var frm = document.forms['reggie']; |
3158 |
04 Mar 15 |
nicklas |
55 |
|
3767 |
23 Feb 16 |
nicklas |
var yellowImg = '<img src="../images/yellow-label.png">'; |
3158 |
04 Mar 15 |
nicklas |
var html = ''; |
3158 |
04 Mar 15 |
nicklas |
var usedFlags = []; |
3158 |
04 Mar 15 |
nicklas |
for (var rnaNo = 0; rnaNo < flaggedRna.length; rnaNo++) |
3158 |
04 Mar 15 |
nicklas |
60 |
{ |
3158 |
04 Mar 15 |
nicklas |
var rna = flaggedRna[rnaNo]; |
3158 |
04 Mar 15 |
nicklas |
rna.include = true; |
3158 |
04 Mar 15 |
nicklas |
if (rna.flag && usedFlags.indexOf(rna.flag) == -1) |
3158 |
04 Mar 15 |
nicklas |
64 |
{ |
3158 |
04 Mar 15 |
nicklas |
usedFlags[usedFlags.length] = rna.flag; |
3158 |
04 Mar 15 |
nicklas |
66 |
} |
3182 |
18 Mar 15 |
nicklas |
var qs = rna.rin || rna.rqs; |
3158 |
04 Mar 15 |
nicklas |
68 |
|
3767 |
23 Feb 16 |
nicklas |
var isYellow = rna.specimen && rna.specimen.YellowLabel != null; |
3767 |
23 Feb 16 |
nicklas |
var img = isYellow ? yellowImg : ''; |
3767 |
23 Feb 16 |
nicklas |
71 |
|
6116 |
05 Feb 21 |
nicklas |
var stringTieCount = search.countRawBioAssaysByType(rna.rawbioassays, 'variant.sequencing.stringtie'); |
6116 |
05 Feb 21 |
nicklas |
var cufflinksCount = search.countRawBioAssaysByType(rna.rawbioassays, 'cufflinks'); |
6116 |
05 Feb 21 |
nicklas |
var variantCallCount = search.countRawBioAssaysByType(rna.rawbioassays, 'variant.sequencing.variant-call'); |
6116 |
05 Feb 21 |
nicklas |
75 |
|
4995 |
02 Oct 18 |
nicklas |
html += '<tr class="highlight ' + (rnaNo % 2 == 0 ? 'oddrow' : 'evenrow') + (isYellow ? ' yellow-specimen' : '') + (rna.DO_NOT_USE ? ' donotuse' : '') + '" id="rna.'+rna.id + '">'; |
3158 |
04 Mar 15 |
nicklas |
html += '<td><span id="index.'+rna.id+'">'+(rnaNo+1)+'</span> <input type="checkbox" name="rna.'+rna.id+'">'; |
3158 |
04 Mar 15 |
nicklas |
html += '<img class="link case-summary" data-name="'+Strings.encodeTags(rna.name)+'" src="../images/case_summary.png"></td>'; |
4995 |
02 Oct 18 |
nicklas |
html += '<td class="iconcol-1">'+search.doNotUseWarning(rna)+'</td>'; |
6720 |
03 May 22 |
nicklas |
html += '<td class="dottedleft if-yellow">'+img+Strings.encodeTags(rna.name)+'</td>'; |
6720 |
03 May 22 |
nicklas |
html += '<td class="if-yellow">'+Strings.encodeTags(rna.label)+'</td>'; |
3158 |
04 Mar 15 |
nicklas |
html += '<td>'+Strings.encodeTags(rna.flag) + '</td>'; |
3182 |
18 Mar 15 |
nicklas |
html += '<td>'+Reggie.formatNumber(rna.originalQuantity, null, 2) + '</td>'; |
3182 |
18 Mar 15 |
nicklas |
html += '<td>'+Reggie.formatNumber(rna.remainingQuantity, null, 2) + '</td>'; |
3182 |
18 Mar 15 |
nicklas |
html += '<td>'+(qs == -100 ? '-100' : Reggie.formatNumber(qs, null, 2))+'</td>'; |
3158 |
04 Mar 15 |
nicklas |
86 |
|
3158 |
04 Mar 15 |
nicklas |
html += '<td class="dottedleft">'+Math.round(rna.lysate.remainingQuantity) + '</td>'; |
3158 |
04 Mar 15 |
nicklas |
html += '<td>'+Reggie.formatNumber(rna.lysate.usedQuantity/1000, null, 1) + '</td>'; |
3158 |
04 Mar 15 |
nicklas |
html += '<td class="dottedleft">'+Reggie.formatNumber(rna.specimen.remainingQuantity/1000, null, 1) + '</td>'; |
3158 |
04 Mar 15 |
nicklas |
html += '<td>'+Reggie.reformatDate(rna.specimen.registered)+'</td>'; |
3158 |
04 Mar 15 |
nicklas |
html += '<td class="dottedleft">'+(rna.libraries.length > 0 ? rna.libraries.length : '-')+'</td>'; |
6116 |
05 Feb 21 |
nicklas |
html += '<td class="dottedleft">'+(rna.rawbioassays.length > 0 ? stringTieCount +' / '+cufflinksCount+' / '+variantCallCount : '-')+'</td>'; |
3158 |
04 Mar 15 |
nicklas |
html += '</tr>'; |
3158 |
04 Mar 15 |
nicklas |
94 |
} |
3158 |
04 Mar 15 |
nicklas |
95 |
|
3158 |
04 Mar 15 |
nicklas |
usedFlags.sort(); |
3158 |
04 Mar 15 |
nicklas |
for (var flagNo = 0; flagNo < usedFlags.length; flagNo++) |
3158 |
04 Mar 15 |
nicklas |
98 |
{ |
3158 |
04 Mar 15 |
nicklas |
var flag = usedFlags[flagNo]; |
3158 |
04 Mar 15 |
nicklas |
frm.flagFilter[frm.flagFilter.length] = new Option(flag); |
3158 |
04 Mar 15 |
nicklas |
101 |
} |
3158 |
04 Mar 15 |
nicklas |
102 |
|
3158 |
04 Mar 15 |
nicklas |
Doc.element('rna-list').innerHTML = html; |
3158 |
04 Mar 15 |
nicklas |
Doc.element('num-matching').innerHTML = flaggedRna.length; |
3158 |
04 Mar 15 |
nicklas |
105 |
|
3158 |
04 Mar 15 |
nicklas |
Doc.show('step-1'); |
3158 |
04 Mar 15 |
nicklas |
107 |
|
3158 |
04 Mar 15 |
nicklas |
var cs = document.getElementsByClassName('case-summary'); |
3158 |
04 Mar 15 |
nicklas |
for (var i = 0; i < cs.length; i++) |
3158 |
04 Mar 15 |
nicklas |
110 |
{ |
5019 |
10 Oct 18 |
nicklas |
Events.addEventHandler(cs[i], 'click', Reggie.openCaseSummaryPopupOnEvent); |
3158 |
04 Mar 15 |
nicklas |
112 |
} |
3158 |
04 Mar 15 |
nicklas |
113 |
} |
3158 |
04 Mar 15 |
nicklas |
114 |
|
6116 |
05 Feb 21 |
nicklas |
search.countRawBioAssaysByType = function(rawbioassays, rawDataType) |
6116 |
05 Feb 21 |
nicklas |
116 |
{ |
6116 |
05 Feb 21 |
nicklas |
var count = 0; |
6116 |
05 Feb 21 |
nicklas |
for (var i = 0; i < rawbioassays.length; i++) |
6116 |
05 Feb 21 |
nicklas |
119 |
{ |
6116 |
05 Feb 21 |
nicklas |
if (rawbioassays[i].rawDataType == rawDataType) count++; |
6116 |
05 Feb 21 |
nicklas |
121 |
} |
6116 |
05 Feb 21 |
nicklas |
return count; |
6116 |
05 Feb 21 |
nicklas |
123 |
} |
6116 |
05 Feb 21 |
nicklas |
124 |
|
4995 |
02 Oct 18 |
nicklas |
search.doNotUseWarning = function(rna) |
4995 |
02 Oct 18 |
nicklas |
126 |
{ |
4995 |
02 Oct 18 |
nicklas |
var warning = ''; |
4995 |
02 Oct 18 |
nicklas |
if (rna && rna.DO_NOT_USE) |
4995 |
02 Oct 18 |
nicklas |
129 |
{ |
4995 |
02 Oct 18 |
nicklas |
warning += '<img src="../images/warning.png" title="DoNotUse-'+Strings.encodeTags(rna.DO_NOT_USE + ': ' + rna.DO_NOT_USE_COMMENT)+'">'; |
4995 |
02 Oct 18 |
nicklas |
131 |
} |
4995 |
02 Oct 18 |
nicklas |
return warning; |
4995 |
02 Oct 18 |
nicklas |
133 |
} |
4995 |
02 Oct 18 |
nicklas |
134 |
|
4995 |
02 Oct 18 |
nicklas |
135 |
|
3158 |
04 Mar 15 |
nicklas |
search.selectAll = function() |
3158 |
04 Mar 15 |
nicklas |
137 |
{ |
3158 |
04 Mar 15 |
nicklas |
var frm = document.forms['reggie']; |
3158 |
04 Mar 15 |
nicklas |
var firstChecked = null; |
3158 |
04 Mar 15 |
nicklas |
for (var rnaNo = 0; rnaNo < flaggedRna.length; rnaNo++) |
3158 |
04 Mar 15 |
nicklas |
141 |
{ |
3158 |
04 Mar 15 |
nicklas |
var rna = flaggedRna[rnaNo]; |
3158 |
04 Mar 15 |
nicklas |
if (rna.include) |
3158 |
04 Mar 15 |
nicklas |
144 |
{ |
3158 |
04 Mar 15 |
nicklas |
if (firstChecked == null) |
3158 |
04 Mar 15 |
nicklas |
146 |
{ |
3158 |
04 Mar 15 |
nicklas |
firstChecked = frm['rna.'+rna.id].checked; |
3158 |
04 Mar 15 |
nicklas |
148 |
} |
3158 |
04 Mar 15 |
nicklas |
frm['rna.'+rna.id].checked = !firstChecked; |
3158 |
04 Mar 15 |
nicklas |
150 |
} |
3158 |
04 Mar 15 |
nicklas |
151 |
} |
3158 |
04 Mar 15 |
nicklas |
152 |
} |
3158 |
04 Mar 15 |
nicklas |
153 |
|
3158 |
04 Mar 15 |
nicklas |
search.filterOnChange = function() |
3158 |
04 Mar 15 |
nicklas |
155 |
{ |
3158 |
04 Mar 15 |
nicklas |
var frm = document.forms['reggie']; |
3158 |
04 Mar 15 |
nicklas |
157 |
|
3158 |
04 Mar 15 |
nicklas |
var filter = new Filter(); |
3158 |
04 Mar 15 |
nicklas |
// RNA filters |
6720 |
03 May 22 |
nicklas |
filter.addTextCriteria(RnaProperty.LabelExists, frm.labelFilter.value); |
3158 |
04 Mar 15 |
nicklas |
filter.addTextCriteria(RnaProperty.Flag, frm.flagFilter.value); |
3158 |
04 Mar 15 |
nicklas |
filter.addNumericCriteria(RnaProperty.OriginalQuantity, frm.rnaOriginalFilter.value); |
3158 |
04 Mar 15 |
nicklas |
filter.addNumericCriteria(RnaProperty.RemainingQuantity, frm.rnaRemainFilter.value); |
3158 |
04 Mar 15 |
nicklas |
filter.addNumericCriteria(RnaProperty.RqsOrRin, frm.rqsRinFilter.value); |
3158 |
04 Mar 15 |
nicklas |
// Lysate filters |
3158 |
04 Mar 15 |
nicklas |
filter.addNumericCriteria(RnaProperty.LysateRemaining, frm.lysateRemainFilter.value); |
3158 |
04 Mar 15 |
nicklas |
filter.addNumericCriteria(RnaProperty.LysateUsedQuantity, frm.lysateUsedQuantityFilter.value, 1000); |
3158 |
04 Mar 15 |
nicklas |
// Specimen filters |
3158 |
04 Mar 15 |
nicklas |
filter.addNumericCriteria(RnaProperty.SpecimenRemaining, frm.specimenRemainFilter.value, 1000); |
3158 |
04 Mar 15 |
nicklas |
// Lib and raw data |
3158 |
04 Mar 15 |
nicklas |
filter.addNumericCriteria(RnaProperty.NumLibraries, frm.libExistsFilter.value); |
3158 |
04 Mar 15 |
nicklas |
filter.addNumericCriteria(RnaProperty.NumRawBioAssays, frm.rawDataExistsFilter.value); |
3158 |
04 Mar 15 |
nicklas |
173 |
|
3158 |
04 Mar 15 |
nicklas |
var index = 0; |
3158 |
04 Mar 15 |
nicklas |
for (var rnaNo = 0; rnaNo < flaggedRna.length; rnaNo++) |
3158 |
04 Mar 15 |
nicklas |
176 |
{ |
3158 |
04 Mar 15 |
nicklas |
var rna = flaggedRna[rnaNo]; |
3158 |
04 Mar 15 |
nicklas |
178 |
|
3158 |
04 Mar 15 |
nicklas |
rna.include = filter.check(rna); |
3158 |
04 Mar 15 |
nicklas |
if (rna.include) |
3158 |
04 Mar 15 |
nicklas |
181 |
{ |
3158 |
04 Mar 15 |
nicklas |
index++; |
3158 |
04 Mar 15 |
nicklas |
var evenRow = index % 2 == 0; |
3158 |
04 Mar 15 |
nicklas |
var tr = Doc.element('rna.'+rna.id); |
3158 |
04 Mar 15 |
nicklas |
Doc.addOrRemoveClass(tr, 'oddrow', !evenRow); |
3158 |
04 Mar 15 |
nicklas |
Doc.addOrRemoveClass(tr, 'evenrow', evenRow); |
3158 |
04 Mar 15 |
nicklas |
Doc.element('index.'+rna.id).innerHTML = index; |
3158 |
04 Mar 15 |
nicklas |
Doc.show(tr); |
3158 |
04 Mar 15 |
nicklas |
189 |
} |
3158 |
04 Mar 15 |
nicklas |
else |
3158 |
04 Mar 15 |
nicklas |
191 |
{ |
3158 |
04 Mar 15 |
nicklas |
Doc.hide('rna.'+rna.id); |
3158 |
04 Mar 15 |
nicklas |
193 |
} |
3158 |
04 Mar 15 |
nicklas |
194 |
} |
3158 |
04 Mar 15 |
nicklas |
195 |
|
3158 |
04 Mar 15 |
nicklas |
Doc.element('num-matching').innerHTML = index; |
3158 |
04 Mar 15 |
nicklas |
197 |
} |
3158 |
04 Mar 15 |
nicklas |
198 |
|
3165 |
05 Mar 15 |
nicklas |
search.checkSelected = function(noNotification) |
3158 |
04 Mar 15 |
nicklas |
200 |
{ |
3158 |
04 Mar 15 |
nicklas |
var frm = document.forms['reggie']; |
3158 |
04 Mar 15 |
nicklas |
var selected = []; |
3158 |
04 Mar 15 |
nicklas |
203 |
|
3158 |
04 Mar 15 |
nicklas |
for (var rnaNo = 0; rnaNo < flaggedRna.length; rnaNo++) |
3158 |
04 Mar 15 |
nicklas |
205 |
{ |
3158 |
04 Mar 15 |
nicklas |
var rna = flaggedRna[rnaNo]; |
3158 |
04 Mar 15 |
nicklas |
if (rna.include && frm['rna.'+rna.id].checked) |
3158 |
04 Mar 15 |
nicklas |
208 |
{ |
3158 |
04 Mar 15 |
nicklas |
selected[selected.length] = rna.id; |
3158 |
04 Mar 15 |
nicklas |
210 |
} |
3158 |
04 Mar 15 |
nicklas |
211 |
} |
3158 |
04 Mar 15 |
nicklas |
212 |
|
3165 |
05 Mar 15 |
nicklas |
if (selected.length == 0 && !noNotification) |
3158 |
04 Mar 15 |
nicklas |
214 |
{ |
3158 |
04 Mar 15 |
nicklas |
Forms.showNotification('check_uncheck', 'Please select at least one RNA from the list', null, 'pointer-below'); |
3158 |
04 Mar 15 |
nicklas |
216 |
} |
3158 |
04 Mar 15 |
nicklas |
217 |
|
3158 |
04 Mar 15 |
nicklas |
return selected; |
3158 |
04 Mar 15 |
nicklas |
219 |
} |
3158 |
04 Mar 15 |
nicklas |
220 |
|
3162 |
04 Mar 15 |
nicklas |
search.reExtractSpecimen = function() |
3158 |
04 Mar 15 |
nicklas |
222 |
{ |
3158 |
04 Mar 15 |
nicklas |
var frm = document.forms['reggie']; |
3158 |
04 Mar 15 |
nicklas |
var selected = search.checkSelected(); |
3158 |
04 Mar 15 |
nicklas |
if (selected.length == 0) return; |
3158 |
04 Mar 15 |
nicklas |
226 |
|
3158 |
04 Mar 15 |
nicklas |
if (!confirm('This will remove ' + selected.length + ' RNA items from this list and schedule re-extraction from specimen.\n\nContinue?')) |
3158 |
04 Mar 15 |
nicklas |
228 |
{ |
3158 |
04 Mar 15 |
nicklas |
return; |
3158 |
04 Mar 15 |
nicklas |
230 |
} |
3158 |
04 Mar 15 |
nicklas |
231 |
|
3158 |
04 Mar 15 |
nicklas |
submitInfo = {}; |
3158 |
04 Mar 15 |
nicklas |
submitInfo.rna = selected; |
3158 |
04 Mar 15 |
nicklas |
234 |
|
3158 |
04 Mar 15 |
nicklas |
submitUrl = '../FlaggedRna.servlet?ID='+App.getSessionId(); |
3158 |
04 Mar 15 |
nicklas |
submitUrl += '&cmd=ReExtractFromSpecimen'; |
4086 |
07 Sep 16 |
nicklas |
Wizard.showLoadingAnimation('Registering selected RNA for re-extraction from specimen...'); |
3158 |
04 Mar 15 |
nicklas |
Wizard.goRegister(); |
3158 |
04 Mar 15 |
nicklas |
239 |
} |
3158 |
04 Mar 15 |
nicklas |
240 |
|
4086 |
07 Sep 16 |
nicklas |
search.reExtractLysate = function() |
4086 |
07 Sep 16 |
nicklas |
242 |
{ |
4086 |
07 Sep 16 |
nicklas |
var frm = document.forms['reggie']; |
4086 |
07 Sep 16 |
nicklas |
var selected = search.checkSelected(); |
4086 |
07 Sep 16 |
nicklas |
if (selected.length == 0) return; |
4086 |
07 Sep 16 |
nicklas |
246 |
|
4086 |
07 Sep 16 |
nicklas |
if (!confirm('This will remove ' + selected.length + ' RNA items from this list and schedule re-extraction from lysate.\n\nContinue?')) |
4086 |
07 Sep 16 |
nicklas |
248 |
{ |
4086 |
07 Sep 16 |
nicklas |
return; |
4086 |
07 Sep 16 |
nicklas |
250 |
} |
4086 |
07 Sep 16 |
nicklas |
251 |
|
4086 |
07 Sep 16 |
nicklas |
submitInfo = {}; |
4086 |
07 Sep 16 |
nicklas |
submitInfo.rna = selected; |
4086 |
07 Sep 16 |
nicklas |
254 |
|
4086 |
07 Sep 16 |
nicklas |
submitUrl = '../FlaggedRna.servlet?ID='+App.getSessionId(); |
4086 |
07 Sep 16 |
nicklas |
submitUrl += '&cmd=ReExtractFromLysate'; |
4086 |
07 Sep 16 |
nicklas |
Wizard.showLoadingAnimation('Registering selected RNA for re-extraction from lysate...'); |
4086 |
07 Sep 16 |
nicklas |
Wizard.goRegister(); |
4086 |
07 Sep 16 |
nicklas |
259 |
} |
4086 |
07 Sep 16 |
nicklas |
260 |
|
4086 |
07 Sep 16 |
nicklas |
261 |
|
3162 |
04 Mar 15 |
nicklas |
search.flagSpecimen = function() |
3161 |
04 Mar 15 |
nicklas |
263 |
{ |
3161 |
04 Mar 15 |
nicklas |
var frm = document.forms['reggie']; |
3161 |
04 Mar 15 |
nicklas |
var selected = search.checkSelected(); |
3161 |
04 Mar 15 |
nicklas |
if (selected.length == 0) return; |
3161 |
04 Mar 15 |
nicklas |
267 |
|
3162 |
04 Mar 15 |
nicklas |
if (!confirm('This will remove ' + selected.length + ' RNA items from this list and flag the specimen instead.\n\nContinue?')) |
3162 |
04 Mar 15 |
nicklas |
269 |
{ |
3162 |
04 Mar 15 |
nicklas |
return; |
3162 |
04 Mar 15 |
nicklas |
271 |
} |
3162 |
04 Mar 15 |
nicklas |
272 |
|
3162 |
04 Mar 15 |
nicklas |
submitInfo = {}; |
3162 |
04 Mar 15 |
nicklas |
submitInfo.rna = selected; |
3162 |
04 Mar 15 |
nicklas |
275 |
|
3162 |
04 Mar 15 |
nicklas |
submitUrl = '../FlaggedRna.servlet?ID='+App.getSessionId(); |
3162 |
04 Mar 15 |
nicklas |
submitUrl += '&cmd=FlagSpecimen'; |
3162 |
04 Mar 15 |
nicklas |
Wizard.showLoadingAnimation('Flagging specimen for the selected RNA...'); |
3162 |
04 Mar 15 |
nicklas |
Wizard.goRegister(); |
3162 |
04 Mar 15 |
nicklas |
280 |
} |
3162 |
04 Mar 15 |
nicklas |
281 |
|
3164 |
04 Mar 15 |
nicklas |
search.reProcessRna = function() |
3164 |
04 Mar 15 |
nicklas |
283 |
{ |
3164 |
04 Mar 15 |
nicklas |
var frm = document.forms['reggie']; |
3164 |
04 Mar 15 |
nicklas |
var selected = search.checkSelected(); |
3164 |
04 Mar 15 |
nicklas |
if (selected.length == 0) return; |
3164 |
04 Mar 15 |
nicklas |
287 |
|
3164 |
04 Mar 15 |
nicklas |
if (!confirm('This will schedule ' + selected.length + ' RNA items for library preparation.\n\nContinue?')) |
3164 |
04 Mar 15 |
nicklas |
289 |
{ |
3164 |
04 Mar 15 |
nicklas |
return; |
3164 |
04 Mar 15 |
nicklas |
291 |
} |
3164 |
04 Mar 15 |
nicklas |
292 |
|
3164 |
04 Mar 15 |
nicklas |
submitInfo = {}; |
3164 |
04 Mar 15 |
nicklas |
submitInfo.rna = selected; |
3164 |
04 Mar 15 |
nicklas |
295 |
|
3164 |
04 Mar 15 |
nicklas |
submitUrl = '../FlaggedRna.servlet?ID='+App.getSessionId(); |
3164 |
04 Mar 15 |
nicklas |
submitUrl += '&cmd=ReProcessRna'; |
3164 |
04 Mar 15 |
nicklas |
Wizard.showLoadingAnimation('Registering selected RNA for new library preparation...'); |
3164 |
04 Mar 15 |
nicklas |
Wizard.goRegister(); |
3164 |
04 Mar 15 |
nicklas |
300 |
} |
3164 |
04 Mar 15 |
nicklas |
301 |
|
3162 |
04 Mar 15 |
nicklas |
search.unflagRna = function() |
3162 |
04 Mar 15 |
nicklas |
303 |
{ |
3162 |
04 Mar 15 |
nicklas |
var frm = document.forms['reggie']; |
3162 |
04 Mar 15 |
nicklas |
var selected = search.checkSelected(); |
3162 |
04 Mar 15 |
nicklas |
if (selected.length == 0) return; |
3162 |
04 Mar 15 |
nicklas |
307 |
|
3161 |
04 Mar 15 |
nicklas |
if (!confirm('This will remove ' + selected.length + ' RNA items from this list and reset their flags.\n\nContinue?')) |
3161 |
04 Mar 15 |
nicklas |
309 |
{ |
3161 |
04 Mar 15 |
nicklas |
return; |
3161 |
04 Mar 15 |
nicklas |
311 |
} |
3161 |
04 Mar 15 |
nicklas |
312 |
|
3161 |
04 Mar 15 |
nicklas |
submitInfo = {}; |
3161 |
04 Mar 15 |
nicklas |
submitInfo.rna = selected; |
3161 |
04 Mar 15 |
nicklas |
315 |
|
3161 |
04 Mar 15 |
nicklas |
submitUrl = '../FlaggedRna.servlet?ID='+App.getSessionId(); |
3162 |
04 Mar 15 |
nicklas |
submitUrl += '&cmd=UnflagRna'; |
3161 |
04 Mar 15 |
nicklas |
Wizard.showLoadingAnimation('Unflagging selected RNA...'); |
3161 |
04 Mar 15 |
nicklas |
Wizard.goRegister(); |
3161 |
04 Mar 15 |
nicklas |
320 |
} |
3165 |
05 Mar 15 |
nicklas |
321 |
|
3165 |
05 Mar 15 |
nicklas |
search.newBioMaterialList = function() |
3165 |
05 Mar 15 |
nicklas |
323 |
{ |
3165 |
05 Mar 15 |
nicklas |
var frm = document.forms['reggie']; |
3165 |
05 Mar 15 |
nicklas |
var selected = search.checkSelected(); |
3165 |
05 Mar 15 |
nicklas |
if (selected.length == 0) return; |
3161 |
04 Mar 15 |
nicklas |
327 |
|
3165 |
05 Mar 15 |
nicklas |
var url = 'new_list.jsp?ID='+App.getSessionId(); |
3165 |
05 Mar 15 |
nicklas |
Dialogs.openPopup(url, 'NewBioMaterialList', 600, 400); |
3165 |
05 Mar 15 |
nicklas |
330 |
} |
3165 |
05 Mar 15 |
nicklas |
331 |
|
3158 |
04 Mar 15 |
nicklas |
var submitInfo; |
3158 |
04 Mar 15 |
nicklas |
var submitUrl; |
3158 |
04 Mar 15 |
nicklas |
334 |
|
3158 |
04 Mar 15 |
nicklas |
search.submit = function() |
3158 |
04 Mar 15 |
nicklas |
336 |
{ |
3158 |
04 Mar 15 |
nicklas |
Wizard.asyncJsonRequest(submitUrl, search.submissionResults, 'POST', JSON.stringify(submitInfo)); |
3158 |
04 Mar 15 |
nicklas |
338 |
} |
3158 |
04 Mar 15 |
nicklas |
339 |
|
3158 |
04 Mar 15 |
nicklas |
search.submissionResults = function(response) |
3158 |
04 Mar 15 |
nicklas |
341 |
{ |
3158 |
04 Mar 15 |
nicklas |
Wizard.showFinalMessage(response.messages); |
3158 |
04 Mar 15 |
nicklas |
Doc.show('gorestart'); |
3158 |
04 Mar 15 |
nicklas |
344 |
} |
3158 |
04 Mar 15 |
nicklas |
345 |
|
3158 |
04 Mar 15 |
nicklas |
return search; |
3158 |
04 Mar 15 |
nicklas |
347 |
}(); |
3158 |
04 Mar 15 |
nicklas |
348 |
|
3158 |
04 Mar 15 |
nicklas |
Doc.onLoad(Search.initPage); |
3158 |
04 Mar 15 |
nicklas |
350 |
|
3158 |
04 Mar 15 |
nicklas |
351 |
|
3158 |
04 Mar 15 |
nicklas |
352 |
/** |
3158 |
04 Mar 15 |
nicklas |
Holds one or more filter criterias. Use the 'add*' methods |
3158 |
04 Mar 15 |
nicklas |
to add criterias to the filter, and the 'check(rna)' method |
3158 |
04 Mar 15 |
nicklas |
to evaluate all criterias against a single RNA item. |
3158 |
04 Mar 15 |
nicklas |
356 |
*/ |
3158 |
04 Mar 15 |
nicklas |
var Filter = function() |
3158 |
04 Mar 15 |
nicklas |
358 |
{ |
3158 |
04 Mar 15 |
nicklas |
this.criterias = []; |
3158 |
04 Mar 15 |
nicklas |
360 |
} |
3158 |
04 Mar 15 |
nicklas |
361 |
|
3158 |
04 Mar 15 |
nicklas |
362 |
/** |
3158 |
04 Mar 15 |
nicklas |
Adds a text criteria comparing the given RNA property to |
3158 |
04 Mar 15 |
nicklas |
a static value (f2). |
3158 |
04 Mar 15 |
nicklas |
365 |
*/ |
3158 |
04 Mar 15 |
nicklas |
Filter.prototype.addTextCriteria = function(rnaProp, f2) |
3158 |
04 Mar 15 |
nicklas |
367 |
{ |
3158 |
04 Mar 15 |
nicklas |
if (f2 != '') |
3158 |
04 Mar 15 |
nicklas |
369 |
{ |
3158 |
04 Mar 15 |
nicklas |
this.criterias[this.criterias.length] = function(rna) { return Comparator.eq(rnaProp(rna), f2) }; |
3158 |
04 Mar 15 |
nicklas |
371 |
} |
3158 |
04 Mar 15 |
nicklas |
372 |
} |
3158 |
04 Mar 15 |
nicklas |
373 |
|
3158 |
04 Mar 15 |
nicklas |
374 |
/** |
3158 |
04 Mar 15 |
nicklas |
Adds a numeric criteria comparing the given RNA property to |
3158 |
04 Mar 15 |
nicklas |
a static value (f2). The 'f2' value may start with either '<' or '>' |
3158 |
04 Mar 15 |
nicklas |
to compare with less than/greater than operators, otherwise |
3158 |
04 Mar 15 |
nicklas |
it will use the 'approximately equals' operator. |
3158 |
04 Mar 15 |
nicklas |
379 |
*/ |
3158 |
04 Mar 15 |
nicklas |
Filter.prototype.addNumericCriteria = function(rnaProp, f2, factor) |
3158 |
04 Mar 15 |
nicklas |
381 |
{ |
3158 |
04 Mar 15 |
nicklas |
if (f2 != '') |
3158 |
04 Mar 15 |
nicklas |
383 |
{ |
3158 |
04 Mar 15 |
nicklas |
var firstChar = f2.charAt(0); |
3158 |
04 Mar 15 |
nicklas |
if (!firstChar.match(/[\d\-]/)) f2 = f2.substring(1); |
3158 |
04 Mar 15 |
nicklas |
386 |
|
3158 |
04 Mar 15 |
nicklas |
var cmp = Comparator.get(firstChar, Comparator.approx); |
3158 |
04 Mar 15 |
nicklas |
var limit = parseFloat(f2); |
3158 |
04 Mar 15 |
nicklas |
if (factor) limit *= factor; |
3158 |
04 Mar 15 |
nicklas |
390 |
|
3158 |
04 Mar 15 |
nicklas |
this.criterias[this.criterias.length] = function(rna) { return cmp(rnaProp(rna), limit) }; |
3158 |
04 Mar 15 |
nicklas |
392 |
} |
3158 |
04 Mar 15 |
nicklas |
393 |
} |
3158 |
04 Mar 15 |
nicklas |
394 |
|
3158 |
04 Mar 15 |
nicklas |
395 |
/** |
3158 |
04 Mar 15 |
nicklas |
Evaluate all criterias. Return true if all pass, false otherwise. |
3158 |
04 Mar 15 |
nicklas |
397 |
*/ |
3158 |
04 Mar 15 |
nicklas |
Filter.prototype.check = function(rna) |
3158 |
04 Mar 15 |
nicklas |
399 |
{ |
3158 |
04 Mar 15 |
nicklas |
for (var i = 0; i < this.criterias.length; i++) |
3158 |
04 Mar 15 |
nicklas |
401 |
{ |
3158 |
04 Mar 15 |
nicklas |
if (!this.criterias[i](rna)) return false; |
3158 |
04 Mar 15 |
nicklas |
403 |
} |
3158 |
04 Mar 15 |
nicklas |
return true; |
3158 |
04 Mar 15 |
nicklas |
405 |
} |
3158 |
04 Mar 15 |
nicklas |
406 |
|
3158 |
04 Mar 15 |
nicklas |
407 |
/** |
3158 |
04 Mar 15 |
nicklas |
Functions for extracting various properties from |
3158 |
04 Mar 15 |
nicklas |
RNA items. Each method accepts a single RNA as a parameter |
3158 |
04 Mar 15 |
nicklas |
and return a value from the RNA item. The methods |
3158 |
04 Mar 15 |
nicklas |
are used as parameters to Filter.add*Criteria() methods. |
3158 |
04 Mar 15 |
nicklas |
412 |
*/ |
3158 |
04 Mar 15 |
nicklas |
var RnaProperty = function() |
3158 |
04 Mar 15 |
nicklas |
414 |
{ |
3158 |
04 Mar 15 |
nicklas |
var p = {}; |
3158 |
04 Mar 15 |
nicklas |
416 |
|
6720 |
03 May 22 |
nicklas |
// Get "1" if a rna.label exists, or "0" if not |
6720 |
03 May 22 |
nicklas |
p.LabelExists = function(rna) |
6720 |
03 May 22 |
nicklas |
419 |
{ |
6720 |
03 May 22 |
nicklas |
return rna.label ? '1' : '0'; |
6720 |
03 May 22 |
nicklas |
421 |
} |
6720 |
03 May 22 |
nicklas |
422 |
|
3158 |
04 Mar 15 |
nicklas |
// Get the rna.flag value |
3158 |
04 Mar 15 |
nicklas |
p.Flag = function(rna) |
3158 |
04 Mar 15 |
nicklas |
425 |
{ |
3158 |
04 Mar 15 |
nicklas |
return rna.flag; |
3158 |
04 Mar 15 |
nicklas |
427 |
} |
3158 |
04 Mar 15 |
nicklas |
428 |
|
3158 |
04 Mar 15 |
nicklas |
// Get the rna.originalQuantity value |
3158 |
04 Mar 15 |
nicklas |
p.OriginalQuantity = function(rna) |
3158 |
04 Mar 15 |
nicklas |
431 |
{ |
3158 |
04 Mar 15 |
nicklas |
return rna.originalQuantity; |
3158 |
04 Mar 15 |
nicklas |
433 |
} |
3158 |
04 Mar 15 |
nicklas |
434 |
|
3158 |
04 Mar 15 |
nicklas |
// Get the rna.remainingQuantity value |
3158 |
04 Mar 15 |
nicklas |
p.RemainingQuantity = function(rna) |
3158 |
04 Mar 15 |
nicklas |
437 |
{ |
3158 |
04 Mar 15 |
nicklas |
return rna.remainingQuantity; |
3158 |
04 Mar 15 |
nicklas |
439 |
} |
3158 |
04 Mar 15 |
nicklas |
440 |
|
3158 |
04 Mar 15 |
nicklas |
// Get the rna.rqs or rna.rin value |
3158 |
04 Mar 15 |
nicklas |
p.RqsOrRin = function(rna) |
3158 |
04 Mar 15 |
nicklas |
443 |
{ |
3158 |
04 Mar 15 |
nicklas |
return rna.rqs || rna.rin; |
3158 |
04 Mar 15 |
nicklas |
445 |
} |
3158 |
04 Mar 15 |
nicklas |
446 |
|
3158 |
04 Mar 15 |
nicklas |
// Get the rna.lysate.remainingQuantity |
3158 |
04 Mar 15 |
nicklas |
p.LysateRemaining = function(rna) |
3158 |
04 Mar 15 |
nicklas |
449 |
{ |
3158 |
04 Mar 15 |
nicklas |
return rna.lysate.remainingQuantity; |
3158 |
04 Mar 15 |
nicklas |
451 |
} |
3158 |
04 Mar 15 |
nicklas |
452 |
|
3158 |
04 Mar 15 |
nicklas |
// Get the rna.lysate.usedQuantity |
3158 |
04 Mar 15 |
nicklas |
p.LysateUsedQuantity = function(rna) |
3158 |
04 Mar 15 |
nicklas |
455 |
{ |
3158 |
04 Mar 15 |
nicklas |
return rna.lysate.usedQuantity; |
3158 |
04 Mar 15 |
nicklas |
457 |
} |
3158 |
04 Mar 15 |
nicklas |
458 |
|
3158 |
04 Mar 15 |
nicklas |
// Get the rna.specimen.remainingQuantity |
3158 |
04 Mar 15 |
nicklas |
p.SpecimenRemaining = function(rna) |
3158 |
04 Mar 15 |
nicklas |
461 |
{ |
3158 |
04 Mar 15 |
nicklas |
return rna.specimen.remainingQuantity; |
3158 |
04 Mar 15 |
nicklas |
463 |
} |
3158 |
04 Mar 15 |
nicklas |
464 |
|
3158 |
04 Mar 15 |
nicklas |
// Get the number of rna.libraries |
3158 |
04 Mar 15 |
nicklas |
p.NumLibraries = function(rna) |
3158 |
04 Mar 15 |
nicklas |
467 |
{ |
3158 |
04 Mar 15 |
nicklas |
return rna.libraries.length; |
3158 |
04 Mar 15 |
nicklas |
469 |
} |
3158 |
04 Mar 15 |
nicklas |
470 |
|
3158 |
04 Mar 15 |
nicklas |
// Get the number of rna.rawbioassays |
3158 |
04 Mar 15 |
nicklas |
p.NumRawBioAssays = function(rna) |
3158 |
04 Mar 15 |
nicklas |
473 |
{ |
3158 |
04 Mar 15 |
nicklas |
return rna.rawbioassays.length; |
3158 |
04 Mar 15 |
nicklas |
475 |
} |
3158 |
04 Mar 15 |
nicklas |
476 |
|
3158 |
04 Mar 15 |
nicklas |
return p; |
3158 |
04 Mar 15 |
nicklas |
478 |
}(); |
3158 |
04 Mar 15 |
nicklas |
479 |
|
3158 |
04 Mar 15 |
nicklas |
480 |
/** |
3158 |
04 Mar 15 |
nicklas |
Comparator functions for comparing two values. |
3158 |
04 Mar 15 |
nicklas |
482 |
*/ |
3158 |
04 Mar 15 |
nicklas |
var Comparator = function() |
3158 |
04 Mar 15 |
nicklas |
484 |
{ |
3158 |
04 Mar 15 |
nicklas |
var cmp = {}; |
3158 |
04 Mar 15 |
nicklas |
486 |
|
3158 |
04 Mar 15 |
nicklas |
487 |
/** |
3158 |
04 Mar 15 |
nicklas |
Return a comparator based on the symbol |
3158 |
04 Mar 15 |
nicklas |
which can be either '>' or '<' to return |
3158 |
04 Mar 15 |
nicklas |
Comparator.gt or Comparator.lt. Otherwise |
3158 |
04 Mar 15 |
nicklas |
the given default or Comparator.eq is returned. |
3158 |
04 Mar 15 |
nicklas |
492 |
*/ |
3158 |
04 Mar 15 |
nicklas |
cmp.get = function(symbol, defaultCmp) |
3158 |
04 Mar 15 |
nicklas |
494 |
{ |
3158 |
04 Mar 15 |
nicklas |
var c; |
3158 |
04 Mar 15 |
nicklas |
if (symbol == '<') |
3158 |
04 Mar 15 |
nicklas |
497 |
{ |
3158 |
04 Mar 15 |
nicklas |
c = cmp.lt; |
3158 |
04 Mar 15 |
nicklas |
499 |
} |
3158 |
04 Mar 15 |
nicklas |
else if (symbol == '>') |
3158 |
04 Mar 15 |
nicklas |
501 |
{ |
3158 |
04 Mar 15 |
nicklas |
c = cmp.gt; |
3158 |
04 Mar 15 |
nicklas |
503 |
} |
3158 |
04 Mar 15 |
nicklas |
else |
3158 |
04 Mar 15 |
nicklas |
505 |
{ |
3158 |
04 Mar 15 |
nicklas |
c = defaultCmp || cmp.eq; |
3158 |
04 Mar 15 |
nicklas |
507 |
} |
3158 |
04 Mar 15 |
nicklas |
return c; |
3158 |
04 Mar 15 |
nicklas |
509 |
} |
3158 |
04 Mar 15 |
nicklas |
510 |
|
3158 |
04 Mar 15 |
nicklas |
// Compare if two values are equal |
3158 |
04 Mar 15 |
nicklas |
cmp.eq = function(v1, v2) |
3158 |
04 Mar 15 |
nicklas |
513 |
{ |
3158 |
04 Mar 15 |
nicklas |
return v1 == v2; |
3158 |
04 Mar 15 |
nicklas |
515 |
} |
3158 |
04 Mar 15 |
nicklas |
516 |
|
3158 |
04 Mar 15 |
nicklas |
// Compare if two values are appoximately equals (difference is not more than 0.05) |
3158 |
04 Mar 15 |
nicklas |
cmp.approx = function(v1, v2) |
3158 |
04 Mar 15 |
nicklas |
519 |
{ |
3158 |
04 Mar 15 |
nicklas |
return Math.abs(v2 - v1) < 0.05; |
3158 |
04 Mar 15 |
nicklas |
521 |
} |
3158 |
04 Mar 15 |
nicklas |
522 |
|
3158 |
04 Mar 15 |
nicklas |
// Compare if v1 is greater than or equal to v2 |
3158 |
04 Mar 15 |
nicklas |
cmp.gt = function(v1, v2) |
3158 |
04 Mar 15 |
nicklas |
525 |
{ |
3158 |
04 Mar 15 |
nicklas |
return v1 >= v2; |
3158 |
04 Mar 15 |
nicklas |
527 |
} |
3158 |
04 Mar 15 |
nicklas |
528 |
|
3158 |
04 Mar 15 |
nicklas |
// Compare if v1 is less than or equal to v2 |
3158 |
04 Mar 15 |
nicklas |
cmp.lt = function(v1, v2) |
3158 |
04 Mar 15 |
nicklas |
531 |
{ |
3158 |
04 Mar 15 |
nicklas |
return v1 <= v2; |
3158 |
04 Mar 15 |
nicklas |
533 |
} |
3158 |
04 Mar 15 |
nicklas |
534 |
|
3158 |
04 Mar 15 |
nicklas |
return cmp; |
3158 |
04 Mar 15 |
nicklas |
536 |
}(); |
3158 |
04 Mar 15 |
nicklas |
537 |
|