3832 |
07 Apr 16 |
nicklas |
var MINIMAL_RNA_VOLUME = 1.0; // µl |
3832 |
07 Apr 16 |
nicklas |
// Default initial volumes (can be overridden by protocols) |
3832 |
07 Apr 16 |
nicklas |
var TOTAL_VOLUME = 50; // µl |
3832 |
07 Apr 16 |
nicklas |
var QUANTITY_REGULAR = 0.5; // µg |
3832 |
07 Apr 16 |
nicklas |
var QUANTITY_QC = 0.6; // µg |
3832 |
07 Apr 16 |
nicklas |
var QUANTITY_MINIMAL = QUANTITY_REGULAR; |
3832 |
07 Apr 16 |
nicklas |
7 |
|
3832 |
07 Apr 16 |
nicklas |
8 |
|
2803 |
14 Oct 14 |
nicklas |
var SelectRna = function() |
2803 |
14 Oct 14 |
nicklas |
10 |
{ |
2803 |
14 Oct 14 |
nicklas |
var selectrna = {}; |
5881 |
25 Mar 20 |
nicklas |
var plateType = 'MRNA'; |
3645 |
03 Dec 15 |
nicklas |
var autoDesign = 0; |
3832 |
07 Apr 16 |
nicklas |
var hasInitProtocols = false; |
2803 |
14 Oct 14 |
nicklas |
15 |
|
2803 |
14 Oct 14 |
nicklas |
var EXTERNAL_RNA_NAME = 'External.r'; |
2853 |
23 Oct 14 |
nicklas |
var debug = 0; |
2803 |
14 Oct 14 |
nicklas |
18 |
|
2803 |
14 Oct 14 |
nicklas |
var graphics; |
2803 |
14 Oct 14 |
nicklas |
var pen; |
2803 |
14 Oct 14 |
nicklas |
21 |
|
2803 |
14 Oct 14 |
nicklas |
var subtypeRna; |
5884 |
27 Mar 20 |
nicklas |
var subtypeRnaNormalized; |
5884 |
27 Mar 20 |
nicklas |
24 |
|
5884 |
27 Mar 20 |
nicklas |
var plateDefault; |
5884 |
27 Mar 20 |
nicklas |
var plateDefaults = { |
5884 |
27 Mar 20 |
nicklas |
'MRNA': |
5884 |
27 Mar 20 |
nicklas |
28 |
{ |
5884 |
27 Mar 20 |
nicklas |
'poolSchemaType': 'manual', |
5884 |
27 Mar 20 |
nicklas |
'poolSchema': '1by24offset' |
5884 |
27 Mar 20 |
nicklas |
31 |
}, |
5884 |
27 Mar 20 |
nicklas |
'EXTERNAL_LIBRARY': |
5884 |
27 Mar 20 |
nicklas |
33 |
{ |
5884 |
27 Mar 20 |
nicklas |
'poolSchemaType': 'external', |
5884 |
27 Mar 20 |
nicklas |
'poolSchema': 'external32' |
5884 |
27 Mar 20 |
nicklas |
36 |
} |
5884 |
27 Mar 20 |
nicklas |
37 |
}; |
2803 |
14 Oct 14 |
nicklas |
38 |
|
2803 |
14 Oct 14 |
nicklas |
// Page initialization |
2803 |
14 Oct 14 |
nicklas |
selectrna.initPage = function() |
2803 |
14 Oct 14 |
nicklas |
41 |
{ |
3645 |
03 Dec 15 |
nicklas |
autoDesign = Data.int('page-data', 'auto-design'); |
5881 |
25 Mar 20 |
nicklas |
plateType = Data.get('page-data', 'plate-type'); |
5884 |
27 Mar 20 |
nicklas |
plateDefault = plateDefaults[plateType] || plateDefaults['MRNA']; |
3645 |
03 Dec 15 |
nicklas |
45 |
|
2803 |
14 Oct 14 |
nicklas |
// Step 1 |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('step-1', 'wizard-validate', selectrna.validateStep1); |
2803 |
14 Oct 14 |
nicklas |
48 |
|
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('pool_schema', 'change', selectrna.poolSchemaOnChange); |
3832 |
07 Apr 16 |
nicklas |
Events.addEventHandler('normalizationProtocol', 'change', selectrna.protocolOnChange); |
2803 |
14 Oct 14 |
nicklas |
51 |
|
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('warning_quantity', 'change', selectrna.warningLevelOnChange); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('warning_quality_score', 'change', selectrna.warningLevelOnChange); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('warning_quantity', 'keypress', Events.numberOnly); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('warning_quality_score', 'keypress', Events.numberOnly); |
2803 |
14 Oct 14 |
nicklas |
56 |
|
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('location', 'click', selectrna.toggleInfo); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('quantity', 'click', selectrna.toggleInfo); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('quality-score', 'click', selectrna.toggleInfo); |
6218 |
20 Apr 21 |
nicklas |
Events.addEventHandler('conc', 'click', selectrna.toggleInfo); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('volumes', 'click', selectrna.toggleInfo); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('qiacube-date', 'click', selectrna.toggleInfo); |
2803 |
14 Oct 14 |
nicklas |
63 |
|
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('pool-row', 'click', selectrna.togglePool); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('pool-row', 'mouseover', selectrna.highlightPool); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('pool-row', 'mouseout', selectrna.highlightPool); |
2803 |
14 Oct 14 |
nicklas |
67 |
|
2803 |
14 Oct 14 |
nicklas |
Buttons.addClickHandler('btnAutoSelect', selectrna.autoSelect); |
2803 |
14 Oct 14 |
nicklas |
Buttons.addClickHandler('btnManualSelect', selectrna.manualSelect); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('plate', 'base-selected', selectrna.manuallySelected); |
2803 |
14 Oct 14 |
nicklas |
Buttons.addClickHandler('btnStratagene', selectrna.setToStratagene); |
2803 |
14 Oct 14 |
nicklas |
Buttons.addClickHandler('btnExternal', selectrna.setToExternal); |
2803 |
14 Oct 14 |
nicklas |
Buttons.addClickHandler('btnToggleQc', selectrna.toggleQc); |
2803 |
14 Oct 14 |
nicklas |
Buttons.addClickHandler('btnComment', selectrna.commentSelected); |
2803 |
14 Oct 14 |
nicklas |
Buttons.addClickHandler('btnCutSelected', selectrna.cutSelected); |
2803 |
14 Oct 14 |
nicklas |
Buttons.addClickHandler('btnCopySelected', selectrna.copySelected); |
2803 |
14 Oct 14 |
nicklas |
Buttons.addClickHandler('btnPasteToSelected', selectrna.pasteToSelected); |
2803 |
14 Oct 14 |
nicklas |
Buttons.addClickHandler('btnSwitch', selectrna.switchSelected); |
2803 |
14 Oct 14 |
nicklas |
79 |
|
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('iconSpecialSelect', 'click', selectrna.toggleSpecialSelect); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('plate', 'mouseup', selectrna.contextEvent); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('plate', 'contextmenu', selectrna.contextEvent); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('mnuComment', 'click', selectrna.commentSelected); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('mnuToggleQc', 'click', selectrna.toggleQc); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('mnuCutSelected', 'click', selectrna.cutSelected); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('mnuCopySelected', 'click', selectrna.copySelected); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('mnuPasteToSelected', 'click', selectrna.pasteToSelected); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('mnuSwitch', 'click', selectrna.switchSelected); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('mnuCaseSummary', 'click', selectrna.showCaseSummary); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('mnuFlagLowQualityScore', 'click', selectrna.flagSelected); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('mnuFlagNotEnoughRemainingQuantity', 'click', selectrna.flagSelected); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('mnuFlagOther', 'click', selectrna.flagSelected); |
2803 |
14 Oct 14 |
nicklas |
93 |
|
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('flaggedRna', 'click', selectrna.showFlaggedRna); |
2803 |
14 Oct 14 |
nicklas |
95 |
|
2803 |
14 Oct 14 |
nicklas |
// Navigation |
2803 |
14 Oct 14 |
nicklas |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
2803 |
14 Oct 14 |
nicklas |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
2803 |
14 Oct 14 |
nicklas |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
2803 |
14 Oct 14 |
nicklas |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
2803 |
14 Oct 14 |
nicklas |
101 |
|
2803 |
14 Oct 14 |
nicklas |
// Final registration |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler('wizard', 'wizard-submit', selectrna.submit); |
2803 |
14 Oct 14 |
nicklas |
104 |
|
5882 |
26 Mar 20 |
nicklas |
Reggie.loadProtocols('RNA_NORMALIZATION_PROTOCOL', 'normalizationProtocol', 'LIBPREP_TARGET,RNA_TARGET_AMOUNT,RNA_MINIMAL_AMOUNT,RNA_TARGET_VOLUME', 'Manual'); |
3833 |
08 Apr 16 |
nicklas |
106 |
} |
3833 |
08 Apr 16 |
nicklas |
107 |
|
3833 |
08 Apr 16 |
nicklas |
selectrna.initProtocols = function() |
3833 |
08 Apr 16 |
nicklas |
109 |
{ |
3833 |
08 Apr 16 |
nicklas |
var frm = document.forms['reggie']; |
3833 |
08 Apr 16 |
nicklas |
hasInitProtocols = true; |
2803 |
14 Oct 14 |
nicklas |
112 |
|
3833 |
08 Apr 16 |
nicklas |
if (frm.normalizationProtocol.length == 0) |
3833 |
08 Apr 16 |
nicklas |
114 |
{ |
3833 |
08 Apr 16 |
nicklas |
Wizard.setFatalError('No RNA dilution protocols found. Please ask the server administrator to create at least one protocol.'); |
3833 |
08 Apr 16 |
nicklas |
return; |
3833 |
08 Apr 16 |
nicklas |
117 |
} |
3833 |
08 Apr 16 |
nicklas |
118 |
|
3833 |
08 Apr 16 |
nicklas |
for (var i=0; i < frm.normalizationProtocol.length; i++) |
3833 |
08 Apr 16 |
nicklas |
120 |
{ |
3833 |
08 Apr 16 |
nicklas |
var p = frm.normalizationProtocol[i].item; |
3833 |
08 Apr 16 |
nicklas |
122 |
|
3833 |
08 Apr 16 |
nicklas |
var unit = 'µg'; |
3833 |
08 Apr 16 |
nicklas |
var factor = 1; |
3833 |
08 Apr 16 |
nicklas |
if (p.RNATargetAmount < 0.5) |
3833 |
08 Apr 16 |
nicklas |
126 |
{ |
3833 |
08 Apr 16 |
nicklas |
unit = 'ng'; |
3833 |
08 Apr 16 |
nicklas |
factor = 1000; |
3833 |
08 Apr 16 |
nicklas |
129 |
} |
3833 |
08 Apr 16 |
nicklas |
130 |
|
3833 |
08 Apr 16 |
nicklas |
var text = p.name + ' ('; |
3833 |
08 Apr 16 |
nicklas |
if (p.RNAMinimalAmount) text += Reggie.formatNumber(p.RNAMinimalAmount * factor, '', 1) + '-'; |
3833 |
08 Apr 16 |
nicklas |
text += p.RNATargetAmount ? Reggie.formatNumber(p.RNATargetAmount * factor, '', 1) : '? '; |
3833 |
08 Apr 16 |
nicklas |
text += unit; |
3833 |
08 Apr 16 |
nicklas |
text += ' in '+(p.RNATargetVolume || '? ')+'µl)'; |
3833 |
08 Apr 16 |
nicklas |
frm.normalizationProtocol[i].text = text; |
3833 |
08 Apr 16 |
nicklas |
137 |
} |
3833 |
08 Apr 16 |
nicklas |
138 |
|
3833 |
08 Apr 16 |
nicklas |
if (autoDesign) frm.normalizationProtocol.disabled = true; |
3832 |
07 Apr 16 |
nicklas |
140 |
|
2803 |
14 Oct 14 |
nicklas |
var url = '../MRna.servlet?ID='+App.getSessionId(); |
3288 |
30 Apr 15 |
nicklas |
url += '&cmd=GetNextAutoGeneratedPlateName'; |
5881 |
25 Mar 20 |
nicklas |
url += '&bioPlateType='+ encodeURIComponent(plateType); |
5882 |
26 Mar 20 |
nicklas |
Wizard.showLoadingAnimation('Loading next plate name'); |
2803 |
14 Oct 14 |
nicklas |
Wizard.asyncJsonRequest(url, selectrna.nextPlateNameLoaded); |
3645 |
03 Dec 15 |
nicklas |
146 |
} |
3645 |
03 Dec 15 |
nicklas |
147 |
|
3645 |
03 Dec 15 |
nicklas |
selectrna.nextPlateNameLoaded = function(response) |
3645 |
03 Dec 15 |
nicklas |
149 |
{ |
3645 |
03 Dec 15 |
nicklas |
Plate.name = response.name; |
3645 |
03 Dec 15 |
nicklas |
Doc.element('plateName').innerHTML = Strings.encodeTags(Plate.name); |
3645 |
03 Dec 15 |
nicklas |
152 |
|
3645 |
03 Dec 15 |
nicklas |
var url = '../MRna.servlet?ID='+App.getSessionId(); |
3645 |
03 Dec 15 |
nicklas |
url += '&cmd=GetStratagene'; |
3645 |
03 Dec 15 |
nicklas |
Wizard.asyncJsonRequest(url, selectrna.stratageneLoaded); |
3645 |
03 Dec 15 |
nicklas |
156 |
} |
3645 |
03 Dec 15 |
nicklas |
157 |
|
3833 |
08 Apr 16 |
nicklas |
158 |
|
3645 |
03 Dec 15 |
nicklas |
selectrna.stratageneLoaded = function(response) |
3645 |
03 Dec 15 |
nicklas |
160 |
{ |
3645 |
03 Dec 15 |
nicklas |
var frm = document.forms['reggie']; |
3645 |
03 Dec 15 |
nicklas |
var stratagene = response.stratagene; |
3645 |
03 Dec 15 |
nicklas |
163 |
|
3645 |
03 Dec 15 |
nicklas |
for (var i = 0; i < stratagene.length; i++) |
3645 |
03 Dec 15 |
nicklas |
165 |
{ |
3645 |
03 Dec 15 |
nicklas |
var s = stratagene[i]; |
3645 |
03 Dec 15 |
nicklas |
var name = s.name; |
3645 |
03 Dec 15 |
nicklas |
if (s.bioWell) |
3645 |
03 Dec 15 |
nicklas |
169 |
{ |
3645 |
03 Dec 15 |
nicklas |
name += ' -- ' + s.bioWell.bioPlate.name + ' ('+s.bioWell.location + ')'; |
3645 |
03 Dec 15 |
nicklas |
171 |
} |
3645 |
03 Dec 15 |
nicklas |
frm.stratagene[frm.stratagene.length] = new Option(name, s.name); |
3645 |
03 Dec 15 |
nicklas |
173 |
} |
3833 |
08 Apr 16 |
nicklas |
174 |
|
3832 |
07 Apr 16 |
nicklas |
//selectrna.quantityOnChange(); |
3300 |
04 May 15 |
nicklas |
selectrna.warningLevelOnChange(); |
3290 |
30 Apr 15 |
nicklas |
177 |
|
3290 |
30 Apr 15 |
nicklas |
// Init plate, pool schema and barcode variants |
3290 |
30 Apr 15 |
nicklas |
graphics = new jsGraphics(Doc.element('canvas')); |
3290 |
30 Apr 15 |
nicklas |
pen = new jsPen(new jsColor('#2288AA'), 2); |
5882 |
26 Mar 20 |
nicklas |
var columns = 12; |
3290 |
30 Apr 15 |
nicklas |
var rows = 8; |
5884 |
27 Mar 20 |
nicklas |
var schema = PoolSchema.initList(frm.pool_schema, plateDefault.poolSchema, plateDefault.poolSchemaType); |
3290 |
30 Apr 15 |
nicklas |
Plate.init(rows, columns, schema, WellPainter); |
3290 |
30 Apr 15 |
nicklas |
Events.sendChangeEvent(frm.pool_schema); |
3645 |
03 Dec 15 |
nicklas |
186 |
|
3645 |
03 Dec 15 |
nicklas |
if (autoDesign) |
3645 |
03 Dec 15 |
nicklas |
188 |
{ |
3645 |
03 Dec 15 |
nicklas |
frm.pool_schema.disabled = true; |
3645 |
03 Dec 15 |
nicklas |
var wells = Plate.getPool(0); |
3645 |
03 Dec 15 |
nicklas |
191 |
|
3645 |
03 Dec 15 |
nicklas |
var url = '../MRna.servlet?ID='+App.getSessionId(); |
3645 |
03 Dec 15 |
nicklas |
url += '&cmd=GetRNAForAutoDesign&numToSelect='+wells.length; |
3833 |
08 Apr 16 |
nicklas |
url += '&protocol='+frm.normalizationProtocol.value; |
3645 |
03 Dec 15 |
nicklas |
Wizard.showLoadingAnimation('Finding RNA. Please wait...'); |
3645 |
03 Dec 15 |
nicklas |
Wizard.asyncJsonRequest(url, selectrna.rnaAutoDesignSelected); |
3645 |
03 Dec 15 |
nicklas |
197 |
} |
3645 |
03 Dec 15 |
nicklas |
else |
3645 |
03 Dec 15 |
nicklas |
199 |
{ |
3645 |
03 Dec 15 |
nicklas |
selectrna.step1IsInitialized(); |
3645 |
03 Dec 15 |
nicklas |
201 |
} |
2803 |
14 Oct 14 |
nicklas |
202 |
} |
3300 |
04 May 15 |
nicklas |
203 |
|
3645 |
03 Dec 15 |
nicklas |
204 |
|
3645 |
03 Dec 15 |
nicklas |
selectrna.rnaAutoDesignSelected = function(response) |
2803 |
14 Oct 14 |
nicklas |
206 |
{ |
3645 |
03 Dec 15 |
nicklas |
var rna = response.rna; |
3645 |
03 Dec 15 |
nicklas |
if (rna.length == 0) |
3645 |
03 Dec 15 |
nicklas |
209 |
{ |
3645 |
03 Dec 15 |
nicklas |
Doc.addClass('btnOk', 'disabled'); |
3645 |
03 Dec 15 |
nicklas |
Wizard.setFatalError('Could not find any unprocessed RNA at this time.'); |
3645 |
03 Dec 15 |
nicklas |
return; |
3645 |
03 Dec 15 |
nicklas |
213 |
} |
3645 |
03 Dec 15 |
nicklas |
var wells = Plate.getPool(0); |
3645 |
03 Dec 15 |
nicklas |
Plate.setSelected(wells, true); |
3645 |
03 Dec 15 |
nicklas |
selectrna.rnaSelected(response); |
3645 |
03 Dec 15 |
nicklas |
Plate.setSelected(wells, false); |
2803 |
14 Oct 14 |
nicklas |
218 |
|
3645 |
03 Dec 15 |
nicklas |
selectrna.step1IsInitialized(); |
3645 |
03 Dec 15 |
nicklas |
220 |
} |
3645 |
03 Dec 15 |
nicklas |
221 |
|
3645 |
03 Dec 15 |
nicklas |
selectrna.step1IsInitialized = function() |
3645 |
03 Dec 15 |
nicklas |
223 |
{ |
3645 |
03 Dec 15 |
nicklas |
Doc.show('step-1'); |
3645 |
03 Dec 15 |
nicklas |
Doc.show('gocancel'); |
3645 |
03 Dec 15 |
nicklas |
Doc.show('goregister'); |
3645 |
03 Dec 15 |
nicklas |
if (!autoDesign) |
2803 |
14 Oct 14 |
nicklas |
228 |
{ |
3645 |
03 Dec 15 |
nicklas |
window.addEventListener('beforeunload', selectrna.confirmLeaveWizard); |
3645 |
03 Dec 15 |
nicklas |
Wizard.keepSessionAlive(); |
2803 |
14 Oct 14 |
nicklas |
231 |
} |
2803 |
14 Oct 14 |
nicklas |
232 |
} |
2803 |
14 Oct 14 |
nicklas |
233 |
|
3645 |
03 Dec 15 |
nicklas |
234 |
/** |
3645 |
03 Dec 15 |
nicklas |
Ask for confirmation to abort if RNA has been placed on the plate. |
3645 |
03 Dec 15 |
nicklas |
Only enabled in manual design. |
3645 |
03 Dec 15 |
nicklas |
237 |
*/ |
3645 |
03 Dec 15 |
nicklas |
selectrna.confirmLeaveWizard = function(event) |
2803 |
14 Oct 14 |
nicklas |
239 |
{ |
3645 |
03 Dec 15 |
nicklas |
if (Plate.getUsed().length > 0) |
3645 |
03 Dec 15 |
nicklas |
241 |
{ |
3645 |
03 Dec 15 |
nicklas |
event.preventDefault(); |
3645 |
03 Dec 15 |
nicklas |
243 |
} |
2803 |
14 Oct 14 |
nicklas |
244 |
} |
2803 |
14 Oct 14 |
nicklas |
245 |
|
3832 |
07 Apr 16 |
nicklas |
selectrna.protocolOnChange = function() |
2803 |
14 Oct 14 |
nicklas |
247 |
{ |
2803 |
14 Oct 14 |
nicklas |
var frm = document.forms['reggie']; |
3833 |
08 Apr 16 |
nicklas |
if (!hasInitProtocols) selectrna.initProtocols(); |
3832 |
07 Apr 16 |
nicklas |
250 |
|
3832 |
07 Apr 16 |
nicklas |
var protocol = frm.normalizationProtocol[frm.normalizationProtocol.selectedIndex].item; |
3832 |
07 Apr 16 |
nicklas |
if (!protocol || !protocol.RNATargetAmount || !protocol.RNATargetVolume) |
2803 |
14 Oct 14 |
nicklas |
253 |
{ |
3832 |
07 Apr 16 |
nicklas |
protocol = {}; |
3832 |
07 Apr 16 |
nicklas |
if (!protocol.RNATargetAmount) protocol.RNATargetAmount = 1.1; |
3832 |
07 Apr 16 |
nicklas |
if (!protocol.RNATargetVolume) protocol.RNATargetVolume = 50; |
3832 |
07 Apr 16 |
nicklas |
257 |
|
3832 |
07 Apr 16 |
nicklas |
var msg = 'Missing normalization data; assuming '; |
3832 |
07 Apr 16 |
nicklas |
msg += protocol.RNATargetAmount+ 'µg in '+protocol.RNATargetVolume+'µl.'; |
3832 |
07 Apr 16 |
nicklas |
Wizard.setInputStatus('normalizationProtocol', 'warning', msg); |
2803 |
14 Oct 14 |
nicklas |
261 |
} |
3832 |
07 Apr 16 |
nicklas |
else |
3832 |
07 Apr 16 |
nicklas |
263 |
{ |
3832 |
07 Apr 16 |
nicklas |
Wizard.setInputStatus('normalizationProtocol', 'valid'); |
3832 |
07 Apr 16 |
nicklas |
265 |
} |
3832 |
07 Apr 16 |
nicklas |
if (!protocol.RNAMinimalAmount) protocol.RNAMinimalAmount = protocol.RNATargetAmount; |
2803 |
14 Oct 14 |
nicklas |
267 |
|
3832 |
07 Apr 16 |
nicklas |
QUANTITY_REGULAR = protocol.RNATargetAmount; |
3832 |
07 Apr 16 |
nicklas |
QUANTITY_QC = QUANTITY_REGULAR+0.12; |
3832 |
07 Apr 16 |
nicklas |
TOTAL_VOLUME = protocol.RNATargetVolume; |
3832 |
07 Apr 16 |
nicklas |
QUANTITY_MINIMAL = protocol.RNAMinimalAmount; |
3832 |
07 Apr 16 |
nicklas |
Plate.paint(Plate.getWells()); |
2803 |
14 Oct 14 |
nicklas |
273 |
} |
2803 |
14 Oct 14 |
nicklas |
274 |
|
2803 |
14 Oct 14 |
nicklas |
selectrna.warningLevelOnChange = function(event) |
2803 |
14 Oct 14 |
nicklas |
276 |
{ |
2803 |
14 Oct 14 |
nicklas |
var frm = document.forms['reggie']; |
2803 |
14 Oct 14 |
nicklas |
278 |
|
2803 |
14 Oct 14 |
nicklas |
var wQuantity = parseFloat(frm.warning_quantity.value); |
2803 |
14 Oct 14 |
nicklas |
if (!(wQuantity > 0)) |
2803 |
14 Oct 14 |
nicklas |
281 |
{ |
2803 |
14 Oct 14 |
nicklas |
Wizard.setInputStatus('warnings', 'invalid', 'Remaining quantity must be ≥ 0.'); |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
284 |
} |
2803 |
14 Oct 14 |
nicklas |
var wQualityScore = parseFloat(frm.warning_quality_score.value); |
2803 |
14 Oct 14 |
nicklas |
if (!(wQualityScore > 0)) |
2803 |
14 Oct 14 |
nicklas |
287 |
{ |
2803 |
14 Oct 14 |
nicklas |
Wizard.setInputStatus('warnings', 'invalid', 'RQS/RIN must be ≥ 0.'); |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
290 |
} |
2803 |
14 Oct 14 |
nicklas |
291 |
|
2803 |
14 Oct 14 |
nicklas |
LOW_QUANTITY_WARNING_LIMIT = wQuantity; |
2803 |
14 Oct 14 |
nicklas |
QUALITY_SCORE_WARNING_LIMIT = wQualityScore; |
2803 |
14 Oct 14 |
nicklas |
294 |
|
2803 |
14 Oct 14 |
nicklas |
Wizard.setInputStatus('warnings', 'valid'); |
3290 |
30 Apr 15 |
nicklas |
if (event) Plate.paint(Plate.getWells()); |
2803 |
14 Oct 14 |
nicklas |
297 |
} |
2803 |
14 Oct 14 |
nicklas |
298 |
|
2803 |
14 Oct 14 |
nicklas |
selectrna.poolSchemaOnChange = function() |
2803 |
14 Oct 14 |
nicklas |
300 |
{ |
2803 |
14 Oct 14 |
nicklas |
var frm = document.forms['reggie']; |
3289 |
30 Apr 15 |
nicklas |
var schema = PoolSchema.getById(frm.pool_schema.value); |
3290 |
30 Apr 15 |
nicklas |
Plate.setPoolSchema(schema); |
3290 |
30 Apr 15 |
nicklas |
304 |
|
5882 |
26 Mar 20 |
nicklas |
PoolSchema.buildPoolTableRow(schema, Plate.columns, true); |
2803 |
14 Oct 14 |
nicklas |
Plate.paint(Plate.getWells()); |
2803 |
14 Oct 14 |
nicklas |
307 |
} |
2803 |
14 Oct 14 |
nicklas |
308 |
|
2803 |
14 Oct 14 |
nicklas |
selectrna.toggleInfo = function(event) |
2803 |
14 Oct 14 |
nicklas |
310 |
{ |
2803 |
14 Oct 14 |
nicklas |
var show = event.currentTarget.checked; |
2803 |
14 Oct 14 |
nicklas |
Doc.addOrRemoveClass('plate', 'hide-'+event.currentTarget.id, !show); |
2803 |
14 Oct 14 |
nicklas |
313 |
} |
2803 |
14 Oct 14 |
nicklas |
314 |
|
2803 |
14 Oct 14 |
nicklas |
var currentSelected; |
2808 |
15 Oct 14 |
nicklas |
var names = []; |
2803 |
14 Oct 14 |
nicklas |
317 |
/** |
2803 |
14 Oct 14 |
nicklas |
Open a popup dialog for manual selection of RNA. |
2803 |
14 Oct 14 |
nicklas |
319 |
*/ |
2803 |
14 Oct 14 |
nicklas |
selectrna.manualSelect = function(event) |
2803 |
14 Oct 14 |
nicklas |
321 |
{ |
2803 |
14 Oct 14 |
nicklas |
currentSelected = Plate.getSelected(); |
2803 |
14 Oct 14 |
nicklas |
if (currentSelected.length == 0) |
2803 |
14 Oct 14 |
nicklas |
324 |
{ |
2803 |
14 Oct 14 |
nicklas |
Forms.showNotification(event.currentTarget, 'Please select one or more wells were RNA should be placed.'); |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
327 |
} |
2803 |
14 Oct 14 |
nicklas |
328 |
|
2803 |
14 Oct 14 |
nicklas |
if (subtypeRna == null) subtypeRna = Reggie.getSubtypeInfo('RNA'); |
2906 |
07 Nov 14 |
nicklas |
if (subtypeRnaNormalized == null) subtypeRnaNormalized = Reggie.getSubtypeInfo('RNA_NORMALIZED_ALIQUOT'); |
2803 |
14 Oct 14 |
nicklas |
331 |
|
2803 |
14 Oct 14 |
nicklas |
var url = '&resetTemporary=1'; |
4517 |
01 Jun 17 |
nicklas |
url += '&tmpfilter:INT:itemSubtype='+encodeURIComponent(subtypeRna.id+'|'+subtypeRnaNormalized.id); |
2803 |
14 Oct 14 |
nicklas |
url += '&tmpfilter:DATE:creationEvent.eventDate='+encodeURIComponent('<>'); |
3832 |
07 Apr 16 |
nicklas |
url += '&tmpfilter:FLOAT:remainingQuantity='+encodeURIComponent('>='+QUANTITY_MINIMAL); |
2803 |
14 Oct 14 |
nicklas |
url += '&'+encodeURIComponent('tmpfilter:STRING:&childCreationEvents(event.bioMaterial.name)')+'='+encodeURIComponent('<>%.m'); |
2803 |
14 Oct 14 |
nicklas |
337 |
|
2803 |
14 Oct 14 |
nicklas |
Dialogs.selectItem('EXTRACT', 'plate', 1, url); |
2803 |
14 Oct 14 |
nicklas |
339 |
} |
2803 |
14 Oct 14 |
nicklas |
340 |
|
2803 |
14 Oct 14 |
nicklas |
341 |
/** |
2803 |
14 Oct 14 |
nicklas |
Callback method for manual selection. |
2803 |
14 Oct 14 |
nicklas |
343 |
*/ |
2803 |
14 Oct 14 |
nicklas |
selectrna.manuallySelected = function(event) |
2803 |
14 Oct 14 |
nicklas |
345 |
{ |
2808 |
15 Oct 14 |
nicklas |
names[names.length] = event.detail.name; |
2808 |
15 Oct 14 |
nicklas |
347 |
|
2808 |
15 Oct 14 |
nicklas |
if (event.detail.remaining == 0 && names.length > 0) |
2803 |
14 Oct 14 |
nicklas |
349 |
{ |
2808 |
15 Oct 14 |
nicklas |
Rna.loadInfoByNames(names); |
2808 |
15 Oct 14 |
nicklas |
351 |
|
2808 |
15 Oct 14 |
nicklas |
for (var i = 0; i < names.length && i < currentSelected.length; i++) |
2808 |
15 Oct 14 |
nicklas |
353 |
{ |
2808 |
15 Oct 14 |
nicklas |
var well = currentSelected[i]; |
2808 |
15 Oct 14 |
nicklas |
var name = names[i]; |
2808 |
15 Oct 14 |
nicklas |
356 |
|
2808 |
15 Oct 14 |
nicklas |
// Create a new RNA object |
2808 |
15 Oct 14 |
nicklas |
var rna = Rna.createByName(name); |
2808 |
15 Oct 14 |
nicklas |
Rna.unflag(rna); |
2808 |
15 Oct 14 |
nicklas |
well.setExtract(rna); |
2808 |
15 Oct 14 |
nicklas |
well.selected = false; |
2808 |
15 Oct 14 |
nicklas |
362 |
} |
2808 |
15 Oct 14 |
nicklas |
363 |
|
2808 |
15 Oct 14 |
nicklas |
Plate.checkReplicates(); |
2808 |
15 Oct 14 |
nicklas |
Plate.paint(currentSelected); |
2808 |
15 Oct 14 |
nicklas |
selectrna.updateNumFlaggedRna(); |
2808 |
15 Oct 14 |
nicklas |
names = []; |
2803 |
14 Oct 14 |
nicklas |
368 |
} |
2803 |
14 Oct 14 |
nicklas |
369 |
} |
2803 |
14 Oct 14 |
nicklas |
370 |
|
2803 |
14 Oct 14 |
nicklas |
371 |
|
2803 |
14 Oct 14 |
nicklas |
372 |
/** |
2803 |
14 Oct 14 |
nicklas |
Let the wizard automatically select among unprocessed RNA items. |
2803 |
14 Oct 14 |
nicklas |
374 |
*/ |
2803 |
14 Oct 14 |
nicklas |
selectrna.autoSelect = function(event) |
2803 |
14 Oct 14 |
nicklas |
376 |
{ |
2803 |
14 Oct 14 |
nicklas |
var frm = document.forms['reggie']; |
2803 |
14 Oct 14 |
nicklas |
var wells = Plate.getWells(); |
2803 |
14 Oct 14 |
nicklas |
var selected = []; |
2803 |
14 Oct 14 |
nicklas |
var ignore = []; |
2803 |
14 Oct 14 |
nicklas |
var notEmpty = 0; |
2803 |
14 Oct 14 |
nicklas |
382 |
|
2803 |
14 Oct 14 |
nicklas |
// Count selected and non-empty wells and keep track of RNA that is already present |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < wells.length; i++) |
2803 |
14 Oct 14 |
nicklas |
385 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = wells[i]; |
2803 |
14 Oct 14 |
nicklas |
if (well.selected) |
2803 |
14 Oct 14 |
nicklas |
388 |
{ |
2803 |
14 Oct 14 |
nicklas |
selected[selected.length] = well; |
2803 |
14 Oct 14 |
nicklas |
if (well.extract && !well.hasError()) notEmpty++; |
2803 |
14 Oct 14 |
nicklas |
391 |
} |
2803 |
14 Oct 14 |
nicklas |
if (well.extract && well.extract.id) |
2803 |
14 Oct 14 |
nicklas |
393 |
{ |
2803 |
14 Oct 14 |
nicklas |
ignore[ignore.length] = well.extract.id; |
2803 |
14 Oct 14 |
nicklas |
395 |
} |
2803 |
14 Oct 14 |
nicklas |
396 |
} |
2803 |
14 Oct 14 |
nicklas |
// Ignore RNA already flagged |
2803 |
14 Oct 14 |
nicklas |
var flagged = Rna.getFlagged(); |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < flagged.length; i++) |
2803 |
14 Oct 14 |
nicklas |
400 |
{ |
2803 |
14 Oct 14 |
nicklas |
var rna = flagged[i]; |
2803 |
14 Oct 14 |
nicklas |
if (rna.id) ignore[ignore.length] = rna.id; |
2803 |
14 Oct 14 |
nicklas |
403 |
} |
2803 |
14 Oct 14 |
nicklas |
404 |
|
2803 |
14 Oct 14 |
nicklas |
if (selected.length == 0) |
2803 |
14 Oct 14 |
nicklas |
406 |
{ |
2803 |
14 Oct 14 |
nicklas |
Forms.showNotification(event.currentTarget, 'Please select one or more wells were RNA should be placed.'); |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
409 |
} |
2803 |
14 Oct 14 |
nicklas |
410 |
|
2803 |
14 Oct 14 |
nicklas |
if (notEmpty > 0) |
2803 |
14 Oct 14 |
nicklas |
412 |
{ |
2803 |
14 Oct 14 |
nicklas |
if (!confirm('Replace RNA in ' + notEmpty + ' wells?')) |
2803 |
14 Oct 14 |
nicklas |
414 |
{ |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
416 |
} |
2803 |
14 Oct 14 |
nicklas |
417 |
} |
2803 |
14 Oct 14 |
nicklas |
418 |
|
2803 |
14 Oct 14 |
nicklas |
var url = 'auto_select_rna.jsp?ID='+App.getSessionId(); |
2803 |
14 Oct 14 |
nicklas |
url += '&numToSelect='+selected.length; |
3832 |
07 Apr 16 |
nicklas |
url += '&protocol='+frm.normalizationProtocol.value; |
4650 |
08 Jan 18 |
nicklas |
url += '&quantity='+encodeURIComponent(QUANTITY_MINIMAL); |
2803 |
14 Oct 14 |
nicklas |
url += '&ignore='+ignore.join(','); |
2803 |
14 Oct 14 |
nicklas |
Dialogs.openPopup(url, 'AutoSelectRNA', 750, 500); |
2803 |
14 Oct 14 |
nicklas |
425 |
} |
2803 |
14 Oct 14 |
nicklas |
426 |
|
2803 |
14 Oct 14 |
nicklas |
selectrna.rnaSelected = function(response) |
2803 |
14 Oct 14 |
nicklas |
428 |
{ |
2803 |
14 Oct 14 |
nicklas |
// Cache RNA information |
2803 |
14 Oct 14 |
nicklas |
Rna.cacheInfo(response.rna); |
2803 |
14 Oct 14 |
nicklas |
Rna.cacheInfo(response.flagged); |
2808 |
15 Oct 14 |
nicklas |
432 |
|
2803 |
14 Oct 14 |
nicklas |
selectrna.updateNumFlaggedRna(); |
2803 |
14 Oct 14 |
nicklas |
var selected = Plate.getSelected(); |
2803 |
14 Oct 14 |
nicklas |
435 |
|
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < response.rna.length; i++) |
2803 |
14 Oct 14 |
nicklas |
437 |
{ |
2803 |
14 Oct 14 |
nicklas |
if (i < selected.length) |
2803 |
14 Oct 14 |
nicklas |
439 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = selected[i]; |
2803 |
14 Oct 14 |
nicklas |
// Create a new RNA object |
2803 |
14 Oct 14 |
nicklas |
var rna = Rna.createByName(response.rna[i].name); |
2803 |
14 Oct 14 |
nicklas |
well.setExtract(rna); |
2803 |
14 Oct 14 |
nicklas |
well.selected = false; |
2803 |
14 Oct 14 |
nicklas |
445 |
} |
2803 |
14 Oct 14 |
nicklas |
446 |
} |
2803 |
14 Oct 14 |
nicklas |
447 |
|
2803 |
14 Oct 14 |
nicklas |
// Check for replicates on the whole plate and repaint it |
2803 |
14 Oct 14 |
nicklas |
Plate.checkReplicates(null, true); |
2803 |
14 Oct 14 |
nicklas |
Plate.paint(Plate.getWells()); |
2803 |
14 Oct 14 |
nicklas |
451 |
} |
2803 |
14 Oct 14 |
nicklas |
452 |
|
2803 |
14 Oct 14 |
nicklas |
// Update the 'Flagged RNA' information |
2803 |
14 Oct 14 |
nicklas |
selectrna.updateNumFlaggedRna = function() |
2803 |
14 Oct 14 |
nicklas |
455 |
{ |
3759 |
19 Feb 16 |
nicklas |
var flagged = Rna.getFlagged(); |
3759 |
19 Feb 16 |
nicklas |
var numFlagged = flagged.length; |
2803 |
14 Oct 14 |
nicklas |
if (numFlagged > 0) |
2803 |
14 Oct 14 |
nicklas |
459 |
{ |
3759 |
19 Feb 16 |
nicklas |
var numFlaggedYellow = 0; |
3759 |
19 Feb 16 |
nicklas |
for (var rnaNo = 0; rnaNo < numFlagged; rnaNo++) |
3759 |
19 Feb 16 |
nicklas |
462 |
{ |
3759 |
19 Feb 16 |
nicklas |
var r = flagged[rnaNo]; |
3759 |
19 Feb 16 |
nicklas |
if (r.specimen && r.specimen.YellowLabel != null) numFlaggedYellow++; |
3759 |
19 Feb 16 |
nicklas |
465 |
} |
3759 |
19 Feb 16 |
nicklas |
var msg = numFlagged + ' flagged RNA items.'; |
3759 |
19 Feb 16 |
nicklas |
if (numFlaggedYellow > 0) |
3759 |
19 Feb 16 |
nicklas |
468 |
{ |
3759 |
19 Feb 16 |
nicklas |
msg += ' <img src="../images/yellow-label.png"> '+numFlaggedYellow + (numFlaggedYellow == 1?' is':' are')+ ' derived from YellowLabel specimen!'; |
3759 |
19 Feb 16 |
nicklas |
470 |
} |
3759 |
19 Feb 16 |
nicklas |
Doc.element('flaggedRna').innerHTML = msg; |
2803 |
14 Oct 14 |
nicklas |
Doc.show('flaggedRna'); |
2803 |
14 Oct 14 |
nicklas |
473 |
} |
2803 |
14 Oct 14 |
nicklas |
else |
2803 |
14 Oct 14 |
nicklas |
475 |
{ |
2803 |
14 Oct 14 |
nicklas |
Doc.hide('flaggedRna'); |
2803 |
14 Oct 14 |
nicklas |
477 |
} |
2803 |
14 Oct 14 |
nicklas |
478 |
} |
2803 |
14 Oct 14 |
nicklas |
479 |
|
2803 |
14 Oct 14 |
nicklas |
480 |
/** |
2803 |
14 Oct 14 |
nicklas |
Add 'Stratagene' to the selected wells. |
2803 |
14 Oct 14 |
nicklas |
482 |
*/ |
2803 |
14 Oct 14 |
nicklas |
selectrna.setToStratagene = function(event) |
2803 |
14 Oct 14 |
nicklas |
484 |
{ |
2803 |
14 Oct 14 |
nicklas |
var frm = document.forms['reggie']; |
2803 |
14 Oct 14 |
nicklas |
selectrna.setToSpecial(event, frm.stratagene.value, true); |
2803 |
14 Oct 14 |
nicklas |
487 |
} |
2803 |
14 Oct 14 |
nicklas |
488 |
|
2803 |
14 Oct 14 |
nicklas |
489 |
|
2803 |
14 Oct 14 |
nicklas |
490 |
/** |
2803 |
14 Oct 14 |
nicklas |
Add 'External RNA' to the selected wells. |
2803 |
14 Oct 14 |
nicklas |
492 |
*/ |
2803 |
14 Oct 14 |
nicklas |
selectrna.setToExternal = function(event) |
2803 |
14 Oct 14 |
nicklas |
494 |
{ |
2803 |
14 Oct 14 |
nicklas |
selectrna.setToSpecial(event, EXTERNAL_RNA_NAME, false); |
2803 |
14 Oct 14 |
nicklas |
496 |
} |
2803 |
14 Oct 14 |
nicklas |
497 |
|
2803 |
14 Oct 14 |
nicklas |
498 |
/** |
2803 |
14 Oct 14 |
nicklas |
Add special RNA to the selected wells. |
2803 |
14 Oct 14 |
nicklas |
500 |
*/ |
2803 |
14 Oct 14 |
nicklas |
selectrna.setToSpecial = function(event, specialName, qc) |
2803 |
14 Oct 14 |
nicklas |
502 |
{ |
2803 |
14 Oct 14 |
nicklas |
var wells = Plate.getSelected(); |
2803 |
14 Oct 14 |
nicklas |
504 |
|
2803 |
14 Oct 14 |
nicklas |
if (wells.length == 0) |
2803 |
14 Oct 14 |
nicklas |
506 |
{ |
2803 |
14 Oct 14 |
nicklas |
Forms.showNotification(event.currentTarget, 'No wells have been selected'); |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
509 |
} |
2803 |
14 Oct 14 |
nicklas |
510 |
|
2803 |
14 Oct 14 |
nicklas |
// Count non-empty wells |
2803 |
14 Oct 14 |
nicklas |
var count = 0; |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < wells.length; i++) |
2803 |
14 Oct 14 |
nicklas |
514 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = wells[i]; |
2803 |
14 Oct 14 |
nicklas |
if (well.extract && !well.hasError()) count++; |
2803 |
14 Oct 14 |
nicklas |
517 |
} |
2803 |
14 Oct 14 |
nicklas |
518 |
|
2803 |
14 Oct 14 |
nicklas |
if (count > 0) |
2803 |
14 Oct 14 |
nicklas |
520 |
{ |
2803 |
14 Oct 14 |
nicklas |
if (!confirm('Replace RNA in ' + count + ' wells with '+specialName+'?')) |
2803 |
14 Oct 14 |
nicklas |
522 |
{ |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
524 |
} |
2803 |
14 Oct 14 |
nicklas |
525 |
} |
2803 |
14 Oct 14 |
nicklas |
526 |
|
2803 |
14 Oct 14 |
nicklas |
var info = Rna.infoByName(specialName); |
2803 |
14 Oct 14 |
nicklas |
if (!info.id) |
2803 |
14 Oct 14 |
nicklas |
529 |
{ |
2803 |
14 Oct 14 |
nicklas |
alert('Could not find any RNA with name=\''+specialName+'\'. Please check that it exists on the server.'); |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
532 |
} |
2803 |
14 Oct 14 |
nicklas |
533 |
|
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < wells.length; i++) |
2803 |
14 Oct 14 |
nicklas |
535 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = wells[i]; |
2803 |
14 Oct 14 |
nicklas |
var rna = Rna.createByInfo(info); |
2803 |
14 Oct 14 |
nicklas |
rna.qc = qc; |
2803 |
14 Oct 14 |
nicklas |
well.setExtract(rna); |
2803 |
14 Oct 14 |
nicklas |
well.selected = false; |
2803 |
14 Oct 14 |
nicklas |
541 |
} |
2803 |
14 Oct 14 |
nicklas |
542 |
|
2803 |
14 Oct 14 |
nicklas |
Plate.paint(wells); |
2803 |
14 Oct 14 |
nicklas |
544 |
|
2803 |
14 Oct 14 |
nicklas |
// Check for replicated RNA if some have been replaced with Stratagene |
2803 |
14 Oct 14 |
nicklas |
if (count > 0) Plate.checkReplicates(); |
2803 |
14 Oct 14 |
nicklas |
547 |
} |
2803 |
14 Oct 14 |
nicklas |
548 |
|
2803 |
14 Oct 14 |
nicklas |
549 |
/** |
2803 |
14 Oct 14 |
nicklas |
Toggle the QC flag for the selected wells. The first non-empty |
2803 |
14 Oct 14 |
nicklas |
well is toggled and the rest of the wells will use the same new QC |
2803 |
14 Oct 14 |
nicklas |
value. |
2803 |
14 Oct 14 |
nicklas |
553 |
*/ |
2803 |
14 Oct 14 |
nicklas |
selectrna.toggleQc = function(event) |
2803 |
14 Oct 14 |
nicklas |
555 |
{ |
2803 |
14 Oct 14 |
nicklas |
var wells = Plate.getSelected(); |
2803 |
14 Oct 14 |
nicklas |
557 |
|
2803 |
14 Oct 14 |
nicklas |
if (wells.length == 0) |
2803 |
14 Oct 14 |
nicklas |
559 |
{ |
2803 |
14 Oct 14 |
nicklas |
Forms.showNotification(event.currentTarget, 'No wells have been selected'); |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
562 |
} |
2803 |
14 Oct 14 |
nicklas |
563 |
|
2803 |
14 Oct 14 |
nicklas |
var gotQc = false; |
2803 |
14 Oct 14 |
nicklas |
var newQc; |
2803 |
14 Oct 14 |
nicklas |
var count = 0; |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < wells.length; i++) |
2803 |
14 Oct 14 |
nicklas |
568 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = wells[i]; |
2803 |
14 Oct 14 |
nicklas |
if (well.extract) |
2803 |
14 Oct 14 |
nicklas |
571 |
{ |
2803 |
14 Oct 14 |
nicklas |
// Toggle QC flag for the first well with RNA, then use the same flag for the rest |
2803 |
14 Oct 14 |
nicklas |
if (!gotQc) |
2803 |
14 Oct 14 |
nicklas |
574 |
{ |
2803 |
14 Oct 14 |
nicklas |
gotQc = true; |
2803 |
14 Oct 14 |
nicklas |
newQc = !well.extract.qc; |
2803 |
14 Oct 14 |
nicklas |
577 |
} |
2803 |
14 Oct 14 |
nicklas |
well.extract.qc = newQc; |
2803 |
14 Oct 14 |
nicklas |
count++; |
2803 |
14 Oct 14 |
nicklas |
580 |
} |
2803 |
14 Oct 14 |
nicklas |
581 |
} |
2803 |
14 Oct 14 |
nicklas |
582 |
|
2803 |
14 Oct 14 |
nicklas |
if (count == 0) |
2803 |
14 Oct 14 |
nicklas |
584 |
{ |
2803 |
14 Oct 14 |
nicklas |
Forms.showNotification(event.currentTarget, 'None of the selected wells contain any RNA'); |
2803 |
14 Oct 14 |
nicklas |
586 |
} |
2803 |
14 Oct 14 |
nicklas |
else |
2803 |
14 Oct 14 |
nicklas |
588 |
{ |
2803 |
14 Oct 14 |
nicklas |
Plate.paint(wells); |
2803 |
14 Oct 14 |
nicklas |
590 |
} |
2803 |
14 Oct 14 |
nicklas |
591 |
} |
2803 |
14 Oct 14 |
nicklas |
592 |
|
2803 |
14 Oct 14 |
nicklas |
// Set a comment on the selected wells |
2803 |
14 Oct 14 |
nicklas |
selectrna.commentSelected = function(event) |
2803 |
14 Oct 14 |
nicklas |
595 |
{ |
2803 |
14 Oct 14 |
nicklas |
var wells = Plate.getSelected(); |
2803 |
14 Oct 14 |
nicklas |
597 |
|
2803 |
14 Oct 14 |
nicklas |
if (wells.length == 0) |
2803 |
14 Oct 14 |
nicklas |
599 |
{ |
2803 |
14 Oct 14 |
nicklas |
Forms.showNotification(event.currentTarget, 'No wells have been selected'); |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
602 |
} |
2803 |
14 Oct 14 |
nicklas |
603 |
|
2803 |
14 Oct 14 |
nicklas |
var count = 0; |
2803 |
14 Oct 14 |
nicklas |
var comment = ''; |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < wells.length; i++) |
2803 |
14 Oct 14 |
nicklas |
607 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = wells[i]; |
2803 |
14 Oct 14 |
nicklas |
if (well.extract) |
2803 |
14 Oct 14 |
nicklas |
610 |
{ |
2803 |
14 Oct 14 |
nicklas |
count++; |
2803 |
14 Oct 14 |
nicklas |
if (well.extract.comment) comment = well.extract.comment; |
2803 |
14 Oct 14 |
nicklas |
613 |
} |
2803 |
14 Oct 14 |
nicklas |
614 |
} |
2803 |
14 Oct 14 |
nicklas |
615 |
|
2803 |
14 Oct 14 |
nicklas |
if (count == 0) |
2803 |
14 Oct 14 |
nicklas |
617 |
{ |
2803 |
14 Oct 14 |
nicklas |
Forms.showNotification(event.currentTarget, 'None of the selected wells contain any RNA'); |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
620 |
} |
2803 |
14 Oct 14 |
nicklas |
621 |
|
2803 |
14 Oct 14 |
nicklas |
comment = prompt('Comment', comment || ''); |
2803 |
14 Oct 14 |
nicklas |
if (comment == null) return; |
2803 |
14 Oct 14 |
nicklas |
624 |
|
2803 |
14 Oct 14 |
nicklas |
if (comment == '') comment = null; |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < wells.length; i++) |
2803 |
14 Oct 14 |
nicklas |
627 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = wells[i]; |
2803 |
14 Oct 14 |
nicklas |
if (well.extract) well.extract.comment = comment; |
2803 |
14 Oct 14 |
nicklas |
630 |
} |
2803 |
14 Oct 14 |
nicklas |
Plate.paint(wells); |
2803 |
14 Oct 14 |
nicklas |
632 |
} |
2803 |
14 Oct 14 |
nicklas |
633 |
|
2803 |
14 Oct 14 |
nicklas |
634 |
/** |
2803 |
14 Oct 14 |
nicklas |
Empty the selected wells from RNA. They can later be pasted again. |
2803 |
14 Oct 14 |
nicklas |
636 |
*/ |
2803 |
14 Oct 14 |
nicklas |
selectrna.cutSelected = function(event) |
2803 |
14 Oct 14 |
nicklas |
638 |
{ |
2803 |
14 Oct 14 |
nicklas |
var wells = Plate.getSelected(); |
2803 |
14 Oct 14 |
nicklas |
640 |
|
2803 |
14 Oct 14 |
nicklas |
if (wells.length == 0) |
2803 |
14 Oct 14 |
nicklas |
642 |
{ |
2803 |
14 Oct 14 |
nicklas |
Forms.showNotification(event.currentTarget, 'No wells have been selected'); |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
645 |
} |
2803 |
14 Oct 14 |
nicklas |
646 |
|
2803 |
14 Oct 14 |
nicklas |
var count = 0; |
2803 |
14 Oct 14 |
nicklas |
var valid = 0; |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < wells.length; i++) |
2803 |
14 Oct 14 |
nicklas |
650 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = wells[i]; |
2803 |
14 Oct 14 |
nicklas |
if (well.extract) |
2803 |
14 Oct 14 |
nicklas |
653 |
{ |
2803 |
14 Oct 14 |
nicklas |
count++; |
2803 |
14 Oct 14 |
nicklas |
if (!well.hasError()) valid++; |
2803 |
14 Oct 14 |
nicklas |
656 |
} |
2803 |
14 Oct 14 |
nicklas |
657 |
} |
2803 |
14 Oct 14 |
nicklas |
658 |
|
2803 |
14 Oct 14 |
nicklas |
if (count == 0) |
2803 |
14 Oct 14 |
nicklas |
660 |
{ |
2803 |
14 Oct 14 |
nicklas |
Forms.showNotification(event.currentTarget, 'None of the selected wells contain any RNA'); |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
663 |
} |
2803 |
14 Oct 14 |
nicklas |
664 |
|
2803 |
14 Oct 14 |
nicklas |
// Ask for confirmation before deleting from valid wells |
2803 |
14 Oct 14 |
nicklas |
if (valid > 0) |
2803 |
14 Oct 14 |
nicklas |
667 |
{ |
2803 |
14 Oct 14 |
nicklas |
if (!confirm('Clear RNA from ' + count + ' of ' + wells.length + ' selected wells?')) |
2803 |
14 Oct 14 |
nicklas |
669 |
{ |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
671 |
} |
2803 |
14 Oct 14 |
nicklas |
672 |
} |
2803 |
14 Oct 14 |
nicklas |
673 |
|
2803 |
14 Oct 14 |
nicklas |
selectrna.copySelected(); |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < wells.length; i++) |
2803 |
14 Oct 14 |
nicklas |
676 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = wells[i]; |
2803 |
14 Oct 14 |
nicklas |
well.setExtract(null); |
2803 |
14 Oct 14 |
nicklas |
well.selected = false; |
2803 |
14 Oct 14 |
nicklas |
680 |
} |
2803 |
14 Oct 14 |
nicklas |
Plate.paint(wells); |
2803 |
14 Oct 14 |
nicklas |
Plate.checkReplicates(); |
2803 |
14 Oct 14 |
nicklas |
683 |
} |
2803 |
14 Oct 14 |
nicklas |
684 |
|
2803 |
14 Oct 14 |
nicklas |
var copy; |
2803 |
14 Oct 14 |
nicklas |
686 |
/** |
2803 |
14 Oct 14 |
nicklas |
Copy information about the selected wells. |
2803 |
14 Oct 14 |
nicklas |
688 |
*/ |
2803 |
14 Oct 14 |
nicklas |
selectrna.copySelected = function(event) |
2803 |
14 Oct 14 |
nicklas |
690 |
{ |
2803 |
14 Oct 14 |
nicklas |
// Clear existing wells in the copy |
2803 |
14 Oct 14 |
nicklas |
var repaint = []; |
2803 |
14 Oct 14 |
nicklas |
if (copy && copy.length > 0) |
2803 |
14 Oct 14 |
nicklas |
694 |
{ |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < copy.length; i++) |
2803 |
14 Oct 14 |
nicklas |
696 |
{ |
2803 |
14 Oct 14 |
nicklas |
var cp = copy[i]; |
2803 |
14 Oct 14 |
nicklas |
cp.well.doneWithCopy(); |
2803 |
14 Oct 14 |
nicklas |
repaint[repaint.length] = cp.well; |
2803 |
14 Oct 14 |
nicklas |
700 |
} |
2803 |
14 Oct 14 |
nicklas |
701 |
} |
2803 |
14 Oct 14 |
nicklas |
Plate.paint(repaint); |
2803 |
14 Oct 14 |
nicklas |
703 |
|
2803 |
14 Oct 14 |
nicklas |
// Place selected wells in the copy |
2803 |
14 Oct 14 |
nicklas |
var wells = Plate.getSelected(); |
2803 |
14 Oct 14 |
nicklas |
copy = []; |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < wells.length; i++) |
2803 |
14 Oct 14 |
nicklas |
708 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = wells[i]; |
2803 |
14 Oct 14 |
nicklas |
copy[copy.length] = well.makeCopy(); |
2803 |
14 Oct 14 |
nicklas |
well.selected = false; |
2803 |
14 Oct 14 |
nicklas |
712 |
} |
2803 |
14 Oct 14 |
nicklas |
Plate.paint(wells); |
2803 |
14 Oct 14 |
nicklas |
714 |
} |
2803 |
14 Oct 14 |
nicklas |
715 |
|
2803 |
14 Oct 14 |
nicklas |
716 |
/** |
2803 |
14 Oct 14 |
nicklas |
Paste information into the selected wells. |
2803 |
14 Oct 14 |
nicklas |
718 |
*/ |
2803 |
14 Oct 14 |
nicklas |
selectrna.pasteToSelected = function(event) |
2803 |
14 Oct 14 |
nicklas |
720 |
{ |
2803 |
14 Oct 14 |
nicklas |
if (!copy || copy.length == 0) |
2803 |
14 Oct 14 |
nicklas |
722 |
{ |
2803 |
14 Oct 14 |
nicklas |
Forms.showNotification(event.currentTarget, 'Nothing to paste. Please cut or copy wells first.'); |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
725 |
} |
2803 |
14 Oct 14 |
nicklas |
726 |
|
2803 |
14 Oct 14 |
nicklas |
var wells = Plate.getSelected(); |
2803 |
14 Oct 14 |
nicklas |
// Count non-empty and valid wells |
2803 |
14 Oct 14 |
nicklas |
var count = 0; |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < wells.length; i++) |
2803 |
14 Oct 14 |
nicklas |
731 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = wells[i]; |
2803 |
14 Oct 14 |
nicklas |
if (well.extract && !well.hasError()) count++; |
2803 |
14 Oct 14 |
nicklas |
734 |
} |
2803 |
14 Oct 14 |
nicklas |
735 |
|
2803 |
14 Oct 14 |
nicklas |
if (count > 0) |
2803 |
14 Oct 14 |
nicklas |
737 |
{ |
2803 |
14 Oct 14 |
nicklas |
if (!confirm('Replace RNA in ' + count + ' wells with copy?')) |
2803 |
14 Oct 14 |
nicklas |
739 |
{ |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
741 |
} |
2803 |
14 Oct 14 |
nicklas |
742 |
} |
2803 |
14 Oct 14 |
nicklas |
743 |
|
2803 |
14 Oct 14 |
nicklas |
var wi = 0; |
2803 |
14 Oct 14 |
nicklas |
var ci = 0; |
2803 |
14 Oct 14 |
nicklas |
var copyEmpty; |
2803 |
14 Oct 14 |
nicklas |
var askIfEmpty = true; |
2803 |
14 Oct 14 |
nicklas |
var repaint = []; |
2803 |
14 Oct 14 |
nicklas |
749 |
|
2803 |
14 Oct 14 |
nicklas |
while (wi < wells.length && ci < copy.length) |
2803 |
14 Oct 14 |
nicklas |
751 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = wells[wi]; |
2803 |
14 Oct 14 |
nicklas |
var cp = copy[ci]; |
2803 |
14 Oct 14 |
nicklas |
var rna = null; |
2803 |
14 Oct 14 |
nicklas |
cp.well.doneWithCopy(); |
2803 |
14 Oct 14 |
nicklas |
repaint[repaint.length] = cp.well; |
2803 |
14 Oct 14 |
nicklas |
if (cp.name) |
2803 |
14 Oct 14 |
nicklas |
758 |
{ |
2803 |
14 Oct 14 |
nicklas |
rna = Rna.createByName(cp.name); |
2803 |
14 Oct 14 |
nicklas |
rna.comment = cp.comment; |
2803 |
14 Oct 14 |
nicklas |
761 |
} |
2803 |
14 Oct 14 |
nicklas |
else |
2803 |
14 Oct 14 |
nicklas |
763 |
{ |
2803 |
14 Oct 14 |
nicklas |
// The copy is from an empty well |
2803 |
14 Oct 14 |
nicklas |
if (askIfEmpty) |
2803 |
14 Oct 14 |
nicklas |
766 |
{ |
2803 |
14 Oct 14 |
nicklas |
askIfEmpty = false; |
2803 |
14 Oct 14 |
nicklas |
copyEmpty = confirm('Do you want to copy empty wells? If not, only non-empty well are copied.'); |
2803 |
14 Oct 14 |
nicklas |
769 |
} |
2803 |
14 Oct 14 |
nicklas |
770 |
} |
2803 |
14 Oct 14 |
nicklas |
if (rna != null || copyEmpty) |
2803 |
14 Oct 14 |
nicklas |
772 |
{ |
2803 |
14 Oct 14 |
nicklas |
well.setExtract(rna); |
2803 |
14 Oct 14 |
nicklas |
well.selected = false; |
2803 |
14 Oct 14 |
nicklas |
repaint[repaint.length] = well; |
2803 |
14 Oct 14 |
nicklas |
wi++; |
2803 |
14 Oct 14 |
nicklas |
777 |
} |
2803 |
14 Oct 14 |
nicklas |
ci++; |
2803 |
14 Oct 14 |
nicklas |
779 |
} |
2803 |
14 Oct 14 |
nicklas |
Plate.paint(repaint); |
2803 |
14 Oct 14 |
nicklas |
copy.splice(0, ci); |
2803 |
14 Oct 14 |
nicklas |
Plate.checkReplicates(); |
2803 |
14 Oct 14 |
nicklas |
783 |
} |
2803 |
14 Oct 14 |
nicklas |
784 |
|
2803 |
14 Oct 14 |
nicklas |
785 |
/* |
2803 |
14 Oct 14 |
nicklas |
If exactly two wells have been selected, switch the RNA in them. |
2803 |
14 Oct 14 |
nicklas |
787 |
*/ |
2803 |
14 Oct 14 |
nicklas |
selectrna.switchSelected = function(event) |
2803 |
14 Oct 14 |
nicklas |
789 |
{ |
2803 |
14 Oct 14 |
nicklas |
var wells = Plate.getSelected(); |
2803 |
14 Oct 14 |
nicklas |
791 |
|
2803 |
14 Oct 14 |
nicklas |
if (wells.length != 2) |
2803 |
14 Oct 14 |
nicklas |
793 |
{ |
2803 |
14 Oct 14 |
nicklas |
Forms.showNotification(event.currentTarget, 'Exactly 2 wells must be selected.'); |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
796 |
} |
2803 |
14 Oct 14 |
nicklas |
797 |
|
2803 |
14 Oct 14 |
nicklas |
var rna0 = wells[0].extract; |
2803 |
14 Oct 14 |
nicklas |
var rna1 = wells[1].extract; |
2803 |
14 Oct 14 |
nicklas |
800 |
|
2803 |
14 Oct 14 |
nicklas |
wells[0].setExtract(rna1); |
2803 |
14 Oct 14 |
nicklas |
wells[1].setExtract(rna0); |
2803 |
14 Oct 14 |
nicklas |
Plate.paint(wells); |
2803 |
14 Oct 14 |
nicklas |
804 |
} |
2803 |
14 Oct 14 |
nicklas |
805 |
|
2803 |
14 Oct 14 |
nicklas |
// Toggle the 'special select' menu on and off |
2803 |
14 Oct 14 |
nicklas |
selectrna.toggleSpecialSelect = function(event) |
2803 |
14 Oct 14 |
nicklas |
808 |
{ |
2803 |
14 Oct 14 |
nicklas |
var pos = Doc.getElementPosition('iconSpecialSelect'); |
2803 |
14 Oct 14 |
nicklas |
Menu.toggleTopMenu('menuSpecialSelect', pos.left+pos.width/4, pos.top+pos.height); |
2803 |
14 Oct 14 |
nicklas |
event.stopPropagation(); |
2803 |
14 Oct 14 |
nicklas |
812 |
} |
2803 |
14 Oct 14 |
nicklas |
813 |
|
2803 |
14 Oct 14 |
nicklas |
var contextRNA = null; |
2803 |
14 Oct 14 |
nicklas |
var contextX; |
2803 |
14 Oct 14 |
nicklas |
var contextY; |
2803 |
14 Oct 14 |
nicklas |
817 |
/** |
2803 |
14 Oct 14 |
nicklas |
Reacts to 'mouseup' and 'contextmenu' events for the bioplate. |
2803 |
14 Oct 14 |
nicklas |
This should bring up the cut/copy/paste context menu depending on which |
2803 |
14 Oct 14 |
nicklas |
mouse button that was clicked. |
2803 |
14 Oct 14 |
nicklas |
821 |
*/ |
2803 |
14 Oct 14 |
nicklas |
selectrna.contextEvent = function(event) |
2803 |
14 Oct 14 |
nicklas |
823 |
{ |
2803 |
14 Oct 14 |
nicklas |
// Context menu on 'right' mouse button |
2803 |
14 Oct 14 |
nicklas |
// Can't just check the button since two events are sent ('mouseup' and 'contextmenu') |
2803 |
14 Oct 14 |
nicklas |
var showContext = event.type == 'contextmenu' && event.button == 2; |
2803 |
14 Oct 14 |
nicklas |
827 |
|
2803 |
14 Oct 14 |
nicklas |
if (showContext) |
2803 |
14 Oct 14 |
nicklas |
829 |
{ |
2803 |
14 Oct 14 |
nicklas |
event.preventDefault(); // Prevents the default right-click menu from appearing |
2803 |
14 Oct 14 |
nicklas |
831 |
|
2803 |
14 Oct 14 |
nicklas |
// Get the well that is right-clicked and the RNA that is in it |
2803 |
14 Oct 14 |
nicklas |
contextRNA = null; |
2803 |
14 Oct 14 |
nicklas |
var well = event.target; |
2803 |
14 Oct 14 |
nicklas |
while (well && (!well.id || well.id.indexOf('well') != 0)) |
2803 |
14 Oct 14 |
nicklas |
836 |
{ |
2803 |
14 Oct 14 |
nicklas |
well = well.parentNode; |
2803 |
14 Oct 14 |
nicklas |
838 |
} |
2803 |
14 Oct 14 |
nicklas |
if (well) |
2803 |
14 Oct 14 |
nicklas |
840 |
{ |
2803 |
14 Oct 14 |
nicklas |
var c = well.id.split(/\./); |
2803 |
14 Oct 14 |
nicklas |
contextRNA = Plate.getWell(parseInt(c[1]), parseInt(c[2])).extract; |
2803 |
14 Oct 14 |
nicklas |
843 |
} |
2803 |
14 Oct 14 |
nicklas |
// Update the context meny |
2803 |
14 Oct 14 |
nicklas |
var caseSummaryMenu = Doc.element('mnuCaseSummary'); |
2803 |
14 Oct 14 |
nicklas |
if (contextRNA) |
2803 |
14 Oct 14 |
nicklas |
847 |
{ |
2803 |
14 Oct 14 |
nicklas |
caseSummaryMenu.title = 'Show case summary for ' + Strings.encodeTags(contextRNA.name); |
2803 |
14 Oct 14 |
nicklas |
Doc.show('sepCaseSummary'); |
2803 |
14 Oct 14 |
nicklas |
Doc.show('mnuCaseSummary'); |
2803 |
14 Oct 14 |
nicklas |
851 |
} |
2803 |
14 Oct 14 |
nicklas |
else |
2803 |
14 Oct 14 |
nicklas |
853 |
{ |
2803 |
14 Oct 14 |
nicklas |
Doc.hide('sepCaseSummary'); |
2803 |
14 Oct 14 |
nicklas |
Doc.hide('mnuCaseSummary'); |
2803 |
14 Oct 14 |
nicklas |
856 |
} |
2803 |
14 Oct 14 |
nicklas |
857 |
|
2803 |
14 Oct 14 |
nicklas |
var menu = Doc.element('menuContext'); |
2803 |
14 Oct 14 |
nicklas |
// 1 pixel offset to avoid losing well focus outline |
2803 |
14 Oct 14 |
nicklas |
contextX = event.clientX+1; |
2803 |
14 Oct 14 |
nicklas |
contextY = event.clientY+1; |
2803 |
14 Oct 14 |
nicklas |
// Need short delay since 'mouseup' are also sent as 'click' events |
2803 |
14 Oct 14 |
nicklas |
// to the 'document' object which BASE already have a Menu.hideAll() |
2803 |
14 Oct 14 |
nicklas |
// call which would hide the menu immediately |
2803 |
14 Oct 14 |
nicklas |
setTimeout(selectrna.showContextMenu, 100); |
2803 |
14 Oct 14 |
nicklas |
866 |
} |
2803 |
14 Oct 14 |
nicklas |
867 |
} |
2803 |
14 Oct 14 |
nicklas |
868 |
|
2803 |
14 Oct 14 |
nicklas |
selectrna.showContextMenu = function() |
2803 |
14 Oct 14 |
nicklas |
870 |
{ |
2803 |
14 Oct 14 |
nicklas |
Menu.showTopMenu('menuContext', contextX, contextY); |
2803 |
14 Oct 14 |
nicklas |
872 |
} |
2803 |
14 Oct 14 |
nicklas |
873 |
|
2803 |
14 Oct 14 |
nicklas |
selectrna.showCaseSummary = function() |
2803 |
14 Oct 14 |
nicklas |
875 |
{ |
2803 |
14 Oct 14 |
nicklas |
if (!contextRNA) return; |
5019 |
10 Oct 18 |
nicklas |
Reggie.openCaseSummaryPopup(contextRNA.name); |
2803 |
14 Oct 14 |
nicklas |
878 |
} |
2803 |
14 Oct 14 |
nicklas |
879 |
|
2803 |
14 Oct 14 |
nicklas |
selectrna.showFlaggedRna = function() |
2803 |
14 Oct 14 |
nicklas |
881 |
{ |
2803 |
14 Oct 14 |
nicklas |
currentSelected = Plate.getSelected(); |
2803 |
14 Oct 14 |
nicklas |
currentIndex = 0; |
2803 |
14 Oct 14 |
nicklas |
884 |
|
2803 |
14 Oct 14 |
nicklas |
var flagged = Rna.getFlagged(); |
2803 |
14 Oct 14 |
nicklas |
var url = 'show_flagged_rna.jsp?ID='+App.getSessionId(); |
2803 |
14 Oct 14 |
nicklas |
url += '&numFlagged='+flagged.length; |
2803 |
14 Oct 14 |
nicklas |
url += '&numSelected='+currentSelected.length; |
2803 |
14 Oct 14 |
nicklas |
Dialogs.openPopup(url, 'FlaggedRna', 800, 500); |
2803 |
14 Oct 14 |
nicklas |
890 |
} |
2803 |
14 Oct 14 |
nicklas |
891 |
|
2803 |
14 Oct 14 |
nicklas |
892 |
|
2803 |
14 Oct 14 |
nicklas |
//Flag the selected RNA |
2803 |
14 Oct 14 |
nicklas |
selectrna.flagSelected = function(event) |
2803 |
14 Oct 14 |
nicklas |
895 |
{ |
2803 |
14 Oct 14 |
nicklas |
var flag = Data.get(event.currentTarget, 'flag'); |
2803 |
14 Oct 14 |
nicklas |
var wells = Plate.getSelected(); |
2803 |
14 Oct 14 |
nicklas |
898 |
|
2803 |
14 Oct 14 |
nicklas |
if (wells.length == 0) |
2803 |
14 Oct 14 |
nicklas |
900 |
{ |
2803 |
14 Oct 14 |
nicklas |
Forms.showNotification(event.currentTarget, 'No wells have been selected.'); |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
903 |
} |
2803 |
14 Oct 14 |
nicklas |
904 |
|
2803 |
14 Oct 14 |
nicklas |
var comment = null; |
2803 |
14 Oct 14 |
nicklas |
if (flag == 'ManualFlag') |
2803 |
14 Oct 14 |
nicklas |
907 |
{ |
2803 |
14 Oct 14 |
nicklas |
// Check if a comment has been set on any of the RNA |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < wells.length; i++) |
2803 |
14 Oct 14 |
nicklas |
910 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = wells[i]; |
2803 |
14 Oct 14 |
nicklas |
if (well.extract && well.extract.info) |
2803 |
14 Oct 14 |
nicklas |
913 |
{ |
2803 |
14 Oct 14 |
nicklas |
if (well.extract.info.comment) comment = well.extract.info.comment; |
2803 |
14 Oct 14 |
nicklas |
915 |
} |
2803 |
14 Oct 14 |
nicklas |
916 |
} |
2803 |
14 Oct 14 |
nicklas |
comment = prompt('Comment', comment || ''); |
2803 |
14 Oct 14 |
nicklas |
if (!comment) return; |
2803 |
14 Oct 14 |
nicklas |
919 |
} |
2803 |
14 Oct 14 |
nicklas |
920 |
|
2803 |
14 Oct 14 |
nicklas |
var count = 0; |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < wells.length; i++) |
2803 |
14 Oct 14 |
nicklas |
923 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = wells[i]; |
2803 |
14 Oct 14 |
nicklas |
var rna = well.extract; |
2803 |
14 Oct 14 |
nicklas |
if (rna && !rna.stratagene && !rna.external) |
2803 |
14 Oct 14 |
nicklas |
927 |
{ |
2803 |
14 Oct 14 |
nicklas |
Rna.flag(rna, flag); |
2803 |
14 Oct 14 |
nicklas |
rna.info.comment = comment; |
2803 |
14 Oct 14 |
nicklas |
well.setExtract(null); |
2803 |
14 Oct 14 |
nicklas |
count++; |
2803 |
14 Oct 14 |
nicklas |
932 |
} |
2803 |
14 Oct 14 |
nicklas |
well.selected = false; |
2803 |
14 Oct 14 |
nicklas |
934 |
} |
2803 |
14 Oct 14 |
nicklas |
935 |
|
2803 |
14 Oct 14 |
nicklas |
selectrna.updateNumFlaggedRna(); |
2803 |
14 Oct 14 |
nicklas |
Plate.paint(wells); |
2803 |
14 Oct 14 |
nicklas |
938 |
} |
2803 |
14 Oct 14 |
nicklas |
939 |
|
2803 |
14 Oct 14 |
nicklas |
940 |
|
2803 |
14 Oct 14 |
nicklas |
selectrna.validateStep1 = function(event) |
2803 |
14 Oct 14 |
nicklas |
942 |
{ |
2803 |
14 Oct 14 |
nicklas |
var frm = document.forms['reggie']; |
2803 |
14 Oct 14 |
nicklas |
var numErrors = 0; |
2803 |
14 Oct 14 |
nicklas |
var numWarnings = 0; |
2803 |
14 Oct 14 |
nicklas |
var numRna = 0; |
2803 |
14 Oct 14 |
nicklas |
var numStratagene = 0; |
2803 |
14 Oct 14 |
nicklas |
var numExternal = 0; |
2803 |
14 Oct 14 |
nicklas |
var wells = Plate.getWells(); |
3289 |
30 Apr 15 |
nicklas |
var schema = PoolSchema.getById(frm.pool_schema.value); |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < wells.length; i++) |
2803 |
14 Oct 14 |
nicklas |
952 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = wells[i]; |
2803 |
14 Oct 14 |
nicklas |
var rna = well.extract; |
2803 |
14 Oct 14 |
nicklas |
if (well.hasWarning()) |
2803 |
14 Oct 14 |
nicklas |
956 |
{ |
2803 |
14 Oct 14 |
nicklas |
numWarnings++; |
2803 |
14 Oct 14 |
nicklas |
958 |
} |
2803 |
14 Oct 14 |
nicklas |
if (well.hasError()) |
2803 |
14 Oct 14 |
nicklas |
960 |
{ |
2803 |
14 Oct 14 |
nicklas |
numErrors++; |
2803 |
14 Oct 14 |
nicklas |
962 |
} |
2803 |
14 Oct 14 |
nicklas |
else |
2803 |
14 Oct 14 |
nicklas |
964 |
{ |
2803 |
14 Oct 14 |
nicklas |
if (rna && rna.id) |
2803 |
14 Oct 14 |
nicklas |
966 |
{ |
2803 |
14 Oct 14 |
nicklas |
numRna++; |
2803 |
14 Oct 14 |
nicklas |
if (rna.stratagene) numStratagene++; |
2803 |
14 Oct 14 |
nicklas |
if (rna.external) numExternal++; |
2803 |
14 Oct 14 |
nicklas |
970 |
} |
2803 |
14 Oct 14 |
nicklas |
971 |
} |
2803 |
14 Oct 14 |
nicklas |
972 |
} |
2803 |
14 Oct 14 |
nicklas |
973 |
|
2803 |
14 Oct 14 |
nicklas |
if (numErrors > 0) |
2803 |
14 Oct 14 |
nicklas |
975 |
{ |
2803 |
14 Oct 14 |
nicklas |
event.preventDefault(); |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
978 |
} |
2803 |
14 Oct 14 |
nicklas |
979 |
|
2803 |
14 Oct 14 |
nicklas |
if (numRna == 0) |
2803 |
14 Oct 14 |
nicklas |
981 |
{ |
2803 |
14 Oct 14 |
nicklas |
alert('There is no RNA in any wells'); |
2803 |
14 Oct 14 |
nicklas |
event.preventDefault(); |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
985 |
} |
2803 |
14 Oct 14 |
nicklas |
986 |
|
2803 |
14 Oct 14 |
nicklas |
if (numWarnings > 0) |
2803 |
14 Oct 14 |
nicklas |
988 |
{ |
2803 |
14 Oct 14 |
nicklas |
if (!confirm('There are ' + numWarnings + ' wells with a warning. Continue anyway?')) |
2803 |
14 Oct 14 |
nicklas |
990 |
{ |
2803 |
14 Oct 14 |
nicklas |
event.preventDefault(); |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
993 |
} |
2803 |
14 Oct 14 |
nicklas |
994 |
} |
2803 |
14 Oct 14 |
nicklas |
995 |
|
2803 |
14 Oct 14 |
nicklas |
if (schema) |
2803 |
14 Oct 14 |
nicklas |
997 |
{ |
2803 |
14 Oct 14 |
nicklas |
var numPrimary = schema.numPools * schema.numWellsPerPool; |
2803 |
14 Oct 14 |
nicklas |
if (numRna < numPrimary) |
2803 |
14 Oct 14 |
nicklas |
1000 |
{ |
2803 |
14 Oct 14 |
nicklas |
if (!confirm((numPrimary-numRna)+ ' primary wells are missing RNA. Continue anyway?')) |
2803 |
14 Oct 14 |
nicklas |
1002 |
{ |
2803 |
14 Oct 14 |
nicklas |
event.preventDefault(); |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
1005 |
} |
2803 |
14 Oct 14 |
nicklas |
1006 |
} |
2803 |
14 Oct 14 |
nicklas |
1007 |
} |
2803 |
14 Oct 14 |
nicklas |
1008 |
|
2803 |
14 Oct 14 |
nicklas |
if (numRna == numStratagene+numExternal) |
2803 |
14 Oct 14 |
nicklas |
1010 |
{ |
2803 |
14 Oct 14 |
nicklas |
if (!confirm('There are only wells with Stratagene or external RNA on this plate. Continue anyway?')) |
2803 |
14 Oct 14 |
nicklas |
1012 |
{ |
2803 |
14 Oct 14 |
nicklas |
event.preventDefault(); |
2803 |
14 Oct 14 |
nicklas |
return; |
2803 |
14 Oct 14 |
nicklas |
1015 |
} |
2803 |
14 Oct 14 |
nicklas |
1016 |
} |
2803 |
14 Oct 14 |
nicklas |
1017 |
|
2803 |
14 Oct 14 |
nicklas |
1018 |
} |
2803 |
14 Oct 14 |
nicklas |
1019 |
|
2803 |
14 Oct 14 |
nicklas |
selectrna.submit = function() |
2803 |
14 Oct 14 |
nicklas |
1021 |
{ |
2803 |
14 Oct 14 |
nicklas |
var frm = document.forms['reggie']; |
2803 |
14 Oct 14 |
nicklas |
1023 |
|
2803 |
14 Oct 14 |
nicklas |
var submitInfo = {}; |
2803 |
14 Oct 14 |
nicklas |
var plateInfo = {}; |
2803 |
14 Oct 14 |
nicklas |
var flaggedRnaInfo = []; |
2803 |
14 Oct 14 |
nicklas |
1027 |
|
5891 |
07 Apr 20 |
nicklas |
submitInfo.normalizationProtocol = parseInt(frm.normalizationProtocol.value); |
2803 |
14 Oct 14 |
nicklas |
submitInfo.bioplate = plateInfo; |
2803 |
14 Oct 14 |
nicklas |
submitInfo.flagged = flaggedRnaInfo; |
3302 |
04 May 15 |
nicklas |
var schema = PoolSchema.getById(frm.pool_schema.value); |
2803 |
14 Oct 14 |
nicklas |
1032 |
|
2803 |
14 Oct 14 |
nicklas |
plateInfo.name = Plate.name; |
2803 |
14 Oct 14 |
nicklas |
plateInfo.comments = frm.comments.value; |
5881 |
25 Mar 20 |
nicklas |
plateInfo.plateType = Data.get('page-data', 'plate-type'); |
2803 |
14 Oct 14 |
nicklas |
plateInfo.poolSchema = schema ? schema.id : null; |
5882 |
26 Mar 20 |
nicklas |
1037 |
|
2803 |
14 Oct 14 |
nicklas |
plateInfo.wells = []; |
2803 |
14 Oct 14 |
nicklas |
var wells = Plate.getWells(); |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < wells.length; i++) |
2803 |
14 Oct 14 |
nicklas |
1041 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = wells[i]; |
2803 |
14 Oct 14 |
nicklas |
var rna = well.extract; |
2803 |
14 Oct 14 |
nicklas |
if (rna && rna.id) |
2803 |
14 Oct 14 |
nicklas |
1045 |
{ |
2803 |
14 Oct 14 |
nicklas |
var tmp = {}; |
2803 |
14 Oct 14 |
nicklas |
tmp.row = well.row; |
2803 |
14 Oct 14 |
nicklas |
tmp.column = well.column; |
2803 |
14 Oct 14 |
nicklas |
tmp.rna = {}; |
2803 |
14 Oct 14 |
nicklas |
tmp.rna.id = rna.id; |
4377 |
02 Mar 17 |
nicklas |
tmp.rna.usedQuantity = rna.usedQuantity || (rna.qc ? QUANTITY_QC : QUANTITY_REGULAR); |
3303 |
04 May 15 |
nicklas |
tmp.rna.dilutionConc = rna.dilutionConc; |
3832 |
07 Apr 16 |
nicklas |
tmp.rna.dilutionVolume = TOTAL_VOLUME; |
3303 |
04 May 15 |
nicklas |
tmp.rna.qc = rna.qc; |
2803 |
14 Oct 14 |
nicklas |
tmp.rna.comment = rna.comment; |
3302 |
04 May 15 |
nicklas |
if (well.barcode) |
3302 |
04 May 15 |
nicklas |
1057 |
{ |
3302 |
04 May 15 |
nicklas |
tmp.rna.barcode = well.barcode; |
3302 |
04 May 15 |
nicklas |
1059 |
} |
2803 |
14 Oct 14 |
nicklas |
plateInfo.wells[plateInfo.wells.length] = tmp; |
2803 |
14 Oct 14 |
nicklas |
1061 |
} |
2803 |
14 Oct 14 |
nicklas |
1062 |
} |
2803 |
14 Oct 14 |
nicklas |
1063 |
|
2803 |
14 Oct 14 |
nicklas |
var flagged = Rna.getFlagged(); |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < flagged.length; i++) |
2803 |
14 Oct 14 |
nicklas |
1066 |
{ |
2803 |
14 Oct 14 |
nicklas |
var rna = flagged[i]; |
2803 |
14 Oct 14 |
nicklas |
var tmp = {}; |
2803 |
14 Oct 14 |
nicklas |
tmp.id = rna.id; |
2803 |
14 Oct 14 |
nicklas |
tmp.flag = rna.flag; |
2803 |
14 Oct 14 |
nicklas |
tmp.comment = rna.comment; |
2803 |
14 Oct 14 |
nicklas |
flaggedRnaInfo[flaggedRnaInfo.length] = tmp; |
2803 |
14 Oct 14 |
nicklas |
1073 |
} |
2803 |
14 Oct 14 |
nicklas |
var url = '../MRna.servlet?ID='+App.getSessionId(); |
3302 |
04 May 15 |
nicklas |
url += '&cmd=CreateMRnaOrLibPlate'; |
2803 |
14 Oct 14 |
nicklas |
Wizard.showLoadingAnimation('Performing registration...'); |
2803 |
14 Oct 14 |
nicklas |
Wizard.asyncJsonRequest(url, selectrna.submissionResults, 'POST', JSON.stringify(submitInfo)); |
2803 |
14 Oct 14 |
nicklas |
1078 |
} |
2803 |
14 Oct 14 |
nicklas |
1079 |
|
2803 |
14 Oct 14 |
nicklas |
selectrna.submissionResults = function(response) |
2803 |
14 Oct 14 |
nicklas |
1081 |
{ |
4650 |
08 Jan 18 |
nicklas |
window.removeEventListener('beforeunload', selectrna.confirmLeaveWizard); |
2803 |
14 Oct 14 |
nicklas |
Wizard.showFinalMessage(response.messages); |
2803 |
14 Oct 14 |
nicklas |
Doc.show('gorestart'); |
2803 |
14 Oct 14 |
nicklas |
1085 |
} |
2803 |
14 Oct 14 |
nicklas |
1086 |
|
2803 |
14 Oct 14 |
nicklas |
selectrna.initElements = function(element, autoInit) |
2803 |
14 Oct 14 |
nicklas |
1088 |
{ |
2803 |
14 Oct 14 |
nicklas |
if (autoInit == 'plate-col') |
2803 |
14 Oct 14 |
nicklas |
1090 |
{ |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler(element, 'click', selectrna.toggleColumn); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler(element, 'mouseover', selectrna.highlightColumn); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler(element, 'mouseout', selectrna.highlightColumn); |
2803 |
14 Oct 14 |
nicklas |
1094 |
} |
2803 |
14 Oct 14 |
nicklas |
else if (autoInit == 'plate-row') |
2803 |
14 Oct 14 |
nicklas |
1096 |
{ |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler(element, 'click', selectrna.toggleRow); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler(element, 'mouseover', selectrna.highlightRow); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler(element, 'mouseout', selectrna.highlightRow); |
2803 |
14 Oct 14 |
nicklas |
1100 |
} |
2803 |
14 Oct 14 |
nicklas |
else if (autoInit == 'plate-well') |
2803 |
14 Oct 14 |
nicklas |
1102 |
{ |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler(element, 'click', selectrna.toggleWell); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler(element, 'mouseover', selectrna.highlightReplicated); |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler(element, 'mouseout', selectrna.highlightReplicated); |
2803 |
14 Oct 14 |
nicklas |
1106 |
} |
2803 |
14 Oct 14 |
nicklas |
else if (autoInit == 'special-select') |
2803 |
14 Oct 14 |
nicklas |
1108 |
{ |
2803 |
14 Oct 14 |
nicklas |
Events.addEventHandler(element, 'click', selectrna.specialToggle) |
2803 |
14 Oct 14 |
nicklas |
1110 |
} |
2803 |
14 Oct 14 |
nicklas |
1111 |
} |
2803 |
14 Oct 14 |
nicklas |
1112 |
|
2803 |
14 Oct 14 |
nicklas |
// Toggle the selected status of a single well |
2803 |
14 Oct 14 |
nicklas |
selectrna.toggleWell = function(event) |
2803 |
14 Oct 14 |
nicklas |
1115 |
{ |
2803 |
14 Oct 14 |
nicklas |
var row = Data.int(event.currentTarget, 'row'); |
2803 |
14 Oct 14 |
nicklas |
var column = Data.int(event.currentTarget, 'col'); |
2803 |
14 Oct 14 |
nicklas |
var well = Plate.getWell(row, column); |
2803 |
14 Oct 14 |
nicklas |
Plate.toggleSelected([well]); |
2803 |
14 Oct 14 |
nicklas |
1120 |
} |
2803 |
14 Oct 14 |
nicklas |
1121 |
|
2803 |
14 Oct 14 |
nicklas |
// Toggle the selected status of a complete row |
2803 |
14 Oct 14 |
nicklas |
selectrna.toggleRow = function(event) |
2803 |
14 Oct 14 |
nicklas |
1124 |
{ |
2803 |
14 Oct 14 |
nicklas |
var row = Data.int(event.currentTarget, 'row'); |
2803 |
14 Oct 14 |
nicklas |
Plate.toggleSelected(Plate.getRow(row)); |
2803 |
14 Oct 14 |
nicklas |
1127 |
} |
2803 |
14 Oct 14 |
nicklas |
1128 |
|
2803 |
14 Oct 14 |
nicklas |
// Toggle the selected status of a complete column |
2803 |
14 Oct 14 |
nicklas |
selectrna.toggleColumn = function(event) |
2803 |
14 Oct 14 |
nicklas |
1131 |
{ |
2803 |
14 Oct 14 |
nicklas |
var column = Data.int(event.currentTarget, 'col'); |
2803 |
14 Oct 14 |
nicklas |
Plate.toggleSelected(Plate.getColumn(column)); |
2803 |
14 Oct 14 |
nicklas |
1134 |
} |
2803 |
14 Oct 14 |
nicklas |
1135 |
|
2803 |
14 Oct 14 |
nicklas |
// Toggle the selected status of a pool |
2803 |
14 Oct 14 |
nicklas |
selectrna.togglePool = function(event) |
2803 |
14 Oct 14 |
nicklas |
1138 |
{ |
2803 |
14 Oct 14 |
nicklas |
var pool = Data.int(event.target, 'pool-num'); |
2803 |
14 Oct 14 |
nicklas |
if (!isNaN(pool)) Plate.toggleSelected(Plate.getPool(pool)); |
2803 |
14 Oct 14 |
nicklas |
1141 |
} |
2803 |
14 Oct 14 |
nicklas |
1142 |
|
2803 |
14 Oct 14 |
nicklas |
// Highlight enable/disable all wells in a column |
2803 |
14 Oct 14 |
nicklas |
selectrna.highlightColumn = function(event) |
2803 |
14 Oct 14 |
nicklas |
1145 |
{ |
2803 |
14 Oct 14 |
nicklas |
var column = Data.int(event.currentTarget, 'col'); |
2803 |
14 Oct 14 |
nicklas |
var on = event.type == 'mouseover'; |
2803 |
14 Oct 14 |
nicklas |
1148 |
|
2803 |
14 Oct 14 |
nicklas |
Doc.addOrRemoveClass(event.currentTarget, 'highlight-column', on); |
2803 |
14 Oct 14 |
nicklas |
var wells = Plate.getColumn(column); |
2803 |
14 Oct 14 |
nicklas |
Plate.setHighlight(wells, 'highlight-column', on); |
2803 |
14 Oct 14 |
nicklas |
1152 |
} |
2803 |
14 Oct 14 |
nicklas |
1153 |
|
2803 |
14 Oct 14 |
nicklas |
// Highlight enable/disable all wells in a row |
2803 |
14 Oct 14 |
nicklas |
selectrna.highlightRow = function(event) |
2803 |
14 Oct 14 |
nicklas |
1156 |
{ |
2803 |
14 Oct 14 |
nicklas |
var row = Data.int(event.currentTarget, 'row'); |
2803 |
14 Oct 14 |
nicklas |
var on = event.type == 'mouseover'; |
2803 |
14 Oct 14 |
nicklas |
1159 |
|
2803 |
14 Oct 14 |
nicklas |
Doc.addOrRemoveClass(event.currentTarget, 'highlight-row', on); |
2803 |
14 Oct 14 |
nicklas |
var wells = Plate.getRow(row); |
2803 |
14 Oct 14 |
nicklas |
Plate.setHighlight(wells, 'highlight-row', on); |
2803 |
14 Oct 14 |
nicklas |
1163 |
} |
2803 |
14 Oct 14 |
nicklas |
1164 |
|
2803 |
14 Oct 14 |
nicklas |
// Highligt enable/disable all wells in a pool |
2803 |
14 Oct 14 |
nicklas |
selectrna.highlightPool = function(event) |
2803 |
14 Oct 14 |
nicklas |
1167 |
{ |
2803 |
14 Oct 14 |
nicklas |
var pool = Data.int(event.target, 'pool-num'); |
2803 |
14 Oct 14 |
nicklas |
var on = event.type == 'mouseover'; |
2803 |
14 Oct 14 |
nicklas |
if (!isNaN(pool)) |
2803 |
14 Oct 14 |
nicklas |
1171 |
{ |
2803 |
14 Oct 14 |
nicklas |
Doc.addOrRemoveClass(event.target, 'highlight-pool', on); |
2803 |
14 Oct 14 |
nicklas |
var wells = Plate.getPool(pool); |
2803 |
14 Oct 14 |
nicklas |
Plate.setHighlight(wells, 'highlight-pool', on); |
2803 |
14 Oct 14 |
nicklas |
1175 |
} |
2803 |
14 Oct 14 |
nicklas |
1176 |
} |
2803 |
14 Oct 14 |
nicklas |
1177 |
|
2803 |
14 Oct 14 |
nicklas |
1178 |
/** |
2803 |
14 Oct 14 |
nicklas |
Highlight all replicated wells with the same RNA as the given well. |
2803 |
14 Oct 14 |
nicklas |
1180 |
*/ |
2803 |
14 Oct 14 |
nicklas |
selectrna.highlightReplicated = function(event) |
2803 |
14 Oct 14 |
nicklas |
1182 |
{ |
2803 |
14 Oct 14 |
nicklas |
var column = Data.int(event.currentTarget, 'col'); |
2803 |
14 Oct 14 |
nicklas |
var row = Data.int(event.currentTarget, 'row'); |
2803 |
14 Oct 14 |
nicklas |
var on = event.type == 'mouseover'; |
2803 |
14 Oct 14 |
nicklas |
1186 |
|
2803 |
14 Oct 14 |
nicklas |
var well = Plate.getWell(row, column); |
2803 |
14 Oct 14 |
nicklas |
if (well.extract && well.replicate) |
2803 |
14 Oct 14 |
nicklas |
1189 |
{ |
2803 |
14 Oct 14 |
nicklas |
// Get center coordinates for the current well |
2803 |
14 Oct 14 |
nicklas |
var pos = Doc.getElementPosition(well.tag); |
2803 |
14 Oct 14 |
nicklas |
var jsPos = new jsPoint(pos.left+pos.width/2, pos.top+pos.height/2); |
2803 |
14 Oct 14 |
nicklas |
1193 |
|
2803 |
14 Oct 14 |
nicklas |
var replicated = Plate.getWellsByName(well.extract.name); |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < replicated.length; i++) |
2803 |
14 Oct 14 |
nicklas |
1196 |
{ |
2803 |
14 Oct 14 |
nicklas |
var rep = replicated[i]; |
2803 |
14 Oct 14 |
nicklas |
if (rep != well) |
2803 |
14 Oct 14 |
nicklas |
1199 |
{ |
2803 |
14 Oct 14 |
nicklas |
Doc.addOrRemoveClass(rep.tag, 'highlight-replicated', on); |
2803 |
14 Oct 14 |
nicklas |
if (rep.line) |
2803 |
14 Oct 14 |
nicklas |
1202 |
{ |
2803 |
14 Oct 14 |
nicklas |
// Clear any recent lines |
2803 |
14 Oct 14 |
nicklas |
graphics.clearDrawing(rep.line); |
2803 |
14 Oct 14 |
nicklas |
rep.line = null; |
2803 |
14 Oct 14 |
nicklas |
1206 |
} |
2803 |
14 Oct 14 |
nicklas |
if (on) |
2803 |
14 Oct 14 |
nicklas |
1208 |
{ |
2803 |
14 Oct 14 |
nicklas |
// We draw a line between the current and replicated well |
2803 |
14 Oct 14 |
nicklas |
var rPos = Doc.getElementPosition(rep.tag); |
2803 |
14 Oct 14 |
nicklas |
rep.line = graphics.drawLine(pen, jsPos, new jsPoint(rPos.left+rPos.width/2, rPos.top+rPos.height/2)); |
2803 |
14 Oct 14 |
nicklas |
1212 |
} |
2803 |
14 Oct 14 |
nicklas |
1213 |
} |
2803 |
14 Oct 14 |
nicklas |
1214 |
} |
2803 |
14 Oct 14 |
nicklas |
1215 |
} |
2803 |
14 Oct 14 |
nicklas |
1216 |
} |
2803 |
14 Oct 14 |
nicklas |
1217 |
|
2803 |
14 Oct 14 |
nicklas |
// Some special toogle operations |
2803 |
14 Oct 14 |
nicklas |
selectrna.specialToggle = function(event) |
2803 |
14 Oct 14 |
nicklas |
1220 |
{ |
2803 |
14 Oct 14 |
nicklas |
var what = Data.get(event.currentTarget, 'special'); |
2803 |
14 Oct 14 |
nicklas |
var wells = []; |
2803 |
14 Oct 14 |
nicklas |
if (what == 'all' || what == 'empty' || what == 'none') |
2803 |
14 Oct 14 |
nicklas |
1224 |
{ |
2803 |
14 Oct 14 |
nicklas |
// All wells or all empty (will be filtered later) |
2803 |
14 Oct 14 |
nicklas |
wells = Plate.getWells(); |
2803 |
14 Oct 14 |
nicklas |
1227 |
} |
2803 |
14 Oct 14 |
nicklas |
else if (what == 'pools' || what == 'empty-pools') |
2803 |
14 Oct 14 |
nicklas |
1229 |
{ |
2803 |
14 Oct 14 |
nicklas |
// All primary pools or all empty in the primary pools (will be filtered later) |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < Plate.poolSchema.numPools; i++) |
2803 |
14 Oct 14 |
nicklas |
1232 |
{ |
2803 |
14 Oct 14 |
nicklas |
wells = wells.concat(Plate.getPool(i)); |
2803 |
14 Oct 14 |
nicklas |
1234 |
} |
2803 |
14 Oct 14 |
nicklas |
1235 |
} |
2803 |
14 Oct 14 |
nicklas |
else if (what == 'stratagene') |
2803 |
14 Oct 14 |
nicklas |
1237 |
{ |
2803 |
14 Oct 14 |
nicklas |
// All wells with 'Stratagene' |
2803 |
14 Oct 14 |
nicklas |
var tmp = Plate.getWells(); |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < tmp.length; i++) |
2803 |
14 Oct 14 |
nicklas |
1241 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = tmp[i]; |
2803 |
14 Oct 14 |
nicklas |
if (well.extract && well.extract.stratagene) wells[wells.length] = well; |
2803 |
14 Oct 14 |
nicklas |
1244 |
} |
2803 |
14 Oct 14 |
nicklas |
1245 |
} |
2803 |
14 Oct 14 |
nicklas |
else if (what == 'external') |
2803 |
14 Oct 14 |
nicklas |
1247 |
{ |
2803 |
14 Oct 14 |
nicklas |
// All wells with 'External RNA' |
2803 |
14 Oct 14 |
nicklas |
var tmp = Plate.getWells(); |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < tmp.length; i++) |
2803 |
14 Oct 14 |
nicklas |
1251 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = tmp[i]; |
2803 |
14 Oct 14 |
nicklas |
if (well.extract && well.extract.external) wells[wells.length] = well; |
2803 |
14 Oct 14 |
nicklas |
1254 |
} |
2803 |
14 Oct 14 |
nicklas |
1255 |
} |
2803 |
14 Oct 14 |
nicklas |
else if (what == 'replicates') |
2803 |
14 Oct 14 |
nicklas |
1257 |
{ |
2803 |
14 Oct 14 |
nicklas |
// All wells with replicated RNA |
2803 |
14 Oct 14 |
nicklas |
var tmp = Plate.getWells(); |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < tmp.length; i++) |
2803 |
14 Oct 14 |
nicklas |
1261 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = tmp[i]; |
2803 |
14 Oct 14 |
nicklas |
if (well.extract && well.replicate) wells[wells.length] = well; |
2803 |
14 Oct 14 |
nicklas |
1264 |
} |
2803 |
14 Oct 14 |
nicklas |
1265 |
} |
2803 |
14 Oct 14 |
nicklas |
else if (what == 'error') |
2803 |
14 Oct 14 |
nicklas |
1267 |
{ |
2803 |
14 Oct 14 |
nicklas |
// All wells with an error |
2803 |
14 Oct 14 |
nicklas |
var tmp = Plate.getWells(); |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < tmp.length; i++) |
2803 |
14 Oct 14 |
nicklas |
1271 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = tmp[i]; |
2803 |
14 Oct 14 |
nicklas |
if (well.hasError()) wells[wells.length] = well; |
2803 |
14 Oct 14 |
nicklas |
1274 |
} |
2803 |
14 Oct 14 |
nicklas |
1275 |
} |
2803 |
14 Oct 14 |
nicklas |
else if (what == 'warning') |
2803 |
14 Oct 14 |
nicklas |
1277 |
{ |
2803 |
14 Oct 14 |
nicklas |
// All wells with a warning |
2803 |
14 Oct 14 |
nicklas |
var tmp = Plate.getWells(); |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < tmp.length; i++) |
2803 |
14 Oct 14 |
nicklas |
1281 |
{ |
2803 |
14 Oct 14 |
nicklas |
var well = tmp[i]; |
2803 |
14 Oct 14 |
nicklas |
if (well.warning) wells[wells.length] = well; |
2803 |
14 Oct 14 |
nicklas |
1284 |
} |
2803 |
14 Oct 14 |
nicklas |
1285 |
} |
2803 |
14 Oct 14 |
nicklas |
1286 |
|
2803 |
14 Oct 14 |
nicklas |
// Extra filter for empty wells only |
2803 |
14 Oct 14 |
nicklas |
if (what.indexOf('empty') != -1) |
2803 |
14 Oct 14 |
nicklas |
1289 |
{ |
2803 |
14 Oct 14 |
nicklas |
var tmp = wells; |
2803 |
14 Oct 14 |
nicklas |
wells = []; |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < tmp.length; i++) |
2803 |
14 Oct 14 |
nicklas |
1293 |
{ |
2803 |
14 Oct 14 |
nicklas |
if (!tmp[i].extract) wells[wells.length] = tmp[i]; |
2803 |
14 Oct 14 |
nicklas |
1295 |
} |
2803 |
14 Oct 14 |
nicklas |
1296 |
} |
2803 |
14 Oct 14 |
nicklas |
1297 |
|
2803 |
14 Oct 14 |
nicklas |
if (what == 'none') |
2803 |
14 Oct 14 |
nicklas |
1299 |
{ |
2803 |
14 Oct 14 |
nicklas |
Plate.setSelected(wells, false); |
2803 |
14 Oct 14 |
nicklas |
1301 |
} |
2803 |
14 Oct 14 |
nicklas |
else |
2803 |
14 Oct 14 |
nicklas |
1303 |
{ |
2803 |
14 Oct 14 |
nicklas |
Plate.toggleSelected(wells); |
2803 |
14 Oct 14 |
nicklas |
1305 |
} |
2803 |
14 Oct 14 |
nicklas |
1306 |
} |
2803 |
14 Oct 14 |
nicklas |
1307 |
|
2803 |
14 Oct 14 |
nicklas |
1308 |
|
2803 |
14 Oct 14 |
nicklas |
return selectrna; |
2803 |
14 Oct 14 |
nicklas |
1310 |
}(); |
2803 |
14 Oct 14 |
nicklas |
1311 |
|
2803 |
14 Oct 14 |
nicklas |
Doc.onLoad(SelectRna.initPage); |
2803 |
14 Oct 14 |
nicklas |
Doc.addElementInitializer(SelectRna.initElements); |
2803 |
14 Oct 14 |
nicklas |
1314 |
|
2803 |
14 Oct 14 |
nicklas |
1315 |
|
2803 |
14 Oct 14 |
nicklas |
var Rna = function() |
2803 |
14 Oct 14 |
nicklas |
1317 |
{ |
2803 |
14 Oct 14 |
nicklas |
var rna = {}; |
2803 |
14 Oct 14 |
nicklas |
var flagged = []; |
2803 |
14 Oct 14 |
nicklas |
var info = []; |
2803 |
14 Oct 14 |
nicklas |
1321 |
|
2803 |
14 Oct 14 |
nicklas |
1322 |
/** |
2803 |
14 Oct 14 |
nicklas |
Create a new RNA object by name. More information |
2803 |
14 Oct 14 |
nicklas |
about the RNA is automatically loaded from the database. |
2803 |
14 Oct 14 |
nicklas |
1325 |
*/ |
2803 |
14 Oct 14 |
nicklas |
rna.createByName = function(name) |
2803 |
14 Oct 14 |
nicklas |
1327 |
{ |
2803 |
14 Oct 14 |
nicklas |
var tmp = {}; |
2803 |
14 Oct 14 |
nicklas |
tmp.name = name; |
2803 |
14 Oct 14 |
nicklas |
tmp.stratagene = Reggie.isStratagene(name) |
2803 |
14 Oct 14 |
nicklas |
tmp.external = Reggie.isExternal(name); |
2803 |
14 Oct 14 |
nicklas |
tmp.info = rna.infoByName(name); |
2803 |
14 Oct 14 |
nicklas |
tmp.id = tmp.info.id; |
2803 |
14 Oct 14 |
nicklas |
return tmp; |
2803 |
14 Oct 14 |
nicklas |
1335 |
} |
2803 |
14 Oct 14 |
nicklas |
1336 |
|
2803 |
14 Oct 14 |
nicklas |
1337 |
/** |
2803 |
14 Oct 14 |
nicklas |
Create a new RNA object by info object. |
2803 |
14 Oct 14 |
nicklas |
1339 |
*/ |
2803 |
14 Oct 14 |
nicklas |
rna.createByInfo = function(info) |
2803 |
14 Oct 14 |
nicklas |
1341 |
{ |
2803 |
14 Oct 14 |
nicklas |
var tmp = {}; |
2803 |
14 Oct 14 |
nicklas |
tmp.name = info.name; |
2803 |
14 Oct 14 |
nicklas |
tmp.stratagene = Reggie.isStratagene(tmp.name); |
2803 |
14 Oct 14 |
nicklas |
tmp.external = Reggie.isExternal(tmp.name); |
2803 |
14 Oct 14 |
nicklas |
tmp.id = info.id; |
2803 |
14 Oct 14 |
nicklas |
tmp.info = info; |
2803 |
14 Oct 14 |
nicklas |
return tmp; |
2803 |
14 Oct 14 |
nicklas |
1349 |
} |
2803 |
14 Oct 14 |
nicklas |
1350 |
|
2803 |
14 Oct 14 |
nicklas |
1351 |
/** |
2803 |
14 Oct 14 |
nicklas |
Get information about a RNA item with a given name. |
2803 |
14 Oct 14 |
nicklas |
1353 |
*/ |
2803 |
14 Oct 14 |
nicklas |
rna.infoByName = function(name) |
2803 |
14 Oct 14 |
nicklas |
1355 |
{ |
2803 |
14 Oct 14 |
nicklas |
var key = 'N'+name; |
2803 |
14 Oct 14 |
nicklas |
if (!info[key]) |
2803 |
14 Oct 14 |
nicklas |
1358 |
{ |
2803 |
14 Oct 14 |
nicklas |
rna.loadInfoByNames([name]); |
2803 |
14 Oct 14 |
nicklas |
if (!info[key]) info[key] = {}; |
2803 |
14 Oct 14 |
nicklas |
1361 |
} |
2803 |
14 Oct 14 |
nicklas |
return info[key]; |
2803 |
14 Oct 14 |
nicklas |
1363 |
} |
2803 |
14 Oct 14 |
nicklas |
1364 |
|
2803 |
14 Oct 14 |
nicklas |
1365 |
/** |
2803 |
14 Oct 14 |
nicklas |
Load and cache RNA information for all RNA items with a name in the |
2803 |
14 Oct 14 |
nicklas |
given list. |
2803 |
14 Oct 14 |
nicklas |
1368 |
*/ |
2803 |
14 Oct 14 |
nicklas |
rna.loadInfoByNames = function(names) |
2803 |
14 Oct 14 |
nicklas |
1370 |
{ |
2808 |
15 Oct 14 |
nicklas |
var newNames = []; |
2808 |
15 Oct 14 |
nicklas |
for (var i = 0; i < names.length; i++) |
2808 |
15 Oct 14 |
nicklas |
1373 |
{ |
2808 |
15 Oct 14 |
nicklas |
if (!info['N'+names[i]]) newNames[newNames.length] = names[i]; |
2808 |
15 Oct 14 |
nicklas |
1375 |
} |
2808 |
15 Oct 14 |
nicklas |
1376 |
|
2803 |
14 Oct 14 |
nicklas |
var submitInfo = {}; |
2808 |
15 Oct 14 |
nicklas |
submitInfo.names = newNames; |
2808 |
15 Oct 14 |
nicklas |
1379 |
|
2808 |
15 Oct 14 |
nicklas |
if (newNames.length > 0) |
2808 |
15 Oct 14 |
nicklas |
1381 |
{ |
2808 |
15 Oct 14 |
nicklas |
var url = '../MRna.servlet?ID='+App.getSessionId(); |
2808 |
15 Oct 14 |
nicklas |
url += '&cmd=GetRnaInfoFromNames'; |
2808 |
15 Oct 14 |
nicklas |
var response = Wizard.syncJsonRequest(url, 'POST', JSON.stringify(submitInfo)); |
2808 |
15 Oct 14 |
nicklas |
rna.cacheInfo(response.rna); |
2808 |
15 Oct 14 |
nicklas |
1386 |
} |
2803 |
14 Oct 14 |
nicklas |
1387 |
} |
2803 |
14 Oct 14 |
nicklas |
1388 |
|
2803 |
14 Oct 14 |
nicklas |
rna.cacheInfo = function(rnaList) |
2803 |
14 Oct 14 |
nicklas |
1390 |
{ |
3645 |
03 Dec 15 |
nicklas |
if (!rnaList) return; |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < rnaList.length; i++) |
2803 |
14 Oct 14 |
nicklas |
1393 |
{ |
2803 |
14 Oct 14 |
nicklas |
var r = rnaList[i]; |
2803 |
14 Oct 14 |
nicklas |
info['N'+r.name] = r; |
2803 |
14 Oct 14 |
nicklas |
info['I'+r.id] = r; |
2803 |
14 Oct 14 |
nicklas |
if (r.flag) flagged[flagged.length] = r; |
2803 |
14 Oct 14 |
nicklas |
1398 |
} |
2803 |
14 Oct 14 |
nicklas |
1399 |
} |
2803 |
14 Oct 14 |
nicklas |
1400 |
|
2803 |
14 Oct 14 |
nicklas |
rna.unflag = function(r) |
2803 |
14 Oct 14 |
nicklas |
1402 |
{ |
2803 |
14 Oct 14 |
nicklas |
if (!r.info || !r.info.flag) return false; |
2803 |
14 Oct 14 |
nicklas |
1404 |
|
2803 |
14 Oct 14 |
nicklas |
r.info.flag = null; |
2803 |
14 Oct 14 |
nicklas |
for (var i = 0; i < flagged.length; i++) |
2803 |
14 Oct 14 |
nicklas |
1407 |
{ |
2803 |
14 Oct 14 |
nicklas |
if (r.id == flagged[i].id) |
2803 |
14 Oct 14 |
nicklas |
1409 |
{ |
2803 |
14 Oct 14 |
nicklas |
flagged.splice(i, 1); |
2803 |
14 Oct 14 |
nicklas |
break; |
2803 |
14 Oct 14 |
nicklas |
1412 |
} |
2803 |
14 Oct 14 |
nicklas |
1413 |
} |
2803 |
14 Oct 14 |
nicklas |
return true; |
2803 |
14 Oct 14 |
nicklas |
1415 |
} |
2803 |
14 Oct 14 |
nicklas |
1416 |
|
2803 |
14 Oct 14 |
nicklas |
rna.flag = function(r, flag) |
2803 |
14 Oct 14 |
nicklas |
1418 |
{ |
2803 |
14 Oct 14 |
nicklas |
if (!r.info || r.info.flag) return false; |
2803 |
14 Oct 14 |
nicklas |
r.info.flag = flag; |
2803 |
14 Oct 14 |
nicklas |
flagged[flagged.length] = r.info; |
2803 |
14 Oct 14 |
nicklas |
1422 |
} |
2803 |
14 Oct 14 |
nicklas |
1423 |
|
2803 |
14 Oct 14 |
nicklas |
rna.getFlagged = function() |
2803 |
14 Oct 14 |
nicklas |
1425 |
{ |
2803 |
14 Oct 14 |
nicklas |
return flagged; |
2803 |
14 Oct 14 |
nicklas |
1427 |
} |
2803 |
14 Oct 14 |
nicklas |
1428 |
|
2803 |
14 Oct 14 |
nicklas |
return rna; |
2803 |
14 Oct 14 |
nicklas |
1430 |
}(); |
2803 |
14 Oct 14 |
nicklas |
1431 |
|
2803 |
14 Oct 14 |
nicklas |
1432 |
|
2803 |
14 Oct 14 |
nicklas |
1433 |
|
2803 |
14 Oct 14 |
nicklas |
var WellPainter = function() |
2803 |
14 Oct 14 |
nicklas |
1435 |
{ |
2803 |
14 Oct 14 |
nicklas |
var painter = {}; |
2803 |
14 Oct 14 |
nicklas |
1437 |
|
2803 |
14 Oct 14 |
nicklas |
// Add class indicators for replicates and QC assigned wells |
2803 |
14 Oct 14 |
nicklas |
painter.getClassNameForWell = function(well) |
2803 |
14 Oct 14 |
nicklas |
1440 |
{ |
2803 |
14 Oct 14 |
nicklas |
var cls = ''; |
2803 |
14 Oct 14 |
nicklas |
if (well.extract) |
2803 |
14 Oct 14 |
nicklas |
1443 |
{ |
3757 |
18 Feb 16 |
nicklas |
var rna = well.extract; |
2803 |
14 Oct 14 |
nicklas |
if (well.replicate) cls += ' replicate'; |
3757 |
18 Feb 16 |
nicklas |
if (rna.qc) cls += ' qc'; |
3757 |
18 Feb 16 |
nicklas |
if (rna.info.specimen && rna.info.specimen.YellowLabel != null) |
3757 |
18 Feb 16 |
nicklas |
1448 |
{ |
3757 |
18 Feb 16 |
nicklas |
cls += ' yellow-specimen'; |
3757 |
18 Feb 16 |
nicklas |
1450 |
} |
2803 |
14 Oct 14 |
nicklas |
1451 |
} |
3297 |
30 Apr 15 |
nicklas |
if (well.column == Plate.columns-1) cls += ' last-child'; |
2803 |
14 Oct 14 |
nicklas |
return cls; |
2803 |
14 Oct 14 |
nicklas |
1454 |
} |
2803 |
14 Oct 14 |
nicklas |
1455 |
|
2803 |
14 Oct 14 |
nicklas |
painter.getWellText = function(well) |
2803 |
14 Oct 14 |
nicklas |
1457 |
{ |
2803 |
14 Oct 14 |
nicklas |
var text = ''; |
2803 |
14 Oct 14 |
nicklas |
if (well.duplicates) |
2803 |
14 Oct 14 |
nicklas |
1460 |
{ |
2803 |
14 Oct 14 |
nicklas |
well.setError('Duplicate RNA in this location'); |
2803 |
14 Oct 14 |
nicklas |
text += '<div class="name">'+Strings.encodeTags(well.duplicates.join(', '))+'</div>'; |
2803 |
14 Oct 14 |
nicklas |
1463 |
} |
2803 |
14 Oct 14 |
nicklas |
else if (well.extract) |
2803 |
14 Oct 14 |
nicklas |
1465 |
{ |
2803 |
14 Oct 14 |
nicklas |
// The well contains RNA |
2803 |
14 Oct 14 |
nicklas |
var rna = well.extract; |
2803 |
14 Oct 14 |
nicklas |
var info = rna.info; |
3757 |
18 Feb 16 |
nicklas |
text += '<div class="name if-yellow">'+Strings.encodeTags(rna.name)+'</div>'; |
2803 |
14 Oct 14 |
nicklas |
1470 |
|
2803 |
14 Oct 14 |
nicklas |
var warningMsg = []; |
2803 |
14 Oct 14 |
nicklas |
if (info.bioWell) |
2803 |
14 Oct 14 |
nicklas |
1473 |
{ |
2803 |
14 Oct 14 |
nicklas |
var rnaWell = info.bioWell; |
2803 |
14 Oct 14 |
nicklas |
text += '<div class="location">'+Strings.encodeTags(rnaWell.bioPlate.name+'['+rnaWell.location)+']</div>'; |
2803 |
14 Oct 14 |
nicklas |
1476 |
} |
2906 |
07 Nov 14 |
nicklas |
else if (info.preNormalized) |
2906 |
07 Nov 14 |
nicklas |
1478 |
{ |
2906 |
07 Nov 14 |
nicklas |
text += '<div class="location">PreNormalized</div>'; |
2906 |
07 Nov 14 |
nicklas |
1480 |
} |
2803 |
14 Oct 14 |
nicklas |
else if (!rna.stratagene && !rna.external) |
2803 |
14 Oct 14 |
nicklas |
1482 |
{ |
2803 |
14 Oct 14 |
nicklas |
warningMsg[warningMsg.length] = 'No location'; |
2803 |
14 Oct 14 |
nicklas |
1484 |
} |
2803 |
14 Oct 14 |
nicklas |
1485 |
|
5740 |
20 Nov 19 |
nicklas |
if (info && info.id && !rna.stratagene) |
2803 |
14 Oct 14 |
nicklas |
1487 |
{ |
4650 |
08 Jan 18 |
nicklas |
rna.usedQuantity = Math.max(Math.min(info.remainingQuantity, rna.qc ? QUANTITY_QC : QUANTITY_REGULAR), QUANTITY_MINIMAL); // µg |
3303 |
04 May 15 |
nicklas |
rna.dilutionConc = 1000 * rna.usedQuantity / TOTAL_VOLUME; // ng/µl |
3303 |
04 May 15 |
nicklas |
1490 |
|
6218 |
20 Apr 21 |
nicklas |
var volRNA = Math.ceil(10000*rna.usedQuantity/info.conc) / 10; // µl, rounded to 1 decimal |
3302 |
04 May 15 |
nicklas |
var water = TOTAL_VOLUME - volRNA; |
3301 |
04 May 15 |
nicklas |
1493 |
|
3302 |
04 May 15 |
nicklas |
if (volRNA < MINIMAL_RNA_VOLUME) |
3301 |
04 May 15 |
nicklas |
1495 |
{ |
3301 |
04 May 15 |
nicklas |
// Large mix since we do not want to take less than 1µl |
3302 |
04 May 15 |
nicklas |
volRNA = MINIMAL_RNA_VOLUME; |
6218 |
20 Apr 21 |
nicklas |
rna.usedQuantity = volRNA * info.conc / 1000; // µg |
3303 |
04 May 15 |
nicklas |
var totalVolume = 1000 * rna.usedQuantity / rna.dilutionConc; // µl |
3302 |
04 May 15 |
nicklas |
water = totalVolume - volRNA; |
3301 |
04 May 15 |
nicklas |
warningMsg[warningMsg.length] = 'Large mix'; |
3301 |
04 May 15 |
nicklas |
1502 |
} |
3832 |
07 Apr 16 |
nicklas |
else if (volRNA > TOTAL_VOLUME) |
3832 |
07 Apr 16 |
nicklas |
1504 |
{ |
4650 |
08 Jan 18 |
nicklas |
volRNA = TOTAL_VOLUME; |
6218 |
20 Apr 21 |
nicklas |
rna.usedQuantity = volRNA * info.conc / 1000; // µg |
6218 |
20 Apr 21 |
nicklas |
rna.dilutionConc = info.conc; |
4650 |
08 Jan 18 |
nicklas |
water = 0; |
3832 |
07 Apr 16 |
nicklas |
1509 |
} |
3301 |
04 May 15 |
nicklas |
1510 |
|
2803 |
14 Oct 14 |
nicklas |
if (info.remainingQuantity) |
2803 |
14 Oct 14 |
nicklas |
1512 |
{ |
3832 |
07 Apr 16 |
nicklas |
var useNanoGram = info.remainingQuantity < 0.5; |
3832 |
07 Apr 16 |
nicklas |
text += '<div class="quantity">'+(useNanoGram ? Reggie.formatNumber(info.remainingQuantity * 1000, 'ng', 1):Reggie.formatNumber(info.remainingQuantity, 'µg', 2)) + '</div>'; |
3832 |
07 Apr 16 |
nicklas |
1515 |
|
3832 |
07 Apr 16 |
nicklas |
if (info.remainingQuantity < rna.usedQuantity || rna.usedQuantity < QUANTITY_MINIMAL) |
2803 |
14 Oct 14 |
nicklas |
1517 |
{ |
3272 |
23 Apr 15 |
nicklas |
well.setError('Not enough RNA'); |
2803 |
14 Oct 14 |
nicklas |
1519 |
} |
2803 |
14 Oct 14 |
nicklas |
// Warning if near the limit |
2906 |
07 Nov 14 |
nicklas |
if (info.remainingQuantity < LOW_QUANTITY_WARNING_LIMIT && !info.preNormalized) |
2803 |
14 Oct 14 |
nicklas |
1522 |
{ |
2803 |
14 Oct 14 |
nicklas |
warningMsg[warningMsg.length] = 'Low quantity'; |
2803 |
14 Oct 14 |
nicklas |
1524 |
} |
2803 |
14 Oct 14 |
nicklas |
1525 |
} |
2803 |
14 Oct 14 |
nicklas |
else |
2803 |
14 Oct 14 |
nicklas |
1527 |
{ |
5740 |
20 Nov 19 |
nicklas |
if (!rna.external) warningMsg[warningMsg.length] = 'No quantity'; |
2803 |
14 Oct 14 |
nicklas |
1529 |
} |
2803 |
14 Oct 14 |
nicklas |
if (info.rqs) |
2803 |
14 Oct 14 |
nicklas |
1531 |
{ |
2803 |
14 Oct 14 |
nicklas |
text += '<div class="quality-score">RQS='+Numbers.formatNumber(info.rqs, 1) + '</div>'; |
2803 |
14 Oct 14 |
nicklas |
if (info.rqs < QUALITY_SCORE_WARNING_LIMIT) warningMsg[warningMsg.length] = 'Low RQS value'; |
2803 |
14 Oct 14 |
nicklas |
1534 |
} |
2803 |
14 Oct 14 |
nicklas |
else if (info.rin) |
2803 |
14 Oct 14 |
nicklas |
1536 |
{ |
2803 |
14 Oct 14 |
nicklas |
text += '<div class="quality-score">RIN='+Numbers.formatNumber(info.rin, 1) + '</div>'; |
2803 |
14 Oct 14 |
nicklas |
if (info.rin < QUALITY_SCORE_WARNING_LIMIT) warningMsg[warningMsg.length] = 'Low RIN value'; |
2803 |
14 Oct 14 |
nicklas |
1539 |
} |
5740 |
20 Nov 19 |
nicklas |
else if (!info.preNormalized && !rna.external) |
2803 |
14 Oct 14 |
nicklas |
1541 |
{ |
2803 |
14 Oct 14 |
nicklas |
warningMsg[warningMsg.length] = 'No RQS/RIN value'; |
2803 |
14 Oct 14 |
nicklas |
1543 |
} |
6218 |
20 Apr 21 |
nicklas |
if (info.conc) |
2803 |
14 Oct 14 |
nicklas |
1545 |
{ |
6218 |
20 Apr 21 |
nicklas |
text += '<div class="conc">'+Numbers.formatNumber(info.conc, 2) + 'ng/µl</div>'; |
3302 |
04 May 15 |
nicklas |
text += '<div class="volumes"><span class="volume">'+Numbers.formatNumber(volRNA, 1)+'</span> + <span class="water">'+Numbers.formatNumber(water, 1)+'µl</span></div>'; |
2803 |
14 Oct 14 |
nicklas |
1548 |
} |
5740 |
20 Nov 19 |
nicklas |
else |
2803 |
14 Oct 14 |
nicklas |
1550 |
{ |
6218 |
20 Apr 21 |
nicklas |
if (!rna.external) warningMsg[warningMsg.length] = 'No concentration'; |
2803 |
14 Oct 14 |
nicklas |
1552 |
} |
2906 |
07 Nov 14 |
nicklas |
if (info.QiacubeDate) |
2803 |
14 Oct 14 |
nicklas |
1554 |
{ |
2906 |
07 Nov 14 |
nicklas |
text += '<div class="qiacube-date">'+info.QiacubeDate+'</div>'; |
2803 |
14 Oct 14 |
nicklas |
1556 |
} |
2906 |
07 Nov 14 |
nicklas |
else if (info.DilutionDate) |
2906 |
07 Nov 14 |
nicklas |
1558 |
{ |
2906 |
07 Nov 14 |
nicklas |
text += '<div class="dilution-date">'+info.DilutionDate+'</div>'; |
2906 |
07 Nov 14 |
nicklas |
1560 |
} |
2803 |
14 Oct 14 |
nicklas |
else |
2803 |
14 Oct 14 |
nicklas |
1562 |
{ |
5740 |
20 Nov 19 |
nicklas |
if (!rna.external) warningMsg[warningMsg.length] = info.preNormalized ? 'No DilutionDate value' : 'No QiacubeDate value'; |
2803 |
14 Oct 14 |
nicklas |
1564 |
} |
3112 |
04 Feb 15 |
nicklas |
if (info.AutoProcessing) |
3112 |
04 Feb 15 |
nicklas |
1566 |
{ |
3112 |
04 Feb 15 |
nicklas |
warningMsg[warningMsg.length] = info.AutoProcessing; |
3112 |
04 Feb 15 |
nicklas |
1568 |
} |
4983 |
27 Sep 18 |
nicklas |
if (info.DO_NOT_USE) |
4983 |
27 Sep 18 |
nicklas |
1570 |
{ |
4983 |
27 Sep 18 |
nicklas |
warningMsg[warningMsg.length] = 'DoNotUse-'+Strings.encodeTags(info.DO_NOT_USE); |
4983 |
27 Sep 18 |
nicklas |
1572 |
} |
3757 |
18 Feb 16 |
nicklas |
1573 |
|
2803 |
14 Oct 14 |
nicklas |
1574 |
} |
2803 |
14 Oct 14 |
nicklas |
else if (!rna.id) |
2803 |
14 Oct 14 |
nicklas |
1576 |
{ |
2803 |
14 Oct 14 |
nicklas |
well.setError('RNA not found'); |
2803 |
14 Oct 14 |
nicklas |
1578 |
} |
2803 |
14 Oct 14 |
nicklas |
if (rna.comment) |
2803 |
14 Oct 14 |
nicklas |
1580 |
{ |
2803 |
14 Oct 14 |
nicklas |
text += '<div class="comment">'+Strings.encodeTags(rna.comment)+'</div>'; |
2803 |
14 Oct 14 |
nicklas |
1582 |
} |
2803 |
14 Oct 14 |
nicklas |
if (info && info.comment) |
2803 |
14 Oct 14 |
nicklas |
1584 |
{ |
2803 |
14 Oct 14 |
nicklas |
text += '<div class="comment">'+Strings.encodeTags(info.comment)+'</div>'; |
2803 |
14 Oct 14 |
nicklas |
1586 |
} |
2803 |
14 Oct 14 |
nicklas |
if (warningMsg.length > 0) |
2803 |
14 Oct 14 |
nicklas |
1588 |
{ |
2803 |
14 Oct 14 |
nicklas |
well.setWarning(warningMsg.join('; ')); |
2803 |
14 Oct 14 |
nicklas |
1590 |
} |
2803 |
14 Oct 14 |
nicklas |
1591 |
} |
2803 |
14 Oct 14 |
nicklas |
else if (well.copyText) |
2803 |
14 Oct 14 |
nicklas |
1593 |
{ |
2803 |
14 Oct 14 |
nicklas |
text = '<div class="copy-text">'+well.copyText+'</div>'; |
2803 |
14 Oct 14 |
nicklas |
1595 |
} |
2803 |
14 Oct 14 |
nicklas |
else |
2803 |
14 Oct 14 |
nicklas |
1597 |
{ |
2803 |
14 Oct 14 |
nicklas |
text = 'empty'; |
2803 |
14 Oct 14 |
nicklas |
1599 |
} |
3300 |
04 May 15 |
nicklas |
if (well.duplicate) |
3300 |
04 May 15 |
nicklas |
1601 |
{ |
3300 |
04 May 15 |
nicklas |
well.setError('Duplicate barcode'); |
3300 |
04 May 15 |
nicklas |
1603 |
} |
3297 |
30 Apr 15 |
nicklas |
1604 |
|
3297 |
30 Apr 15 |
nicklas |
var bc = Doc.element('barcode.'+well.row+'.'+well.column); |
3297 |
30 Apr 15 |
nicklas |
if (bc) |
3297 |
30 Apr 15 |
nicklas |
1607 |
{ |
3297 |
30 Apr 15 |
nicklas |
var cls = 'barcode-well' |
3297 |
30 Apr 15 |
nicklas |
cls += well.column == 0 ? ' barcode-left' : ' barcode-right'; |
3297 |
30 Apr 15 |
nicklas |
1610 |
|
3297 |
30 Apr 15 |
nicklas |
if (well.barcode) |
3297 |
30 Apr 15 |
nicklas |
1612 |
{ |
3297 |
30 Apr 15 |
nicklas |
bc.innerHTML = well.barcode.name; |
3297 |
30 Apr 15 |
nicklas |
var indexSet = painter.barcodeVariant ? painter.barcodeVariant.indexSets[well.column] : null; |
3297 |
30 Apr 15 |
nicklas |
if (indexSet) |
3297 |
30 Apr 15 |
nicklas |
1616 |
{ |
3297 |
30 Apr 15 |
nicklas |
cls += ' ' + indexSet.color; |
3297 |
30 Apr 15 |
nicklas |
1618 |
} |
3297 |
30 Apr 15 |
nicklas |
if (well.defaultBarcode && well.barcode != well.defaultBarcode) |
3297 |
30 Apr 15 |
nicklas |
1620 |
{ |
3297 |
30 Apr 15 |
nicklas |
cls += ' bg-modified'; |
3297 |
30 Apr 15 |
nicklas |
1622 |
} |
3297 |
30 Apr 15 |
nicklas |
if (well.duplicate) |
3297 |
30 Apr 15 |
nicklas |
1624 |
{ |
3297 |
30 Apr 15 |
nicklas |
cls += ' duplicate'; |
3297 |
30 Apr 15 |
nicklas |
1626 |
} |
3297 |
30 Apr 15 |
nicklas |
1627 |
} |
3297 |
30 Apr 15 |
nicklas |
bc.className = cls; |
3297 |
30 Apr 15 |
nicklas |
1629 |
} |
2803 |
14 Oct 14 |
nicklas |
return text; |
2803 |
14 Oct 14 |
nicklas |
1631 |
} |
2803 |
14 Oct 14 |
nicklas |
1632 |
|
2803 |
14 Oct 14 |
nicklas |
return painter; |
2803 |
14 Oct 14 |
nicklas |
1634 |
}(); |