1 | <%@ page |
---|
2 | pageEncoding="UTF-8" |
---|
3 | session="false" |
---|
4 | import="net.sf.basedb.core.User" |
---|
5 | import="net.sf.basedb.core.DbControl" |
---|
6 | import="net.sf.basedb.core.SessionControl" |
---|
7 | import="net.sf.basedb.core.Application" |
---|
8 | import="net.sf.basedb.util.formatter.WellCoordinateFormatter" |
---|
9 | import="net.sf.basedb.clients.web.Base" |
---|
10 | import="net.sf.basedb.clients.web.util.HTML" |
---|
11 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
12 | %> |
---|
13 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
14 | <%@ taglib prefix="p" uri="/WEB-INF/path.tld" %> |
---|
15 | <% |
---|
16 | final SessionControl sc = Base.getExistingSessionControl(request, true); |
---|
17 | final String ID = sc.getId(); |
---|
18 | final float scale = Base.getScale(sc); |
---|
19 | final String home = ExtensionsControl.getHomeUrl("net.sf.basedb.reggie"); |
---|
20 | DbControl dc = null; |
---|
21 | try |
---|
22 | { |
---|
23 | dc = sc.newDbControl(); |
---|
24 | final User user = User.getById(dc, sc.getLoggedInUserId()); |
---|
25 | %> |
---|
26 | <base:page type="default" > |
---|
27 | <base:head scripts="ajax.js" styles="path.css"> |
---|
28 | <link rel="stylesheet" type="text/css" href="../css/reggie.css"> |
---|
29 | <link rel="stylesheet" type="text/css" href="../css/plate.css"> |
---|
30 | <script language="JavaScript" src="../reggie.js" type="text/javascript" charset="UTF-8"></script> |
---|
31 | <script language="JavaScript" src="pools.js" type="text/javascript" charset="UTF-8"></script> |
---|
32 | <script language="JavaScript" src="plate.js" type="text/javascript" charset="UTF-8"></script> |
---|
33 | |
---|
34 | <script language="JavaScript"> |
---|
35 | var debug = false; |
---|
36 | var currentStep = 1; |
---|
37 | |
---|
38 | var cdnaDateIsValid = false; |
---|
39 | var barcodesByName = []; |
---|
40 | |
---|
41 | function init() |
---|
42 | { |
---|
43 | var frm = document.forms['reggie']; |
---|
44 | |
---|
45 | var barcodes = loadBarcodes(); |
---|
46 | var selectBarcodeHtml = ''; |
---|
47 | |
---|
48 | for (var i = 0; i < barcodes.length; i++) |
---|
49 | { |
---|
50 | if (i % 8 == 0 && i > 0) |
---|
51 | { |
---|
52 | selectBarcodeHtml += '<div class="menuseparator"></div>'; |
---|
53 | } |
---|
54 | var barcode = barcodes[i]; |
---|
55 | barcodesByName[barcode.name] = barcode; |
---|
56 | selectBarcodeHtml += '<div class="menuitem enabled" id="bc-'+barcode.id+'" data-barcode-name="'+barcode.name+'">'; |
---|
57 | selectBarcodeHtml += barcode.name+'</div>'; |
---|
58 | } |
---|
59 | setInnerHTML('select-barcode-all', selectBarcodeHtml); |
---|
60 | |
---|
61 | // Load existing cDNA plates that have not yet been assigned barcodes |
---|
62 | var bioplates = getCDnaBioPlatesForBarcode(); |
---|
63 | var plates = frm.bioplate; |
---|
64 | if (bioplates != null && bioplates.length > 0) |
---|
65 | { |
---|
66 | for (var i=0; i < bioplates.length; i++) |
---|
67 | { |
---|
68 | var bioplate = bioplates[i]; |
---|
69 | var option = new Option(bioplate.name, bioplate.id); |
---|
70 | option.bioplate = bioplate; |
---|
71 | plates.options[plates.length] = option; |
---|
72 | } |
---|
73 | bioplateIsValid = true; |
---|
74 | setInputStatus('bioplate', '', 'valid'); |
---|
75 | bioPlateOnChange(); |
---|
76 | } |
---|
77 | else |
---|
78 | { |
---|
79 | var msg = 'No cDNA bioplates available for processing.'; |
---|
80 | setFatalError(msg); |
---|
81 | return; |
---|
82 | } |
---|
83 | |
---|
84 | Main.show('gonext'); |
---|
85 | } |
---|
86 | |
---|
87 | function getCDnaBioPlatesForBarcode() |
---|
88 | { |
---|
89 | var frm = document.forms['reggie']; |
---|
90 | |
---|
91 | var request = Ajax.getXmlHttpRequest(); |
---|
92 | try |
---|
93 | { |
---|
94 | showLoadingAnimation('Loading cDNA bioplates ...'); |
---|
95 | var url = '../LibPrep.servlet?ID=<%=ID%>&cmd=GetCDNAPlatesForBarcoding'; |
---|
96 | request.open("GET", url, false); |
---|
97 | request.send(null); |
---|
98 | } |
---|
99 | finally |
---|
100 | { |
---|
101 | hideLoadingAnimation(); |
---|
102 | } |
---|
103 | |
---|
104 | if (debug) Main.debug(request.responseText); |
---|
105 | var response = JSON.parse(request.responseText); |
---|
106 | if (response.status != 'ok') |
---|
107 | { |
---|
108 | setFatalError(response.message); |
---|
109 | return false; |
---|
110 | } |
---|
111 | return response.bioplates; |
---|
112 | } |
---|
113 | |
---|
114 | function bioPlateOnChange() |
---|
115 | { |
---|
116 | var frm = document.forms['reggie']; |
---|
117 | var bioplate = frm.bioplate[frm.bioplate.selectedIndex].bioplate; |
---|
118 | setInnerHTML('cdnacomments', formatText(bioplate.comments)); |
---|
119 | } |
---|
120 | |
---|
121 | |
---|
122 | function loadBarcodes() |
---|
123 | { |
---|
124 | var request = Ajax.getXmlHttpRequest(); |
---|
125 | try |
---|
126 | { |
---|
127 | showLoadingAnimation('Loading barcode information...'); |
---|
128 | var url = '../LibPrep.servlet?ID=<%=ID%>&cmd=GetAllBarcodeInfo'; |
---|
129 | request.open("GET", url, false); |
---|
130 | request.send(null); |
---|
131 | } |
---|
132 | finally |
---|
133 | { |
---|
134 | hideLoadingAnimation(); |
---|
135 | } |
---|
136 | |
---|
137 | if (debug) Main.debug(request.responseText); |
---|
138 | var response = JSON.parse(request.responseText); |
---|
139 | if (response.status != 'ok') |
---|
140 | { |
---|
141 | setFatalError(response.message); |
---|
142 | return false; |
---|
143 | } |
---|
144 | |
---|
145 | return response.barcodes; |
---|
146 | } |
---|
147 | |
---|
148 | function goNext(manual) |
---|
149 | { |
---|
150 | setInnerHTML('gonext.message', ''); |
---|
151 | if (currentStep == 1) |
---|
152 | { |
---|
153 | gotoStep2(); |
---|
154 | } |
---|
155 | setCurrentStep(currentStep); |
---|
156 | } |
---|
157 | |
---|
158 | function gotoStep2() |
---|
159 | { |
---|
160 | var frm = document.forms['reggie']; |
---|
161 | frm.bioplate.disabled = true; |
---|
162 | |
---|
163 | Main.addClass(document.getElementById('step.1.section'), 'disabled'); |
---|
164 | Main.hide('gonext'); |
---|
165 | Main.hide('gocancel'); |
---|
166 | loadCDNAInformation(); |
---|
167 | |
---|
168 | currentStep = 2; |
---|
169 | Main.hide('step.1.section'); |
---|
170 | Main.show('step.2.section'); |
---|
171 | Main.show('gocancel'); |
---|
172 | Main.show('gocreate'); |
---|
173 | |
---|
174 | keepSessionAlive('<%=ID%>', debug, '../'); |
---|
175 | } |
---|
176 | |
---|
177 | function loadCDNAInformation() |
---|
178 | { |
---|
179 | // Load cDNA and related info from the selected bioplate |
---|
180 | |
---|
181 | var frm = document.forms['reggie']; |
---|
182 | var cdnaPlate = frm.bioplate[frm.bioplate.selectedIndex].bioplate; |
---|
183 | |
---|
184 | var schema = PoolSchema.getById(cdnaPlate.poolSchema); |
---|
185 | PoolSchema.initList(frm.pool_schema, schema.id); |
---|
186 | PoolSchema.initVariantList(frm.barcode_variant, schema, cdnaPlate.barcodeVariant); |
---|
187 | |
---|
188 | var request = Ajax.getXmlHttpRequest(); |
---|
189 | try |
---|
190 | { |
---|
191 | showLoadingAnimation('Loading cDNA bioplate information...'); |
---|
192 | var url = '../LibPrep.servlet?ID=<%=ID%>&cmd=GetCDnaInfoForPlate&bioplate='+cdnaPlate.id; |
---|
193 | request.open("GET", url, false); |
---|
194 | request.send(null); |
---|
195 | } |
---|
196 | finally |
---|
197 | { |
---|
198 | hideLoadingAnimation(); |
---|
199 | } |
---|
200 | |
---|
201 | if (debug) Main.debug(request.responseText); |
---|
202 | var response = JSON.parse(request.responseText); |
---|
203 | if (response.status != 'ok') |
---|
204 | { |
---|
205 | setFatalError(response.message); |
---|
206 | return false; |
---|
207 | } |
---|
208 | |
---|
209 | var list = response.cdna; |
---|
210 | // Pre-process the return cDNA items |
---|
211 | for (var i = 0; i < list.length; i++) |
---|
212 | { |
---|
213 | checkAndPreProcessCDna(list[i]); |
---|
214 | } |
---|
215 | |
---|
216 | viewAsPlate(list, schema); |
---|
217 | } |
---|
218 | |
---|
219 | |
---|
220 | /** |
---|
221 | Check the mRNA and RNA items for problems and calculate derived |
---|
222 | information such as volume and water, qc/stratagene flags. |
---|
223 | */ |
---|
224 | function checkAndPreProcessCDna(cdna) |
---|
225 | { |
---|
226 | // Set the 'stratagene'/'external' flag |
---|
227 | cdna.stratagene = cdna.name.indexOf(GENERIC_STRATAGENE_NAME) == 0; |
---|
228 | cdna.external = cdna.name.indexOf(EXTERNAL_RNA_NAME) == 0; |
---|
229 | } |
---|
230 | |
---|
231 | function viewAsPlate(list, schema) |
---|
232 | { |
---|
233 | Plate.init(8, 12, schema, WellPainter); |
---|
234 | |
---|
235 | for (var i = 0; i < list.length; i++) |
---|
236 | { |
---|
237 | var cdna = list[i]; |
---|
238 | var well = cdna.bioWell; |
---|
239 | Plate.getWell(well.row, well.column).setExtract(cdna); |
---|
240 | } |
---|
241 | var frm = document.forms['reggie']; |
---|
242 | |
---|
243 | var barcodeVariant = schema.barcodeVariants[frm.barcode_variant.selectedIndex]; |
---|
244 | assignSchemaDefinedBarcodeVariant(schema, barcodeVariant); |
---|
245 | |
---|
246 | WellPainter.barcodeVariant = barcodeVariant; |
---|
247 | Plate.paint(Plate.getWells()); |
---|
248 | PoolSchema.buildPoolTableRow(schema, 12, false); |
---|
249 | } |
---|
250 | |
---|
251 | function assignSchemaDefinedBarcodeVariant(schema, barcodeVariant) |
---|
252 | { |
---|
253 | var wells = Plate.getWells(); |
---|
254 | for (var i = 0; i < wells.length; i++) |
---|
255 | { |
---|
256 | var well = wells[i]; |
---|
257 | var cdna = well.extract; |
---|
258 | if (cdna) |
---|
259 | { |
---|
260 | var indexSet = barcodeVariant.indexSets[well.column]; |
---|
261 | var barcode = null; |
---|
262 | if (indexSet) |
---|
263 | { |
---|
264 | var barcodeName = indexSet.barcodes[well.row]; |
---|
265 | barcode = barcodesByName[barcodeName]; |
---|
266 | } |
---|
267 | cdna.barcode = barcode; |
---|
268 | cdna.defaultBarcode = barcode; |
---|
269 | well.duplicate = false; |
---|
270 | } |
---|
271 | } |
---|
272 | } |
---|
273 | |
---|
274 | |
---|
275 | function poolSchemaOnChange() |
---|
276 | { |
---|
277 | var frm = document.forms['reggie']; |
---|
278 | var schema = POOL_SCHEMA[frm.pool_schema.selectedIndex]; |
---|
279 | Plate.setPoolSchema(schema); |
---|
280 | PoolSchema.initVariantList(frm.barcode_variant, schema); |
---|
281 | |
---|
282 | var barcodeVariant = schema.barcodeVariants[frm.barcode_variant.selectedIndex]; |
---|
283 | assignSchemaDefinedBarcodeVariant(schema, barcodeVariant); |
---|
284 | |
---|
285 | WellPainter.barcodeVariant = barcodeVariant; |
---|
286 | Plate.paint(Plate.getWells()); |
---|
287 | PoolSchema.buildPoolTableRow(schema, 12, false); |
---|
288 | } |
---|
289 | |
---|
290 | function barcodeVariantOnChange() |
---|
291 | { |
---|
292 | var frm = document.forms['reggie']; |
---|
293 | var schema = POOL_SCHEMA[frm.pool_schema.selectedIndex]; |
---|
294 | var barcodeVariant = schema.barcodeVariants[frm.barcode_variant.selectedIndex]; |
---|
295 | |
---|
296 | assignSchemaDefinedBarcodeVariant(schema, barcodeVariant); |
---|
297 | |
---|
298 | WellPainter.barcodeVariant = barcodeVariant; |
---|
299 | Plate.paint(Plate.getWells()); |
---|
300 | } |
---|
301 | |
---|
302 | |
---|
303 | |
---|
304 | function goCreate() |
---|
305 | { |
---|
306 | var submitInfo = {}; |
---|
307 | var plateInfo = {}; |
---|
308 | |
---|
309 | submitInfo.bioplate = plateInfo; |
---|
310 | var frm = document.forms['reggie']; |
---|
311 | |
---|
312 | plateInfo.id = parseInt(frm.bioplate.value); |
---|
313 | plateInfo.poolSchema = frm.pool_schema.value; |
---|
314 | plateInfo.barcodeVariant = frm.barcode_variant.value; |
---|
315 | plateInfo.comments = frm.comments.value; |
---|
316 | plateInfo.wells = []; |
---|
317 | |
---|
318 | var wells = Plate.getWells(); |
---|
319 | var numErrors = 0; |
---|
320 | var numWarnings = 0; |
---|
321 | var numCdna = 0; |
---|
322 | for (var i = 0; i < wells.length; i++) |
---|
323 | { |
---|
324 | var well = wells[i]; |
---|
325 | if (well.hasWarning()) |
---|
326 | { |
---|
327 | numWarnings++; |
---|
328 | } |
---|
329 | if (well.hasError()) |
---|
330 | { |
---|
331 | numErrors++; |
---|
332 | } |
---|
333 | else |
---|
334 | { |
---|
335 | if (well.extract && well.extract.id) |
---|
336 | { |
---|
337 | var tmp = {}; |
---|
338 | tmp.row = well.row; |
---|
339 | tmp.column = well.column; |
---|
340 | tmp.cdna = {}; |
---|
341 | tmp.cdna.id = well.extract.id; |
---|
342 | tmp.cdna.barcode = {}; |
---|
343 | tmp.cdna.barcode.id = well.extract.barcode.id; |
---|
344 | plateInfo.wells[plateInfo.wells.length] = tmp; |
---|
345 | numCdna++; |
---|
346 | } |
---|
347 | } |
---|
348 | } |
---|
349 | |
---|
350 | if (numErrors > 0) |
---|
351 | { |
---|
352 | alert('There are ' + numErrors + ' wells with errors. Please fix them before continuing.'); |
---|
353 | return; |
---|
354 | } |
---|
355 | |
---|
356 | if (numCdna == 0) |
---|
357 | { |
---|
358 | alert('There is no cDNA in any wells'); |
---|
359 | return; |
---|
360 | } |
---|
361 | |
---|
362 | if (numWarnings > 0) |
---|
363 | { |
---|
364 | if (!confirm('There are ' + numWarnings + ' wells with a warning. Continue anyway?')) return; |
---|
365 | } |
---|
366 | |
---|
367 | |
---|
368 | Main.addClass(document.getElementById('step.2.section'), 'disabled'); |
---|
369 | Main.hide('gocancel'); |
---|
370 | Main.hide('gocreate'); |
---|
371 | |
---|
372 | if (debug) Main.debug(JSON.stringify(submitInfo)); |
---|
373 | |
---|
374 | var request = Ajax.getXmlHttpRequest(); |
---|
375 | var url = '../LibPrep.servlet?ID=<%=ID%>'; |
---|
376 | url += '&cmd=CreateBarcodedLibraries'; |
---|
377 | try |
---|
378 | { |
---|
379 | showLoadingAnimation('Registering barcoded libraries...'); |
---|
380 | request.open("POST", url, false); |
---|
381 | request.setRequestHeader("Content-Type", "application/json"); |
---|
382 | request.send(JSON.stringify(submitInfo)); |
---|
383 | } |
---|
384 | finally |
---|
385 | { |
---|
386 | hideLoadingAnimation(); |
---|
387 | } |
---|
388 | |
---|
389 | if (debug) Main.debug(request.responseText); |
---|
390 | |
---|
391 | var response = JSON.parse(request.responseText); |
---|
392 | if (response.status != 'ok') |
---|
393 | { |
---|
394 | setFatalError(response.message); |
---|
395 | return false; |
---|
396 | } |
---|
397 | |
---|
398 | var msg = '<ul>'; |
---|
399 | for (var i = 0; i < response.messages.length; i++) |
---|
400 | { |
---|
401 | msg += '<li>' + response.messages[i]; |
---|
402 | } |
---|
403 | msg += '</ul>'; |
---|
404 | setInnerHTML('done', msg); |
---|
405 | Main.show('done'); |
---|
406 | Main.show('gorestart'); |
---|
407 | } |
---|
408 | |
---|
409 | var currentWell; |
---|
410 | var lastSelectedBarcode; |
---|
411 | function selectBarcode(event, row, column) |
---|
412 | { |
---|
413 | // Locate the barcode selection div so that the current |
---|
414 | // barcode is positioned next to the current mouse position |
---|
415 | // Initially set it to the right of the mouse so that the |
---|
416 | // center is vertically aligned |
---|
417 | |
---|
418 | currentWell = Plate.getWell(row, column); |
---|
419 | var cdna = currentWell.extract; |
---|
420 | var scroll = 0; |
---|
421 | if (cdna) |
---|
422 | { |
---|
423 | // Reset 'current' selection |
---|
424 | var menu = document.getElementById('select-barcode'); |
---|
425 | var selectAll = document.getElementById('select-barcode-all'); |
---|
426 | for (var i = 0; i < selectAll.childNodes.length; i++) |
---|
427 | { |
---|
428 | Main.removeClass(selectAll.childNodes[i], 'current'); |
---|
429 | } |
---|
430 | menu.style.display = 'block'; |
---|
431 | |
---|
432 | var x = event.clientX+1; |
---|
433 | var halfHeight = Math.floor(selectAll.offsetHeight/2) |
---|
434 | var y = event.clientY-halfHeight; |
---|
435 | var scroll = 0; |
---|
436 | var barcodeDiv; |
---|
437 | |
---|
438 | var useBarcode = cdna.barcode || lastSelectedBarcode; |
---|
439 | if (useBarcode) |
---|
440 | { |
---|
441 | var barcodeDiv = document.getElementById('bc-'+useBarcode.id); |
---|
442 | if (!cdna.barcode && barcodeDiv.nextSibling) barcodeDiv = barcodeDiv.nextSibling; |
---|
443 | // Try to scroll the current barcode so that it's baseline is at the center of the div |
---|
444 | scroll = barcodeDiv.offsetTop + barcodeDiv.offsetHeight - halfHeight; |
---|
445 | if (scroll < 0) |
---|
446 | { |
---|
447 | // We get a negative scroll for the first few elements, shift the |
---|
448 | // entire selection div down instead |
---|
449 | y -= scroll; |
---|
450 | scroll = 0; |
---|
451 | } |
---|
452 | else if (scroll > selectAll.scrollHeight - selectAll.offsetHeight) |
---|
453 | { |
---|
454 | // We get a too large scroll value for the last few elements, shift |
---|
455 | // the entire selection div up instead |
---|
456 | y -= scroll - (selectAll.scrollHeight - selectAll.offsetHeight); |
---|
457 | scroll = selectAll.scrollHeight - selectAll.offsetHeight; |
---|
458 | } |
---|
459 | if (cdna.barcode) |
---|
460 | { |
---|
461 | Main.addClass(barcodeDiv, 'current'); |
---|
462 | } |
---|
463 | } |
---|
464 | |
---|
465 | // Default barcode |
---|
466 | if (cdna.defaultBarcode && cdna.defaultBarcode != cdna.barcode) |
---|
467 | { |
---|
468 | var selectDefault = document.getElementById('select-barcode-default'); |
---|
469 | selectDefault.setAttribute('data-barcode-name', cdna.defaultBarcode.name); |
---|
470 | selectDefault.innerHTML = 'Default: ' + cdna.defaultBarcode.name; |
---|
471 | Main.show('select-barcode-default'); |
---|
472 | Main.show('select-barcode-default-separator'); |
---|
473 | } |
---|
474 | else |
---|
475 | { |
---|
476 | Main.hide('select-barcode-default'); |
---|
477 | Main.hide('select-barcode-default-separator'); |
---|
478 | } |
---|
479 | |
---|
480 | // Position the selection div |
---|
481 | selectAll.scrollTop = scroll; |
---|
482 | menu.style.left = (x)+'px'; |
---|
483 | menu.style.top = (y)+'px'; |
---|
484 | event.stopPropagation(); |
---|
485 | } |
---|
486 | |
---|
487 | } |
---|
488 | |
---|
489 | function barcodeSelected(event) |
---|
490 | { |
---|
491 | var frm = document.forms['reggie']; |
---|
492 | var schema = POOL_SCHEMA[frm.pool_schema.selectedIndex]; |
---|
493 | var target = event.target; |
---|
494 | if (currentWell && currentWell.extract) |
---|
495 | { |
---|
496 | lastSelectedBarcode = barcodesByName[target.getAttribute('data-barcode-name')]; |
---|
497 | currentWell.extract.barcode = lastSelectedBarcode; |
---|
498 | var poolNum = schema.getPoolNumForColumn(currentWell.column); |
---|
499 | if (poolNum >= 0) |
---|
500 | { |
---|
501 | checkDuplicateBarcode(poolNum); |
---|
502 | Plate.paint(schema.getWellsInPool(Plate, poolNum)); |
---|
503 | } |
---|
504 | else |
---|
505 | { |
---|
506 | Plate.paint([currentWell]); |
---|
507 | } |
---|
508 | } |
---|
509 | } |
---|
510 | |
---|
511 | function checkDuplicateBarcode(poolNum) |
---|
512 | { |
---|
513 | var frm = document.forms['reggie']; |
---|
514 | var schema = POOL_SCHEMA[frm.pool_schema.selectedIndex]; |
---|
515 | |
---|
516 | var wells = schema.getWellsInPool(Plate, poolNum); |
---|
517 | var wellByBarcodeName = []; |
---|
518 | for (var i = 0; i < wells.length; i++) |
---|
519 | { |
---|
520 | var well = wells[i]; |
---|
521 | var cdna = well.extract; |
---|
522 | if (cdna && cdna.barcode) |
---|
523 | { |
---|
524 | if (wellByBarcodeName[cdna.barcode.name]) |
---|
525 | { |
---|
526 | well.duplicate = true; |
---|
527 | wellByBarcodeName[cdna.barcode.name].duplicate = true; |
---|
528 | } |
---|
529 | else |
---|
530 | { |
---|
531 | wellByBarcodeName[cdna.barcode.name] = well; |
---|
532 | well.duplicate = false; |
---|
533 | } |
---|
534 | } |
---|
535 | } |
---|
536 | } |
---|
537 | |
---|
538 | |
---|
539 | var WellPainter = function() |
---|
540 | { |
---|
541 | var painter = {}; |
---|
542 | |
---|
543 | painter.getClassNameForWell = function(well, schema) |
---|
544 | { |
---|
545 | var cls = ''; |
---|
546 | var indexSet = painter.barcodeVariant.indexSets[well.column]; |
---|
547 | if (indexSet) |
---|
548 | { |
---|
549 | cls += indexSet.color; |
---|
550 | } |
---|
551 | var cdna = well.extract; |
---|
552 | if (cdna && cdna.barcode) |
---|
553 | { |
---|
554 | if (cdna.defaultBarcode && cdna.barcode != cdna.defaultBarcode) |
---|
555 | { |
---|
556 | cls += ' bg-modified'; |
---|
557 | } |
---|
558 | } |
---|
559 | if (well.duplicate) |
---|
560 | { |
---|
561 | cls += ' duplicate'; |
---|
562 | } |
---|
563 | return cls; |
---|
564 | } |
---|
565 | |
---|
566 | painter.getWellText = function(well, schema) |
---|
567 | { |
---|
568 | var text = ''; |
---|
569 | var cdna = well.extract; |
---|
570 | if (cdna) |
---|
571 | { |
---|
572 | var name = cdna.name; |
---|
573 | var i = name.indexOf('.m'); |
---|
574 | text += '<div class="name">'+name.substring(0, i)+'.<br> '+name.substring(i)+'</div>'; |
---|
575 | if (cdna.barcode) |
---|
576 | { |
---|
577 | text += '<div class="barcode">'+cdna.barcode.name+'</div>'; |
---|
578 | if (cdna.defaultBarcode && cdna.barcode != cdna.defaultBarcode) |
---|
579 | { |
---|
580 | text += '<div class="warn-msg">Modified barcode</div>'; |
---|
581 | } |
---|
582 | } |
---|
583 | else |
---|
584 | { |
---|
585 | well.setError('No barcode'); |
---|
586 | } |
---|
587 | } |
---|
588 | if (well.duplicate) |
---|
589 | { |
---|
590 | well.setError('Duplicate barcode'); |
---|
591 | } |
---|
592 | return text; |
---|
593 | } |
---|
594 | |
---|
595 | return painter; |
---|
596 | }(); |
---|
597 | |
---|
598 | </script> |
---|
599 | <style> |
---|
600 | |
---|
601 | /* A well assigned for QC include a background icon as indicator */ |
---|
602 | .well.qc |
---|
603 | { |
---|
604 | background-image: url('../images/mrnaqc.png'); |
---|
605 | background-position: 95% 25%; |
---|
606 | background-repeat: no-repeat; |
---|
607 | } |
---|
608 | |
---|
609 | |
---|
610 | #select-barcode-all |
---|
611 | { |
---|
612 | max-height: 20em; |
---|
613 | overflow: auto; |
---|
614 | } |
---|
615 | |
---|
616 | #select-barcode .menuitem |
---|
617 | { |
---|
618 | padding-left: 16px; |
---|
619 | } |
---|
620 | |
---|
621 | #select-barcode div.current |
---|
622 | { |
---|
623 | font-weight: bold; |
---|
624 | background-image: url('../images/selected.gif'); |
---|
625 | background-position: 2px 50%; |
---|
626 | background-repeat: no-repeat; |
---|
627 | } |
---|
628 | |
---|
629 | #select-barcode .menuitem:hover |
---|
630 | { |
---|
631 | padding-left: 14px; |
---|
632 | background-position: 0px 50%; |
---|
633 | } |
---|
634 | |
---|
635 | .menuseparator |
---|
636 | { |
---|
637 | width: auto !important; |
---|
638 | } |
---|
639 | |
---|
640 | </style> |
---|
641 | </base:head> |
---|
642 | <base:body onload="init()"> |
---|
643 | |
---|
644 | <p:path><p:pathelement |
---|
645 | title="Reggie" href="<%="../index.jsp?ID="+ID%>" |
---|
646 | /><p:pathelement title="Assign barcodes to cDNA plates" |
---|
647 | /></p:path> |
---|
648 | |
---|
649 | <div class="content" onclick="Main.hide('select-barcode')"> |
---|
650 | <% |
---|
651 | if (sc.getActiveProjectId() == 0) |
---|
652 | { |
---|
653 | %> |
---|
654 | <div class="messagecontainer note" style="width: 950px; margin-left: 20px; margin-bottom: 20px; margin-right: 0px; font-weight: bold; color: #cc0000;"> |
---|
655 | No project has been selected. You may proceed with the registration but |
---|
656 | created items will not be shared. |
---|
657 | </div> |
---|
658 | <% |
---|
659 | } |
---|
660 | %> |
---|
661 | |
---|
662 | <div id="select-barcode" class="menu vertical" style="width: 150px; display: none;" |
---|
663 | onclick="barcodeSelected(event)" |
---|
664 | > |
---|
665 | <div class="menuitem enabled" id="select-barcode-default">Default</div> |
---|
666 | <div class="menuseparator" id="select-barcode-default-separator"></div> |
---|
667 | <div id="select-barcode-all"></div> |
---|
668 | </div> |
---|
669 | |
---|
670 | <div class="allsteps"> |
---|
671 | <div class="step current" id="step.1">1</div> |
---|
672 | › |
---|
673 | <div class="step future" id="step.2">2</div> |
---|
674 | </div> |
---|
675 | |
---|
676 | <form name="reggie" onsubmit="return false;"> |
---|
677 | |
---|
678 | <div id="step.1.section"> |
---|
679 | <table class="stepform" style="width: auto;"> |
---|
680 | <tr> |
---|
681 | <td rowspan="3" class="stepno">1</td> |
---|
682 | <td class="steptitle">Select cDNA bioplate</td> |
---|
683 | </tr> |
---|
684 | <tr> |
---|
685 | <td class="stepfields"> |
---|
686 | <table> |
---|
687 | <tr valign="top"> |
---|
688 | <td class="prompt">cDNA bioplate</td> |
---|
689 | <td class="input"><select class="required" style="width:90%" |
---|
690 | name="bioplate" id="bioplate"></select> |
---|
691 | <div id="cdnacomments" style="font-style: italic; background: #E8E8E8; padding: 2px 5px 2px 5px;"></div> |
---|
692 | </td> |
---|
693 | <td class="status" id="bioplate.status"></td> |
---|
694 | <td class="help"><span id="bioplate.message" class="message" style="display: none;"></span> |
---|
695 | Select an existing cDNA bioplate. The list contain all cDNA bioplates that |
---|
696 | has not yet been assigned barcodes (determined by the absence of 'BarcodeVariant' |
---|
697 | annotation). |
---|
698 | </td> |
---|
699 | </tr> |
---|
700 | </table> |
---|
701 | </td> |
---|
702 | </tr> |
---|
703 | </table> |
---|
704 | </div> |
---|
705 | |
---|
706 | <div id="step.2.section" style="display: none;"> |
---|
707 | <table class="stepform" style="width: auto;"> |
---|
708 | <tr> |
---|
709 | <td rowspan="2" class="stepno">2</td> |
---|
710 | <td class="steptitle">Select barcodes</td> |
---|
711 | </tr> |
---|
712 | <tr> |
---|
713 | <td class="stepfields"> |
---|
714 | |
---|
715 | <table class="bottomborder" style="width: 100%;"> |
---|
716 | <tr valign="top"> |
---|
717 | <td class="prompt">Pool layout</td> |
---|
718 | <td class="input"> |
---|
719 | <select name="pool_schema" onchange="poolSchemaOnChange()"></select> |
---|
720 | </td> |
---|
721 | <td class="help"></td> |
---|
722 | </tr> |
---|
723 | <tr valign="top"> |
---|
724 | <td class="prompt">Barcode variants</td> |
---|
725 | <td class="input"> |
---|
726 | <select name="barcode_variant" onchange="barcodeVariantOnChange()"></select> |
---|
727 | </td> |
---|
728 | <td class="help"></td> |
---|
729 | </tr> |
---|
730 | <tr valign="top"> |
---|
731 | <td class="prompt">Comments</td> |
---|
732 | <td class="input"> |
---|
733 | <textarea rows="2" style="width: 90%;" name="comments" value=""></textarea> |
---|
734 | </td> |
---|
735 | <td class="help">Comments for the library preparation.</td> |
---|
736 | </tr> |
---|
737 | </table> |
---|
738 | |
---|
739 | <table class="plate" style="margin: 1em 1em 1em 1em;" id="plate"> |
---|
740 | <% |
---|
741 | int columns = 12; |
---|
742 | int rows = 8; |
---|
743 | WellCoordinateFormatter rowF = new WellCoordinateFormatter(true); |
---|
744 | WellCoordinateFormatter colF = new WellCoordinateFormatter(false); |
---|
745 | %> |
---|
746 | <tr class="header"> |
---|
747 | <th></th> |
---|
748 | <% |
---|
749 | for (int c = 0; c < columns; ++c) |
---|
750 | { |
---|
751 | %> |
---|
752 | <th id="col.<%=c%>"><%=colF.format(c)%></th> |
---|
753 | <% |
---|
754 | } |
---|
755 | %> |
---|
756 | </tr> |
---|
757 | <tbody> |
---|
758 | <% |
---|
759 | for (int r = 0; r < rows; ++r) |
---|
760 | { |
---|
761 | String row = rowF.format(r); |
---|
762 | %> |
---|
763 | <tr class="row-<%=r%>"> |
---|
764 | <th id="row.<%=r%>" class="rowheader"><%=row%></th> |
---|
765 | <% |
---|
766 | for (int c = 0; c < columns; ++c) |
---|
767 | { |
---|
768 | %> |
---|
769 | <td class="well col-<%=c%>" id="well.<%=r%>.<%=c%>" |
---|
770 | onclick="selectBarcode(event, <%=r%>,<%=c%>)" |
---|
771 | title="Click to select barcode for this well" |
---|
772 | ></td> |
---|
773 | <% |
---|
774 | } |
---|
775 | %> |
---|
776 | </tr> |
---|
777 | <% |
---|
778 | } |
---|
779 | %> |
---|
780 | </tbody> |
---|
781 | <tr id="pool-row"> |
---|
782 | <th colspan="13"> </th> |
---|
783 | </tr> |
---|
784 | </table> |
---|
785 | </td> |
---|
786 | </tr> |
---|
787 | </table> |
---|
788 | </div> |
---|
789 | |
---|
790 | <div class="loading" id="loading" style="display: none;"><table><tr><td><img src="../images/loading.gif"></td><td id="loading.msg">Please wait...</td></tr></table></div> |
---|
791 | |
---|
792 | <div class="messagecontainer error" id="errorMessage" style="display: none; width: 950px; margin-left: 20px; margin-bottom: 0px;"></div> |
---|
793 | |
---|
794 | <div id="done" class="success" style="display: none; width: 950px; margin-left: 20px; margin-top: 20px;"></div> |
---|
795 | |
---|
796 | <table style="margin-left: 20px; margin-top: 10px;" class="navigation"> |
---|
797 | <tr> |
---|
798 | <td><base:button id="gocancel" title="Cancel" onclick="goRestart(false)" /></td> |
---|
799 | <td><base:button id="gonext" title="Next" image="<%=home+"/images/gonext.png"%>" onclick="goNext(true)"/></td> |
---|
800 | <td><base:button id="gocreate" title="Create" image="<%=home+"/images/gonext.png"%>" onclick="goCreate()" style="display: none;"/></td> |
---|
801 | <td><base:button id="gorestart" title="Restart" image="<%=home+"/images/goback.png"%>" onclick="goRestart(true)" style="display: none;"/></td> |
---|
802 | <td id="gonext.message" class="message"></td> |
---|
803 | </tr> |
---|
804 | </table> |
---|
805 | |
---|
806 | </form> |
---|
807 | </div> |
---|
808 | |
---|
809 | </base:body> |
---|
810 | </base:page> |
---|
811 | <% |
---|
812 | } |
---|
813 | finally |
---|
814 | { |
---|
815 | if (dc != null) dc.close(); |
---|
816 | } |
---|
817 | %> |
---|