2668 |
15 Sep 14 |
nicklas |
var Protocol = function() |
2668 |
15 Sep 14 |
nicklas |
2 |
{ |
2668 |
15 Sep 14 |
nicklas |
var protocol = {}; |
2702 |
26 Sep 14 |
nicklas |
var debug = 0; |
2668 |
15 Sep 14 |
nicklas |
5 |
|
2668 |
15 Sep 14 |
nicklas |
var LOW_QUANTITY_WARNING_FACTOR = 2; |
3832 |
07 Apr 16 |
nicklas |
var DEFAULT_DILUTION_VOLUME = 50; //µl |
2668 |
15 Sep 14 |
nicklas |
8 |
|
2668 |
15 Sep 14 |
nicklas |
// Page initialization |
2668 |
15 Sep 14 |
nicklas |
protocol.initPage = function() |
2668 |
15 Sep 14 |
nicklas |
11 |
{ |
2668 |
15 Sep 14 |
nicklas |
var pageId = Doc.getPageId(); |
2668 |
15 Sep 14 |
nicklas |
if (pageId == 'protocol') |
2668 |
15 Sep 14 |
nicklas |
14 |
{ |
2668 |
15 Sep 14 |
nicklas |
Buttons.addClickHandler('print-button', Wizard.goPrint); |
2668 |
15 Sep 14 |
nicklas |
16 |
|
2668 |
15 Sep 14 |
nicklas |
var mrnaPlateId = Data.int('page-data', 'mrna-plate'); |
2668 |
15 Sep 14 |
nicklas |
18 |
|
2668 |
15 Sep 14 |
nicklas |
var url = '../MRna.servlet?ID='+App.getSessionId(); |
2668 |
15 Sep 14 |
nicklas |
url += '&cmd=GetMRnaInfoForPlate&bioplate='+mrnaPlateId; |
2668 |
15 Sep 14 |
nicklas |
Wizard.showLoadingAnimation('Loading mRNA bioplate information...'); |
2668 |
15 Sep 14 |
nicklas |
Wizard.asyncJsonRequest(url, protocol.initializeProtocol); |
2668 |
15 Sep 14 |
nicklas |
23 |
} |
2668 |
15 Sep 14 |
nicklas |
else |
2668 |
15 Sep 14 |
nicklas |
25 |
{ |
2668 |
15 Sep 14 |
nicklas |
Events.addEventHandler('bioplate', 'change', protocol.bioplateOnChange); |
2668 |
15 Sep 14 |
nicklas |
Events.addEventHandler('listview', 'click', protocol.viewProtocol); |
2668 |
15 Sep 14 |
nicklas |
Events.addEventHandler('plateview', 'click', protocol.viewProtocol); |
2842 |
20 Oct 14 |
nicklas |
Events.addEventHandler('stratageneConc', 'keypress', Events.numberOnly); |
2668 |
15 Sep 14 |
nicklas |
30 |
|
2668 |
15 Sep 14 |
nicklas |
var url = '../MRna.servlet?ID='+App.getSessionId(); |
2668 |
15 Sep 14 |
nicklas |
url += '&cmd=GetUnprocessedPlates&plateType=MRNA'; |
2668 |
15 Sep 14 |
nicklas |
Wizard.showLoadingAnimation('Loading mRNA plates...'); |
2668 |
15 Sep 14 |
nicklas |
Wizard.asyncJsonRequest(url, protocol.initializeStep1); |
2668 |
15 Sep 14 |
nicklas |
35 |
} |
2668 |
15 Sep 14 |
nicklas |
36 |
} |
2668 |
15 Sep 14 |
nicklas |
37 |
|
2668 |
15 Sep 14 |
nicklas |
38 |
|
2668 |
15 Sep 14 |
nicklas |
protocol.initializeStep1 = function(response) |
2668 |
15 Sep 14 |
nicklas |
40 |
{ |
2668 |
15 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2668 |
15 Sep 14 |
nicklas |
42 |
|
2668 |
15 Sep 14 |
nicklas |
var bioplates = response.bioplates; |
2668 |
15 Sep 14 |
nicklas |
var plates = frm.bioplate; |
2668 |
15 Sep 14 |
nicklas |
if (bioplates.length > 0) |
2668 |
15 Sep 14 |
nicklas |
46 |
{ |
2668 |
15 Sep 14 |
nicklas |
for (var i=0; i < bioplates.length; i++) |
2668 |
15 Sep 14 |
nicklas |
48 |
{ |
2668 |
15 Sep 14 |
nicklas |
var bioplate = bioplates[i]; |
2668 |
15 Sep 14 |
nicklas |
var name = bioplate.name; |
2906 |
07 Nov 14 |
nicklas |
if (bioplate.AutoProcessing == 'PreNormalizeRNA') |
2668 |
15 Sep 14 |
nicklas |
52 |
{ |
2906 |
07 Nov 14 |
nicklas |
name += ' (pre-normalized)'; |
2906 |
07 Nov 14 |
nicklas |
54 |
} |
2906 |
07 Nov 14 |
nicklas |
else if (bioplate.DilutionDate) |
2906 |
07 Nov 14 |
nicklas |
56 |
{ |
2668 |
15 Sep 14 |
nicklas |
name += ' (diluted ' + Reggie.reformatDate(bioplate.DilutionDate) + ')'; |
2668 |
15 Sep 14 |
nicklas |
58 |
} |
2668 |
15 Sep 14 |
nicklas |
var option = new Option(name, bioplate.id); |
2668 |
15 Sep 14 |
nicklas |
option.bioplate = bioplate; |
2668 |
15 Sep 14 |
nicklas |
plates.options[plates.length] = option; |
2668 |
15 Sep 14 |
nicklas |
62 |
} |
2668 |
15 Sep 14 |
nicklas |
bioplateIsValid = true; |
2668 |
15 Sep 14 |
nicklas |
64 |
|
2668 |
15 Sep 14 |
nicklas |
protocol.bioplateOnChange(); |
2668 |
15 Sep 14 |
nicklas |
protocol.loadStratageneConc(); |
2668 |
15 Sep 14 |
nicklas |
67 |
} |
2668 |
15 Sep 14 |
nicklas |
else |
2668 |
15 Sep 14 |
nicklas |
69 |
{ |
2668 |
15 Sep 14 |
nicklas |
Wizard.setFatalError('No mRNA bioplates available for processing.'); |
2668 |
15 Sep 14 |
nicklas |
return; |
2668 |
15 Sep 14 |
nicklas |
72 |
} |
2668 |
15 Sep 14 |
nicklas |
73 |
|
2668 |
15 Sep 14 |
nicklas |
Doc.show('step-1'); |
2668 |
15 Sep 14 |
nicklas |
Doc.show('gonext'); |
2668 |
15 Sep 14 |
nicklas |
76 |
} |
2668 |
15 Sep 14 |
nicklas |
77 |
|
2668 |
15 Sep 14 |
nicklas |
78 |
|
2668 |
15 Sep 14 |
nicklas |
// Add pools to the pools list based on the bioplate selection |
2668 |
15 Sep 14 |
nicklas |
protocol.bioplateOnChange = function() |
2668 |
15 Sep 14 |
nicklas |
81 |
{ |
2668 |
15 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2668 |
15 Sep 14 |
nicklas |
var bioplate = frm.bioplate[frm.bioplate.selectedIndex].bioplate; |
2668 |
15 Sep 14 |
nicklas |
Doc.element('comments').innerHTML = Strings.encodeTags(bioplate.comments); |
2668 |
15 Sep 14 |
nicklas |
frm.poolSchema.value = bioplate.poolSchema; |
2668 |
15 Sep 14 |
nicklas |
86 |
} |
2668 |
15 Sep 14 |
nicklas |
87 |
|
2668 |
15 Sep 14 |
nicklas |
protocol.saveStratageneConc = function() |
2668 |
15 Sep 14 |
nicklas |
89 |
{ |
2668 |
15 Sep 14 |
nicklas |
if (!window.localStorage) return; |
2668 |
15 Sep 14 |
nicklas |
91 |
|
2668 |
15 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2668 |
15 Sep 14 |
nicklas |
var stratageneInfo = new Object(); |
2668 |
15 Sep 14 |
nicklas |
stratageneInfo.conc = frm.stratageneConc.value; |
2668 |
15 Sep 14 |
nicklas |
window.localStorage.setItem('reggie.stratagene-info', JSON.stringify(stratageneInfo)); |
2668 |
15 Sep 14 |
nicklas |
96 |
} |
2668 |
15 Sep 14 |
nicklas |
97 |
|
2668 |
15 Sep 14 |
nicklas |
protocol.loadStratageneConc = function() |
2668 |
15 Sep 14 |
nicklas |
99 |
{ |
2668 |
15 Sep 14 |
nicklas |
if (!window.localStorage) return; |
2668 |
15 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2668 |
15 Sep 14 |
nicklas |
102 |
|
2668 |
15 Sep 14 |
nicklas |
var stratageneInfo = JSON.parse(window.localStorage.getItem('reggie.stratagene-info')); |
2668 |
15 Sep 14 |
nicklas |
if (stratageneInfo) |
2668 |
15 Sep 14 |
nicklas |
105 |
{ |
2668 |
15 Sep 14 |
nicklas |
frm.stratageneConc.value = stratageneInfo.conc; |
2668 |
15 Sep 14 |
nicklas |
107 |
} |
2668 |
15 Sep 14 |
nicklas |
108 |
} |
2668 |
15 Sep 14 |
nicklas |
109 |
|
2668 |
15 Sep 14 |
nicklas |
protocol.viewProtocol = function(event) |
2668 |
15 Sep 14 |
nicklas |
111 |
{ |
2668 |
15 Sep 14 |
nicklas |
protocol.saveStratageneConc(); |
2668 |
15 Sep 14 |
nicklas |
113 |
|
2668 |
15 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2668 |
15 Sep 14 |
nicklas |
if (frm.bioplate && !frm.bioplate.disabled) |
2668 |
15 Sep 14 |
nicklas |
116 |
{ |
2668 |
15 Sep 14 |
nicklas |
frm.view.value = Data.get(event.currentTarget, 'protocol-type'); |
2668 |
15 Sep 14 |
nicklas |
frm.submit(); |
2668 |
15 Sep 14 |
nicklas |
119 |
} |
2668 |
15 Sep 14 |
nicklas |
120 |
} |
2668 |
15 Sep 14 |
nicklas |
121 |
|
2668 |
15 Sep 14 |
nicklas |
122 |
|
2668 |
15 Sep 14 |
nicklas |
protocol.initializeProtocol = function(response) |
2668 |
15 Sep 14 |
nicklas |
124 |
{ |
2668 |
15 Sep 14 |
nicklas |
var plate = response.plate; |
2668 |
15 Sep 14 |
nicklas |
if (plate.DilutionDate) |
2668 |
15 Sep 14 |
nicklas |
127 |
{ |
2668 |
15 Sep 14 |
nicklas |
Doc.element('dilution-date').innerHTML = Reggie.reformatDate(plate.DilutionDate); |
2668 |
15 Sep 14 |
nicklas |
Doc.element('dilution-operator').innerHTML = Strings.encodeTags(plate.DilutionOperator); |
2668 |
15 Sep 14 |
nicklas |
130 |
} |
2668 |
15 Sep 14 |
nicklas |
131 |
|
2668 |
15 Sep 14 |
nicklas |
var list = response.mrna; |
2668 |
15 Sep 14 |
nicklas |
var stratageneConc = Data.float('page-data', 'stratagene-conc'); |
2668 |
15 Sep 14 |
nicklas |
134 |
|
2668 |
15 Sep 14 |
nicklas |
// Pre-process the return mRNA items |
2906 |
07 Nov 14 |
nicklas |
var allPreNormalized = true; |
6727 |
05 May 22 |
nicklas |
var showLabelColumn = false; |
2668 |
15 Sep 14 |
nicklas |
for (var i = 0; i < list.length; i++) |
2668 |
15 Sep 14 |
nicklas |
139 |
{ |
6727 |
05 May 22 |
nicklas |
var rna = list[i].rna; |
6727 |
05 May 22 |
nicklas |
allPreNormalized &= rna.preNormalized; |
6727 |
05 May 22 |
nicklas |
if (rna.label) showLabelColumn = true; |
2668 |
15 Sep 14 |
nicklas |
protocol.checkAndPreProcessMRna(list[i], stratageneConc); |
2668 |
15 Sep 14 |
nicklas |
144 |
} |
2668 |
15 Sep 14 |
nicklas |
145 |
|
2668 |
15 Sep 14 |
nicklas |
var view = Data.get('page-data', 'view'); |
2668 |
15 Sep 14 |
nicklas |
if (view == 'list') |
2668 |
15 Sep 14 |
nicklas |
148 |
{ |
2668 |
15 Sep 14 |
nicklas |
protocol.viewAsList(list); |
6727 |
05 May 22 |
nicklas |
if (showLabelColumn) |
6727 |
05 May 22 |
nicklas |
151 |
{ |
6727 |
05 May 22 |
nicklas |
Doc.removeClass('listview', 'nolabels'); |
6727 |
05 May 22 |
nicklas |
Doc.show('protocol-footer'); |
6727 |
05 May 22 |
nicklas |
154 |
} |
2668 |
15 Sep 14 |
nicklas |
155 |
} |
2668 |
15 Sep 14 |
nicklas |
else |
2668 |
15 Sep 14 |
nicklas |
157 |
{ |
2668 |
15 Sep 14 |
nicklas |
protocol.viewAsPlate(plate, list) |
2668 |
15 Sep 14 |
nicklas |
159 |
} |
2906 |
07 Nov 14 |
nicklas |
if (allPreNormalized) |
2906 |
07 Nov 14 |
nicklas |
161 |
{ |
2906 |
07 Nov 14 |
nicklas |
Doc.element('dilution-date').innerHTML = 'PreNormalized'; |
2906 |
07 Nov 14 |
nicklas |
163 |
} |
2668 |
15 Sep 14 |
nicklas |
164 |
} |
2668 |
15 Sep 14 |
nicklas |
165 |
|
2668 |
15 Sep 14 |
nicklas |
protocol.checkAndPreProcessMRna = function(mrna, stratageneConc) |
2668 |
15 Sep 14 |
nicklas |
167 |
{ |
2668 |
15 Sep 14 |
nicklas |
var rna = mrna.rna; |
2668 |
15 Sep 14 |
nicklas |
// Set the 'stratagene' flag |
2668 |
15 Sep 14 |
nicklas |
rna.stratagene = Reggie.isStratagene(rna.name); |
2668 |
15 Sep 14 |
nicklas |
rna.external = Reggie.isExternal(rna.name); |
3757 |
18 Feb 16 |
nicklas |
rna.isYellow = rna.specimen && rna.specimen.YellowLabel != null; |
3833 |
08 Apr 16 |
nicklas |
if (!mrna.DilutionVolume) mrna.DilutionVolume = DEFAULT_DILUTION_VOLUME; |
2668 |
15 Sep 14 |
nicklas |
174 |
|
3303 |
04 May 15 |
nicklas |
// Set the 'QC' flag |
3303 |
04 May 15 |
nicklas |
rna.qc = mrna.UseForQC; |
2668 |
15 Sep 14 |
nicklas |
177 |
|
2668 |
15 Sep 14 |
nicklas |
if (stratageneConc > 0) |
2668 |
15 Sep 14 |
nicklas |
179 |
{ |
6218 |
20 Apr 21 |
nicklas |
if (rna.stratagene && !rna.conc) rna.conc = stratageneConc; |
2668 |
15 Sep 14 |
nicklas |
181 |
} |
2668 |
15 Sep 14 |
nicklas |
182 |
|
2668 |
15 Sep 14 |
nicklas |
// Calculate volume to use and water to add based on concentration |
3303 |
04 May 15 |
nicklas |
var remarks = []; |
6218 |
20 Apr 21 |
nicklas |
if (rna.conc && rna.usedQuantity) |
2668 |
15 Sep 14 |
nicklas |
186 |
{ |
6218 |
20 Apr 21 |
nicklas |
rna.volume = Math.ceil(10000*rna.usedQuantity/rna.conc) / 10; // µl |
3833 |
08 Apr 16 |
nicklas |
188 |
|
3833 |
08 Apr 16 |
nicklas |
var totalVolume = mrna.DilutionConc ? 1000 * rna.usedQuantity / mrna.DilutionConc : mrna.DilutionVolume; |
3833 |
08 Apr 16 |
nicklas |
if (totalVolume < mrna.DilutionVolume) |
2906 |
07 Nov 14 |
nicklas |
191 |
{ |
3833 |
08 Apr 16 |
nicklas |
totalVolume = mrna.DilutionVolume; |
2906 |
07 Nov 14 |
nicklas |
193 |
} |
5740 |
20 Nov 19 |
nicklas |
else if (totalVolume - 0.05 > mrna.DilutionVolume) // Use 0.05 to avoid issues with 50.0000000001 > 50.0 |
2906 |
07 Nov 14 |
nicklas |
195 |
{ |
3833 |
08 Apr 16 |
nicklas |
remarks[remarks.length] = 'Large mix; Use '+Reggie.formatNumber(mrna.DilutionVolume, 'µl', 1); |
2906 |
07 Nov 14 |
nicklas |
197 |
} |
3833 |
08 Apr 16 |
nicklas |
rna.water = totalVolume-rna.volume; |
2668 |
15 Sep 14 |
nicklas |
199 |
} |
2668 |
15 Sep 14 |
nicklas |
200 |
|
2668 |
15 Sep 14 |
nicklas |
// check for some issues that may indicate problems |
2668 |
15 Sep 14 |
nicklas |
if (rna.qc) remarks[remarks.length] = 'QC'; |
2668 |
15 Sep 14 |
nicklas |
if (!rna.stratagene && !rna.external) |
2668 |
15 Sep 14 |
nicklas |
204 |
{ |
2906 |
07 Nov 14 |
nicklas |
if (!rna.bioWell && !rna.preNormalized) |
2668 |
15 Sep 14 |
nicklas |
206 |
{ |
2668 |
15 Sep 14 |
nicklas |
remarks[remarks.length] = 'No location'; |
2668 |
15 Sep 14 |
nicklas |
208 |
} |
2668 |
15 Sep 14 |
nicklas |
if (!rna.remainingQuantity) |
2668 |
15 Sep 14 |
nicklas |
210 |
{ |
2668 |
15 Sep 14 |
nicklas |
remarks[remarks.length] = 'No quantity'; |
2668 |
15 Sep 14 |
nicklas |
212 |
} |
3272 |
23 Apr 15 |
nicklas |
else if (rna.remainingQuantity < rna.usedQuantity) |
3272 |
23 Apr 15 |
nicklas |
214 |
{ |
3272 |
23 Apr 15 |
nicklas |
remarks[remarks.length] = 'Not enough RNA'; |
3272 |
23 Apr 15 |
nicklas |
216 |
} |
3303 |
04 May 15 |
nicklas |
else if (rna.remainingQuantity < rna.usedQuantity * LOW_QUANTITY_WARNING_FACTOR && !rna.preNormalized) |
2668 |
15 Sep 14 |
nicklas |
218 |
{ |
2668 |
15 Sep 14 |
nicklas |
remarks[remarks.length] = 'Low quantity'; |
2668 |
15 Sep 14 |
nicklas |
220 |
} |
6218 |
20 Apr 21 |
nicklas |
if (!rna.conc) |
2668 |
15 Sep 14 |
nicklas |
222 |
{ |
6218 |
20 Apr 21 |
nicklas |
remarks[remarks.length] = 'No concentration'; |
2668 |
15 Sep 14 |
nicklas |
224 |
} |
2668 |
15 Sep 14 |
nicklas |
225 |
} |
5552 |
12 Aug 19 |
nicklas |
else |
2668 |
15 Sep 14 |
nicklas |
227 |
{ |
6218 |
20 Apr 21 |
nicklas |
if (!rna.conc && rna.usedQuantity) |
2668 |
15 Sep 14 |
nicklas |
229 |
{ |
2668 |
15 Sep 14 |
nicklas |
remarks[remarks.length] = 'Use ' + Numbers.formatNumber(rna.usedQuantity, 2) + ' µg RNA'; |
2668 |
15 Sep 14 |
nicklas |
231 |
} |
2668 |
15 Sep 14 |
nicklas |
232 |
} |
2668 |
15 Sep 14 |
nicklas |
if (mrna.comment) remarks[remarks.length] = mrna.comment; |
2668 |
15 Sep 14 |
nicklas |
rna.remarks = remarks; |
2668 |
15 Sep 14 |
nicklas |
235 |
} |
2668 |
15 Sep 14 |
nicklas |
236 |
|
2668 |
15 Sep 14 |
nicklas |
protocol.viewAsPlate = function(plate, list) |
2668 |
15 Sep 14 |
nicklas |
238 |
{ |
3299 |
04 May 15 |
nicklas |
var schema = PoolSchema.getById(plate.poolSchema); |
2668 |
15 Sep 14 |
nicklas |
Plate.init(plate.rows, plate.columns, schema, WellPainter); |
2668 |
15 Sep 14 |
nicklas |
241 |
|
2668 |
15 Sep 14 |
nicklas |
for (var i = 0; i < list.length; i++) |
2668 |
15 Sep 14 |
nicklas |
243 |
{ |
2668 |
15 Sep 14 |
nicklas |
var mrna = list[i]; |
2668 |
15 Sep 14 |
nicklas |
var well = mrna.bioWell; |
2668 |
15 Sep 14 |
nicklas |
Plate.getWell(well.row, well.column).setExtract(mrna); |
2668 |
15 Sep 14 |
nicklas |
247 |
} |
2668 |
15 Sep 14 |
nicklas |
248 |
|
2668 |
15 Sep 14 |
nicklas |
Plate.paint(Plate.getWells()); |
2668 |
15 Sep 14 |
nicklas |
PoolSchema.buildPoolTableRow(schema, plate.columns); |
2668 |
15 Sep 14 |
nicklas |
Doc.show('all-protocol'); |
2668 |
15 Sep 14 |
nicklas |
252 |
} |
2668 |
15 Sep 14 |
nicklas |
253 |
|
2668 |
15 Sep 14 |
nicklas |
protocol.viewAsList = function(list) |
2668 |
15 Sep 14 |
nicklas |
255 |
{ |
3757 |
18 Feb 16 |
nicklas |
var homeUrl = Data.get('page-data', 'home-url'); |
3757 |
18 Feb 16 |
nicklas |
var yellowImg = '<img src="'+homeUrl+'/images/yellow-label-small.png">'; |
2668 |
15 Sep 14 |
nicklas |
for (var i = 0; i < list.length; i++) |
2668 |
15 Sep 14 |
nicklas |
259 |
{ |
2668 |
15 Sep 14 |
nicklas |
var mrna = list[i]; |
2668 |
15 Sep 14 |
nicklas |
var rna = mrna.rna; |
2668 |
15 Sep 14 |
nicklas |
var idSuffix = mrna.bioWell.column + '.' + mrna.bioWell.row; |
2668 |
15 Sep 14 |
nicklas |
var tableRow = Doc.element('row.'+idSuffix); |
3757 |
18 Feb 16 |
nicklas |
var img = rna.isYellow ? yellowImg : ''; |
2668 |
15 Sep 14 |
nicklas |
265 |
|
2668 |
15 Sep 14 |
nicklas |
Doc.removeClass(tableRow, 'empty'); |
2668 |
15 Sep 14 |
nicklas |
if (rna.external) Doc.addClass(tableRow, 'external'); |
2668 |
15 Sep 14 |
nicklas |
if (rna.stratagene) Doc.addClass(tableRow, 'stratagene'); |
3757 |
18 Feb 16 |
nicklas |
if (rna.isYellow) Doc.addClass(tableRow, 'yellow-specimen'); |
6727 |
05 May 22 |
nicklas |
var name = rna.name; |
6727 |
05 May 22 |
nicklas |
if (rna.external && mrna.externalId) |
6727 |
05 May 22 |
nicklas |
272 |
{ |
6727 |
05 May 22 |
nicklas |
name = mrna.externalId; |
6727 |
05 May 22 |
nicklas |
274 |
} |
6727 |
05 May 22 |
nicklas |
Doc.element('rna.'+idSuffix).innerHTML = img+Strings.encodeTags(name); |
6728 |
05 May 22 |
nicklas |
Doc.element('label.'+idSuffix).innerHTML = Strings.encodeTags(rna.label); |
2906 |
07 Nov 14 |
nicklas |
Doc.element('box.'+idSuffix).innerHTML = Strings.encodeTags(protocol.getPlateCoordinate(rna, true)); |
6218 |
20 Apr 21 |
nicklas |
Doc.element('conc.'+idSuffix).innerHTML = Numbers.formatNumber(rna.conc, 2); |
2668 |
15 Sep 14 |
nicklas |
Doc.element('remain.'+idSuffix).innerHTML = Numbers.formatNumber(rna.remainingQuantity, 2); |
2668 |
15 Sep 14 |
nicklas |
Doc.element('volume.'+idSuffix).innerHTML = Numbers.formatNumber(rna.volume, 1); |
3833 |
08 Apr 16 |
nicklas |
Doc.element('water.'+idSuffix).innerHTML = rna.water > 0 ? Numbers.formatNumber(rna.water, 1) : '—'; |
2668 |
15 Sep 14 |
nicklas |
Doc.element('remarks.'+idSuffix).innerHTML = rna.remarks.join('; '); |
2668 |
15 Sep 14 |
nicklas |
283 |
} |
2668 |
15 Sep 14 |
nicklas |
284 |
|
2668 |
15 Sep 14 |
nicklas |
Doc.show('all-protocol'); |
2668 |
15 Sep 14 |
nicklas |
286 |
} |
2668 |
15 Sep 14 |
nicklas |
287 |
|
2668 |
15 Sep 14 |
nicklas |
288 |
|
2906 |
07 Nov 14 |
nicklas |
protocol.getPlateCoordinate = function(rna, includePlateName) |
2668 |
15 Sep 14 |
nicklas |
290 |
{ |
2668 |
15 Sep 14 |
nicklas |
var c = ''; |
2907 |
07 Nov 14 |
nicklas |
if (rna.bioWell) |
2668 |
15 Sep 14 |
nicklas |
293 |
{ |
2907 |
07 Nov 14 |
nicklas |
if (includePlateName) c += rna.bioWell.bioPlate.name; |
2907 |
07 Nov 14 |
nicklas |
c += ' ' + Reggie.wellToAlpha(rna.bioWell.row) + (rna.bioWell.column+1); |
2668 |
15 Sep 14 |
nicklas |
296 |
} |
2906 |
07 Nov 14 |
nicklas |
else if (rna.preNormalized) |
2906 |
07 Nov 14 |
nicklas |
298 |
{ |
2907 |
07 Nov 14 |
nicklas |
c = 'PreNorm.'; |
2906 |
07 Nov 14 |
nicklas |
300 |
} |
2668 |
15 Sep 14 |
nicklas |
else |
2668 |
15 Sep 14 |
nicklas |
302 |
{ |
2906 |
07 Nov 14 |
nicklas |
c = ' '; |
2668 |
15 Sep 14 |
nicklas |
304 |
} |
2668 |
15 Sep 14 |
nicklas |
return c; |
2668 |
15 Sep 14 |
nicklas |
306 |
} |
2668 |
15 Sep 14 |
nicklas |
307 |
|
2668 |
15 Sep 14 |
nicklas |
308 |
|
2668 |
15 Sep 14 |
nicklas |
return protocol; |
2668 |
15 Sep 14 |
nicklas |
310 |
}(); |
2668 |
15 Sep 14 |
nicklas |
311 |
|
2668 |
15 Sep 14 |
nicklas |
Doc.onLoad(Protocol.initPage); |
2668 |
15 Sep 14 |
nicklas |
313 |
|
2668 |
15 Sep 14 |
nicklas |
314 |
|
2668 |
15 Sep 14 |
nicklas |
var WellPainter = function() |
2668 |
15 Sep 14 |
nicklas |
316 |
{ |
2668 |
15 Sep 14 |
nicklas |
var painter = {}; |
2668 |
15 Sep 14 |
nicklas |
318 |
|
2668 |
15 Sep 14 |
nicklas |
painter.getClassNameForWell = function(well) |
2668 |
15 Sep 14 |
nicklas |
320 |
{ |
2668 |
15 Sep 14 |
nicklas |
var cls = ''; |
2668 |
15 Sep 14 |
nicklas |
var mrna = well.extract; |
2668 |
15 Sep 14 |
nicklas |
if (mrna) |
2668 |
15 Sep 14 |
nicklas |
324 |
{ |
2668 |
15 Sep 14 |
nicklas |
var rna = mrna.rna; |
2668 |
15 Sep 14 |
nicklas |
if (rna.qc) cls += ' qc'; |
2668 |
15 Sep 14 |
nicklas |
if (rna.external) cls += ' external'; |
2668 |
15 Sep 14 |
nicklas |
if (rna.stratagene) cls += ' stratagene'; |
3757 |
18 Feb 16 |
nicklas |
if (rna.isYellow) cls += ' yellow-specimen'; |
2668 |
15 Sep 14 |
nicklas |
330 |
} |
2668 |
15 Sep 14 |
nicklas |
return cls; |
2668 |
15 Sep 14 |
nicklas |
332 |
} |
2668 |
15 Sep 14 |
nicklas |
333 |
|
2668 |
15 Sep 14 |
nicklas |
painter.getWellText = function(well) |
2668 |
15 Sep 14 |
nicklas |
335 |
{ |
2668 |
15 Sep 14 |
nicklas |
var text = ''; |
2668 |
15 Sep 14 |
nicklas |
var mrna = well.extract; |
2668 |
15 Sep 14 |
nicklas |
if (mrna) |
2668 |
15 Sep 14 |
nicklas |
339 |
{ |
2668 |
15 Sep 14 |
nicklas |
var rna = mrna.rna; |
6727 |
05 May 22 |
nicklas |
var name = rna.name; |
6727 |
05 May 22 |
nicklas |
if (rna.label) |
6727 |
05 May 22 |
nicklas |
343 |
{ |
6727 |
05 May 22 |
nicklas |
name = rna.label; |
6727 |
05 May 22 |
nicklas |
345 |
} |
6727 |
05 May 22 |
nicklas |
else if (rna.external && mrna.externalId) |
6727 |
05 May 22 |
nicklas |
347 |
{ |
6727 |
05 May 22 |
nicklas |
name = mrna.externalId; |
6727 |
05 May 22 |
nicklas |
349 |
} |
6727 |
05 May 22 |
nicklas |
text += '<div class="rna if-yellow">'+Strings.encodeTags(name)+'</div>'; |
2906 |
07 Nov 14 |
nicklas |
text += '<div class="box">'+Strings.encodeTags(Protocol.getPlateCoordinate(rna, true))+'</div>'; |
2668 |
15 Sep 14 |
nicklas |
text += '<div class="remain">'+Numbers.formatNumber(rna.remainingQuantity, 2, 'µg')+'</div>'; |
6218 |
20 Apr 21 |
nicklas |
text += '<div class="conc">'+Numbers.formatNumber(rna.conc, 2, 'ng/µl') + '</div>'; |
2668 |
15 Sep 14 |
nicklas |
354 |
|
2668 |
15 Sep 14 |
nicklas |
if (rna.volume >= 0 && rna.water >= 0) |
2668 |
15 Sep 14 |
nicklas |
356 |
{ |
2668 |
15 Sep 14 |
nicklas |
text += '<div><span class="volume">'+Numbers.formatNumber(rna.volume, 1)+'µl</span>'; |
3833 |
08 Apr 16 |
nicklas |
text += '<span class="water">'+(rna.water > 0 ? Numbers.formatNumber(rna.water, 1)+'µl' : '—')+'</span></div>'; |
2668 |
15 Sep 14 |
nicklas |
359 |
} |
2668 |
15 Sep 14 |
nicklas |
text += '<div class="remarks">'+ rna.remarks.join('; ') + '</div>'; |
2668 |
15 Sep 14 |
nicklas |
361 |
} |
2668 |
15 Sep 14 |
nicklas |
return text; |
2668 |
15 Sep 14 |
nicklas |
363 |
} |
2668 |
15 Sep 14 |
nicklas |
364 |
|
2668 |
15 Sep 14 |
nicklas |
return painter; |
2668 |
15 Sep 14 |
nicklas |
366 |
}(); |
2668 |
15 Sep 14 |
nicklas |
367 |
|