5887 |
02 Apr 20 |
nicklas |
var Protocol = function() |
5887 |
02 Apr 20 |
nicklas |
2 |
{ |
5887 |
02 Apr 20 |
nicklas |
var protocol = {}; |
5887 |
02 Apr 20 |
nicklas |
var debug = 0; |
5887 |
02 Apr 20 |
nicklas |
5 |
|
5887 |
02 Apr 20 |
nicklas |
var LOW_QUANTITY_WARNING_FACTOR = 2; |
5887 |
02 Apr 20 |
nicklas |
var DEFAULT_DILUTION_VOLUME = 50; //µl |
5887 |
02 Apr 20 |
nicklas |
8 |
|
5887 |
02 Apr 20 |
nicklas |
// Page initialization |
5887 |
02 Apr 20 |
nicklas |
protocol.initPage = function() |
5887 |
02 Apr 20 |
nicklas |
11 |
{ |
5887 |
02 Apr 20 |
nicklas |
var pageId = Doc.getPageId(); |
5887 |
02 Apr 20 |
nicklas |
if (pageId == 'protocol') |
5887 |
02 Apr 20 |
nicklas |
14 |
{ |
5887 |
02 Apr 20 |
nicklas |
Buttons.addClickHandler('print-button', Wizard.goPrint); |
5887 |
02 Apr 20 |
nicklas |
16 |
|
5887 |
02 Apr 20 |
nicklas |
var plateId = Data.int('page-data', 'plate-id'); |
5887 |
02 Apr 20 |
nicklas |
18 |
|
5887 |
02 Apr 20 |
nicklas |
var url = '../LibPrep.servlet?ID='+App.getSessionId(); |
5887 |
02 Apr 20 |
nicklas |
url += '&cmd=GetLibraryInfoForPlate&bioplate='+plateId; |
5887 |
02 Apr 20 |
nicklas |
url += '&loadDilutionInfo=1'; |
5887 |
02 Apr 20 |
nicklas |
Wizard.showLoadingAnimation('Loading library plate information...'); |
5887 |
02 Apr 20 |
nicklas |
Wizard.asyncJsonRequest(url, protocol.initializeProtocol); |
5887 |
02 Apr 20 |
nicklas |
24 |
} |
5887 |
02 Apr 20 |
nicklas |
else |
5887 |
02 Apr 20 |
nicklas |
26 |
{ |
5887 |
02 Apr 20 |
nicklas |
Events.addEventHandler('bioplate', 'change', protocol.bioplateOnChange); |
5887 |
02 Apr 20 |
nicklas |
Events.addEventHandler('listview', 'click', protocol.viewProtocol); |
5887 |
02 Apr 20 |
nicklas |
Events.addEventHandler('plateview', 'click', protocol.viewProtocol); |
5888 |
03 Apr 20 |
nicklas |
Events.addEventHandler('downloadLabelsCsv', 'click', protocol.downloadLabels); |
5888 |
03 Apr 20 |
nicklas |
Events.addEventHandler('downloadLabelsXlsx', 'click', protocol.downloadLabels); |
5888 |
03 Apr 20 |
nicklas |
Events.addEventHandler('ctgRnaSampleSheet', 'click', protocol.downloadSampleSheet); |
5887 |
02 Apr 20 |
nicklas |
33 |
|
5887 |
02 Apr 20 |
nicklas |
var url = '../LibPrep.servlet?ID='+App.getSessionId(); |
5887 |
02 Apr 20 |
nicklas |
url += '&cmd=GetLibraryPlatesForLibPrep&plateType=EXTERNAL_LIBRARY'; |
5887 |
02 Apr 20 |
nicklas |
Wizard.showLoadingAnimation('Loading library plates...'); |
5887 |
02 Apr 20 |
nicklas |
Wizard.asyncJsonRequest(url, protocol.initializeStep1); |
5887 |
02 Apr 20 |
nicklas |
38 |
} |
5887 |
02 Apr 20 |
nicklas |
39 |
} |
5887 |
02 Apr 20 |
nicklas |
40 |
|
5887 |
02 Apr 20 |
nicklas |
41 |
|
5887 |
02 Apr 20 |
nicklas |
protocol.initializeStep1 = function(response) |
5887 |
02 Apr 20 |
nicklas |
43 |
{ |
5887 |
02 Apr 20 |
nicklas |
var frm = document.forms['reggie']; |
5887 |
02 Apr 20 |
nicklas |
45 |
|
5887 |
02 Apr 20 |
nicklas |
var bioplates = response.bioplates; |
5887 |
02 Apr 20 |
nicklas |
var plates = frm.bioplate; |
5887 |
02 Apr 20 |
nicklas |
if (bioplates.length > 0) |
5887 |
02 Apr 20 |
nicklas |
49 |
{ |
5887 |
02 Apr 20 |
nicklas |
for (var i=0; i < bioplates.length; i++) |
5887 |
02 Apr 20 |
nicklas |
51 |
{ |
5887 |
02 Apr 20 |
nicklas |
var bioplate = bioplates[i]; |
5887 |
02 Apr 20 |
nicklas |
var name = bioplate.name + ' (' + bioplate.usedWells + ' samples'; |
5887 |
02 Apr 20 |
nicklas |
if (bioplate.AutoProcessing == 'PreNormalizeRNA') |
5887 |
02 Apr 20 |
nicklas |
55 |
{ |
5887 |
02 Apr 20 |
nicklas |
name += '; pre-normalized'; |
5887 |
02 Apr 20 |
nicklas |
57 |
} |
5887 |
02 Apr 20 |
nicklas |
else if (bioplate.DilutionDate) |
5887 |
02 Apr 20 |
nicklas |
59 |
{ |
5887 |
02 Apr 20 |
nicklas |
name += '; diluted ' + Reggie.reformatDate(bioplate.DilutionDate); |
5887 |
02 Apr 20 |
nicklas |
61 |
} |
5887 |
02 Apr 20 |
nicklas |
name += ')'; |
5887 |
02 Apr 20 |
nicklas |
var option = new Option(name, bioplate.id); |
5887 |
02 Apr 20 |
nicklas |
option.bioplate = bioplate; |
5887 |
02 Apr 20 |
nicklas |
plates.options[plates.length] = option; |
5887 |
02 Apr 20 |
nicklas |
66 |
} |
5887 |
02 Apr 20 |
nicklas |
bioplateIsValid = true; |
5887 |
02 Apr 20 |
nicklas |
68 |
|
5887 |
02 Apr 20 |
nicklas |
protocol.bioplateOnChange(); |
5887 |
02 Apr 20 |
nicklas |
70 |
} |
5887 |
02 Apr 20 |
nicklas |
else |
5887 |
02 Apr 20 |
nicklas |
72 |
{ |
5887 |
02 Apr 20 |
nicklas |
Wizard.setFatalError('No library plates available for processing.'); |
5887 |
02 Apr 20 |
nicklas |
return; |
5887 |
02 Apr 20 |
nicklas |
75 |
} |
5887 |
02 Apr 20 |
nicklas |
76 |
|
5887 |
02 Apr 20 |
nicklas |
Doc.show('step-1'); |
5887 |
02 Apr 20 |
nicklas |
Doc.show('gonext'); |
5887 |
02 Apr 20 |
nicklas |
79 |
} |
5887 |
02 Apr 20 |
nicklas |
80 |
|
5887 |
02 Apr 20 |
nicklas |
81 |
|
5887 |
02 Apr 20 |
nicklas |
// Add pools to the pools list based on the bioplate selection |
5887 |
02 Apr 20 |
nicklas |
protocol.bioplateOnChange = function() |
5887 |
02 Apr 20 |
nicklas |
84 |
{ |
5887 |
02 Apr 20 |
nicklas |
var frm = document.forms['reggie']; |
5887 |
02 Apr 20 |
nicklas |
var bioplate = frm.bioplate[frm.bioplate.selectedIndex].bioplate; |
5887 |
02 Apr 20 |
nicklas |
Doc.element('comments').innerHTML = Strings.encodeTags(bioplate.comments); |
5887 |
02 Apr 20 |
nicklas |
frm.poolSchema.value = bioplate.poolSchema; |
5887 |
02 Apr 20 |
nicklas |
89 |
} |
5887 |
02 Apr 20 |
nicklas |
90 |
|
5887 |
02 Apr 20 |
nicklas |
protocol.viewProtocol = function(event) |
5887 |
02 Apr 20 |
nicklas |
92 |
{ |
5887 |
02 Apr 20 |
nicklas |
var frm = document.forms['reggie']; |
5887 |
02 Apr 20 |
nicklas |
if (frm.bioplate && !frm.bioplate.disabled) |
5887 |
02 Apr 20 |
nicklas |
95 |
{ |
5887 |
02 Apr 20 |
nicklas |
frm.view.value = Data.get(event.currentTarget, 'protocol-type'); |
5887 |
02 Apr 20 |
nicklas |
frm.submit(); |
5887 |
02 Apr 20 |
nicklas |
98 |
} |
5887 |
02 Apr 20 |
nicklas |
99 |
} |
5888 |
03 Apr 20 |
nicklas |
100 |
|
5888 |
03 Apr 20 |
nicklas |
protocol.downloadLabels = function(event) |
5888 |
03 Apr 20 |
nicklas |
102 |
{ |
5888 |
03 Apr 20 |
nicklas |
var frm = document.forms['reggie']; |
5888 |
03 Apr 20 |
nicklas |
104 |
|
5888 |
03 Apr 20 |
nicklas |
var url = '../LibPrep.servlet?ID='+App.getSessionId(); |
5888 |
03 Apr 20 |
nicklas |
url += '&cmd=DownloadLabelsForExternalSequencing'; |
5888 |
03 Apr 20 |
nicklas |
url += '&bioPlateId='+frm.bioplate.value; |
5888 |
03 Apr 20 |
nicklas |
url += '&includeAll='+(frm.includeAll.checked ? 1 : 0); |
5888 |
03 Apr 20 |
nicklas |
url += '&format='+encodeURIComponent(Data.get(event.currentTarget, 'format')); |
5887 |
02 Apr 20 |
nicklas |
110 |
|
5888 |
03 Apr 20 |
nicklas |
window.open(url); |
5888 |
03 Apr 20 |
nicklas |
112 |
} |
5888 |
03 Apr 20 |
nicklas |
113 |
|
5888 |
03 Apr 20 |
nicklas |
protocol.downloadSampleSheet = function(event) |
5887 |
02 Apr 20 |
nicklas |
115 |
{ |
5887 |
02 Apr 20 |
nicklas |
var frm = document.forms['reggie']; |
5887 |
02 Apr 20 |
nicklas |
var url = '../LibPrep.servlet?ID='+App.getSessionId(); |
5887 |
02 Apr 20 |
nicklas |
url += '&cmd=GetExternalSequencingSampleSheet'; |
5887 |
02 Apr 20 |
nicklas |
url += '&bioPlateId='+frm.bioplate.value; |
5888 |
03 Apr 20 |
nicklas |
url += '&template='+encodeURIComponent(Data.get(event.currentTarget, 'template')); |
5887 |
02 Apr 20 |
nicklas |
window.open(url); |
5887 |
02 Apr 20 |
nicklas |
122 |
} |
5887 |
02 Apr 20 |
nicklas |
123 |
|
5887 |
02 Apr 20 |
nicklas |
protocol.initializeProtocol = function(response) |
5887 |
02 Apr 20 |
nicklas |
125 |
{ |
5887 |
02 Apr 20 |
nicklas |
var plate = response.plate; |
5891 |
07 Apr 20 |
nicklas |
var list = response.libraries; |
5891 |
07 Apr 20 |
nicklas |
var normProtocol = response.protocol; |
5891 |
07 Apr 20 |
nicklas |
129 |
|
5891 |
07 Apr 20 |
nicklas |
var unit = 'µg'; |
5891 |
07 Apr 20 |
nicklas |
var factor = 1; |
5891 |
07 Apr 20 |
nicklas |
if (normProtocol.RNATargetAmount <= 0.5) |
5887 |
02 Apr 20 |
nicklas |
133 |
{ |
5891 |
07 Apr 20 |
nicklas |
unit = 'ng'; |
5891 |
07 Apr 20 |
nicklas |
factor = 1000; |
5887 |
02 Apr 20 |
nicklas |
136 |
} |
5887 |
02 Apr 20 |
nicklas |
137 |
|
5891 |
07 Apr 20 |
nicklas |
var text = Strings.encodeTags(normProtocol.name) + ' ('; |
5891 |
07 Apr 20 |
nicklas |
text += normProtocol.RNATargetAmount ? Reggie.formatNumber(normProtocol.RNATargetAmount * factor, '', 1) : '? '; |
5891 |
07 Apr 20 |
nicklas |
text += unit; |
5891 |
07 Apr 20 |
nicklas |
text += ' in '+(normProtocol.RNATargetVolume || '? ')+'µl)'; |
5891 |
07 Apr 20 |
nicklas |
Doc.element('normalization-protocol').innerHTML = text; |
5887 |
02 Apr 20 |
nicklas |
143 |
|
5887 |
02 Apr 20 |
nicklas |
// Pre-process the return mRNA items |
5887 |
02 Apr 20 |
nicklas |
var allPreNormalized = true; |
6728 |
05 May 22 |
nicklas |
var showLabelColumn = false; |
5887 |
02 Apr 20 |
nicklas |
for (var i = 0; i < list.length; i++) |
5887 |
02 Apr 20 |
nicklas |
148 |
{ |
6728 |
05 May 22 |
nicklas |
var rna = list[i].rna; |
6728 |
05 May 22 |
nicklas |
allPreNormalized &= rna.preNormalized; |
6728 |
05 May 22 |
nicklas |
if (rna.label) showLabelColumn = true; |
5887 |
02 Apr 20 |
nicklas |
protocol.checkAndPreProcessLib(list[i]); |
5887 |
02 Apr 20 |
nicklas |
153 |
} |
5887 |
02 Apr 20 |
nicklas |
154 |
|
5887 |
02 Apr 20 |
nicklas |
var view = Data.get('page-data', 'view'); |
5887 |
02 Apr 20 |
nicklas |
if (view == 'list') |
5887 |
02 Apr 20 |
nicklas |
157 |
{ |
5887 |
02 Apr 20 |
nicklas |
protocol.viewAsList(list); |
6728 |
05 May 22 |
nicklas |
if (showLabelColumn) |
6728 |
05 May 22 |
nicklas |
160 |
{ |
6728 |
05 May 22 |
nicklas |
Doc.removeClass('listview', 'nolabels'); |
6728 |
05 May 22 |
nicklas |
Doc.show('protocol-footer'); |
6728 |
05 May 22 |
nicklas |
163 |
} |
5887 |
02 Apr 20 |
nicklas |
164 |
} |
5887 |
02 Apr 20 |
nicklas |
else |
5887 |
02 Apr 20 |
nicklas |
166 |
{ |
5887 |
02 Apr 20 |
nicklas |
protocol.viewAsPlate(plate, list) |
5887 |
02 Apr 20 |
nicklas |
168 |
} |
5891 |
07 Apr 20 |
nicklas |
169 |
|
5887 |
02 Apr 20 |
nicklas |
170 |
} |
5887 |
02 Apr 20 |
nicklas |
171 |
|
5887 |
02 Apr 20 |
nicklas |
protocol.checkAndPreProcessLib = function(lib, stratageneConc) |
5887 |
02 Apr 20 |
nicklas |
173 |
{ |
5887 |
02 Apr 20 |
nicklas |
var rna = lib.rna; |
5887 |
02 Apr 20 |
nicklas |
// Set the 'stratagene' flag |
5887 |
02 Apr 20 |
nicklas |
rna.stratagene = Reggie.isStratagene(rna.name); |
5887 |
02 Apr 20 |
nicklas |
rna.external = Reggie.isExternal(rna.name); |
5887 |
02 Apr 20 |
nicklas |
rna.isYellow = rna.specimen && rna.specimen.YellowLabel != null; |
5887 |
02 Apr 20 |
nicklas |
if (!lib.DilutionVolume) lib.DilutionVolume = DEFAULT_DILUTION_VOLUME; |
5887 |
02 Apr 20 |
nicklas |
180 |
|
5887 |
02 Apr 20 |
nicklas |
// Set the 'QC' flag |
5887 |
02 Apr 20 |
nicklas |
rna.qc = lib.UseForQC; |
5887 |
02 Apr 20 |
nicklas |
183 |
|
5887 |
02 Apr 20 |
nicklas |
if (stratageneConc > 0) |
5887 |
02 Apr 20 |
nicklas |
185 |
{ |
6218 |
20 Apr 21 |
nicklas |
if (rna.stratagene && !rna.conc) rna.conc = stratageneConc; |
5887 |
02 Apr 20 |
nicklas |
187 |
} |
5887 |
02 Apr 20 |
nicklas |
188 |
|
5887 |
02 Apr 20 |
nicklas |
// Calculate volume to use and water to add based on concentration |
5887 |
02 Apr 20 |
nicklas |
var remarks = []; |
6218 |
20 Apr 21 |
nicklas |
if (rna.conc && rna.usedQuantity) |
5887 |
02 Apr 20 |
nicklas |
192 |
{ |
6218 |
20 Apr 21 |
nicklas |
rna.volume = Math.ceil(10000*rna.usedQuantity/rna.conc) / 10; // µl |
5887 |
02 Apr 20 |
nicklas |
194 |
|
5887 |
02 Apr 20 |
nicklas |
var totalVolume = lib.DilutionConc ? 1000 * rna.usedQuantity / lib.DilutionConc : lib.DilutionVolume; |
5887 |
02 Apr 20 |
nicklas |
if (totalVolume < lib.DilutionVolume) |
5887 |
02 Apr 20 |
nicklas |
197 |
{ |
5887 |
02 Apr 20 |
nicklas |
totalVolume = lib.DilutionVolume; |
5887 |
02 Apr 20 |
nicklas |
199 |
} |
5887 |
02 Apr 20 |
nicklas |
else if (totalVolume - 0.05 > lib.DilutionVolume) // Use 0.05 to avoid issues with 50.0000000001 > 50.0 |
5887 |
02 Apr 20 |
nicklas |
201 |
{ |
5887 |
02 Apr 20 |
nicklas |
remarks[remarks.length] = 'Large mix; Use '+Reggie.formatNumber(lib.DilutionVolume, 'µl', 1); |
5887 |
02 Apr 20 |
nicklas |
203 |
} |
5887 |
02 Apr 20 |
nicklas |
rna.water = totalVolume-rna.volume; |
5887 |
02 Apr 20 |
nicklas |
205 |
} |
5887 |
02 Apr 20 |
nicklas |
206 |
|
5887 |
02 Apr 20 |
nicklas |
// check for some issues that may indicate problems |
5887 |
02 Apr 20 |
nicklas |
if (rna.qc) remarks[remarks.length] = 'QC'; |
5887 |
02 Apr 20 |
nicklas |
if (!rna.stratagene && !rna.external) |
5887 |
02 Apr 20 |
nicklas |
210 |
{ |
5887 |
02 Apr 20 |
nicklas |
if (!rna.bioWell && !rna.preNormalized) |
5887 |
02 Apr 20 |
nicklas |
212 |
{ |
5887 |
02 Apr 20 |
nicklas |
remarks[remarks.length] = 'No location'; |
5887 |
02 Apr 20 |
nicklas |
214 |
} |
5887 |
02 Apr 20 |
nicklas |
if (!rna.remainingQuantity) |
5887 |
02 Apr 20 |
nicklas |
216 |
{ |
5887 |
02 Apr 20 |
nicklas |
remarks[remarks.length] = 'No quantity'; |
5887 |
02 Apr 20 |
nicklas |
218 |
} |
5887 |
02 Apr 20 |
nicklas |
else if (rna.remainingQuantity < rna.usedQuantity) |
5887 |
02 Apr 20 |
nicklas |
220 |
{ |
5887 |
02 Apr 20 |
nicklas |
remarks[remarks.length] = 'Not enough RNA'; |
5887 |
02 Apr 20 |
nicklas |
222 |
} |
5887 |
02 Apr 20 |
nicklas |
else if (rna.remainingQuantity < rna.usedQuantity * LOW_QUANTITY_WARNING_FACTOR && !rna.preNormalized) |
5887 |
02 Apr 20 |
nicklas |
224 |
{ |
5887 |
02 Apr 20 |
nicklas |
remarks[remarks.length] = 'Low quantity'; |
5887 |
02 Apr 20 |
nicklas |
226 |
} |
6218 |
20 Apr 21 |
nicklas |
if (!rna.conc) |
5887 |
02 Apr 20 |
nicklas |
228 |
{ |
6218 |
20 Apr 21 |
nicklas |
remarks[remarks.length] = 'No concentration'; |
5887 |
02 Apr 20 |
nicklas |
230 |
} |
5887 |
02 Apr 20 |
nicklas |
231 |
} |
5887 |
02 Apr 20 |
nicklas |
else |
5887 |
02 Apr 20 |
nicklas |
233 |
{ |
6218 |
20 Apr 21 |
nicklas |
if (!rna.conc && rna.usedQuantity) |
5887 |
02 Apr 20 |
nicklas |
235 |
{ |
5887 |
02 Apr 20 |
nicklas |
remarks[remarks.length] = 'Use ' + Numbers.formatNumber(rna.usedQuantity, 2) + ' µg RNA'; |
5887 |
02 Apr 20 |
nicklas |
237 |
} |
5887 |
02 Apr 20 |
nicklas |
238 |
} |
5887 |
02 Apr 20 |
nicklas |
if (lib.comment) remarks[remarks.length] = lib.comment; |
5887 |
02 Apr 20 |
nicklas |
rna.remarks = remarks; |
5887 |
02 Apr 20 |
nicklas |
241 |
} |
5887 |
02 Apr 20 |
nicklas |
242 |
|
5887 |
02 Apr 20 |
nicklas |
protocol.viewAsPlate = function(plate, list) |
5887 |
02 Apr 20 |
nicklas |
244 |
{ |
5887 |
02 Apr 20 |
nicklas |
var schema = PoolSchema.getById(plate.poolSchema); |
5887 |
02 Apr 20 |
nicklas |
Plate.init(plate.rows, plate.columns, schema, WellPainter); |
5887 |
02 Apr 20 |
nicklas |
247 |
|
5887 |
02 Apr 20 |
nicklas |
for (var i = 0; i < list.length; i++) |
5887 |
02 Apr 20 |
nicklas |
249 |
{ |
5887 |
02 Apr 20 |
nicklas |
var lib = list[i]; |
5887 |
02 Apr 20 |
nicklas |
var well = lib.bioWell; |
5887 |
02 Apr 20 |
nicklas |
Plate.getWell(well.row, well.column).setExtract(lib); |
5887 |
02 Apr 20 |
nicklas |
253 |
} |
5887 |
02 Apr 20 |
nicklas |
254 |
|
5887 |
02 Apr 20 |
nicklas |
Plate.paint(Plate.getWells()); |
5887 |
02 Apr 20 |
nicklas |
PoolSchema.buildPoolTableRow(schema, plate.columns); |
5887 |
02 Apr 20 |
nicklas |
Doc.show('all-protocol'); |
5887 |
02 Apr 20 |
nicklas |
258 |
} |
5887 |
02 Apr 20 |
nicklas |
259 |
|
5887 |
02 Apr 20 |
nicklas |
protocol.viewAsList = function(list) |
5887 |
02 Apr 20 |
nicklas |
261 |
{ |
5887 |
02 Apr 20 |
nicklas |
var homeUrl = Data.get('page-data', 'home-url'); |
5887 |
02 Apr 20 |
nicklas |
var yellowImg = '<img src="'+homeUrl+'/images/yellow-label-small.png">'; |
5887 |
02 Apr 20 |
nicklas |
for (var i = 0; i < list.length; i++) |
5887 |
02 Apr 20 |
nicklas |
265 |
{ |
5887 |
02 Apr 20 |
nicklas |
var lib = list[i]; |
5887 |
02 Apr 20 |
nicklas |
var rna = lib.rna; |
5887 |
02 Apr 20 |
nicklas |
var idSuffix = lib.bioWell.column + '.' + lib.bioWell.row; |
5887 |
02 Apr 20 |
nicklas |
var tableRow = Doc.element('row.'+idSuffix); |
5887 |
02 Apr 20 |
nicklas |
var img = rna.isYellow ? yellowImg : ''; |
5887 |
02 Apr 20 |
nicklas |
271 |
|
5887 |
02 Apr 20 |
nicklas |
Doc.removeClass(tableRow, 'empty'); |
5887 |
02 Apr 20 |
nicklas |
if (rna.external) Doc.addClass(tableRow, 'external'); |
5887 |
02 Apr 20 |
nicklas |
if (rna.stratagene) Doc.addClass(tableRow, 'stratagene'); |
5887 |
02 Apr 20 |
nicklas |
if (rna.isYellow) Doc.addClass(tableRow, 'yellow-specimen'); |
5887 |
02 Apr 20 |
nicklas |
Doc.element('rna.'+idSuffix).innerHTML = img+Strings.encodeTags(rna.external && lib.externalId ? lib.externalId : rna.name); |
6728 |
05 May 22 |
nicklas |
Doc.element('label.'+idSuffix).innerHTML = Strings.encodeTags(rna.label); |
5887 |
02 Apr 20 |
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); |
5887 |
02 Apr 20 |
nicklas |
Doc.element('remain.'+idSuffix).innerHTML = Numbers.formatNumber(rna.remainingQuantity, 2); |
5887 |
02 Apr 20 |
nicklas |
Doc.element('volume.'+idSuffix).innerHTML = Numbers.formatNumber(rna.volume, 1); |
5887 |
02 Apr 20 |
nicklas |
Doc.element('water.'+idSuffix).innerHTML = rna.water > 0 ? Numbers.formatNumber(rna.water, 1) : '—'; |
5887 |
02 Apr 20 |
nicklas |
Doc.element('remarks.'+idSuffix).innerHTML = rna.remarks.join('; '); |
5887 |
02 Apr 20 |
nicklas |
284 |
} |
5887 |
02 Apr 20 |
nicklas |
285 |
|
5887 |
02 Apr 20 |
nicklas |
Doc.show('all-protocol'); |
5887 |
02 Apr 20 |
nicklas |
287 |
} |
5887 |
02 Apr 20 |
nicklas |
288 |
|
5887 |
02 Apr 20 |
nicklas |
289 |
|
5887 |
02 Apr 20 |
nicklas |
protocol.getPlateCoordinate = function(rna, includePlateName) |
5887 |
02 Apr 20 |
nicklas |
291 |
{ |
5887 |
02 Apr 20 |
nicklas |
var c = ''; |
5887 |
02 Apr 20 |
nicklas |
if (rna.bioWell) |
5887 |
02 Apr 20 |
nicklas |
294 |
{ |
5887 |
02 Apr 20 |
nicklas |
if (includePlateName) c += rna.bioWell.bioPlate.name; |
5887 |
02 Apr 20 |
nicklas |
c += ' ' + Reggie.wellToAlpha(rna.bioWell.row) + (rna.bioWell.column+1); |
5887 |
02 Apr 20 |
nicklas |
297 |
} |
5887 |
02 Apr 20 |
nicklas |
else if (rna.preNormalized) |
5887 |
02 Apr 20 |
nicklas |
299 |
{ |
5887 |
02 Apr 20 |
nicklas |
c = 'PreNorm.'; |
5887 |
02 Apr 20 |
nicklas |
301 |
} |
5887 |
02 Apr 20 |
nicklas |
else |
5887 |
02 Apr 20 |
nicklas |
303 |
{ |
5887 |
02 Apr 20 |
nicklas |
c = ' '; |
5887 |
02 Apr 20 |
nicklas |
305 |
} |
5887 |
02 Apr 20 |
nicklas |
return c; |
5887 |
02 Apr 20 |
nicklas |
307 |
} |
5887 |
02 Apr 20 |
nicklas |
308 |
|
5887 |
02 Apr 20 |
nicklas |
309 |
|
5887 |
02 Apr 20 |
nicklas |
return protocol; |
5887 |
02 Apr 20 |
nicklas |
311 |
}(); |
5887 |
02 Apr 20 |
nicklas |
312 |
|
5887 |
02 Apr 20 |
nicklas |
Doc.onLoad(Protocol.initPage); |
5887 |
02 Apr 20 |
nicklas |
314 |
|
5887 |
02 Apr 20 |
nicklas |
315 |
|
5887 |
02 Apr 20 |
nicklas |
var WellPainter = function() |
5887 |
02 Apr 20 |
nicklas |
317 |
{ |
5887 |
02 Apr 20 |
nicklas |
var painter = {}; |
5887 |
02 Apr 20 |
nicklas |
319 |
|
5887 |
02 Apr 20 |
nicklas |
painter.getClassNameForWell = function(well) |
5887 |
02 Apr 20 |
nicklas |
321 |
{ |
5887 |
02 Apr 20 |
nicklas |
var cls = ''; |
5887 |
02 Apr 20 |
nicklas |
var lib = well.extract; |
5887 |
02 Apr 20 |
nicklas |
if (lib) |
5887 |
02 Apr 20 |
nicklas |
325 |
{ |
5887 |
02 Apr 20 |
nicklas |
var rna = lib.rna; |
5887 |
02 Apr 20 |
nicklas |
if (rna.qc) cls += ' qc'; |
5887 |
02 Apr 20 |
nicklas |
if (rna.external) cls += ' external'; |
5887 |
02 Apr 20 |
nicklas |
if (rna.stratagene) cls += ' stratagene'; |
5887 |
02 Apr 20 |
nicklas |
if (rna.isYellow) cls += ' yellow-specimen'; |
5887 |
02 Apr 20 |
nicklas |
331 |
} |
5887 |
02 Apr 20 |
nicklas |
return cls; |
5887 |
02 Apr 20 |
nicklas |
333 |
} |
5887 |
02 Apr 20 |
nicklas |
334 |
|
5887 |
02 Apr 20 |
nicklas |
painter.getWellText = function(well) |
5887 |
02 Apr 20 |
nicklas |
336 |
{ |
5887 |
02 Apr 20 |
nicklas |
var text = ''; |
5887 |
02 Apr 20 |
nicklas |
var lib = well.extract; |
5887 |
02 Apr 20 |
nicklas |
if (lib) |
5887 |
02 Apr 20 |
nicklas |
340 |
{ |
5887 |
02 Apr 20 |
nicklas |
var rna = lib.rna; |
6728 |
05 May 22 |
nicklas |
var name = rna.name; |
6728 |
05 May 22 |
nicklas |
if (rna.label) |
6728 |
05 May 22 |
nicklas |
344 |
{ |
6728 |
05 May 22 |
nicklas |
name = rna.label; |
6728 |
05 May 22 |
nicklas |
346 |
} |
6728 |
05 May 22 |
nicklas |
else if (rna.external && mrna.externalId) |
6728 |
05 May 22 |
nicklas |
348 |
{ |
6728 |
05 May 22 |
nicklas |
name = mrna.externalId; |
6728 |
05 May 22 |
nicklas |
350 |
} |
6728 |
05 May 22 |
nicklas |
text += '<div class="rna if-yellow">'+Strings.encodeTags(name)+'</div>'; |
5887 |
02 Apr 20 |
nicklas |
text += '<div class="box">'+Strings.encodeTags(Protocol.getPlateCoordinate(rna, true))+'</div>'; |
5887 |
02 Apr 20 |
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>'; |
5887 |
02 Apr 20 |
nicklas |
355 |
|
5887 |
02 Apr 20 |
nicklas |
if (rna.volume >= 0 && rna.water >= 0) |
5887 |
02 Apr 20 |
nicklas |
357 |
{ |
5887 |
02 Apr 20 |
nicklas |
text += '<div><span class="volume">'+Numbers.formatNumber(rna.volume, 1)+'µl</span>'; |
5887 |
02 Apr 20 |
nicklas |
text += '<span class="water">'+(rna.water > 0 ? Numbers.formatNumber(rna.water, 1)+'µl' : '—')+'</span></div>'; |
5887 |
02 Apr 20 |
nicklas |
360 |
} |
5887 |
02 Apr 20 |
nicklas |
text += '<div class="remarks">'+ rna.remarks.join('; ') + '</div>'; |
5887 |
02 Apr 20 |
nicklas |
362 |
} |
5887 |
02 Apr 20 |
nicklas |
return text; |
5887 |
02 Apr 20 |
nicklas |
364 |
} |
5887 |
02 Apr 20 |
nicklas |
365 |
|
5887 |
02 Apr 20 |
nicklas |
return painter; |
5887 |
02 Apr 20 |
nicklas |
367 |
}(); |
5887 |
02 Apr 20 |
nicklas |
368 |
|