2673 |
16 Sep 14 |
nicklas |
var Protocol = function() |
2673 |
16 Sep 14 |
nicklas |
2 |
{ |
2673 |
16 Sep 14 |
nicklas |
var protocol = {}; |
2702 |
26 Sep 14 |
nicklas |
var debug = 0; |
2673 |
16 Sep 14 |
nicklas |
5 |
|
2673 |
16 Sep 14 |
nicklas |
var QUANTITY_REGULAR = 1.1; |
2673 |
16 Sep 14 |
nicklas |
var LOW_QUANTITY_WARNING_FACTOR = 2; |
2673 |
16 Sep 14 |
nicklas |
8 |
|
2673 |
16 Sep 14 |
nicklas |
// Page initialization |
2673 |
16 Sep 14 |
nicklas |
protocol.initPage = function() |
2673 |
16 Sep 14 |
nicklas |
11 |
{ |
2673 |
16 Sep 14 |
nicklas |
var pageId = Doc.getPageId(); |
2673 |
16 Sep 14 |
nicklas |
if (pageId == 'protocol') |
2673 |
16 Sep 14 |
nicklas |
14 |
{ |
2673 |
16 Sep 14 |
nicklas |
Buttons.addClickHandler('print-button', Wizard.goPrint); |
2673 |
16 Sep 14 |
nicklas |
16 |
|
2673 |
16 Sep 14 |
nicklas |
var libPlateId = Data.int('page-data', 'libplate'); |
2673 |
16 Sep 14 |
nicklas |
18 |
|
2673 |
16 Sep 14 |
nicklas |
var url = '../LibPrep.servlet?ID='+App.getSessionId(); |
2673 |
16 Sep 14 |
nicklas |
url += '&cmd=GetLibraryInfoForPlate&bioplate='+libPlateId; |
2673 |
16 Sep 14 |
nicklas |
Wizard.showLoadingAnimation('Loading Library bioplate information...'); |
2673 |
16 Sep 14 |
nicklas |
Wizard.asyncJsonRequest(url, protocol.initializeProtocol); |
2673 |
16 Sep 14 |
nicklas |
23 |
} |
2673 |
16 Sep 14 |
nicklas |
else |
2673 |
16 Sep 14 |
nicklas |
25 |
{ |
2673 |
16 Sep 14 |
nicklas |
Events.addEventHandler('bioplate', 'change', protocol.bioplateOnChange); |
2673 |
16 Sep 14 |
nicklas |
Events.addEventHandler('listview', 'click', protocol.viewProtocol); |
2673 |
16 Sep 14 |
nicklas |
Events.addEventHandler('plateview', 'click', protocol.viewProtocol); |
2673 |
16 Sep 14 |
nicklas |
29 |
|
2673 |
16 Sep 14 |
nicklas |
var url = '../LibPrep.servlet?ID='+App.getSessionId(); |
2673 |
16 Sep 14 |
nicklas |
url += '&cmd=GetConfigurationsForCaliperRunParametersExporter'; |
2673 |
16 Sep 14 |
nicklas |
Wizard.asyncJsonRequest(url, protocol.initExportLinks); |
2673 |
16 Sep 14 |
nicklas |
33 |
|
2673 |
16 Sep 14 |
nicklas |
var url = '../LibPrep.servlet?ID='+App.getSessionId(); |
2673 |
16 Sep 14 |
nicklas |
url += '&cmd=GetLibraryPlatesForLibPrep'; |
2673 |
16 Sep 14 |
nicklas |
Wizard.showLoadingAnimation('Loading Library plates...'); |
2673 |
16 Sep 14 |
nicklas |
Wizard.asyncJsonRequest(url, protocol.initializeStep1); |
2673 |
16 Sep 14 |
nicklas |
38 |
} |
2673 |
16 Sep 14 |
nicklas |
39 |
} |
2673 |
16 Sep 14 |
nicklas |
40 |
|
2673 |
16 Sep 14 |
nicklas |
41 |
|
2673 |
16 Sep 14 |
nicklas |
protocol.initializeStep1 = function(response) |
2673 |
16 Sep 14 |
nicklas |
43 |
{ |
2673 |
16 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2673 |
16 Sep 14 |
nicklas |
45 |
|
2673 |
16 Sep 14 |
nicklas |
var bioplates = response.bioplates; |
2673 |
16 Sep 14 |
nicklas |
var plates = frm.bioplate; |
2673 |
16 Sep 14 |
nicklas |
if (bioplates.length > 0) |
2673 |
16 Sep 14 |
nicklas |
49 |
{ |
2673 |
16 Sep 14 |
nicklas |
for (var i=0; i < bioplates.length; i++) |
2673 |
16 Sep 14 |
nicklas |
51 |
{ |
2673 |
16 Sep 14 |
nicklas |
var bioplate = bioplates[i]; |
2673 |
16 Sep 14 |
nicklas |
var option = new Option(bioplate.name, bioplate.id); |
2673 |
16 Sep 14 |
nicklas |
option.bioplate = bioplate; |
2673 |
16 Sep 14 |
nicklas |
plates.options[plates.length] = option; |
2673 |
16 Sep 14 |
nicklas |
56 |
} |
2673 |
16 Sep 14 |
nicklas |
bioplateIsValid = true; |
2673 |
16 Sep 14 |
nicklas |
protocol.bioplateOnChange(); |
2673 |
16 Sep 14 |
nicklas |
59 |
} |
2673 |
16 Sep 14 |
nicklas |
else |
2673 |
16 Sep 14 |
nicklas |
61 |
{ |
2673 |
16 Sep 14 |
nicklas |
Wizard.setFatalError('No Library bioplates available for processing.'); |
2673 |
16 Sep 14 |
nicklas |
return; |
2673 |
16 Sep 14 |
nicklas |
64 |
} |
2673 |
16 Sep 14 |
nicklas |
65 |
|
2673 |
16 Sep 14 |
nicklas |
Doc.show('step-1'); |
2673 |
16 Sep 14 |
nicklas |
67 |
} |
2673 |
16 Sep 14 |
nicklas |
68 |
|
2673 |
16 Sep 14 |
nicklas |
protocol.initExportLinks = function(response) |
2673 |
16 Sep 14 |
nicklas |
70 |
{ |
2673 |
16 Sep 14 |
nicklas |
var configurations = response.configurations; |
5297 |
13 Feb 19 |
nicklas |
var caliper96 = protocol.makeExportLink('Sample names for Caliper [csv]', 'CALIPER', 'SAMPLE_NAMES'); |
2673 |
16 Sep 14 |
nicklas |
for (var i = 0; i < configurations.length; i++) |
2673 |
16 Sep 14 |
nicklas |
74 |
{ |
2673 |
16 Sep 14 |
nicklas |
var config = configurations[i]; |
5297 |
13 Feb 19 |
nicklas |
var btnHtml = protocol.makeExportLink('Run parameters: '+Strings.encodeTags(config.name) + ' [xml]', 'CALIPER', config.id); |
2673 |
16 Sep 14 |
nicklas |
if (config.name.indexOf('384') > 0) |
2673 |
16 Sep 14 |
nicklas |
78 |
{ |
3665 |
14 Dec 15 |
nicklas |
// ignore old 96->284 plate remapping |
2673 |
16 Sep 14 |
nicklas |
80 |
} |
2673 |
16 Sep 14 |
nicklas |
else |
2673 |
16 Sep 14 |
nicklas |
82 |
{ |
2673 |
16 Sep 14 |
nicklas |
caliper96 += btnHtml; |
2673 |
16 Sep 14 |
nicklas |
84 |
} |
2673 |
16 Sep 14 |
nicklas |
85 |
} |
2673 |
16 Sep 14 |
nicklas |
Doc.element('exportCaliper96').innerHTML = caliper96; |
2673 |
16 Sep 14 |
nicklas |
87 |
|
5297 |
13 Feb 19 |
nicklas |
var formats = [ |
5297 |
13 Feb 19 |
nicklas |
{ name: 'csv', description: 'Tab-separated text file'}, |
5297 |
13 Feb 19 |
nicklas |
{ name: 'xlsx', description: 'Excel worksheet'} |
5297 |
13 Feb 19 |
nicklas |
91 |
]; |
5297 |
13 Feb 19 |
nicklas |
92 |
|
5297 |
13 Feb 19 |
nicklas |
var qubit = protocol.makeExportLink('Sample names for Qubit', 'QUBIT', 'SAMPLE_NAMES', formats); |
2673 |
16 Sep 14 |
nicklas |
Doc.element('exportQubit').innerHTML = qubit; |
2673 |
16 Sep 14 |
nicklas |
95 |
|
2673 |
16 Sep 14 |
nicklas |
var links = Doc.element('export').getElementsByClassName('link'); |
2673 |
16 Sep 14 |
nicklas |
for (var linkNo = 0; linkNo < links.length; linkNo++) |
2673 |
16 Sep 14 |
nicklas |
98 |
{ |
2673 |
16 Sep 14 |
nicklas |
Events.addEventHandler(links[linkNo], 'click', protocol.exportFile); |
2673 |
16 Sep 14 |
nicklas |
100 |
} |
2673 |
16 Sep 14 |
nicklas |
101 |
} |
2673 |
16 Sep 14 |
nicklas |
102 |
|
5297 |
13 Feb 19 |
nicklas |
// Note! fileFormats parameter (if used) must be an array of objects with 'name' and 'description' properties |
5297 |
13 Feb 19 |
nicklas |
protocol.makeExportLink = function(title, hardware, exporter, fileFormats) |
2673 |
16 Sep 14 |
nicklas |
105 |
{ |
2673 |
16 Sep 14 |
nicklas |
var btn = ''; |
5297 |
13 Feb 19 |
nicklas |
107 |
|
5297 |
13 Feb 19 |
nicklas |
if (fileFormats && fileFormats.length) |
5297 |
13 Feb 19 |
nicklas |
109 |
{ |
5297 |
13 Feb 19 |
nicklas |
btn += '<img src="../images/export.png"> '+title; |
5297 |
13 Feb 19 |
nicklas |
for (var i = 0; i < fileFormats.length; i++) |
5297 |
13 Feb 19 |
nicklas |
112 |
{ |
5297 |
13 Feb 19 |
nicklas |
var ff = fileFormats[i]; |
5297 |
13 Feb 19 |
nicklas |
btn += ' [<span class="link" data-hardware="'+hardware+'" data-exporter="'+exporter+'"'; |
5297 |
13 Feb 19 |
nicklas |
btn += ' data-file-format="'+ff.name+'" title="'+ff.description+'">'; |
5297 |
13 Feb 19 |
nicklas |
btn += ff.name+'</span>]'; |
5297 |
13 Feb 19 |
nicklas |
117 |
} |
5297 |
13 Feb 19 |
nicklas |
118 |
} |
5297 |
13 Feb 19 |
nicklas |
else |
5297 |
13 Feb 19 |
nicklas |
120 |
{ |
5297 |
13 Feb 19 |
nicklas |
btn += '<span class="link" data-hardware="'+hardware+'" data-exporter="'+exporter+'"'; |
5297 |
13 Feb 19 |
nicklas |
btn += '><img src="../images/export.png"> '; |
5297 |
13 Feb 19 |
nicklas |
btn += title+'</span>'; |
5297 |
13 Feb 19 |
nicklas |
124 |
} |
5297 |
13 Feb 19 |
nicklas |
btn += '<br>\n'; |
2673 |
16 Sep 14 |
nicklas |
return btn; |
2673 |
16 Sep 14 |
nicklas |
127 |
} |
2673 |
16 Sep 14 |
nicklas |
128 |
|
2673 |
16 Sep 14 |
nicklas |
// Add pools to the pools list based on the bioplate selection |
2673 |
16 Sep 14 |
nicklas |
protocol.bioplateOnChange = function() |
2673 |
16 Sep 14 |
nicklas |
131 |
{ |
2673 |
16 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2673 |
16 Sep 14 |
nicklas |
var bioplate = frm.bioplate[frm.bioplate.selectedIndex].bioplate; |
2673 |
16 Sep 14 |
nicklas |
Doc.element('comments').innerHTML = Strings.encodeTags(bioplate.comments); |
2673 |
16 Sep 14 |
nicklas |
frm.poolSchema.value = bioplate.poolSchema; |
2673 |
16 Sep 14 |
nicklas |
frm.barcodeVariant.value = bioplate.barcodeVariant; |
2673 |
16 Sep 14 |
nicklas |
137 |
} |
2673 |
16 Sep 14 |
nicklas |
138 |
|
2673 |
16 Sep 14 |
nicklas |
139 |
|
2673 |
16 Sep 14 |
nicklas |
protocol.viewProtocol = function(event) |
2673 |
16 Sep 14 |
nicklas |
141 |
{ |
2673 |
16 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2673 |
16 Sep 14 |
nicklas |
if (frm.bioplate && !frm.bioplate.disabled) |
2673 |
16 Sep 14 |
nicklas |
144 |
{ |
2673 |
16 Sep 14 |
nicklas |
frm.view.value = Data.get(event.currentTarget, 'protocol-type'); |
2673 |
16 Sep 14 |
nicklas |
frm.submit(); |
2673 |
16 Sep 14 |
nicklas |
147 |
} |
2673 |
16 Sep 14 |
nicklas |
148 |
} |
2673 |
16 Sep 14 |
nicklas |
149 |
|
2673 |
16 Sep 14 |
nicklas |
protocol.exportFile = function(event) |
2673 |
16 Sep 14 |
nicklas |
151 |
{ |
2673 |
16 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2673 |
16 Sep 14 |
nicklas |
if (frm.bioplate && !frm.bioplate.disabled) |
2673 |
16 Sep 14 |
nicklas |
154 |
{ |
2673 |
16 Sep 14 |
nicklas |
var bioPlateId = frm.bioplate[frm.bioplate.selectedIndex].value; |
2673 |
16 Sep 14 |
nicklas |
156 |
|
2673 |
16 Sep 14 |
nicklas |
var hardware = Data.get(event.currentTarget, 'hardware'); |
2673 |
16 Sep 14 |
nicklas |
var exporter = Data.get(event.currentTarget, 'exporter'); |
5297 |
13 Feb 19 |
nicklas |
var fileFormat = Data.get(event.currentTarget, 'file-format'); |
2673 |
16 Sep 14 |
nicklas |
160 |
|
2673 |
16 Sep 14 |
nicklas |
var url = '../LibPrep.servlet?ID='+App.getSessionId(); |
2673 |
16 Sep 14 |
nicklas |
if (hardware == 'CALIPER') |
2673 |
16 Sep 14 |
nicklas |
163 |
{ |
2673 |
16 Sep 14 |
nicklas |
if (exporter == 'SAMPLE_NAMES') |
2673 |
16 Sep 14 |
nicklas |
165 |
{ |
2673 |
16 Sep 14 |
nicklas |
url += '&cmd=ExportSampleNamesForCaliper&bioPlateId='+bioPlateId; |
2673 |
16 Sep 14 |
nicklas |
167 |
} |
2673 |
16 Sep 14 |
nicklas |
else |
2673 |
16 Sep 14 |
nicklas |
169 |
{ |
2673 |
16 Sep 14 |
nicklas |
url += '&cmd=ExportCaliperRunParameters&bioPlateId='+bioPlateId+'&configurationId='+exporter; |
2673 |
16 Sep 14 |
nicklas |
171 |
} |
2673 |
16 Sep 14 |
nicklas |
172 |
} |
2673 |
16 Sep 14 |
nicklas |
else if (hardware == 'QUBIT') |
2673 |
16 Sep 14 |
nicklas |
174 |
{ |
2673 |
16 Sep 14 |
nicklas |
if (exporter == 'SAMPLE_NAMES') |
2673 |
16 Sep 14 |
nicklas |
176 |
{ |
5297 |
13 Feb 19 |
nicklas |
url += '&cmd=ExportSampleNamesForQubit&bioPlateId='+bioPlateId+'&format='+fileFormat; |
2673 |
16 Sep 14 |
nicklas |
178 |
} |
2673 |
16 Sep 14 |
nicklas |
else |
2673 |
16 Sep 14 |
nicklas |
180 |
{ |
2673 |
16 Sep 14 |
nicklas |
alert('not implemented'); |
2673 |
16 Sep 14 |
nicklas |
return; |
2673 |
16 Sep 14 |
nicklas |
183 |
} |
2673 |
16 Sep 14 |
nicklas |
184 |
} |
2673 |
16 Sep 14 |
nicklas |
window.location = url; |
2673 |
16 Sep 14 |
nicklas |
186 |
} |
2673 |
16 Sep 14 |
nicklas |
187 |
} |
2673 |
16 Sep 14 |
nicklas |
188 |
|
2673 |
16 Sep 14 |
nicklas |
protocol.initializeProtocol = function(response) |
2673 |
16 Sep 14 |
nicklas |
190 |
{ |
2673 |
16 Sep 14 |
nicklas |
var list = response.libraries; |
2673 |
16 Sep 14 |
nicklas |
192 |
|
2673 |
16 Sep 14 |
nicklas |
193 |
|
2673 |
16 Sep 14 |
nicklas |
var schema = PoolSchema.getById(Data.get('page-data', 'schema')); |
2673 |
16 Sep 14 |
nicklas |
var barcodeVariant = PoolSchema.getBarcodeVariantByName(schema, Data.get('page-data', 'barcode-variant')); |
2673 |
16 Sep 14 |
nicklas |
196 |
|
2673 |
16 Sep 14 |
nicklas |
// Pre-process the Library items |
2673 |
16 Sep 14 |
nicklas |
for (var i = 0; i < list.length; i++) |
2673 |
16 Sep 14 |
nicklas |
199 |
{ |
2673 |
16 Sep 14 |
nicklas |
protocol.checkAndPreProcessLibrary(list[i], schema, barcodeVariant); |
2673 |
16 Sep 14 |
nicklas |
201 |
} |
2673 |
16 Sep 14 |
nicklas |
202 |
|
2673 |
16 Sep 14 |
nicklas |
var view = Data.get('page-data', 'view'); |
2673 |
16 Sep 14 |
nicklas |
if (view == 'list') |
2673 |
16 Sep 14 |
nicklas |
205 |
{ |
2673 |
16 Sep 14 |
nicklas |
protocol.viewAsList(list, schema, barcodeVariant); |
2673 |
16 Sep 14 |
nicklas |
207 |
} |
2673 |
16 Sep 14 |
nicklas |
else |
2673 |
16 Sep 14 |
nicklas |
209 |
{ |
2673 |
16 Sep 14 |
nicklas |
protocol.viewAsPlate(list, schema, barcodeVariant) |
2673 |
16 Sep 14 |
nicklas |
211 |
} |
2673 |
16 Sep 14 |
nicklas |
212 |
|
2673 |
16 Sep 14 |
nicklas |
213 |
} |
2673 |
16 Sep 14 |
nicklas |
214 |
|
2673 |
16 Sep 14 |
nicklas |
215 |
/** |
2673 |
16 Sep 14 |
nicklas |
Find the lowest used quantity. This is the QUANTITY_REGULAR |
2673 |
16 Sep 14 |
nicklas |
value. RNA with larger used quantities are assumed to be selected |
2673 |
16 Sep 14 |
nicklas |
for QC. |
2673 |
16 Sep 14 |
nicklas |
219 |
*/ |
2673 |
16 Sep 14 |
nicklas |
protocol.findLowestUsedQuantity = function(mrnaList) |
2673 |
16 Sep 14 |
nicklas |
221 |
{ |
2673 |
16 Sep 14 |
nicklas |
var lowestQuantity = mrnaList[0].rna.usedQuantity; |
2673 |
16 Sep 14 |
nicklas |
for (var i = 1; i < mrnaList.length; i++) |
2673 |
16 Sep 14 |
nicklas |
224 |
{ |
2673 |
16 Sep 14 |
nicklas |
var rna = mrnaList[i].rna; |
2673 |
16 Sep 14 |
nicklas |
if (rna.usedQuantity < lowestQuantity) |
2673 |
16 Sep 14 |
nicklas |
227 |
{ |
2673 |
16 Sep 14 |
nicklas |
lowestQuantity = rna.usedQuantity; |
2673 |
16 Sep 14 |
nicklas |
229 |
} |
2673 |
16 Sep 14 |
nicklas |
230 |
} |
2673 |
16 Sep 14 |
nicklas |
return lowestQuantity; |
2673 |
16 Sep 14 |
nicklas |
232 |
} |
2673 |
16 Sep 14 |
nicklas |
233 |
|
2673 |
16 Sep 14 |
nicklas |
234 |
|
2673 |
16 Sep 14 |
nicklas |
protocol.checkAndPreProcessLibrary = function(lib, schema, barcodeVariant) |
2673 |
16 Sep 14 |
nicklas |
236 |
{ |
2673 |
16 Sep 14 |
nicklas |
var well = lib.bioWell; |
3760 |
19 Feb 16 |
nicklas |
lib.isYellow = lib.specimen && lib.specimen.YellowLabel != null; |
2673 |
16 Sep 14 |
nicklas |
var remarks = []; |
2673 |
16 Sep 14 |
nicklas |
240 |
|
2673 |
16 Sep 14 |
nicklas |
// Check if default barcode has been modified |
2673 |
16 Sep 14 |
nicklas |
var indexSet = barcodeVariant.indexSets[well.column]; |
2673 |
16 Sep 14 |
nicklas |
if (indexSet) |
2673 |
16 Sep 14 |
nicklas |
244 |
{ |
2673 |
16 Sep 14 |
nicklas |
var defaultBarcode = indexSet.barcodes[well.row]; |
2673 |
16 Sep 14 |
nicklas |
if (defaultBarcode && lib.barcode.name != defaultBarcode) |
2673 |
16 Sep 14 |
nicklas |
247 |
{ |
2673 |
16 Sep 14 |
nicklas |
remarks[remarks.length] = 'Modified barcode'; |
2673 |
16 Sep 14 |
nicklas |
lib.barcode.modified = true; |
2673 |
16 Sep 14 |
nicklas |
250 |
} |
2673 |
16 Sep 14 |
nicklas |
251 |
} |
2673 |
16 Sep 14 |
nicklas |
lib.remarks = remarks; |
2673 |
16 Sep 14 |
nicklas |
253 |
} |
2673 |
16 Sep 14 |
nicklas |
254 |
|
2673 |
16 Sep 14 |
nicklas |
protocol.viewAsPlate = function(list, schema, barcodeVariant) |
2673 |
16 Sep 14 |
nicklas |
256 |
{ |
2673 |
16 Sep 14 |
nicklas |
var rows = Data.get('page-data', 'rows'); |
2673 |
16 Sep 14 |
nicklas |
var columns = Data.get('page-data', 'columns'); |
2673 |
16 Sep 14 |
nicklas |
Plate.init(rows, columns, schema, WellPainter); |
2673 |
16 Sep 14 |
nicklas |
260 |
|
2673 |
16 Sep 14 |
nicklas |
for (var i = 0; i < list.length; i++) |
2673 |
16 Sep 14 |
nicklas |
262 |
{ |
2673 |
16 Sep 14 |
nicklas |
var lib = list[i]; |
2673 |
16 Sep 14 |
nicklas |
var well = lib.bioWell; |
2673 |
16 Sep 14 |
nicklas |
Plate.getWell(well.row, well.column).setExtract(lib); |
2673 |
16 Sep 14 |
nicklas |
266 |
} |
2673 |
16 Sep 14 |
nicklas |
267 |
|
2673 |
16 Sep 14 |
nicklas |
WellPainter.barcodeVariant = barcodeVariant; |
2673 |
16 Sep 14 |
nicklas |
Plate.paint(Plate.getWells()); |
2673 |
16 Sep 14 |
nicklas |
PoolSchema.buildPoolTableRow(schema, columns); |
2673 |
16 Sep 14 |
nicklas |
271 |
|
2673 |
16 Sep 14 |
nicklas |
Doc.show('all-protocol'); |
2673 |
16 Sep 14 |
nicklas |
273 |
} |
2673 |
16 Sep 14 |
nicklas |
274 |
|
2673 |
16 Sep 14 |
nicklas |
protocol.viewAsList = function(list, schema, barcodeVariant) |
2673 |
16 Sep 14 |
nicklas |
276 |
{ |
3760 |
19 Feb 16 |
nicklas |
var homeUrl = Data.get('page-data', 'home-url'); |
3760 |
19 Feb 16 |
nicklas |
var yellowImg = '<img src="'+homeUrl+'/images/yellow-label-small.png">'; |
2673 |
16 Sep 14 |
nicklas |
var lastPoolNum = -1; |
2673 |
16 Sep 14 |
nicklas |
for (var i = 0; i < list.length; i++) |
2673 |
16 Sep 14 |
nicklas |
281 |
{ |
2673 |
16 Sep 14 |
nicklas |
var lib = list[i]; |
2673 |
16 Sep 14 |
nicklas |
var well = lib.bioWell; |
2673 |
16 Sep 14 |
nicklas |
284 |
|
2673 |
16 Sep 14 |
nicklas |
var idSuffix = well.column + '.' + well.row; |
3760 |
19 Feb 16 |
nicklas |
var img = lib.isYellow ? yellowImg : ''; |
3760 |
19 Feb 16 |
nicklas |
287 |
|
2673 |
16 Sep 14 |
nicklas |
Doc.removeClass('row.'+idSuffix, 'empty'); |
3760 |
19 Feb 16 |
nicklas |
if (lib.isYellow) Doc.addClass('row.'+idSuffix, 'yellow-specimen'); |
3760 |
19 Feb 16 |
nicklas |
Doc.element('lib.'+idSuffix).innerHTML = img+Strings.encodeTags(lib.name); |
2673 |
16 Sep 14 |
nicklas |
Doc.element('barcode.'+idSuffix).innerHTML = Strings.encodeTags(lib.barcode.name); |
2673 |
16 Sep 14 |
nicklas |
292 |
|
2673 |
16 Sep 14 |
nicklas |
var indexSet = barcodeVariant.indexSets[well.column]; |
2673 |
16 Sep 14 |
nicklas |
if (indexSet) |
2673 |
16 Sep 14 |
nicklas |
295 |
{ |
2673 |
16 Sep 14 |
nicklas |
var color = lib.barcode.modified ? 'bg-modified' : indexSet.color; |
2673 |
16 Sep 14 |
nicklas |
Doc.addClass('barcode.'+idSuffix, color); |
2673 |
16 Sep 14 |
nicklas |
298 |
} |
2673 |
16 Sep 14 |
nicklas |
299 |
|
2673 |
16 Sep 14 |
nicklas |
Doc.element('remarks.'+idSuffix).innerHTML = lib.remarks.join('; '); |
2673 |
16 Sep 14 |
nicklas |
301 |
} |
2673 |
16 Sep 14 |
nicklas |
302 |
|
2673 |
16 Sep 14 |
nicklas |
Doc.show('all-protocol'); |
2673 |
16 Sep 14 |
nicklas |
304 |
} |
2673 |
16 Sep 14 |
nicklas |
305 |
|
2673 |
16 Sep 14 |
nicklas |
306 |
|
2673 |
16 Sep 14 |
nicklas |
return protocol; |
2673 |
16 Sep 14 |
nicklas |
308 |
}(); |
2673 |
16 Sep 14 |
nicklas |
309 |
|
2673 |
16 Sep 14 |
nicklas |
Doc.onLoad(Protocol.initPage); |
2673 |
16 Sep 14 |
nicklas |
311 |
|
2673 |
16 Sep 14 |
nicklas |
312 |
|
2673 |
16 Sep 14 |
nicklas |
var WellPainter = function() |
2673 |
16 Sep 14 |
nicklas |
314 |
{ |
2673 |
16 Sep 14 |
nicklas |
var painter = {}; |
2673 |
16 Sep 14 |
nicklas |
316 |
|
2673 |
16 Sep 14 |
nicklas |
painter.getClassNameForWell = function(well, schema) |
2673 |
16 Sep 14 |
nicklas |
318 |
{ |
2673 |
16 Sep 14 |
nicklas |
var cls = ''; |
2673 |
16 Sep 14 |
nicklas |
var indexSet = painter.barcodeVariant.indexSets[well.column]; |
2673 |
16 Sep 14 |
nicklas |
if (indexSet) |
2673 |
16 Sep 14 |
nicklas |
322 |
{ |
2673 |
16 Sep 14 |
nicklas |
var lib = well.extract; |
2673 |
16 Sep 14 |
nicklas |
cls += lib && lib.barcode.modified ? 'bg-modified' : indexSet.color; |
3760 |
19 Feb 16 |
nicklas |
if (lib && lib.isYellow) cls += ' yellow-specimen'; |
2673 |
16 Sep 14 |
nicklas |
326 |
} |
2673 |
16 Sep 14 |
nicklas |
return cls; |
2673 |
16 Sep 14 |
nicklas |
328 |
} |
2673 |
16 Sep 14 |
nicklas |
329 |
|
2673 |
16 Sep 14 |
nicklas |
painter.getWellText = function(well, schema) |
2673 |
16 Sep 14 |
nicklas |
331 |
{ |
2673 |
16 Sep 14 |
nicklas |
var text = ''; |
2673 |
16 Sep 14 |
nicklas |
var lib = well.extract; |
2673 |
16 Sep 14 |
nicklas |
if (lib) |
2673 |
16 Sep 14 |
nicklas |
335 |
{ |
2673 |
16 Sep 14 |
nicklas |
var name = lib.name; |
2673 |
16 Sep 14 |
nicklas |
var i = name.indexOf('.m'); |
3760 |
19 Feb 16 |
nicklas |
text += '<div class="lib if-yellow">'+Strings.encodeTags(name.substring(0, i))+'.<br> '+Strings.encodeTags(name.substring(i))+'</div>'; |
2673 |
16 Sep 14 |
nicklas |
text += '<div class="barcode">'+Strings.encodeTags(lib.barcode.name)+'</div>'; |
2673 |
16 Sep 14 |
nicklas |
text += '<div class="remarks">'+ lib.remarks.join('; ') + '</div>'; |
2673 |
16 Sep 14 |
nicklas |
341 |
} |
2673 |
16 Sep 14 |
nicklas |
return text; |
2673 |
16 Sep 14 |
nicklas |
343 |
} |
2673 |
16 Sep 14 |
nicklas |
344 |
|
2673 |
16 Sep 14 |
nicklas |
return painter; |
2673 |
16 Sep 14 |
nicklas |
346 |
}(); |