3652 |
08 Dec 15 |
olle |
var InspectStartPlate = function() |
3652 |
08 Dec 15 |
olle |
2 |
{ |
3652 |
08 Dec 15 |
olle |
var inspectstartplate = {}; |
3652 |
08 Dec 15 |
olle |
var barcodesByName = []; |
3652 |
08 Dec 15 |
olle |
5 |
|
3652 |
08 Dec 15 |
olle |
var EXTERNAL_DNA_NAME = 'External.d'; |
3652 |
08 Dec 15 |
olle |
var debug = 0; |
3652 |
08 Dec 15 |
olle |
8 |
|
3652 |
08 Dec 15 |
olle |
var currentSelected; |
3652 |
08 Dec 15 |
olle |
var names = []; |
3652 |
08 Dec 15 |
olle |
var wells = []; |
3652 |
08 Dec 15 |
olle |
var protocolMap = {}; |
3652 |
08 Dec 15 |
olle |
var kitNum = 0; |
3652 |
08 Dec 15 |
olle |
var selectedKitName; |
3652 |
08 Dec 15 |
olle |
15 |
|
3652 |
08 Dec 15 |
olle |
var graphics; |
3652 |
08 Dec 15 |
olle |
var pen; |
3652 |
08 Dec 15 |
olle |
18 |
|
3652 |
08 Dec 15 |
olle |
var quantitiesAreValid = false; |
3652 |
08 Dec 15 |
olle |
var plateNameIsValid = false; |
3652 |
08 Dec 15 |
olle |
var subtypeDna; |
3652 |
08 Dec 15 |
olle |
var subtypeDnaNormalized; |
3652 |
08 Dec 15 |
olle |
var MINIMAL_DNA_VOLUME = 1.0; //µl |
3652 |
08 Dec 15 |
olle |
var THIN_SPACE = ' '; |
3652 |
08 Dec 15 |
olle |
25 |
|
3652 |
08 Dec 15 |
olle |
var jsonRowIndex = {"A": 0, "B": 1, "C": 2, "D": 3, "E": 4, "F": 5, "G": 6, "H": 7}; |
3652 |
08 Dec 15 |
olle |
var jsonColIndex = {"1": 0, "2": 1, "3": 2, "4": 3, "5": 4, "6": 5, "7": 6, "8": 7, "9": 8, "10": 9, "11": 10, "12": 11}; |
3652 |
08 Dec 15 |
olle |
var jsonRowLetter = {0: "A", 1: "B", 2: "C", 3: "D", 4: "E", 5: "F", 6: "G", 7: "H"}; |
3652 |
08 Dec 15 |
olle |
var jsonColNumber = {0: "1", 1: "2", 2: "3", 3: "4", 4: "5", 5: "6", 6: "7", 7: "8", 8: "9", 9: "10", 10: "11", 11: "12"}; |
3652 |
08 Dec 15 |
olle |
30 |
|
3652 |
08 Dec 15 |
olle |
// Page initialization |
3652 |
08 Dec 15 |
olle |
inspectstartplate.initPage = function() |
3652 |
08 Dec 15 |
olle |
33 |
{ |
3652 |
08 Dec 15 |
olle |
// Step 1 |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('step-1', 'wizard-validate', inspectstartplate.validateStep1); |
3652 |
08 Dec 15 |
olle |
36 |
|
3652 |
08 Dec 15 |
olle |
// Step 2 |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('step-2', 'wizard-initialize', inspectstartplate.initializeStep2); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('step-2', 'wizard-validate', inspectstartplate.validateStep2); |
3652 |
08 Dec 15 |
olle |
40 |
|
3652 |
08 Dec 15 |
olle |
41 |
/* |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('plateName', 'change', inspectstartplate.plateNameOnChange); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('pool_schema', 'change', inspectstartplate.poolSchemaOnChange); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('barcode_variant', 'change', inspectstartplate.barcodeVariantOnChange); |
3652 |
08 Dec 15 |
olle |
45 |
*/ |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('min_vol_dna', 'change', inspectstartplate.minVolDnaOnChange); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('min_vol_dna', 'keypress', Events.numberOnly); |
3652 |
08 Dec 15 |
olle |
48 |
|
3652 |
08 Dec 15 |
olle |
//Events.addEventHandler('warning_quantity', 'change', inspectstartplate.warningLevelOnChange); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('warning_quality_score', 'change', inspectstartplate.warningLevelOnChange); |
3652 |
08 Dec 15 |
olle |
//Events.addEventHandler('warning_quantity', 'keypress', Events.numberOnly); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('warning_quality_score', 'keypress', Events.numberOnly); |
3652 |
08 Dec 15 |
olle |
53 |
|
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('location', 'click', inspectstartplate.toggleInfo); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('quantity', 'click', inspectstartplate.toggleInfo); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('quality-score', 'click', inspectstartplate.toggleInfo); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('qubitconc', 'click', inspectstartplate.toggleInfo); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('volumes', 'click', inspectstartplate.toggleInfo); |
3652 |
08 Dec 15 |
olle |
59 |
/* |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('qiacube-date', 'click', inspectstartplate.toggleInfo); |
3652 |
08 Dec 15 |
olle |
61 |
*/ |
3652 |
08 Dec 15 |
olle |
62 |
|
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('pool-row', 'click', inspectstartplate.togglePool); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('pool-row', 'mouseover', inspectstartplate.highlightPool); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('pool-row', 'mouseout', inspectstartplate.highlightPool); |
3652 |
08 Dec 15 |
olle |
66 |
|
3652 |
08 Dec 15 |
olle |
Buttons.addClickHandler('downloadLibPrepFile', inspectstartplate.downloadLibPrepFile); |
3652 |
08 Dec 15 |
olle |
68 |
|
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('iconSpecialSelect', 'click', inspectstartplate.toggleSpecialSelect); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('plate', 'mouseup', inspectstartplate.contextEvent); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('plate', 'contextmenu', inspectstartplate.contextEvent); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('mnuComment', 'click', inspectstartplate.commentSelected); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('mnuCaseSummary', 'click', inspectstartplate.showCaseSummary); |
3652 |
08 Dec 15 |
olle |
74 |
|
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('flaggedDna', 'click', inspectstartplate.showFlaggedDna); |
3652 |
08 Dec 15 |
olle |
76 |
|
3685 |
12 Jan 16 |
olle |
Events.addEventHandler('listview', 'click', inspectstartplate.viewProtocol); |
3685 |
12 Jan 16 |
olle |
Events.addEventHandler('plateview', 'click', inspectstartplate.viewProtocol); |
3652 |
08 Dec 15 |
olle |
79 |
|
3652 |
08 Dec 15 |
olle |
// Navigation |
3652 |
08 Dec 15 |
olle |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
3652 |
08 Dec 15 |
olle |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
3652 |
08 Dec 15 |
olle |
Buttons.addClickHandler('gocreate', inspectstartplate.createProtocol); |
3652 |
08 Dec 15 |
olle |
84 |
|
3652 |
08 Dec 15 |
olle |
85 |
/* |
3652 |
08 Dec 15 |
olle |
// Final registration |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler('wizard', 'wizard-submit', inspectstartplate.submit); |
3652 |
08 Dec 15 |
olle |
88 |
*/ |
3652 |
08 Dec 15 |
olle |
89 |
|
3652 |
08 Dec 15 |
olle |
var isNeoPrep = Data.int('page-data', 'is-neoprep'); |
3652 |
08 Dec 15 |
olle |
91 |
|
3652 |
08 Dec 15 |
olle |
var url = '../Dna.servlet?ID='+App.getSessionId(); |
3652 |
08 Dec 15 |
olle |
url += '&cmd=GetStartPlates'; |
3652 |
08 Dec 15 |
olle |
url += '&bioPlateType=' + (isNeoPrep ? 'NEOPREP' : 'DNA'); |
3652 |
08 Dec 15 |
olle |
url += '&bioPlatePrefix=' + 'LP'; |
3652 |
08 Dec 15 |
olle |
url += '&orderDesc=true'; |
3652 |
08 Dec 15 |
olle |
Wizard.showLoadingAnimation('Loading '+(isNeoPrep ? 'NeoPrep' : 'DNA') + ' plates'); |
3652 |
08 Dec 15 |
olle |
Wizard.asyncJsonRequest(url, inspectstartplate.initializeStep1); |
3652 |
08 Dec 15 |
olle |
99 |
} |
3652 |
08 Dec 15 |
olle |
100 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.initializeStep1 = function(response) |
3652 |
08 Dec 15 |
olle |
102 |
{ |
3652 |
08 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3652 |
08 Dec 15 |
olle |
var jsonPlates = response.bioplates; |
3652 |
08 Dec 15 |
olle |
105 |
|
3652 |
08 Dec 15 |
olle |
var startPlate = frm.startPlate; |
3652 |
08 Dec 15 |
olle |
if (jsonPlates.length > 0) |
3652 |
08 Dec 15 |
olle |
108 |
{ |
3652 |
08 Dec 15 |
olle |
for (var i=0; i < jsonPlates.length; i++) |
3652 |
08 Dec 15 |
olle |
110 |
{ |
3652 |
08 Dec 15 |
olle |
var plate = jsonPlates[i]; |
3652 |
08 Dec 15 |
olle |
var name = (i+1) + ': ' + Strings.encodeTags(plate.name); |
3678 |
18 Dec 15 |
olle |
if (plate.numMeludiItems || plate.numExtraItems) |
3652 |
08 Dec 15 |
olle |
114 |
{ |
3652 |
08 Dec 15 |
olle |
name += ' -- ('; |
3652 |
08 Dec 15 |
olle |
name += plate.numMeludiItems; |
3652 |
08 Dec 15 |
olle |
name += ' + ' + plate.numExtraItems; |
3652 |
08 Dec 15 |
olle |
name += ')'; |
3652 |
08 Dec 15 |
olle |
119 |
} |
3652 |
08 Dec 15 |
olle |
if (plate.registrationDate) |
3652 |
08 Dec 15 |
olle |
121 |
{ |
3652 |
08 Dec 15 |
olle |
name += ' -- [' + inspectstartplate.asDate(plate.registrationDate) + ']'; |
3652 |
08 Dec 15 |
olle |
123 |
} |
3652 |
08 Dec 15 |
olle |
var selected = (i == 0); |
3652 |
08 Dec 15 |
olle |
var option = new Option(name, plate.id, selected, selected); |
3652 |
08 Dec 15 |
olle |
option.plate = plate; |
3652 |
08 Dec 15 |
olle |
startPlate.options[startPlate.length] = option; |
3652 |
08 Dec 15 |
olle |
128 |
} |
3652 |
08 Dec 15 |
olle |
startPlate.options[0].selected = true; |
3652 |
08 Dec 15 |
olle |
130 |
} |
3652 |
08 Dec 15 |
olle |
else |
3652 |
08 Dec 15 |
olle |
132 |
{ |
3652 |
08 Dec 15 |
olle |
Wizard.setFatalError('No start plates available.'); |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
135 |
} |
3652 |
08 Dec 15 |
olle |
Doc.show('step-1'); |
3652 |
08 Dec 15 |
olle |
Doc.show('gocancel'); |
3652 |
08 Dec 15 |
olle |
Doc.show('gonext'); |
3652 |
08 Dec 15 |
olle |
Doc.hide('gocreate'); |
3652 |
08 Dec 15 |
olle |
Doc.hide('extractSourceItems'); |
3652 |
08 Dec 15 |
olle |
141 |
} |
3652 |
08 Dec 15 |
olle |
142 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.validateStep1 = function(event) |
3652 |
08 Dec 15 |
olle |
144 |
{ |
3652 |
08 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3652 |
08 Dec 15 |
olle |
var startPlate = null; |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < frm.startPlate.length; i++) |
3652 |
08 Dec 15 |
olle |
148 |
{ |
3652 |
08 Dec 15 |
olle |
if (frm.startPlate[i].selected) |
3652 |
08 Dec 15 |
olle |
150 |
{ |
3652 |
08 Dec 15 |
olle |
startPlate = frm.startPlate[i]; |
3652 |
08 Dec 15 |
olle |
152 |
} |
3652 |
08 Dec 15 |
olle |
153 |
} |
3652 |
08 Dec 15 |
olle |
if (startPlate == null) |
3652 |
08 Dec 15 |
olle |
155 |
{ |
3652 |
08 Dec 15 |
olle |
event.preventDefault(); |
3652 |
08 Dec 15 |
olle |
157 |
} |
3652 |
08 Dec 15 |
olle |
158 |
} |
3652 |
08 Dec 15 |
olle |
159 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.initializeStep2 = function(event) |
3652 |
08 Dec 15 |
olle |
161 |
{ |
3652 |
08 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3652 |
08 Dec 15 |
olle |
var isNeoPrep = Data.int('page-data', 'is-neoprep'); |
3652 |
08 Dec 15 |
olle |
164 |
|
3652 |
08 Dec 15 |
olle |
var jsonPlate = null; |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < frm.startPlate.length; i++) |
3652 |
08 Dec 15 |
olle |
167 |
{ |
3652 |
08 Dec 15 |
olle |
if (frm.startPlate[i].selected) |
3652 |
08 Dec 15 |
olle |
169 |
{ |
3652 |
08 Dec 15 |
olle |
jsonPlate = frm.startPlate[i]; |
3652 |
08 Dec 15 |
olle |
171 |
} |
3652 |
08 Dec 15 |
olle |
172 |
} |
3652 |
08 Dec 15 |
olle |
if (jsonPlate == null) |
3652 |
08 Dec 15 |
olle |
174 |
{ |
3652 |
08 Dec 15 |
olle |
event.preventDefault(); |
3652 |
08 Dec 15 |
olle |
176 |
} |
3652 |
08 Dec 15 |
olle |
var startPlate = jsonPlate.plate; |
3652 |
08 Dec 15 |
olle |
178 |
|
3652 |
08 Dec 15 |
olle |
frm.startPlate.disabled = true; |
3652 |
08 Dec 15 |
olle |
180 |
|
3652 |
08 Dec 15 |
olle |
Wizard.setCurrentStep(2); |
3652 |
08 Dec 15 |
olle |
Doc.show('step-2'); |
3652 |
08 Dec 15 |
olle |
Doc.show('gocancel'); |
3652 |
08 Dec 15 |
olle |
Doc.hide('gonext'); |
3652 |
08 Dec 15 |
olle |
185 |
|
3652 |
08 Dec 15 |
olle |
Plate.name = startPlate.name; |
3652 |
08 Dec 15 |
olle |
var protocolName = startPlate.protocolName; |
3652 |
08 Dec 15 |
olle |
var kitName = startPlate.kitName; |
3652 |
08 Dec 15 |
olle |
var comment = startPlate.comments; |
3652 |
08 Dec 15 |
olle |
var wellsInfo = startPlate.wells; |
3652 |
08 Dec 15 |
olle |
191 |
|
3652 |
08 Dec 15 |
olle |
frm.plateName.value = Strings.encodeTags(Plate.name); |
3652 |
08 Dec 15 |
olle |
frm.plateName.disabled = true; |
3652 |
08 Dec 15 |
olle |
plateNameIsValid = true; |
3652 |
08 Dec 15 |
olle |
Wizard.setInputStatus('plateName', 'valid'); |
3652 |
08 Dec 15 |
olle |
196 |
|
3652 |
08 Dec 15 |
olle |
frm.libraryPreparationProtocol.value = protocolName; |
3652 |
08 Dec 15 |
olle |
frm.libraryPreparationProtocol.disabled = true; |
3652 |
08 Dec 15 |
olle |
199 |
// |
3652 |
08 Dec 15 |
olle |
frm.tsLibPrepKit.value = kitName; |
3652 |
08 Dec 15 |
olle |
frm.tsLibPrepKit.disabled = true; |
3652 |
08 Dec 15 |
olle |
frm.hiddenLibPrepKitId.value = startPlate.kitId; |
3652 |
08 Dec 15 |
olle |
203 |
|
3652 |
08 Dec 15 |
olle |
frm.comments.value = comment; |
3652 |
08 Dec 15 |
olle |
frm.comments.disabled = true; |
3652 |
08 Dec 15 |
olle |
206 |
|
3652 |
08 Dec 15 |
olle |
// Place pre-selected DNA on plate |
3652 |
08 Dec 15 |
olle |
inspectstartplate.quantityOnChange(); |
3652 |
08 Dec 15 |
olle |
inspectstartplate.warningLevelOnChange(); |
3652 |
08 Dec 15 |
olle |
210 |
|
3652 |
08 Dec 15 |
olle |
// Init plate, pool schema and barcode variants |
3652 |
08 Dec 15 |
olle |
graphics = new jsGraphics(Doc.element('canvas')); |
3652 |
08 Dec 15 |
olle |
pen = new jsPen(new jsColor('#2288AA'), 2); |
3652 |
08 Dec 15 |
olle |
var columns = isNeoPrep ? 2 : 12; |
3652 |
08 Dec 15 |
olle |
var rows = 8; |
3652 |
08 Dec 15 |
olle |
// Disable pool schema menu |
3652 |
08 Dec 15 |
olle |
frm.pool_schema.disabled = true; |
3652 |
08 Dec 15 |
olle |
var schema = PoolSchema.initList(frm.pool_schema, null, isNeoPrep ? 'neoprep' : 'manual'); |
3652 |
08 Dec 15 |
olle |
Plate.init(rows, columns, schema, WellPainter); |
3652 |
08 Dec 15 |
olle |
Events.sendChangeEvent(frm.pool_schema); |
3652 |
08 Dec 15 |
olle |
// Set default for showing info for plate well |
3652 |
08 Dec 15 |
olle |
inspectstartplate.setDefaultInfo('location'); |
3652 |
08 Dec 15 |
olle |
inspectstartplate.setDefaultInfo('volumes'); |
3652 |
08 Dec 15 |
olle |
inspectstartplate.setDefaultInfo('quality-score'); |
3652 |
08 Dec 15 |
olle |
inspectstartplate.setDefaultInfo('qubitconc'); |
3652 |
08 Dec 15 |
olle |
226 |
|
3693 |
15 Jan 16 |
olle |
// Fill plate wells with well data for selected start plate |
3693 |
15 Jan 16 |
olle |
for (var column = 0; column < 12; column++) |
3652 |
08 Dec 15 |
olle |
229 |
{ |
3652 |
08 Dec 15 |
olle |
for (var row = 0; row < 8; row++) |
3652 |
08 Dec 15 |
olle |
231 |
{ |
3652 |
08 Dec 15 |
olle |
var wellStr = inspectstartplate.wellRowColumnToWellStr(row, column); |
3693 |
15 Jan 16 |
olle |
// Get well info from start plate |
3652 |
08 Dec 15 |
olle |
var wellInfo = wellsInfo[wellStr]; |
3652 |
08 Dec 15 |
olle |
if (wellInfo) |
3652 |
08 Dec 15 |
olle |
236 |
{ |
3652 |
08 Dec 15 |
olle |
var well = Plate.getWell(row, column); |
3667 |
15 Dec 15 |
olle |
var parentName = wellInfo.extract.origName; |
3652 |
08 Dec 15 |
olle |
well.extract = wellInfo.extract; |
3693 |
15 Jan 16 |
olle |
var dnaId = wellInfo.extract.id; |
3652 |
08 Dec 15 |
olle |
// Create a new DNA object |
3693 |
15 Jan 16 |
olle |
//var dna = Dna.createByName(name); |
3693 |
15 Jan 16 |
olle |
var dnaExt = '.fpa'; |
3693 |
15 Jan 16 |
olle |
if (column >= 6) |
3693 |
15 Jan 16 |
olle |
245 |
{ |
3693 |
15 Jan 16 |
olle |
dnaExt = '.fpb'; |
3693 |
15 Jan 16 |
olle |
247 |
} |
3693 |
15 Jan 16 |
olle |
var dna = Dna.createByParentName(parentName, parentName + dnaExt, dnaId); |
3652 |
08 Dec 15 |
olle |
Dna.unflag(dna); |
3652 |
08 Dec 15 |
olle |
well.setExtract(dna); |
3652 |
08 Dec 15 |
olle |
well.selected = false; |
3652 |
08 Dec 15 |
olle |
252 |
} |
3652 |
08 Dec 15 |
olle |
253 |
} |
3652 |
08 Dec 15 |
olle |
254 |
} |
3652 |
08 Dec 15 |
olle |
Plate.checkReplicates(); |
3652 |
08 Dec 15 |
olle |
Plate.paint(Plate.getWells()); |
3652 |
08 Dec 15 |
olle |
inspectstartplate.updateNumFlaggedDna(); |
3652 |
08 Dec 15 |
olle |
names = []; |
3652 |
08 Dec 15 |
olle |
259 |
// |
3652 |
08 Dec 15 |
olle |
Doc.show('step-3'); |
3652 |
08 Dec 15 |
olle |
Doc.show('gocancel'); |
3652 |
08 Dec 15 |
olle |
Doc.show('gocreate'); |
3652 |
08 Dec 15 |
olle |
Wizard.setNoConfirmOnFirstStep(false); |
3652 |
08 Dec 15 |
olle |
Wizard.keepSessionAlive(); |
3652 |
08 Dec 15 |
olle |
265 |
} |
3652 |
08 Dec 15 |
olle |
266 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.wellStrToRow = function(wellStr) |
3652 |
08 Dec 15 |
olle |
268 |
{ |
3652 |
08 Dec 15 |
olle |
// Get first letter |
3652 |
08 Dec 15 |
olle |
var rowStr = wellStr.substring(0,1); |
3652 |
08 Dec 15 |
olle |
var row = jsonRowIndex[rowStr]; |
3652 |
08 Dec 15 |
olle |
return row; |
3652 |
08 Dec 15 |
olle |
273 |
} |
3652 |
08 Dec 15 |
olle |
274 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.wellStrToCol = function(wellStr) |
3652 |
08 Dec 15 |
olle |
276 |
{ |
3652 |
08 Dec 15 |
olle |
// Get column string; |
3652 |
08 Dec 15 |
olle |
var colStr = wellStr.substring(1,3); |
3652 |
08 Dec 15 |
olle |
var col = jsonColIndex[colStr]; |
3652 |
08 Dec 15 |
olle |
return col; |
3652 |
08 Dec 15 |
olle |
281 |
} |
3652 |
08 Dec 15 |
olle |
282 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.wellRowColumnToWellStr = function(row, column) |
3652 |
08 Dec 15 |
olle |
284 |
{ |
3652 |
08 Dec 15 |
olle |
// Get well string (row letter + column number, 1-based) |
3652 |
08 Dec 15 |
olle |
var wellStr = jsonRowLetter[row] + jsonColNumber[column]; |
3652 |
08 Dec 15 |
olle |
return wellStr; |
3652 |
08 Dec 15 |
olle |
288 |
} |
3652 |
08 Dec 15 |
olle |
289 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.plateNameOnChange = function(event) |
3652 |
08 Dec 15 |
olle |
291 |
{ |
3652 |
08 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3652 |
08 Dec 15 |
olle |
plateNameIsValid = false; |
3652 |
08 Dec 15 |
olle |
294 |
|
3652 |
08 Dec 15 |
olle |
var name = frm.plateName.value; |
3652 |
08 Dec 15 |
olle |
if (!name || name == '') |
3652 |
08 Dec 15 |
olle |
297 |
{ |
3652 |
08 Dec 15 |
olle |
Wizard.setInputStatus('plateName', 'invalid', 'Missing name'); |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
300 |
} |
3652 |
08 Dec 15 |
olle |
if (name.indexOf("LP") != 0) |
3652 |
08 Dec 15 |
olle |
302 |
{ |
3652 |
08 Dec 15 |
olle |
Wizard.setInputStatus('plateName', 'invalid', 'Plate name must start with prefix "LP"'); |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
305 |
} |
3652 |
08 Dec 15 |
olle |
if (name.length != 7) |
3652 |
08 Dec 15 |
olle |
307 |
{ |
3652 |
08 Dec 15 |
olle |
Wizard.setInputStatus('plateName', 'invalid', 'Plate name must consist of "LP" + 5 digits'); |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
310 |
} |
3652 |
08 Dec 15 |
olle |
311 |
|
3652 |
08 Dec 15 |
olle |
// Check if name exists |
3652 |
08 Dec 15 |
olle |
var url = '../Extraction.servlet?ID='+App.getSessionId(); |
3652 |
08 Dec 15 |
olle |
url += '&cmd=CheckIfStartPlateNameUsed'; |
3652 |
08 Dec 15 |
olle |
url += '&startPlateName=' + encodeURIComponent(name); |
3652 |
08 Dec 15 |
olle |
316 |
|
3652 |
08 Dec 15 |
olle |
Wizard.showLoadingAnimation('Loading information about plate...'); |
3652 |
08 Dec 15 |
olle |
Wizard.asyncJsonRequest(url, inspectstartplate.plateInfoLoaded); |
3652 |
08 Dec 15 |
olle |
319 |
} |
3652 |
08 Dec 15 |
olle |
320 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.plateInfoLoaded = function(response) |
3652 |
08 Dec 15 |
olle |
322 |
{ |
3652 |
08 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3652 |
08 Dec 15 |
olle |
var plateInfo = response.startplate; |
3652 |
08 Dec 15 |
olle |
if (plateInfo) |
3652 |
08 Dec 15 |
olle |
326 |
{ |
3652 |
08 Dec 15 |
olle |
var plateName = plateInfo.name; |
3652 |
08 Dec 15 |
olle |
var plateId = plateInfo.id; |
3652 |
08 Dec 15 |
olle |
329 |
|
3652 |
08 Dec 15 |
olle |
if (plateId) |
3652 |
08 Dec 15 |
olle |
331 |
{ |
3652 |
08 Dec 15 |
olle |
plateNameIsValid = false; |
3652 |
08 Dec 15 |
olle |
Wizard.setInputStatus('plateName', 'invalid', 'Plate already exists with name "' + plateName + '" (ID = ' + plateId + ')'); |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
335 |
} |
3652 |
08 Dec 15 |
olle |
336 |
} |
3652 |
08 Dec 15 |
olle |
plateNameIsValid = true; |
3685 |
12 Jan 16 |
olle |
Plate.name = plateInfo.name; |
3652 |
08 Dec 15 |
olle |
339 |
|
3652 |
08 Dec 15 |
olle |
Wizard.setInputStatus('plateName', 'valid'); |
3652 |
08 Dec 15 |
olle |
341 |
} |
3652 |
08 Dec 15 |
olle |
342 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.quantityOnChange = function(event) |
3652 |
08 Dec 15 |
olle |
344 |
{ |
3652 |
08 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3652 |
08 Dec 15 |
olle |
quantitiesAreValid = false; |
3652 |
08 Dec 15 |
olle |
347 |
|
3652 |
08 Dec 15 |
olle |
348 |
/* |
3652 |
08 Dec 15 |
olle |
var qRegular = parseFloat(frm.quantity_regular.value); |
3652 |
08 Dec 15 |
olle |
if (!(qRegular > 0)) |
3652 |
08 Dec 15 |
olle |
351 |
{ |
3652 |
08 Dec 15 |
olle |
Wizard.setInputStatus('quantities', 'invalid', 'Amount must be ≥ 0.'); |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
354 |
} |
3652 |
08 Dec 15 |
olle |
355 |
*/ |
3652 |
08 Dec 15 |
olle |
356 |
/* |
3652 |
08 Dec 15 |
olle |
var qQc = parseFloat(frm.quantity_qc.value); |
3652 |
08 Dec 15 |
olle |
if (!(qQc > qRegular)) |
3652 |
08 Dec 15 |
olle |
359 |
{ |
3652 |
08 Dec 15 |
olle |
Wizard.setInputStatus('quantities', 'invalid', 'Amount QC must be > ' + qRegular + '.'); |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
362 |
} |
3652 |
08 Dec 15 |
olle |
363 |
*/ |
3652 |
08 Dec 15 |
olle |
364 |
|
3652 |
08 Dec 15 |
olle |
quantitiesAreValid = true; |
3652 |
08 Dec 15 |
olle |
366 |
/* |
3652 |
08 Dec 15 |
olle |
QUANTITY_REGULAR = qRegular; |
3652 |
08 Dec 15 |
olle |
368 |
*/ |
3652 |
08 Dec 15 |
olle |
369 |
/* |
3652 |
08 Dec 15 |
olle |
QUANTITY_QC = qQc; |
3652 |
08 Dec 15 |
olle |
371 |
*/ |
3652 |
08 Dec 15 |
olle |
372 |
|
3652 |
08 Dec 15 |
olle |
373 |
/* |
3652 |
08 Dec 15 |
olle |
Wizard.setInputStatus('quantities', 'valid'); |
3652 |
08 Dec 15 |
olle |
375 |
*/ |
3652 |
08 Dec 15 |
olle |
if (event) Plate.paint(Plate.getWells()); |
3652 |
08 Dec 15 |
olle |
377 |
} |
3652 |
08 Dec 15 |
olle |
378 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.minVolDnaOnChange = function(event) |
3652 |
08 Dec 15 |
olle |
380 |
{ |
3652 |
08 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3652 |
08 Dec 15 |
olle |
quantitiesAreValid = false; |
3652 |
08 Dec 15 |
olle |
383 |
|
3652 |
08 Dec 15 |
olle |
var minVolDna = parseFloat(frm.min_vol_dna.value); |
3652 |
08 Dec 15 |
olle |
if (!(minVolDna > 0)) |
3652 |
08 Dec 15 |
olle |
386 |
{ |
3652 |
08 Dec 15 |
olle |
Wizard.setInputStatus('min_vol_dna', 'invalid', 'Amount must be ≥ 0.'); |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
389 |
} |
3652 |
08 Dec 15 |
olle |
390 |
|
3652 |
08 Dec 15 |
olle |
quantitiesAreValid = true; |
3652 |
08 Dec 15 |
olle |
MINIMAL_DNA_VOLUME = minVolDna; |
3652 |
08 Dec 15 |
olle |
393 |
|
3652 |
08 Dec 15 |
olle |
Wizard.setInputStatus('min_vol_dna', 'valid'); |
3652 |
08 Dec 15 |
olle |
if (event) Plate.paint(Plate.getWells()); |
3652 |
08 Dec 15 |
olle |
396 |
} |
3652 |
08 Dec 15 |
olle |
397 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.warningLevelOnChange = function(event) |
3652 |
08 Dec 15 |
olle |
399 |
{ |
3652 |
08 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3652 |
08 Dec 15 |
olle |
401 |
|
3652 |
08 Dec 15 |
olle |
402 |
/* |
3652 |
08 Dec 15 |
olle |
var wQuantity = parseFloat(frm.warning_quantity.value); |
3652 |
08 Dec 15 |
olle |
if (!(wQuantity > 0)) |
3652 |
08 Dec 15 |
olle |
405 |
{ |
3652 |
08 Dec 15 |
olle |
Wizard.setInputStatus('warnings', 'invalid', 'Remaining quantity must be ≥ 0.'); |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
408 |
} |
3652 |
08 Dec 15 |
olle |
409 |
*/ |
3652 |
08 Dec 15 |
olle |
var wQualityScore = parseFloat(frm.warning_quality_score.value); |
3652 |
08 Dec 15 |
olle |
411 |
|
3652 |
08 Dec 15 |
olle |
412 |
/* |
3652 |
08 Dec 15 |
olle |
LOW_QUANTITY_WARNING_LIMIT = wQuantity; |
3652 |
08 Dec 15 |
olle |
414 |
*/ |
3652 |
08 Dec 15 |
olle |
QUALITY_SCORE_WARNING_LIMIT = wQualityScore; |
3652 |
08 Dec 15 |
olle |
416 |
|
3652 |
08 Dec 15 |
olle |
Wizard.setInputStatus('warnings', 'valid'); |
3652 |
08 Dec 15 |
olle |
if (event) Plate.paint(Plate.getWells()); |
3652 |
08 Dec 15 |
olle |
419 |
} |
3652 |
08 Dec 15 |
olle |
420 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.poolSchemaOnChange = function() |
3652 |
08 Dec 15 |
olle |
422 |
{ |
3652 |
08 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3652 |
08 Dec 15 |
olle |
var schema = PoolSchema.getById(frm.pool_schema.value); |
3652 |
08 Dec 15 |
olle |
Plate.setPoolSchema(schema); |
3652 |
08 Dec 15 |
olle |
426 |
|
3652 |
08 Dec 15 |
olle |
var isNeoPrep = Data.int('page-data', 'is-neoprep'); |
3652 |
08 Dec 15 |
olle |
if (isNeoPrep) |
3652 |
08 Dec 15 |
olle |
429 |
{ |
3652 |
08 Dec 15 |
olle |
PoolSchema.buildPoolTableRow(schema, Plate.columns, true, '<td class="barcode-fill barcode-left"></td>', '<th></th><td class="barcode-fill barcode-right"></td>'); |
3652 |
08 Dec 15 |
olle |
PoolSchema.initVariantList(frm.barcode_variant, schema); |
3652 |
08 Dec 15 |
olle |
Events.sendChangeEvent(frm.barcode_variant); |
3652 |
08 Dec 15 |
olle |
433 |
} |
3652 |
08 Dec 15 |
olle |
else |
3652 |
08 Dec 15 |
olle |
435 |
{ |
3652 |
08 Dec 15 |
olle |
PoolSchema.buildPoolTableRow(schema, Plate.columns, true); |
3652 |
08 Dec 15 |
olle |
Plate.paint(Plate.getWells()); |
3652 |
08 Dec 15 |
olle |
438 |
} |
3652 |
08 Dec 15 |
olle |
439 |
} |
3652 |
08 Dec 15 |
olle |
440 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.barcodeVariantOnChange = function() |
3652 |
08 Dec 15 |
olle |
442 |
{ |
3652 |
08 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3652 |
08 Dec 15 |
olle |
var schema = PoolSchema.getById(frm.pool_schema.value); |
3652 |
08 Dec 15 |
olle |
var barcodeVariant = PoolSchema.getBarcodeVariantByName(schema, frm.barcode_variant.value); |
3652 |
08 Dec 15 |
olle |
446 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.assignSchemaDefinedBarcodeVariant(schema, barcodeVariant); |
3652 |
08 Dec 15 |
olle |
WellPainter.barcodeVariant = barcodeVariant; |
3652 |
08 Dec 15 |
olle |
Plate.paint(Plate.getWells()); |
3652 |
08 Dec 15 |
olle |
450 |
} |
3652 |
08 Dec 15 |
olle |
451 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.assignSchemaDefinedBarcodeVariant = function(schema, barcodeVariant) |
3652 |
08 Dec 15 |
olle |
453 |
{ |
3652 |
08 Dec 15 |
olle |
var wells = Plate.getWells(); |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < wells.length; i++) |
3652 |
08 Dec 15 |
olle |
456 |
{ |
3652 |
08 Dec 15 |
olle |
var well = wells[i]; |
3652 |
08 Dec 15 |
olle |
458 |
|
3652 |
08 Dec 15 |
olle |
var indexSet = barcodeVariant ? barcodeVariant.indexSets[well.column] : null; |
3652 |
08 Dec 15 |
olle |
var barcode = null; |
3652 |
08 Dec 15 |
olle |
if (indexSet) |
3652 |
08 Dec 15 |
olle |
462 |
{ |
3652 |
08 Dec 15 |
olle |
var barcodeName = indexSet.barcodes[well.row]; |
3652 |
08 Dec 15 |
olle |
barcode = barcodesByName[barcodeName]; |
3652 |
08 Dec 15 |
olle |
465 |
} |
3652 |
08 Dec 15 |
olle |
well.barcode = barcode; |
3652 |
08 Dec 15 |
olle |
well.defaultBarcode = barcode; |
3652 |
08 Dec 15 |
olle |
well.duplicate = false; |
3652 |
08 Dec 15 |
olle |
469 |
} |
3652 |
08 Dec 15 |
olle |
470 |
} |
3652 |
08 Dec 15 |
olle |
471 |
|
3652 |
08 Dec 15 |
olle |
var currentWell; |
3652 |
08 Dec 15 |
olle |
var lastSelectedBarcode; |
3652 |
08 Dec 15 |
olle |
inspectstartplate.selectBarcode = function(event) |
3652 |
08 Dec 15 |
olle |
475 |
{ |
3652 |
08 Dec 15 |
olle |
var row = Data.int(event.currentTarget, 'row'); |
3652 |
08 Dec 15 |
olle |
var column = Data.int(event.currentTarget, 'col'); |
3652 |
08 Dec 15 |
olle |
478 |
|
3652 |
08 Dec 15 |
olle |
// Locate the barcode selection div so that the current |
3652 |
08 Dec 15 |
olle |
// barcode is positioned next to the current mouse position |
3652 |
08 Dec 15 |
olle |
// Initially set it to the right of the mouse so that the |
3652 |
08 Dec 15 |
olle |
// center is vertically aligned |
3652 |
08 Dec 15 |
olle |
currentWell = Plate.getWell(row, column); |
3652 |
08 Dec 15 |
olle |
var scroll = 0; |
3652 |
08 Dec 15 |
olle |
485 |
|
3652 |
08 Dec 15 |
olle |
// Reset 'current' selection |
3652 |
08 Dec 15 |
olle |
var menu = Doc.element('select-barcode'); |
3652 |
08 Dec 15 |
olle |
var selectAll = Doc.element('select-barcode-all'); |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < selectAll.childNodes.length; i++) |
3652 |
08 Dec 15 |
olle |
490 |
{ |
3652 |
08 Dec 15 |
olle |
Doc.removeClass(selectAll.childNodes[i], 'current'); |
3652 |
08 Dec 15 |
olle |
492 |
} |
3652 |
08 Dec 15 |
olle |
menu.style.display = 'block'; |
3652 |
08 Dec 15 |
olle |
494 |
|
3652 |
08 Dec 15 |
olle |
var x = event.clientX+1; |
3652 |
08 Dec 15 |
olle |
var halfHeight = Math.floor(selectAll.offsetHeight/2) |
3652 |
08 Dec 15 |
olle |
var y = event.clientY-halfHeight; |
3652 |
08 Dec 15 |
olle |
var scroll = 0; |
3652 |
08 Dec 15 |
olle |
var barcodeDiv; |
3652 |
08 Dec 15 |
olle |
500 |
|
3652 |
08 Dec 15 |
olle |
var useBarcode = currentWell.barcode || lastSelectedBarcode; |
3652 |
08 Dec 15 |
olle |
if (useBarcode) |
3652 |
08 Dec 15 |
olle |
503 |
{ |
3652 |
08 Dec 15 |
olle |
var barcodeDiv = Doc.element('bc-'+useBarcode.id); |
3652 |
08 Dec 15 |
olle |
if (!currentWell.barcode && barcodeDiv.nextSibling) barcodeDiv = barcodeDiv.nextSibling; |
3652 |
08 Dec 15 |
olle |
// Try to scroll the current barcode so that it's baseline is at the center of the div |
3652 |
08 Dec 15 |
olle |
scroll = barcodeDiv.offsetTop + barcodeDiv.offsetHeight - halfHeight; |
3652 |
08 Dec 15 |
olle |
if (scroll < 0) |
3652 |
08 Dec 15 |
olle |
509 |
{ |
3652 |
08 Dec 15 |
olle |
// We get a negative scroll for the first few elements, shift the |
3652 |
08 Dec 15 |
olle |
// entire selection div down instead |
3652 |
08 Dec 15 |
olle |
y -= scroll; |
3652 |
08 Dec 15 |
olle |
scroll = 0; |
3652 |
08 Dec 15 |
olle |
514 |
} |
3652 |
08 Dec 15 |
olle |
else if (scroll > selectAll.scrollHeight - selectAll.offsetHeight) |
3652 |
08 Dec 15 |
olle |
516 |
{ |
3652 |
08 Dec 15 |
olle |
// We get a too large scroll value for the last few elements, shift |
3652 |
08 Dec 15 |
olle |
// the entire selection div up instead |
3652 |
08 Dec 15 |
olle |
y -= scroll - (selectAll.scrollHeight - selectAll.offsetHeight); |
3652 |
08 Dec 15 |
olle |
scroll = selectAll.scrollHeight - selectAll.offsetHeight; |
3652 |
08 Dec 15 |
olle |
521 |
} |
3652 |
08 Dec 15 |
olle |
if (currentWell.barcode) |
3652 |
08 Dec 15 |
olle |
523 |
{ |
3652 |
08 Dec 15 |
olle |
Doc.addClass(barcodeDiv, 'current'); |
3652 |
08 Dec 15 |
olle |
525 |
} |
3652 |
08 Dec 15 |
olle |
526 |
} |
3652 |
08 Dec 15 |
olle |
527 |
|
3652 |
08 Dec 15 |
olle |
// Default barcode |
3652 |
08 Dec 15 |
olle |
if (currentWell.defaultBarcode && currentWell.defaultBarcode != currentWell.barcode) |
3652 |
08 Dec 15 |
olle |
530 |
{ |
3652 |
08 Dec 15 |
olle |
var selectDefault = Doc.element('select-barcode-default'); |
3652 |
08 Dec 15 |
olle |
Data.set(selectDefault, 'barcode-name', currentWell.defaultBarcode.name); |
3652 |
08 Dec 15 |
olle |
selectDefault.innerHTML = 'Default: ' + Strings.encodeTags(currentWell.defaultBarcode.name); |
3652 |
08 Dec 15 |
olle |
Doc.show('select-barcode-default'); |
3652 |
08 Dec 15 |
olle |
Doc.show('select-barcode-default-separator'); |
3652 |
08 Dec 15 |
olle |
536 |
} |
3652 |
08 Dec 15 |
olle |
else |
3652 |
08 Dec 15 |
olle |
538 |
{ |
3652 |
08 Dec 15 |
olle |
Doc.hide('select-barcode-default'); |
3652 |
08 Dec 15 |
olle |
Doc.hide('select-barcode-default-separator'); |
3652 |
08 Dec 15 |
olle |
541 |
} |
3652 |
08 Dec 15 |
olle |
542 |
|
3652 |
08 Dec 15 |
olle |
// Position the selection div |
3652 |
08 Dec 15 |
olle |
selectAll.scrollTop = scroll; |
3652 |
08 Dec 15 |
olle |
menu.style.left = (x)+'px'; |
3652 |
08 Dec 15 |
olle |
menu.style.top = (y)+'px'; |
3652 |
08 Dec 15 |
olle |
event.stopPropagation(); |
3652 |
08 Dec 15 |
olle |
548 |
} |
3652 |
08 Dec 15 |
olle |
549 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.barcodeSelected = function(event) |
3652 |
08 Dec 15 |
olle |
551 |
{ |
3652 |
08 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3652 |
08 Dec 15 |
olle |
var schema = PoolSchema.getById(frm.pool_schema.value); |
3652 |
08 Dec 15 |
olle |
var target = event.target; |
3652 |
08 Dec 15 |
olle |
if (currentWell) |
3652 |
08 Dec 15 |
olle |
556 |
{ |
3652 |
08 Dec 15 |
olle |
lastSelectedBarcode = barcodesByName[Data.get(target, 'barcode-name')]; |
3652 |
08 Dec 15 |
olle |
currentWell.barcode = lastSelectedBarcode; |
3652 |
08 Dec 15 |
olle |
var poolNum = schema.getPoolNumForColumn(currentWell.column); |
3652 |
08 Dec 15 |
olle |
inspectstartplate.checkDuplicateBarcode(poolNum); |
3652 |
08 Dec 15 |
olle |
Plate.paint(Plate.getWells()); |
3652 |
08 Dec 15 |
olle |
562 |
} |
3652 |
08 Dec 15 |
olle |
inspectstartplate.hideBarcodeSelection(); |
3652 |
08 Dec 15 |
olle |
564 |
} |
3652 |
08 Dec 15 |
olle |
565 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.checkDuplicateBarcode = function(poolNum) |
3652 |
08 Dec 15 |
olle |
567 |
{ |
3652 |
08 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3652 |
08 Dec 15 |
olle |
var schema = PoolSchema.getById(frm.pool_schema.value); |
3652 |
08 Dec 15 |
olle |
570 |
|
3652 |
08 Dec 15 |
olle |
var wells = schema.getWellsInPool(Plate, poolNum); |
3652 |
08 Dec 15 |
olle |
var wellByBarcodeName = []; |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < wells.length; i++) |
3652 |
08 Dec 15 |
olle |
574 |
{ |
3652 |
08 Dec 15 |
olle |
var well = wells[i]; |
3652 |
08 Dec 15 |
olle |
if (well.barcode) |
3652 |
08 Dec 15 |
olle |
577 |
{ |
3652 |
08 Dec 15 |
olle |
if (wellByBarcodeName[well.barcode.name]) |
3652 |
08 Dec 15 |
olle |
579 |
{ |
3652 |
08 Dec 15 |
olle |
well.duplicate = true; |
3652 |
08 Dec 15 |
olle |
wellByBarcodeName[well.barcode.name].duplicate = true; |
3652 |
08 Dec 15 |
olle |
582 |
} |
3652 |
08 Dec 15 |
olle |
else |
3652 |
08 Dec 15 |
olle |
584 |
{ |
3652 |
08 Dec 15 |
olle |
wellByBarcodeName[well.barcode.name] = well; |
3652 |
08 Dec 15 |
olle |
well.duplicate = false; |
3652 |
08 Dec 15 |
olle |
587 |
} |
3652 |
08 Dec 15 |
olle |
588 |
} |
3652 |
08 Dec 15 |
olle |
589 |
} |
3652 |
08 Dec 15 |
olle |
590 |
} |
3652 |
08 Dec 15 |
olle |
591 |
|
3652 |
08 Dec 15 |
olle |
592 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.hideBarcodeSelection = function() |
3652 |
08 Dec 15 |
olle |
594 |
{ |
3652 |
08 Dec 15 |
olle |
Doc.hide('select-barcode'); |
3652 |
08 Dec 15 |
olle |
596 |
} |
3652 |
08 Dec 15 |
olle |
597 |
|
3652 |
08 Dec 15 |
olle |
598 |
|
3652 |
08 Dec 15 |
olle |
599 |
/** |
3652 |
08 Dec 15 |
olle |
Sets default display of info data for plate wells, |
3652 |
08 Dec 15 |
olle |
based on check box values. Assumes the id of the |
3652 |
08 Dec 15 |
olle |
check box in question as input. |
3652 |
08 Dec 15 |
olle |
603 |
*/ |
3652 |
08 Dec 15 |
olle |
inspectstartplate.setDefaultInfo = function(chkbox) |
3652 |
08 Dec 15 |
olle |
605 |
{ |
3652 |
08 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3652 |
08 Dec 15 |
olle |
var show = frm[chkbox].checked; |
3652 |
08 Dec 15 |
olle |
Doc.addOrRemoveClass('plate', 'hide-'+chkbox, !show); |
3652 |
08 Dec 15 |
olle |
609 |
} |
3652 |
08 Dec 15 |
olle |
610 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.toggleInfo = function(event) |
3652 |
08 Dec 15 |
olle |
612 |
{ |
3652 |
08 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3652 |
08 Dec 15 |
olle |
var show = event.currentTarget.checked; |
3652 |
08 Dec 15 |
olle |
Doc.addOrRemoveClass('plate', 'hide-'+event.currentTarget.id, !show); |
3667 |
15 Dec 15 |
olle |
if (event.currentTarget.id == 'qubitconc') |
3667 |
15 Dec 15 |
olle |
617 |
{ |
3667 |
15 Dec 15 |
olle |
Doc.addOrRemoveClass('plate', 'hide-origqubitconc', !show); |
3667 |
15 Dec 15 |
olle |
Doc.addOrRemoveClass('plate', 'hide-calcqubitconc', !show); |
3667 |
15 Dec 15 |
olle |
620 |
} |
3652 |
08 Dec 15 |
olle |
// Re-paint well info to show/hide warnings for target class |
3652 |
08 Dec 15 |
olle |
Plate.paint(Plate.getWells()); |
3652 |
08 Dec 15 |
olle |
623 |
} |
3652 |
08 Dec 15 |
olle |
624 |
|
3652 |
08 Dec 15 |
olle |
625 |
/** |
3652 |
08 Dec 15 |
olle |
Open a popup dialog for selecting a data files. |
3652 |
08 Dec 15 |
olle |
627 |
*/ |
3652 |
08 Dec 15 |
olle |
inspectstartplate.selectFile = function() |
3652 |
08 Dec 15 |
olle |
629 |
{ |
3652 |
08 Dec 15 |
olle |
Dialogs.openPopup('select_file.jsp?ID='+App.getSessionId(), 'SelectFile', 600, 400); |
3652 |
08 Dec 15 |
olle |
631 |
} |
3652 |
08 Dec 15 |
olle |
632 |
|
3652 |
08 Dec 15 |
olle |
633 |
/** |
3652 |
08 Dec 15 |
olle |
Parse a tab-separated data file. The columns must be in the following order: |
3652 |
08 Dec 15 |
olle |
0: DNA name |
3652 |
08 Dec 15 |
olle |
1: Row letter (A-H) |
3652 |
08 Dec 15 |
olle |
2: Column number (1-12) |
3652 |
08 Dec 15 |
olle |
3: QC flag (can be empty) |
3652 |
08 Dec 15 |
olle |
639 |
*/ |
3652 |
08 Dec 15 |
olle |
inspectstartplate.parseDnaFile = function(data) |
3652 |
08 Dec 15 |
olle |
641 |
{ |
3652 |
08 Dec 15 |
olle |
var lines = data.split(/[\n\r]+/); |
3652 |
08 Dec 15 |
olle |
643 |
|
3652 |
08 Dec 15 |
olle |
// Load information about all DNA items in a batch (will improve performance) |
3652 |
08 Dec 15 |
olle |
var names = []; |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < lines.length; i++) |
3652 |
08 Dec 15 |
olle |
647 |
{ |
3652 |
08 Dec 15 |
olle |
var line = lines[i]; |
3652 |
08 Dec 15 |
olle |
if (line) |
3652 |
08 Dec 15 |
olle |
650 |
{ |
3652 |
08 Dec 15 |
olle |
var cols = lines[i].split(/\t/); |
3652 |
08 Dec 15 |
olle |
if (cols.length < 3) throw 'On line '+(i+1)+': Too few columns (' + cols.length + ')'; |
3652 |
08 Dec 15 |
olle |
names[names.length] = cols[0]; |
3652 |
08 Dec 15 |
olle |
654 |
} |
3652 |
08 Dec 15 |
olle |
655 |
} |
3652 |
08 Dec 15 |
olle |
Dna.loadInfoByNames(names); |
3652 |
08 Dec 15 |
olle |
657 |
|
3652 |
08 Dec 15 |
olle |
// Place DNA on the plate |
3652 |
08 Dec 15 |
olle |
var duplicates = []; |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < lines.length; i++) |
3652 |
08 Dec 15 |
olle |
661 |
{ |
3652 |
08 Dec 15 |
olle |
var line = lines[i]; |
3652 |
08 Dec 15 |
olle |
if (line) |
3652 |
08 Dec 15 |
olle |
664 |
{ |
3652 |
08 Dec 15 |
olle |
var cols = lines[i].split(/\t/); |
3652 |
08 Dec 15 |
olle |
666 |
|
3652 |
08 Dec 15 |
olle |
//var dna = Dna.createByName(cols[0]); |
3652 |
08 Dec 15 |
olle |
var row = Meludi.alphaToWell(cols[1].toUpperCase()); |
3652 |
08 Dec 15 |
olle |
var col = parseInt(cols[2], 10)-1; |
3652 |
08 Dec 15 |
olle |
670 |
|
3652 |
08 Dec 15 |
olle |
if (col < 6) |
3652 |
08 Dec 15 |
olle |
672 |
{ |
3652 |
08 Dec 15 |
olle |
var well = Plate.getWell(row, col); |
3652 |
08 Dec 15 |
olle |
if (!well) throw 'On line '+(i+1)+': Invalid plate coordinate ['+cols[1]+','+cols[2]+']'; |
3652 |
08 Dec 15 |
olle |
675 |
|
3652 |
08 Dec 15 |
olle |
var name = cols[0]; |
3652 |
08 Dec 15 |
olle |
// Create a new DNA object |
3652 |
08 Dec 15 |
olle |
var dna = Dna.createByName(name); |
3652 |
08 Dec 15 |
olle |
dna.name = name + '.fpa'; |
3652 |
08 Dec 15 |
olle |
dna.qc = cols.length >= 4 && (cols[3] && cols[3] != '0'); |
3652 |
08 Dec 15 |
olle |
Dna.unflag(dna); |
3652 |
08 Dec 15 |
olle |
682 |
|
3652 |
08 Dec 15 |
olle |
// Check for duplicate DNA on same position (which is an error) |
3652 |
08 Dec 15 |
olle |
var pos = 'c'+col+'r'+row; |
3652 |
08 Dec 15 |
olle |
if (duplicates[pos]) |
3652 |
08 Dec 15 |
olle |
686 |
{ |
3652 |
08 Dec 15 |
olle |
well.addDuplicate(dna); |
3652 |
08 Dec 15 |
olle |
688 |
} |
3652 |
08 Dec 15 |
olle |
else |
3652 |
08 Dec 15 |
olle |
690 |
{ |
3652 |
08 Dec 15 |
olle |
duplicates[pos] = dna.name; |
3652 |
08 Dec 15 |
olle |
well.setExtract(dna); |
3652 |
08 Dec 15 |
olle |
693 |
} |
3652 |
08 Dec 15 |
olle |
694 |
|
3652 |
08 Dec 15 |
olle |
// Place FPB sample in corresponding well on right side of plate |
3652 |
08 Dec 15 |
olle |
well = Plate.getWell(row, col + 6); |
3652 |
08 Dec 15 |
olle |
// Create a new DNA object |
3652 |
08 Dec 15 |
olle |
dna = Dna.createByName(name); |
3652 |
08 Dec 15 |
olle |
dna.name = name + '.fpb'; |
3652 |
08 Dec 15 |
olle |
dna.qc = cols.length >= 4 && (cols[3] && cols[3] != '0'); |
3652 |
08 Dec 15 |
olle |
Dna.unflag(dna); |
3652 |
08 Dec 15 |
olle |
well.setExtract(dna); |
3652 |
08 Dec 15 |
olle |
703 |
} |
3652 |
08 Dec 15 |
olle |
704 |
} |
3652 |
08 Dec 15 |
olle |
705 |
} |
3652 |
08 Dec 15 |
olle |
706 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.updateNumFlaggedDna(); |
3652 |
08 Dec 15 |
olle |
708 |
|
3652 |
08 Dec 15 |
olle |
// Check for replicates on the whole plate and repaint it |
3652 |
08 Dec 15 |
olle |
Plate.checkReplicates(null, true); |
3652 |
08 Dec 15 |
olle |
Plate.paint(Plate.getWells()); |
3652 |
08 Dec 15 |
olle |
712 |
} |
3652 |
08 Dec 15 |
olle |
713 |
|
3652 |
08 Dec 15 |
olle |
714 |
/** |
3652 |
08 Dec 15 |
olle |
Open a popup dialog for manual selection of DNA. |
3652 |
08 Dec 15 |
olle |
716 |
*/ |
3652 |
08 Dec 15 |
olle |
inspectstartplate.manualSelect = function(event) |
3652 |
08 Dec 15 |
olle |
718 |
{ |
3652 |
08 Dec 15 |
olle |
currentSelected = Plate.getSelected(); |
3652 |
08 Dec 15 |
olle |
if (currentSelected.length == 0) |
3652 |
08 Dec 15 |
olle |
721 |
{ |
3652 |
08 Dec 15 |
olle |
Forms.showNotification(event.currentTarget, 'Please select one or more wells were DNA should be placed.'); |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
724 |
} |
3652 |
08 Dec 15 |
olle |
725 |
|
3652 |
08 Dec 15 |
olle |
if (subtypeDna == null) subtypeDna = Meludi.getSubtypeInfo('DNA'); |
3652 |
08 Dec 15 |
olle |
727 |
/* |
3652 |
08 Dec 15 |
olle |
if (subtypeDnaNormalized == null) subtypeDnaNormalized = Meludi.getSubtypeInfo('DNA_NORMALIZED_ALIQUOT'); |
3652 |
08 Dec 15 |
olle |
729 |
*/ |
3652 |
08 Dec 15 |
olle |
730 |
|
3652 |
08 Dec 15 |
olle |
var url = '&resetTemporary=1'; |
3652 |
08 Dec 15 |
olle |
732 |
/* |
3652 |
08 Dec 15 |
olle |
url += '&tmpfilter:INT:itemSubtype='+subtypeDna.id+'|'+subtypeDnaNormalized.id; |
3652 |
08 Dec 15 |
olle |
734 |
*/ |
3652 |
08 Dec 15 |
olle |
url += '&tmpfilter:INT:itemSubtype='+subtypeDna.id; |
3652 |
08 Dec 15 |
olle |
url += '&tmpfilter:DATE:creationEvent.eventDate='+encodeURIComponent('<>'); |
3652 |
08 Dec 15 |
olle |
url += '&tmpfilter:FLOAT:remainingQuantity='+encodeURIComponent('>=1'); |
3652 |
08 Dec 15 |
olle |
url += '&'+encodeURIComponent('tmpfilter:STRING:&childCreationEvents(event.bioMaterial.name)')+'='+encodeURIComponent('<>%.m'); |
3652 |
08 Dec 15 |
olle |
739 |
|
3652 |
08 Dec 15 |
olle |
Dialogs.selectItem('EXTRACT', 'plate', 1, url); |
3652 |
08 Dec 15 |
olle |
741 |
} |
3652 |
08 Dec 15 |
olle |
742 |
|
3652 |
08 Dec 15 |
olle |
743 |
/** |
3652 |
08 Dec 15 |
olle |
Callback method for manual selection. |
3652 |
08 Dec 15 |
olle |
745 |
*/ |
3652 |
08 Dec 15 |
olle |
inspectstartplate.manuallySelected = function(event) |
3652 |
08 Dec 15 |
olle |
747 |
{ |
3652 |
08 Dec 15 |
olle |
names[names.length] = event.detail.name; |
3652 |
08 Dec 15 |
olle |
749 |
|
3652 |
08 Dec 15 |
olle |
if (event.detail.remaining == 0 && names.length > 0) |
3652 |
08 Dec 15 |
olle |
751 |
{ |
3652 |
08 Dec 15 |
olle |
Dna.loadInfoByNames(names); |
3652 |
08 Dec 15 |
olle |
753 |
|
3652 |
08 Dec 15 |
olle |
var wellsArray = []; |
3652 |
08 Dec 15 |
olle |
var numItemsPlaced = names.length; |
3652 |
08 Dec 15 |
olle |
if (currentSelected.length < names.length) |
3652 |
08 Dec 15 |
olle |
757 |
{ |
3652 |
08 Dec 15 |
olle |
numItemsPlaced = currentSelected.length; |
3652 |
08 Dec 15 |
olle |
759 |
} |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < numItemsPlaced; i++) |
3652 |
08 Dec 15 |
olle |
761 |
{ |
3652 |
08 Dec 15 |
olle |
var well = currentSelected[i]; |
3652 |
08 Dec 15 |
olle |
wellsArray[i] = well; |
3652 |
08 Dec 15 |
olle |
var name = names[i]; |
3652 |
08 Dec 15 |
olle |
//alert("inspect_start_plate.js::manuallySelected(): currentSelected.length = " + currentSelected.length + " names.legnth = " + names.length + " i = " + i + " name = \"" + name + "\" well = " + JSON.stringify(well)); |
3652 |
08 Dec 15 |
olle |
// Create a new DNA object |
3652 |
08 Dec 15 |
olle |
var dna = Dna.createByName(name); |
3652 |
08 Dec 15 |
olle |
dna.name = name + '.fpa'; |
3652 |
08 Dec 15 |
olle |
Dna.unflag(dna); |
3652 |
08 Dec 15 |
olle |
well.setExtract(dna); |
3652 |
08 Dec 15 |
olle |
well.selected = false; |
3652 |
08 Dec 15 |
olle |
// Place FPB sample in corresponding well on right side of plate |
3652 |
08 Dec 15 |
olle |
var row = well.row; |
3652 |
08 Dec 15 |
olle |
var column = well.column; |
3652 |
08 Dec 15 |
olle |
well = Plate.getWell(row, column + 6); |
3652 |
08 Dec 15 |
olle |
wellsArray[i+numItemsPlaced] = well; |
3652 |
08 Dec 15 |
olle |
// Create a new DNA object |
3652 |
08 Dec 15 |
olle |
dna = Dna.createByName(name); |
3652 |
08 Dec 15 |
olle |
dna.name = name + '.fpb'; |
3652 |
08 Dec 15 |
olle |
Dna.unflag(dna); |
3652 |
08 Dec 15 |
olle |
well.setExtract(dna); |
3652 |
08 Dec 15 |
olle |
well.selected = false; |
3652 |
08 Dec 15 |
olle |
783 |
} |
3652 |
08 Dec 15 |
olle |
Plate.checkReplicates(); |
3652 |
08 Dec 15 |
olle |
785 |
/* |
3652 |
08 Dec 15 |
olle |
Plate.paint(currentSelected); |
3652 |
08 Dec 15 |
olle |
787 |
*/ |
3652 |
08 Dec 15 |
olle |
Plate.paint(wellsArray); |
3652 |
08 Dec 15 |
olle |
inspectstartplate.updateNumFlaggedDna(); |
3652 |
08 Dec 15 |
olle |
names = []; |
3652 |
08 Dec 15 |
olle |
791 |
} |
3652 |
08 Dec 15 |
olle |
792 |
} |
3652 |
08 Dec 15 |
olle |
793 |
|
3652 |
08 Dec 15 |
olle |
794 |
|
3652 |
08 Dec 15 |
olle |
795 |
/** |
3652 |
08 Dec 15 |
olle |
Let the wizard automatically select among unprocessed DNA items. |
3652 |
08 Dec 15 |
olle |
797 |
*/ |
3652 |
08 Dec 15 |
olle |
inspectstartplate.autoSelect = function(event) |
3652 |
08 Dec 15 |
olle |
799 |
{ |
3652 |
08 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3652 |
08 Dec 15 |
olle |
var wells = Plate.getWells(); |
3652 |
08 Dec 15 |
olle |
var selected = []; |
3652 |
08 Dec 15 |
olle |
var ignore = []; |
3652 |
08 Dec 15 |
olle |
var notEmpty = 0; |
3652 |
08 Dec 15 |
olle |
805 |
|
3652 |
08 Dec 15 |
olle |
// Count selected and non-empty wells and keep track of DNA that is already present |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < wells.length; i++) |
3652 |
08 Dec 15 |
olle |
808 |
{ |
3652 |
08 Dec 15 |
olle |
var well = wells[i]; |
3652 |
08 Dec 15 |
olle |
if (well.selected) |
3652 |
08 Dec 15 |
olle |
811 |
{ |
3652 |
08 Dec 15 |
olle |
selected[selected.length] = well; |
3652 |
08 Dec 15 |
olle |
if (well.extract && !well.hasError()) notEmpty++; |
3652 |
08 Dec 15 |
olle |
814 |
} |
3652 |
08 Dec 15 |
olle |
if (well.extract && well.extract.id) |
3652 |
08 Dec 15 |
olle |
816 |
{ |
3652 |
08 Dec 15 |
olle |
ignore[ignore.length] = well.extract.id; |
3652 |
08 Dec 15 |
olle |
818 |
} |
3652 |
08 Dec 15 |
olle |
819 |
} |
3652 |
08 Dec 15 |
olle |
// Ignore DNA already flagged |
3652 |
08 Dec 15 |
olle |
var flagged = Dna.getFlagged(); |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < flagged.length; i++) |
3652 |
08 Dec 15 |
olle |
823 |
{ |
3652 |
08 Dec 15 |
olle |
var dna = flagged[i]; |
3652 |
08 Dec 15 |
olle |
if (dna.id) ignore[ignore.length] = dna.id; |
3652 |
08 Dec 15 |
olle |
826 |
} |
3652 |
08 Dec 15 |
olle |
827 |
|
3652 |
08 Dec 15 |
olle |
if (selected.length == 0) |
3652 |
08 Dec 15 |
olle |
829 |
{ |
3652 |
08 Dec 15 |
olle |
Forms.showNotification(event.currentTarget, 'Please select one or more wells were DNA should be placed.'); |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
832 |
} |
3652 |
08 Dec 15 |
olle |
833 |
|
3652 |
08 Dec 15 |
olle |
if (notEmpty > 0) |
3652 |
08 Dec 15 |
olle |
835 |
{ |
3652 |
08 Dec 15 |
olle |
if (!confirm('Replace DNA in ' + notEmpty + ' wells?')) |
3652 |
08 Dec 15 |
olle |
837 |
{ |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
839 |
} |
3652 |
08 Dec 15 |
olle |
840 |
} |
3652 |
08 Dec 15 |
olle |
841 |
|
3652 |
08 Dec 15 |
olle |
var url = 'auto_select_dna.jsp?ID='+App.getSessionId(); |
3652 |
08 Dec 15 |
olle |
url += '&numToSelect='+selected.length; |
3652 |
08 Dec 15 |
olle |
844 |
/* |
3652 |
08 Dec 15 |
olle |
url += '&quantity='+encodeURIComponent(frm.quantity_regular.value); |
3652 |
08 Dec 15 |
olle |
846 |
*/ |
3652 |
08 Dec 15 |
olle |
url += '&ignore='+ignore.join(','); |
3652 |
08 Dec 15 |
olle |
Dialogs.openPopup(url, 'AutoSelectDNA', 750, 500); |
3652 |
08 Dec 15 |
olle |
849 |
} |
3652 |
08 Dec 15 |
olle |
850 |
|
3652 |
08 Dec 15 |
olle |
851 |
/** |
3652 |
08 Dec 15 |
olle |
Callback function for auto-select. |
3652 |
08 Dec 15 |
olle |
853 |
*/ |
3652 |
08 Dec 15 |
olle |
inspectstartplate.dnaSelected = function(response) |
3652 |
08 Dec 15 |
olle |
855 |
{ |
3652 |
08 Dec 15 |
olle |
// Cache DNA information |
3652 |
08 Dec 15 |
olle |
Dna.cacheInfo(response.dna); |
3652 |
08 Dec 15 |
olle |
Dna.cacheInfo(response.flagged); |
3652 |
08 Dec 15 |
olle |
859 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.updateNumFlaggedDna(); |
3652 |
08 Dec 15 |
olle |
var selected = Plate.getSelected(); |
3652 |
08 Dec 15 |
olle |
862 |
|
3652 |
08 Dec 15 |
olle |
863 |
/* |
3652 |
08 Dec 15 |
olle |
// Get selected DNA names |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < response.dna.length; i++) |
3652 |
08 Dec 15 |
olle |
866 |
{ |
3652 |
08 Dec 15 |
olle |
if (i < selected.length) |
3652 |
08 Dec 15 |
olle |
868 |
{ |
3652 |
08 Dec 15 |
olle |
names[i] = response.dna[i].name; |
3652 |
08 Dec 15 |
olle |
870 |
} |
3652 |
08 Dec 15 |
olle |
871 |
} |
3652 |
08 Dec 15 |
olle |
if (names.length > 0) |
3652 |
08 Dec 15 |
olle |
873 |
{ |
3652 |
08 Dec 15 |
olle |
Dna.loadInfoByNames(names); |
3652 |
08 Dec 15 |
olle |
875 |
|
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < names.length && i < selected.length; i++) |
3652 |
08 Dec 15 |
olle |
877 |
{ |
3652 |
08 Dec 15 |
olle |
var well = selected[i]; |
3652 |
08 Dec 15 |
olle |
var name = names[i]; |
3652 |
08 Dec 15 |
olle |
880 |
|
3652 |
08 Dec 15 |
olle |
// Create a new DNA object |
3652 |
08 Dec 15 |
olle |
var dna = Dna.createByName(name); |
3652 |
08 Dec 15 |
olle |
Dna.unflag(dna); |
3652 |
08 Dec 15 |
olle |
well.setExtract(dna); |
3652 |
08 Dec 15 |
olle |
well.selected = false; |
3652 |
08 Dec 15 |
olle |
886 |
} |
3652 |
08 Dec 15 |
olle |
887 |
|
3652 |
08 Dec 15 |
olle |
Plate.checkReplicates(); |
3652 |
08 Dec 15 |
olle |
Plate.paint(selected); |
3652 |
08 Dec 15 |
olle |
inspectstartplate.updateNumFlaggedDna(); |
3652 |
08 Dec 15 |
olle |
names = []; |
3652 |
08 Dec 15 |
olle |
892 |
} |
3652 |
08 Dec 15 |
olle |
893 |
*/ |
3652 |
08 Dec 15 |
olle |
894 |
|
3652 |
08 Dec 15 |
olle |
var wellsArray = []; |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < response.dna.length; i++) |
3652 |
08 Dec 15 |
olle |
897 |
{ |
3652 |
08 Dec 15 |
olle |
if (i < selected.length) |
3652 |
08 Dec 15 |
olle |
899 |
{ |
3652 |
08 Dec 15 |
olle |
var well = selected[i]; |
3652 |
08 Dec 15 |
olle |
wellsArray[i] = well; |
3652 |
08 Dec 15 |
olle |
// Create a new DNA object |
3652 |
08 Dec 15 |
olle |
var name = response.dna[i].name; |
3652 |
08 Dec 15 |
olle |
var dna = Dna.createByName(name); |
3652 |
08 Dec 15 |
olle |
dna.name = name + '.fpa'; |
3652 |
08 Dec 15 |
olle |
//Dna.unflag(dna); |
3652 |
08 Dec 15 |
olle |
well.setExtract(dna); |
3652 |
08 Dec 15 |
olle |
well.selected = false; |
3652 |
08 Dec 15 |
olle |
// Place FPB sample in corresponding well on right side of plate |
3652 |
08 Dec 15 |
olle |
var row = well.row; |
3652 |
08 Dec 15 |
olle |
var column = well.column; |
3652 |
08 Dec 15 |
olle |
well = Plate.getWell(row, column + 6); |
3652 |
08 Dec 15 |
olle |
wellsArray[i+selected.length] = well; |
3652 |
08 Dec 15 |
olle |
// Create a new DNA object |
3652 |
08 Dec 15 |
olle |
dna = Dna.createByName(name); |
3652 |
08 Dec 15 |
olle |
dna.name = name + '.fpb'; |
3652 |
08 Dec 15 |
olle |
//Dna.unflag(dna); |
3652 |
08 Dec 15 |
olle |
well.setExtract(dna); |
3652 |
08 Dec 15 |
olle |
well.selected = false; |
3652 |
08 Dec 15 |
olle |
920 |
} |
3652 |
08 Dec 15 |
olle |
921 |
} |
3652 |
08 Dec 15 |
olle |
// Check for replicates on the whole plate and repaint it |
3652 |
08 Dec 15 |
olle |
Plate.checkReplicates(null, true); |
3652 |
08 Dec 15 |
olle |
Plate.paint(Plate.getWells()); |
3652 |
08 Dec 15 |
olle |
925 |
} |
3652 |
08 Dec 15 |
olle |
926 |
|
3652 |
08 Dec 15 |
olle |
// Update the 'Flagged DNA' information |
3652 |
08 Dec 15 |
olle |
inspectstartplate.updateNumFlaggedDna = function() |
3652 |
08 Dec 15 |
olle |
929 |
{ |
3652 |
08 Dec 15 |
olle |
var numFlagged = Dna.getFlagged().length; |
3652 |
08 Dec 15 |
olle |
if (numFlagged > 0) |
3652 |
08 Dec 15 |
olle |
932 |
{ |
3652 |
08 Dec 15 |
olle |
Doc.element('flaggedDna').innerHTML = numFlagged + ' flagged DNA items.'; |
3652 |
08 Dec 15 |
olle |
Doc.show('flaggedDna'); |
3652 |
08 Dec 15 |
olle |
935 |
} |
3652 |
08 Dec 15 |
olle |
else |
3652 |
08 Dec 15 |
olle |
937 |
{ |
3652 |
08 Dec 15 |
olle |
Doc.hide('flaggedDna'); |
3652 |
08 Dec 15 |
olle |
939 |
} |
3652 |
08 Dec 15 |
olle |
940 |
} |
3652 |
08 Dec 15 |
olle |
941 |
|
3652 |
08 Dec 15 |
olle |
942 |
/** |
3652 |
08 Dec 15 |
olle |
Add 'Stratagene' to the selected wells. |
3652 |
08 Dec 15 |
olle |
944 |
*/ |
3652 |
08 Dec 15 |
olle |
inspectstartplate.setToStratagene = function(event) |
3652 |
08 Dec 15 |
olle |
946 |
{ |
3652 |
08 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3652 |
08 Dec 15 |
olle |
inspectstartplate.setToSpecial(event, frm.stratagene.value, true); |
3652 |
08 Dec 15 |
olle |
949 |
} |
3652 |
08 Dec 15 |
olle |
950 |
|
3652 |
08 Dec 15 |
olle |
951 |
|
3652 |
08 Dec 15 |
olle |
952 |
/** |
3652 |
08 Dec 15 |
olle |
Add 'External DNA' to the selected wells. |
3652 |
08 Dec 15 |
olle |
954 |
*/ |
3652 |
08 Dec 15 |
olle |
inspectstartplate.setToExternal = function(event) |
3652 |
08 Dec 15 |
olle |
956 |
{ |
3652 |
08 Dec 15 |
olle |
inspectstartplate.setToSpecial(event, EXTERNAL_DNA_NAME, false); |
3652 |
08 Dec 15 |
olle |
958 |
} |
3652 |
08 Dec 15 |
olle |
959 |
|
3652 |
08 Dec 15 |
olle |
960 |
/** |
3652 |
08 Dec 15 |
olle |
Add special DNA to the selected wells. |
3652 |
08 Dec 15 |
olle |
962 |
*/ |
3652 |
08 Dec 15 |
olle |
inspectstartplate.setToSpecial = function(event, specialName, qc) |
3652 |
08 Dec 15 |
olle |
964 |
{ |
3652 |
08 Dec 15 |
olle |
var wells = Plate.getSelected(); |
3652 |
08 Dec 15 |
olle |
966 |
|
3652 |
08 Dec 15 |
olle |
if (wells.length == 0) |
3652 |
08 Dec 15 |
olle |
968 |
{ |
3652 |
08 Dec 15 |
olle |
Forms.showNotification(event.currentTarget, 'No wells have been selected'); |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
971 |
} |
3652 |
08 Dec 15 |
olle |
972 |
|
3652 |
08 Dec 15 |
olle |
// Count non-empty wells |
3652 |
08 Dec 15 |
olle |
var count = 0; |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < wells.length; i++) |
3652 |
08 Dec 15 |
olle |
976 |
{ |
3652 |
08 Dec 15 |
olle |
var well = wells[i]; |
3652 |
08 Dec 15 |
olle |
if (well.extract && !well.hasError()) count++; |
3652 |
08 Dec 15 |
olle |
979 |
} |
3652 |
08 Dec 15 |
olle |
980 |
|
3652 |
08 Dec 15 |
olle |
if (count > 0) |
3652 |
08 Dec 15 |
olle |
982 |
{ |
3652 |
08 Dec 15 |
olle |
if (!confirm('Replace DNA in ' + count + ' wells with '+specialName+'?')) |
3652 |
08 Dec 15 |
olle |
984 |
{ |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
986 |
} |
3652 |
08 Dec 15 |
olle |
987 |
} |
3652 |
08 Dec 15 |
olle |
988 |
|
3652 |
08 Dec 15 |
olle |
var info = Dna.infoByName(specialName); |
3652 |
08 Dec 15 |
olle |
if (!info.id) |
3652 |
08 Dec 15 |
olle |
991 |
{ |
3652 |
08 Dec 15 |
olle |
alert('Could not find any DNA with name=\''+specialName+'\'. Please check that it exists on the server.'); |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
994 |
} |
3652 |
08 Dec 15 |
olle |
995 |
|
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < wells.length; i++) |
3652 |
08 Dec 15 |
olle |
997 |
{ |
3652 |
08 Dec 15 |
olle |
var well = wells[i]; |
3652 |
08 Dec 15 |
olle |
var dna = Dna.createByInfo(info); |
3652 |
08 Dec 15 |
olle |
dna.qc = qc; |
3652 |
08 Dec 15 |
olle |
well.setExtract(dna); |
3652 |
08 Dec 15 |
olle |
well.selected = false; |
3652 |
08 Dec 15 |
olle |
1003 |
} |
3652 |
08 Dec 15 |
olle |
1004 |
|
3652 |
08 Dec 15 |
olle |
Plate.paint(wells); |
3652 |
08 Dec 15 |
olle |
1006 |
|
3652 |
08 Dec 15 |
olle |
// Check for replicated DNA if some have been replaced with Stratagene |
3652 |
08 Dec 15 |
olle |
if (count > 0) Plate.checkReplicates(); |
3652 |
08 Dec 15 |
olle |
1009 |
} |
3652 |
08 Dec 15 |
olle |
1010 |
|
3652 |
08 Dec 15 |
olle |
1011 |
/** |
3652 |
08 Dec 15 |
olle |
Toggle the QC flag for the selected wells. The first non-empty |
3652 |
08 Dec 15 |
olle |
well is toggled and the rest of the wells will use the same new QC |
3652 |
08 Dec 15 |
olle |
value. |
3652 |
08 Dec 15 |
olle |
1015 |
*/ |
3652 |
08 Dec 15 |
olle |
inspectstartplate.toggleQc = function(event) |
3652 |
08 Dec 15 |
olle |
1017 |
{ |
3652 |
08 Dec 15 |
olle |
var wells = Plate.getSelected(); |
3652 |
08 Dec 15 |
olle |
1019 |
|
3652 |
08 Dec 15 |
olle |
if (wells.length == 0) |
3652 |
08 Dec 15 |
olle |
1021 |
{ |
3652 |
08 Dec 15 |
olle |
Forms.showNotification(event.currentTarget, 'No wells have been selected'); |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
1024 |
} |
3652 |
08 Dec 15 |
olle |
1025 |
|
3652 |
08 Dec 15 |
olle |
var gotQc = false; |
3652 |
08 Dec 15 |
olle |
var newQc; |
3652 |
08 Dec 15 |
olle |
var count = 0; |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < wells.length; i++) |
3652 |
08 Dec 15 |
olle |
1030 |
{ |
3652 |
08 Dec 15 |
olle |
var well = wells[i]; |
3652 |
08 Dec 15 |
olle |
if (well.extract) |
3652 |
08 Dec 15 |
olle |
1033 |
{ |
3652 |
08 Dec 15 |
olle |
// Toggle QC flag for the first well with DNA, then use the same flag for the rest |
3652 |
08 Dec 15 |
olle |
if (!gotQc) |
3652 |
08 Dec 15 |
olle |
1036 |
{ |
3652 |
08 Dec 15 |
olle |
gotQc = true; |
3652 |
08 Dec 15 |
olle |
newQc = !well.extract.qc; |
3652 |
08 Dec 15 |
olle |
1039 |
} |
3652 |
08 Dec 15 |
olle |
well.extract.qc = newQc; |
3652 |
08 Dec 15 |
olle |
count++; |
3652 |
08 Dec 15 |
olle |
1042 |
} |
3652 |
08 Dec 15 |
olle |
1043 |
} |
3652 |
08 Dec 15 |
olle |
1044 |
|
3652 |
08 Dec 15 |
olle |
if (count == 0) |
3652 |
08 Dec 15 |
olle |
1046 |
{ |
3652 |
08 Dec 15 |
olle |
Forms.showNotification(event.currentTarget, 'None of the selected wells contain any DNA'); |
3652 |
08 Dec 15 |
olle |
1048 |
} |
3652 |
08 Dec 15 |
olle |
else |
3652 |
08 Dec 15 |
olle |
1050 |
{ |
3652 |
08 Dec 15 |
olle |
Plate.paint(wells); |
3652 |
08 Dec 15 |
olle |
1052 |
} |
3652 |
08 Dec 15 |
olle |
1053 |
} |
3652 |
08 Dec 15 |
olle |
1054 |
|
3652 |
08 Dec 15 |
olle |
// Set a comment on the selected wells |
3652 |
08 Dec 15 |
olle |
inspectstartplate.commentSelected = function(event) |
3652 |
08 Dec 15 |
olle |
1057 |
{ |
3652 |
08 Dec 15 |
olle |
var wells = Plate.getSelected(); |
3652 |
08 Dec 15 |
olle |
1059 |
|
3652 |
08 Dec 15 |
olle |
if (wells.length == 0) |
3652 |
08 Dec 15 |
olle |
1061 |
{ |
3652 |
08 Dec 15 |
olle |
Forms.showNotification(event.currentTarget, 'No wells have been selected'); |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
1064 |
} |
3652 |
08 Dec 15 |
olle |
1065 |
|
3652 |
08 Dec 15 |
olle |
var count = 0; |
3652 |
08 Dec 15 |
olle |
var comment = ''; |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < wells.length; i++) |
3652 |
08 Dec 15 |
olle |
1069 |
{ |
3652 |
08 Dec 15 |
olle |
var well = wells[i]; |
3652 |
08 Dec 15 |
olle |
if (well.extract) |
3652 |
08 Dec 15 |
olle |
1072 |
{ |
3652 |
08 Dec 15 |
olle |
count++; |
3652 |
08 Dec 15 |
olle |
if (well.extract.comment) comment = well.extract.comment; |
3652 |
08 Dec 15 |
olle |
1075 |
} |
3652 |
08 Dec 15 |
olle |
1076 |
} |
3652 |
08 Dec 15 |
olle |
1077 |
|
3652 |
08 Dec 15 |
olle |
if (count == 0) |
3652 |
08 Dec 15 |
olle |
1079 |
{ |
3652 |
08 Dec 15 |
olle |
Forms.showNotification(event.currentTarget, 'None of the selected wells contain any DNA'); |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
1082 |
} |
3652 |
08 Dec 15 |
olle |
1083 |
|
3652 |
08 Dec 15 |
olle |
comment = prompt('Comment', comment || ''); |
3652 |
08 Dec 15 |
olle |
if (comment == null) return; |
3652 |
08 Dec 15 |
olle |
1086 |
|
3652 |
08 Dec 15 |
olle |
if (comment == '') comment = null; |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < wells.length; i++) |
3652 |
08 Dec 15 |
olle |
1089 |
{ |
3652 |
08 Dec 15 |
olle |
var well = wells[i]; |
3652 |
08 Dec 15 |
olle |
if (well.extract) well.extract.comment = comment; |
3652 |
08 Dec 15 |
olle |
1092 |
} |
3652 |
08 Dec 15 |
olle |
Plate.paint(wells); |
3652 |
08 Dec 15 |
olle |
1094 |
} |
3652 |
08 Dec 15 |
olle |
1095 |
|
3652 |
08 Dec 15 |
olle |
1096 |
/** |
3652 |
08 Dec 15 |
olle |
Empty the selected wells from DNA. They can later be pasted again. |
3652 |
08 Dec 15 |
olle |
1098 |
*/ |
3652 |
08 Dec 15 |
olle |
inspectstartplate.cutSelected = function(event) |
3652 |
08 Dec 15 |
olle |
1100 |
{ |
3652 |
08 Dec 15 |
olle |
var wells = Plate.getSelected(); |
3652 |
08 Dec 15 |
olle |
1102 |
|
3652 |
08 Dec 15 |
olle |
if (wells.length == 0) |
3652 |
08 Dec 15 |
olle |
1104 |
{ |
3652 |
08 Dec 15 |
olle |
Forms.showNotification(event.currentTarget, 'No wells have been selected'); |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
1107 |
} |
3652 |
08 Dec 15 |
olle |
1108 |
|
3652 |
08 Dec 15 |
olle |
var count = 0; |
3652 |
08 Dec 15 |
olle |
var valid = 0; |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < wells.length; i++) |
3652 |
08 Dec 15 |
olle |
1112 |
{ |
3652 |
08 Dec 15 |
olle |
var well = wells[i]; |
3652 |
08 Dec 15 |
olle |
if (well.extract) |
3652 |
08 Dec 15 |
olle |
1115 |
{ |
3652 |
08 Dec 15 |
olle |
count++; |
3652 |
08 Dec 15 |
olle |
if (!well.hasError()) valid++; |
3652 |
08 Dec 15 |
olle |
1118 |
} |
3652 |
08 Dec 15 |
olle |
1119 |
} |
3652 |
08 Dec 15 |
olle |
1120 |
|
3652 |
08 Dec 15 |
olle |
if (count == 0) |
3652 |
08 Dec 15 |
olle |
1122 |
{ |
3652 |
08 Dec 15 |
olle |
Forms.showNotification(event.currentTarget, 'None of the selected wells contain any DNA'); |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
1125 |
} |
3652 |
08 Dec 15 |
olle |
1126 |
|
3652 |
08 Dec 15 |
olle |
// Ask for confirmation before deleting from valid wells |
3652 |
08 Dec 15 |
olle |
if (valid > 0) |
3652 |
08 Dec 15 |
olle |
1129 |
{ |
3652 |
08 Dec 15 |
olle |
if (!confirm('Clear DNA from ' + count + ' of ' + wells.length + ' selected wells?')) |
3652 |
08 Dec 15 |
olle |
1131 |
{ |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
1133 |
} |
3652 |
08 Dec 15 |
olle |
1134 |
} |
3652 |
08 Dec 15 |
olle |
1135 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.copySelected(); |
3652 |
08 Dec 15 |
olle |
1137 |
/* |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < wells.length; i++) |
3652 |
08 Dec 15 |
olle |
1139 |
{ |
3652 |
08 Dec 15 |
olle |
var well = wells[i]; |
3652 |
08 Dec 15 |
olle |
well.setExtract(null); |
3652 |
08 Dec 15 |
olle |
well.selected = false; |
3652 |
08 Dec 15 |
olle |
1143 |
} |
3652 |
08 Dec 15 |
olle |
Plate.paint(wells); |
3652 |
08 Dec 15 |
olle |
1145 |
*/ |
3652 |
08 Dec 15 |
olle |
var wellsArray = []; |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < wells.length; i++) |
3652 |
08 Dec 15 |
olle |
1148 |
{ |
3652 |
08 Dec 15 |
olle |
var well = wells[i]; |
3652 |
08 Dec 15 |
olle |
well.setExtract(null); |
3652 |
08 Dec 15 |
olle |
well.selected = false; |
3652 |
08 Dec 15 |
olle |
wellsArray[i] = well; |
3652 |
08 Dec 15 |
olle |
// Clear FPB sample in corresponding well on right side of plate |
3652 |
08 Dec 15 |
olle |
var row = well.row; |
3652 |
08 Dec 15 |
olle |
var column = well.column; |
3652 |
08 Dec 15 |
olle |
well = Plate.getWell(row, column + 6); |
3652 |
08 Dec 15 |
olle |
well.setExtract(null); |
3652 |
08 Dec 15 |
olle |
well.selected = false; |
3652 |
08 Dec 15 |
olle |
wellsArray[i+wells.length] = well; |
3652 |
08 Dec 15 |
olle |
1160 |
} |
3652 |
08 Dec 15 |
olle |
Plate.paint(wellsArray); |
3652 |
08 Dec 15 |
olle |
Plate.checkReplicates(); |
3652 |
08 Dec 15 |
olle |
1163 |
} |
3652 |
08 Dec 15 |
olle |
1164 |
|
3652 |
08 Dec 15 |
olle |
var copy; |
3652 |
08 Dec 15 |
olle |
1166 |
/** |
3652 |
08 Dec 15 |
olle |
Copy information about the selected wells. |
3652 |
08 Dec 15 |
olle |
1168 |
*/ |
3652 |
08 Dec 15 |
olle |
inspectstartplate.copySelected = function(event) |
3652 |
08 Dec 15 |
olle |
1170 |
{ |
3652 |
08 Dec 15 |
olle |
// Clear existing wells in the copy |
3652 |
08 Dec 15 |
olle |
var repaint = []; |
3652 |
08 Dec 15 |
olle |
if (copy && copy.length > 0) |
3652 |
08 Dec 15 |
olle |
1174 |
{ |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < copy.length; i++) |
3652 |
08 Dec 15 |
olle |
1176 |
{ |
3652 |
08 Dec 15 |
olle |
var cp = copy[i]; |
3652 |
08 Dec 15 |
olle |
cp.well.doneWithCopy(); |
3652 |
08 Dec 15 |
olle |
repaint[repaint.length] = cp.well; |
3652 |
08 Dec 15 |
olle |
1180 |
} |
3652 |
08 Dec 15 |
olle |
1181 |
} |
3652 |
08 Dec 15 |
olle |
Plate.paint(repaint); |
3652 |
08 Dec 15 |
olle |
1183 |
|
3652 |
08 Dec 15 |
olle |
// Place selected wells in the copy |
3652 |
08 Dec 15 |
olle |
var wells = Plate.getSelected(); |
3652 |
08 Dec 15 |
olle |
copy = []; |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < wells.length; i++) |
3652 |
08 Dec 15 |
olle |
1188 |
{ |
3652 |
08 Dec 15 |
olle |
var well = wells[i]; |
3652 |
08 Dec 15 |
olle |
copy[copy.length] = well.makeCopy(); |
3652 |
08 Dec 15 |
olle |
well.selected = false; |
3652 |
08 Dec 15 |
olle |
1192 |
} |
3652 |
08 Dec 15 |
olle |
Plate.paint(wells); |
3652 |
08 Dec 15 |
olle |
1194 |
} |
3652 |
08 Dec 15 |
olle |
1195 |
|
3652 |
08 Dec 15 |
olle |
1196 |
/** |
3652 |
08 Dec 15 |
olle |
Paste information into the selected wells. |
3652 |
08 Dec 15 |
olle |
1198 |
*/ |
3652 |
08 Dec 15 |
olle |
inspectstartplate.pasteToSelected = function(event) |
3652 |
08 Dec 15 |
olle |
1200 |
{ |
3652 |
08 Dec 15 |
olle |
if (!copy || copy.length == 0) |
3652 |
08 Dec 15 |
olle |
1202 |
{ |
3652 |
08 Dec 15 |
olle |
Forms.showNotification(event.currentTarget, 'Nothing to paste. Please cut or copy wells first.'); |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
1205 |
} |
3652 |
08 Dec 15 |
olle |
1206 |
|
3652 |
08 Dec 15 |
olle |
var wells = Plate.getSelected(); |
3652 |
08 Dec 15 |
olle |
// Count non-empty and valid wells |
3652 |
08 Dec 15 |
olle |
var count = 0; |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < wells.length; i++) |
3652 |
08 Dec 15 |
olle |
1211 |
{ |
3652 |
08 Dec 15 |
olle |
var well = wells[i]; |
3652 |
08 Dec 15 |
olle |
if (well.extract && !well.hasError()) count++; |
3652 |
08 Dec 15 |
olle |
1214 |
} |
3652 |
08 Dec 15 |
olle |
1215 |
|
3652 |
08 Dec 15 |
olle |
if (count > 0) |
3652 |
08 Dec 15 |
olle |
1217 |
{ |
3652 |
08 Dec 15 |
olle |
if (!confirm('Replace DNA in ' + count + ' wells with copy?')) |
3652 |
08 Dec 15 |
olle |
1219 |
{ |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
1221 |
} |
3652 |
08 Dec 15 |
olle |
1222 |
} |
3652 |
08 Dec 15 |
olle |
1223 |
|
3652 |
08 Dec 15 |
olle |
var wi = 0; |
3652 |
08 Dec 15 |
olle |
var ci = 0; |
3652 |
08 Dec 15 |
olle |
var copyEmpty; |
3652 |
08 Dec 15 |
olle |
var askIfEmpty = true; |
3652 |
08 Dec 15 |
olle |
var repaint = []; |
3652 |
08 Dec 15 |
olle |
1229 |
|
3652 |
08 Dec 15 |
olle |
while (wi < wells.length && ci < copy.length) |
3652 |
08 Dec 15 |
olle |
1231 |
{ |
3652 |
08 Dec 15 |
olle |
var well = wells[wi]; |
3652 |
08 Dec 15 |
olle |
var cp = copy[ci]; |
3652 |
08 Dec 15 |
olle |
var dna = null; |
3652 |
08 Dec 15 |
olle |
var name = null; |
3652 |
08 Dec 15 |
olle |
cp.well.doneWithCopy(); |
3652 |
08 Dec 15 |
olle |
repaint[repaint.length] = cp.well; |
3652 |
08 Dec 15 |
olle |
if (cp.name) |
3652 |
08 Dec 15 |
olle |
1239 |
{ |
3652 |
08 Dec 15 |
olle |
name = cp.name; |
3652 |
08 Dec 15 |
olle |
var suffixIndex = name.indexOf('.fpa'); |
3652 |
08 Dec 15 |
olle |
if (suffixIndex >= 0) |
3652 |
08 Dec 15 |
olle |
1243 |
{ |
3652 |
08 Dec 15 |
olle |
name = name.substring(0, suffixIndex); |
3652 |
08 Dec 15 |
olle |
1245 |
} |
3652 |
08 Dec 15 |
olle |
1246 |
/* |
3652 |
08 Dec 15 |
olle |
dna = Dna.createByName(cp.name); |
3652 |
08 Dec 15 |
olle |
1248 |
*/ |
3652 |
08 Dec 15 |
olle |
dna = Dna.createByName(name); |
3652 |
08 Dec 15 |
olle |
dna.comment = cp.comment; |
3652 |
08 Dec 15 |
olle |
1251 |
} |
3652 |
08 Dec 15 |
olle |
else |
3652 |
08 Dec 15 |
olle |
1253 |
{ |
3652 |
08 Dec 15 |
olle |
// The copy is from an empty well |
3652 |
08 Dec 15 |
olle |
if (askIfEmpty) |
3652 |
08 Dec 15 |
olle |
1256 |
{ |
3652 |
08 Dec 15 |
olle |
askIfEmpty = false; |
3652 |
08 Dec 15 |
olle |
copyEmpty = confirm('Do you want to copy empty wells? If not, only non-empty well are copied.'); |
3652 |
08 Dec 15 |
olle |
1259 |
} |
3652 |
08 Dec 15 |
olle |
1260 |
} |
3652 |
08 Dec 15 |
olle |
if (dna != null || copyEmpty) |
3652 |
08 Dec 15 |
olle |
1262 |
{ |
3652 |
08 Dec 15 |
olle |
// FPA |
3652 |
08 Dec 15 |
olle |
if (dna != null) |
3652 |
08 Dec 15 |
olle |
1265 |
{ |
3652 |
08 Dec 15 |
olle |
dna.name += '.fpa'; |
3652 |
08 Dec 15 |
olle |
1267 |
} |
3652 |
08 Dec 15 |
olle |
well.setExtract(dna); |
3652 |
08 Dec 15 |
olle |
well.selected = false; |
3652 |
08 Dec 15 |
olle |
repaint[repaint.length] = well; |
3652 |
08 Dec 15 |
olle |
wi++; |
3652 |
08 Dec 15 |
olle |
// FPB sample in corresponding well on right side of plate |
3652 |
08 Dec 15 |
olle |
var row = well.row; |
3652 |
08 Dec 15 |
olle |
var column = well.column; |
3652 |
08 Dec 15 |
olle |
well = Plate.getWell(row, column + 6); |
3652 |
08 Dec 15 |
olle |
dna = null; |
3652 |
08 Dec 15 |
olle |
if (name) |
3652 |
08 Dec 15 |
olle |
1278 |
{ |
3652 |
08 Dec 15 |
olle |
dna = Dna.createByName(name); |
3652 |
08 Dec 15 |
olle |
dna.comment = cp.comment; |
3652 |
08 Dec 15 |
olle |
1281 |
} |
3652 |
08 Dec 15 |
olle |
if (dna != null) |
3652 |
08 Dec 15 |
olle |
1283 |
{ |
3652 |
08 Dec 15 |
olle |
dna.name += '.fpb'; |
3652 |
08 Dec 15 |
olle |
1285 |
} |
3652 |
08 Dec 15 |
olle |
well.setExtract(dna); |
3652 |
08 Dec 15 |
olle |
well.selected = false; |
3652 |
08 Dec 15 |
olle |
repaint[repaint.length] = well; |
3652 |
08 Dec 15 |
olle |
1289 |
} |
3652 |
08 Dec 15 |
olle |
ci++; |
3652 |
08 Dec 15 |
olle |
1291 |
} |
3652 |
08 Dec 15 |
olle |
Plate.paint(repaint); |
3652 |
08 Dec 15 |
olle |
copy.splice(0, ci); |
3652 |
08 Dec 15 |
olle |
Plate.checkReplicates(); |
3652 |
08 Dec 15 |
olle |
1295 |
} |
3652 |
08 Dec 15 |
olle |
1296 |
|
3652 |
08 Dec 15 |
olle |
1297 |
/* |
3652 |
08 Dec 15 |
olle |
If exactly two wells have been selected, switch the DNA in them. |
3652 |
08 Dec 15 |
olle |
1299 |
*/ |
3652 |
08 Dec 15 |
olle |
inspectstartplate.switchSelected = function(event) |
3652 |
08 Dec 15 |
olle |
1301 |
{ |
3652 |
08 Dec 15 |
olle |
var wells = Plate.getSelected(); |
3652 |
08 Dec 15 |
olle |
1303 |
|
3652 |
08 Dec 15 |
olle |
if (wells.length != 2) |
3652 |
08 Dec 15 |
olle |
1305 |
{ |
3652 |
08 Dec 15 |
olle |
Forms.showNotification(event.currentTarget, 'Exactly 2 wells must be selected.'); |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
1308 |
} |
3652 |
08 Dec 15 |
olle |
1309 |
|
3652 |
08 Dec 15 |
olle |
1310 |
/* |
3652 |
08 Dec 15 |
olle |
var dna0 = wells[0].extract; |
3652 |
08 Dec 15 |
olle |
var dna1 = wells[1].extract; |
3652 |
08 Dec 15 |
olle |
1313 |
|
3652 |
08 Dec 15 |
olle |
wells[0].setExtract(dna1); |
3652 |
08 Dec 15 |
olle |
wells[1].setExtract(dna0); |
3652 |
08 Dec 15 |
olle |
Plate.paint(wells); |
3652 |
08 Dec 15 |
olle |
1317 |
*/ |
3652 |
08 Dec 15 |
olle |
var wellsArray = []; |
3652 |
08 Dec 15 |
olle |
// FPA |
3652 |
08 Dec 15 |
olle |
wellsArray[0] = wells[0]; |
3652 |
08 Dec 15 |
olle |
wellsArray[1] = wells[1]; |
3652 |
08 Dec 15 |
olle |
1322 |
|
3652 |
08 Dec 15 |
olle |
var dna0 = wells[0].extract; |
3652 |
08 Dec 15 |
olle |
var dna1 = wells[1].extract; |
3652 |
08 Dec 15 |
olle |
1325 |
|
3652 |
08 Dec 15 |
olle |
wells[0].setExtract(dna1); |
3652 |
08 Dec 15 |
olle |
wells[1].setExtract(dna0); |
3652 |
08 Dec 15 |
olle |
// FPB samples in corresponding wells on right side of plate |
3652 |
08 Dec 15 |
olle |
var wellsFpb = []; |
3652 |
08 Dec 15 |
olle |
for (var i=0; i<2; i++) |
3652 |
08 Dec 15 |
olle |
1331 |
{ |
3652 |
08 Dec 15 |
olle |
var row = wells[i].row; |
3652 |
08 Dec 15 |
olle |
var column = wells[i].column; |
3652 |
08 Dec 15 |
olle |
wellsFpb[i] = Plate.getWell(row, column + 6); |
3652 |
08 Dec 15 |
olle |
1335 |
} |
3652 |
08 Dec 15 |
olle |
wellsArray[2] = wellsFpb[0]; |
3652 |
08 Dec 15 |
olle |
wellsArray[3] = wellsFpb[1]; |
3652 |
08 Dec 15 |
olle |
1338 |
|
3652 |
08 Dec 15 |
olle |
dna0 = wellsFpb[0].extract; |
3652 |
08 Dec 15 |
olle |
dna1 = wellsFpb[1].extract; |
3652 |
08 Dec 15 |
olle |
1341 |
|
3652 |
08 Dec 15 |
olle |
wellsFpb[0].setExtract(dna1); |
3652 |
08 Dec 15 |
olle |
wellsFpb[1].setExtract(dna0); |
3652 |
08 Dec 15 |
olle |
1344 |
// |
3652 |
08 Dec 15 |
olle |
Plate.paint(wellsArray); |
3652 |
08 Dec 15 |
olle |
1346 |
} |
3652 |
08 Dec 15 |
olle |
1347 |
|
3652 |
08 Dec 15 |
olle |
// Toggle the 'special select' menu on and off |
3652 |
08 Dec 15 |
olle |
inspectstartplate.toggleSpecialSelect = function(event) |
3652 |
08 Dec 15 |
olle |
1350 |
{ |
3652 |
08 Dec 15 |
olle |
var pos = Doc.getElementPosition('iconSpecialSelect'); |
3652 |
08 Dec 15 |
olle |
Menu.toggleTopMenu('menuSpecialSelect', pos.left+pos.width/4, pos.top+pos.height); |
3652 |
08 Dec 15 |
olle |
event.stopPropagation(); |
3652 |
08 Dec 15 |
olle |
1354 |
} |
3652 |
08 Dec 15 |
olle |
1355 |
|
3652 |
08 Dec 15 |
olle |
1356 |
/** |
3652 |
08 Dec 15 |
olle |
Open a pop-up dialog for manual selection of extracts. |
3652 |
08 Dec 15 |
olle |
1358 |
*/ |
3652 |
08 Dec 15 |
olle |
inspectstartplate.manualSelectExtract = function(event) |
3652 |
08 Dec 15 |
olle |
1360 |
{ |
3652 |
08 Dec 15 |
olle |
if (subtypeDna == null) subtypeDna = Meludi.getSubtypeInfo('DNA'); |
3652 |
08 Dec 15 |
olle |
1362 |
|
3652 |
08 Dec 15 |
olle |
var url = '&resetTemporary=1'; |
3652 |
08 Dec 15 |
olle |
url += '&tmpfilter:INT:itemSubtype='+subtypeDna.id; |
3652 |
08 Dec 15 |
olle |
url += '&tmpfilter:STRING:name='+encodeURIComponent('%.d'); |
3652 |
08 Dec 15 |
olle |
url += '&tmpfilter:DATE:creationEvent.eventDate='+encodeURIComponent(''); |
3652 |
08 Dec 15 |
olle |
url += '&tmpfilter:FLOAT:remainingQuantity='+encodeURIComponent('>0'); |
3652 |
08 Dec 15 |
olle |
url += '&'+encodeURIComponent('tmpfilter:STRING:&childCreationEvents(event.bioMaterial.name)')+'='+encodeURIComponent(''); |
3652 |
08 Dec 15 |
olle |
1369 |
|
3652 |
08 Dec 15 |
olle |
Dialogs.selectItem('EXTRACT', 'plate', 1, url); |
3652 |
08 Dec 15 |
olle |
1371 |
} |
3652 |
08 Dec 15 |
olle |
1372 |
|
3652 |
08 Dec 15 |
olle |
1373 |
/** |
3652 |
08 Dec 15 |
olle |
Open a pop-up dialog for manual selection of controls. |
3652 |
08 Dec 15 |
olle |
1375 |
*/ |
3652 |
08 Dec 15 |
olle |
inspectstartplate.manualSelectControl = function(event) |
3652 |
08 Dec 15 |
olle |
1377 |
{ |
3652 |
08 Dec 15 |
olle |
if (subtypeDna == null) subtypeDna = Meludi.getSubtypeInfo('DNA'); |
3652 |
08 Dec 15 |
olle |
1379 |
|
3652 |
08 Dec 15 |
olle |
var url = '&resetTemporary=1'; |
3652 |
08 Dec 15 |
olle |
url += '&tmpfilter:INT:itemSubtype='+subtypeDna.id; |
3652 |
08 Dec 15 |
olle |
url += '&tmpfilter:STRING:name='+encodeURIComponent('Horizon%.d'); |
3652 |
08 Dec 15 |
olle |
url += '&tmpfilter:DATE:creationEvent.eventDate='+encodeURIComponent(''); |
3652 |
08 Dec 15 |
olle |
url += '&tmpfilter:FLOAT:remainingQuantity='+encodeURIComponent('>0'); |
3652 |
08 Dec 15 |
olle |
url += '&'+encodeURIComponent('tmpfilter:STRING:&childCreationEvents(event.bioMaterial.name)')+'='+encodeURIComponent(''); |
3652 |
08 Dec 15 |
olle |
1386 |
|
3652 |
08 Dec 15 |
olle |
Dialogs.selectItem('EXTRACT', 'plate', 1, url); |
3652 |
08 Dec 15 |
olle |
1388 |
} |
3652 |
08 Dec 15 |
olle |
1389 |
|
3652 |
08 Dec 15 |
olle |
var contextDNA = null; |
3652 |
08 Dec 15 |
olle |
var contextX; |
3652 |
08 Dec 15 |
olle |
var contextY; |
3652 |
08 Dec 15 |
olle |
1393 |
/** |
3652 |
08 Dec 15 |
olle |
Reacts to 'mouseup' and 'contextmenu' events for the bioplate. |
3652 |
08 Dec 15 |
olle |
This should bring up the cut/copy/paste context menu depending on which |
3652 |
08 Dec 15 |
olle |
mouse button that was clicked. |
3652 |
08 Dec 15 |
olle |
1397 |
*/ |
3652 |
08 Dec 15 |
olle |
inspectstartplate.contextEvent = function(event) |
3652 |
08 Dec 15 |
olle |
1399 |
{ |
3652 |
08 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3652 |
08 Dec 15 |
olle |
// Context menu on 'right' mouse button |
3652 |
08 Dec 15 |
olle |
// Can't just check the button since two events are sent ('mouseup' and 'contextmenu') |
3652 |
08 Dec 15 |
olle |
var showContext = event.type == 'contextmenu' && event.button == 2; |
3652 |
08 Dec 15 |
olle |
1404 |
|
3652 |
08 Dec 15 |
olle |
if (showContext) |
3652 |
08 Dec 15 |
olle |
1406 |
{ |
3652 |
08 Dec 15 |
olle |
event.preventDefault(); // Prevents the default right-click menu from appearing |
3652 |
08 Dec 15 |
olle |
1408 |
|
3652 |
08 Dec 15 |
olle |
// Get the well that is right-clicked and the DNA that is in it |
3652 |
08 Dec 15 |
olle |
contextDNA = null; |
3652 |
08 Dec 15 |
olle |
var well = event.target; |
3652 |
08 Dec 15 |
olle |
while (well && (!well.id || well.id.indexOf('well') != 0)) |
3652 |
08 Dec 15 |
olle |
1413 |
{ |
3652 |
08 Dec 15 |
olle |
well = well.parentNode; |
3652 |
08 Dec 15 |
olle |
1415 |
} |
3652 |
08 Dec 15 |
olle |
if (well) |
3652 |
08 Dec 15 |
olle |
1417 |
{ |
3652 |
08 Dec 15 |
olle |
var c = well.id.split(/\./); |
3652 |
08 Dec 15 |
olle |
contextDNA = Plate.getWell(parseInt(c[1]), parseInt(c[2])).extract; |
3652 |
08 Dec 15 |
olle |
1420 |
} |
3652 |
08 Dec 15 |
olle |
// Update the context meny |
3652 |
08 Dec 15 |
olle |
var caseSummaryMenu = Doc.element('mnuCaseSummary'); |
3652 |
08 Dec 15 |
olle |
if (contextDNA) |
3652 |
08 Dec 15 |
olle |
1424 |
{ |
3652 |
08 Dec 15 |
olle |
caseSummaryMenu.title = 'Show case summary for ' + Strings.encodeTags(contextDNA.name); |
3652 |
08 Dec 15 |
olle |
Doc.show('sepCaseSummary'); |
3652 |
08 Dec 15 |
olle |
Doc.show('mnuCaseSummary'); |
3652 |
08 Dec 15 |
olle |
1428 |
} |
3652 |
08 Dec 15 |
olle |
else |
3652 |
08 Dec 15 |
olle |
1430 |
{ |
3652 |
08 Dec 15 |
olle |
Doc.hide('sepCaseSummary'); |
3652 |
08 Dec 15 |
olle |
Doc.hide('mnuCaseSummary'); |
3652 |
08 Dec 15 |
olle |
1433 |
} |
3652 |
08 Dec 15 |
olle |
1434 |
|
3652 |
08 Dec 15 |
olle |
var menu = Doc.element('menuContext'); |
3652 |
08 Dec 15 |
olle |
// 1 pixel offset to avoid losing well focus outline |
3652 |
08 Dec 15 |
olle |
contextX = event.clientX+1; |
3652 |
08 Dec 15 |
olle |
contextY = event.clientY+1; |
3652 |
08 Dec 15 |
olle |
// Need short delay since 'mouseup' are also sent as 'click' events |
3652 |
08 Dec 15 |
olle |
// to the 'document' object which BASE already have a Menu.hideAll() |
3652 |
08 Dec 15 |
olle |
// call which would hide the menu immediately |
3652 |
08 Dec 15 |
olle |
setTimeout(inspectstartplate.showContextMenu, 100); |
3652 |
08 Dec 15 |
olle |
1443 |
} |
3652 |
08 Dec 15 |
olle |
1444 |
} |
3652 |
08 Dec 15 |
olle |
1445 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.showContextMenu = function() |
3652 |
08 Dec 15 |
olle |
1447 |
{ |
3652 |
08 Dec 15 |
olle |
Menu.showTopMenu('menuContext', contextX, contextY); |
3652 |
08 Dec 15 |
olle |
1449 |
} |
3652 |
08 Dec 15 |
olle |
1450 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.showCaseSummary = function() |
3652 |
08 Dec 15 |
olle |
1452 |
{ |
3652 |
08 Dec 15 |
olle |
if (!contextDNA) return; |
3652 |
08 Dec 15 |
olle |
var caseName = contextDNA.name; |
3652 |
08 Dec 15 |
olle |
// Remove suffix starting with dot "." |
3652 |
08 Dec 15 |
olle |
var firstDotIndex = caseName.indexOf("."); |
3652 |
08 Dec 15 |
olle |
if (firstDotIndex >= 0) |
3652 |
08 Dec 15 |
olle |
1458 |
{ |
3652 |
08 Dec 15 |
olle |
caseName = caseName.substring(0, firstDotIndex); |
3652 |
08 Dec 15 |
olle |
1460 |
} |
3652 |
08 Dec 15 |
olle |
var url = '../reports/case_summary.jsp?ID='+App.getSessionId(); |
3652 |
08 Dec 15 |
olle |
url += '&caseName='+encodeURIComponent(caseName); |
3652 |
08 Dec 15 |
olle |
url += '&pageType=popup'; |
3652 |
08 Dec 15 |
olle |
Dialogs.openPopup(url, 'CaseSummary'+caseName, 1000, 700); |
3652 |
08 Dec 15 |
olle |
1465 |
} |
3652 |
08 Dec 15 |
olle |
1466 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.showFlaggedDna = function() |
3652 |
08 Dec 15 |
olle |
1468 |
{ |
3652 |
08 Dec 15 |
olle |
currentSelected = Plate.getSelected(); |
3652 |
08 Dec 15 |
olle |
currentIndex = 0; |
3652 |
08 Dec 15 |
olle |
1471 |
|
3652 |
08 Dec 15 |
olle |
var flagged = Dna.getFlagged(); |
3652 |
08 Dec 15 |
olle |
var url = 'show_flagged_dna.jsp?ID='+App.getSessionId(); |
3652 |
08 Dec 15 |
olle |
url += '&numFlagged='+flagged.length; |
3652 |
08 Dec 15 |
olle |
url += '&numSelected='+currentSelected.length; |
3652 |
08 Dec 15 |
olle |
Dialogs.openPopup(url, 'FlaggedDna', 800, 500); |
3652 |
08 Dec 15 |
olle |
1477 |
} |
3652 |
08 Dec 15 |
olle |
1478 |
|
3652 |
08 Dec 15 |
olle |
1479 |
|
3652 |
08 Dec 15 |
olle |
//Flag the selected DNA |
3652 |
08 Dec 15 |
olle |
inspectstartplate.flagSelected = function(event) |
3652 |
08 Dec 15 |
olle |
1482 |
{ |
3652 |
08 Dec 15 |
olle |
var flag = Data.get(event.currentTarget, 'flag'); |
3652 |
08 Dec 15 |
olle |
var wells = Plate.getSelected(); |
3652 |
08 Dec 15 |
olle |
1485 |
|
3652 |
08 Dec 15 |
olle |
if (wells.length == 0) |
3652 |
08 Dec 15 |
olle |
1487 |
{ |
3652 |
08 Dec 15 |
olle |
Forms.showNotification(event.currentTarget, 'No wells have been selected.'); |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
1490 |
} |
3652 |
08 Dec 15 |
olle |
1491 |
|
3652 |
08 Dec 15 |
olle |
var comment = null; |
3652 |
08 Dec 15 |
olle |
if (flag == 'ManualFlag') |
3652 |
08 Dec 15 |
olle |
1494 |
{ |
3652 |
08 Dec 15 |
olle |
// Check if a comment has been set on any of the DNA |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < wells.length; i++) |
3652 |
08 Dec 15 |
olle |
1497 |
{ |
3652 |
08 Dec 15 |
olle |
var well = wells[i]; |
3652 |
08 Dec 15 |
olle |
if (well.extract && well.extract.info) |
3652 |
08 Dec 15 |
olle |
1500 |
{ |
3652 |
08 Dec 15 |
olle |
if (well.extract.info.comment) comment = well.extract.info.comment; |
3652 |
08 Dec 15 |
olle |
1502 |
} |
3652 |
08 Dec 15 |
olle |
1503 |
} |
3652 |
08 Dec 15 |
olle |
comment = prompt('Comment', comment || ''); |
3652 |
08 Dec 15 |
olle |
if (!comment) return; |
3652 |
08 Dec 15 |
olle |
1506 |
} |
3652 |
08 Dec 15 |
olle |
1507 |
|
3652 |
08 Dec 15 |
olle |
var count = 0; |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < wells.length; i++) |
3652 |
08 Dec 15 |
olle |
1510 |
{ |
3652 |
08 Dec 15 |
olle |
var well = wells[i]; |
3652 |
08 Dec 15 |
olle |
var dna = well.extract; |
3652 |
08 Dec 15 |
olle |
if (dna && !dna.stratagene && !dna.external) |
3652 |
08 Dec 15 |
olle |
1514 |
{ |
3652 |
08 Dec 15 |
olle |
Dna.flag(dna, flag); |
3652 |
08 Dec 15 |
olle |
dna.info.comment = comment; |
3652 |
08 Dec 15 |
olle |
well.setExtract(null); |
3652 |
08 Dec 15 |
olle |
count++; |
3652 |
08 Dec 15 |
olle |
1519 |
} |
3652 |
08 Dec 15 |
olle |
well.selected = false; |
3652 |
08 Dec 15 |
olle |
1521 |
} |
3652 |
08 Dec 15 |
olle |
1522 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.updateNumFlaggedDna(); |
3652 |
08 Dec 15 |
olle |
Plate.paint(wells); |
3652 |
08 Dec 15 |
olle |
1525 |
} |
3652 |
08 Dec 15 |
olle |
1526 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.downloadLibPrepFile = function() |
3652 |
08 Dec 15 |
olle |
1528 |
{ |
3652 |
08 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3652 |
08 Dec 15 |
olle |
var isNeoPrep = Data.int('page-data', 'is-neoprep'); |
3652 |
08 Dec 15 |
olle |
1531 |
|
3652 |
08 Dec 15 |
olle |
var submitInfo = {}; |
3652 |
08 Dec 15 |
olle |
1533 |
|
3652 |
08 Dec 15 |
olle |
var libraryPreparationProtocolName = ''; |
3652 |
08 Dec 15 |
olle |
var libraryPreparationProtocol = frm.libraryPreparationProtocol.value; |
3652 |
08 Dec 15 |
olle |
if (libraryPreparationProtocol) |
3652 |
08 Dec 15 |
olle |
1537 |
{ |
3652 |
08 Dec 15 |
olle |
libraryPreparationProtocolName = protocolMap[libraryPreparationProtocol]; |
3652 |
08 Dec 15 |
olle |
1539 |
} |
3652 |
08 Dec 15 |
olle |
submitInfo.libraryPreparationProtocol = parseInt(libraryPreparationProtocol, 10); |
3652 |
08 Dec 15 |
olle |
submitInfo.libraryPreparationProtocolName = libraryPreparationProtocolName; |
3685 |
12 Jan 16 |
olle |
submitInfo.bioplate = inspectstartplate.fetchBioplateData(); |
3685 |
12 Jan 16 |
olle |
1543 |
|
3685 |
12 Jan 16 |
olle |
var url = '../LibPrep.servlet?ID='+App.getSessionId(); |
3685 |
12 Jan 16 |
olle |
url += '&cmd=PrepareDownloadLibPrepFile'; |
3685 |
12 Jan 16 |
olle |
url += '&referenceName='+encodeURIComponent(frm.plateName.value); |
3685 |
12 Jan 16 |
olle |
1547 |
|
3685 |
12 Jan 16 |
olle |
// POST |
3685 |
12 Jan 16 |
olle |
Wizard.showLoadingAnimation('Performing registration...'); |
3685 |
12 Jan 16 |
olle |
Wizard.asyncJsonRequest(url, inspectstartplate.downloadLibPrepFileResults, 'POST', JSON.stringify(submitInfo)); |
3685 |
12 Jan 16 |
olle |
1551 |
} |
3685 |
12 Jan 16 |
olle |
1552 |
|
3685 |
12 Jan 16 |
olle |
inspectstartplate.fetchBioplateData = function() |
3685 |
12 Jan 16 |
olle |
1554 |
{ |
3685 |
12 Jan 16 |
olle |
var frm = document.forms['meludi']; |
3685 |
12 Jan 16 |
olle |
var isNeoPrep = Data.int('page-data', 'is-neoprep'); |
3652 |
08 Dec 15 |
olle |
var schema = PoolSchema.getById(frm.pool_schema.value); |
3685 |
12 Jan 16 |
olle |
1558 |
|
3685 |
12 Jan 16 |
olle |
var plateInfo = {}; |
3685 |
12 Jan 16 |
olle |
plateInfo.id = Plate.id; |
3652 |
08 Dec 15 |
olle |
plateInfo.name = Plate.name; |
3652 |
08 Dec 15 |
olle |
plateInfo.comments = frm.comments.value; |
3652 |
08 Dec 15 |
olle |
plateInfo.kitName = frm.tsLibPrepKit.value; |
3652 |
08 Dec 15 |
olle |
plateInfo.kitId = frm.hiddenLibPrepKitId.value; |
3652 |
08 Dec 15 |
olle |
plateInfo.plateType = isNeoPrep ? 'NEOPREP' : 'DNA'; |
3652 |
08 Dec 15 |
olle |
plateInfo.poolSchema = schema ? schema.id : null; |
3652 |
08 Dec 15 |
olle |
if (isNeoPrep) |
3652 |
08 Dec 15 |
olle |
1568 |
{ |
3652 |
08 Dec 15 |
olle |
plateInfo.barcodeVariant = frm.barcode_variant.value; |
3652 |
08 Dec 15 |
olle |
1570 |
} |
3652 |
08 Dec 15 |
olle |
plateInfo.wells = []; |
3652 |
08 Dec 15 |
olle |
1572 |
|
3652 |
08 Dec 15 |
olle |
var wells = Plate.getWells(); |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < wells.length; i++) |
3652 |
08 Dec 15 |
olle |
1575 |
{ |
3652 |
08 Dec 15 |
olle |
var well = wells[i]; |
3652 |
08 Dec 15 |
olle |
var dna = well.extract; |
3667 |
15 Dec 15 |
olle |
if (dna && dna.info.origId) |
3652 |
08 Dec 15 |
olle |
1579 |
{ |
3652 |
08 Dec 15 |
olle |
var tmp = {}; |
3652 |
08 Dec 15 |
olle |
tmp.row = well.row; |
3652 |
08 Dec 15 |
olle |
tmp.column = well.column; |
3652 |
08 Dec 15 |
olle |
tmp.dna = {}; |
3667 |
15 Dec 15 |
olle |
tmp.dna.id = dna.info.origId; |
3652 |
08 Dec 15 |
olle |
tmp.dna.usedQuantity = dna.usedQuantity; |
3652 |
08 Dec 15 |
olle |
tmp.dna.dilutionConc = dna.dilutionConc; |
3652 |
08 Dec 15 |
olle |
tmp.dna.qc = dna.qc; |
3652 |
08 Dec 15 |
olle |
tmp.dna.comment = dna.comment; |
3652 |
08 Dec 15 |
olle |
if (well.barcode) |
3652 |
08 Dec 15 |
olle |
1590 |
{ |
3652 |
08 Dec 15 |
olle |
tmp.dna.barcode = well.barcode; |
3652 |
08 Dec 15 |
olle |
1592 |
} |
3652 |
08 Dec 15 |
olle |
plateInfo.wells[plateInfo.wells.length] = tmp; |
3652 |
08 Dec 15 |
olle |
1594 |
} |
3652 |
08 Dec 15 |
olle |
1595 |
} |
3685 |
12 Jan 16 |
olle |
1596 |
|
3685 |
12 Jan 16 |
olle |
return plateInfo; |
3652 |
08 Dec 15 |
olle |
1598 |
} |
3652 |
08 Dec 15 |
olle |
1599 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.downloadLibPrepFileResults = function(response) |
3652 |
08 Dec 15 |
olle |
1601 |
{ |
3652 |
08 Dec 15 |
olle |
var tmpFilePath = response; |
3652 |
08 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3652 |
08 Dec 15 |
olle |
var url = '../LibPrep.servlet?ID='+App.getSessionId(); |
3652 |
08 Dec 15 |
olle |
url += '&cmd=DownloadLibPrepFile'; |
3652 |
08 Dec 15 |
olle |
url += '&referenceName='+encodeURIComponent(frm.plateName.value); |
3652 |
08 Dec 15 |
olle |
url += '&tmpFilePath='+encodeURIComponent(tmpFilePath); |
3652 |
08 Dec 15 |
olle |
window.open(url); |
3652 |
08 Dec 15 |
olle |
1609 |
} |
3652 |
08 Dec 15 |
olle |
1610 |
|
3685 |
12 Jan 16 |
olle |
inspectstartplate.viewProtocol = function(event) |
3685 |
12 Jan 16 |
olle |
1612 |
{ |
3685 |
12 Jan 16 |
olle |
var frm = document.forms['meludi2']; |
3685 |
12 Jan 16 |
olle |
var bioplateData = inspectstartplate.fetchBioplateData(); |
3685 |
12 Jan 16 |
olle |
var submitInfo = inspectstartplate.fetchSubmitInfo(); |
3685 |
12 Jan 16 |
olle |
1616 |
|
3685 |
12 Jan 16 |
olle |
// Save values in hidden input fields for retrieval after HTML request |
3685 |
12 Jan 16 |
olle |
var submitInfoJsonStr = JSON.stringify(submitInfo, inspectstartplate.circular_reference_remover); |
3685 |
12 Jan 16 |
olle |
// Enable garbage collection |
3685 |
12 Jan 16 |
olle |
circular_reference_cache = null; |
3685 |
12 Jan 16 |
olle |
frm.hiddenSubmitInfo.value = submitInfoJsonStr; |
3685 |
12 Jan 16 |
olle |
frm.hiddenNumItems.value = submitInfo.items.length; |
3685 |
12 Jan 16 |
olle |
frm.view.value = Data.get(event.currentTarget, 'protocol-type'); |
3685 |
12 Jan 16 |
olle |
frm.bioplateName.value = bioplateData.name; |
3685 |
12 Jan 16 |
olle |
frm.bioplateDescription.value = bioplateData.comments; |
3685 |
12 Jan 16 |
olle |
frm.bioplateKitName.value = bioplateData.kitName; |
3685 |
12 Jan 16 |
olle |
1627 |
|
3685 |
12 Jan 16 |
olle |
// Calling frm.submit() will change jsp file to libprep_plate_protocol2.jsp |
3685 |
12 Jan 16 |
olle |
frm.submit(); |
3685 |
12 Jan 16 |
olle |
1630 |
} |
3685 |
12 Jan 16 |
olle |
1631 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.createProtocol = function() |
3652 |
08 Dec 15 |
olle |
1633 |
{ |
3652 |
08 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3685 |
12 Jan 16 |
olle |
var submitInfo = inspectstartplate.fetchSubmitInfo(); |
3685 |
12 Jan 16 |
olle |
1636 |
|
3685 |
12 Jan 16 |
olle |
// Save values in hidden input fields for retrieval after HTML request |
3685 |
12 Jan 16 |
olle |
var submitInfoJsonStr = JSON.stringify(submitInfo, inspectstartplate.circular_reference_remover); |
3685 |
12 Jan 16 |
olle |
// Enable garbage collection |
3685 |
12 Jan 16 |
olle |
circular_reference_cache = null; |
3685 |
12 Jan 16 |
olle |
frm.hiddenSubmitInfo.value = submitInfoJsonStr; |
3685 |
12 Jan 16 |
olle |
frm.hiddenNumItems.value = submitInfo.items.length; |
3685 |
12 Jan 16 |
olle |
1643 |
|
3685 |
12 Jan 16 |
olle |
// Calling frm.submit() will change jsp file to libprep_dilution_protocol2.jsp |
3685 |
12 Jan 16 |
olle |
frm.submit(); |
3685 |
12 Jan 16 |
olle |
1646 |
} |
3685 |
12 Jan 16 |
olle |
1647 |
|
3685 |
12 Jan 16 |
olle |
inspectstartplate.fetchSubmitInfo = function() |
3685 |
12 Jan 16 |
olle |
1649 |
{ |
3685 |
12 Jan 16 |
olle |
var frm = document.forms['meludi']; |
3652 |
08 Dec 15 |
olle |
var submitInfo = {}; |
3652 |
08 Dec 15 |
olle |
submitInfo.items = []; |
3652 |
08 Dec 15 |
olle |
1653 |
|
3652 |
08 Dec 15 |
olle |
submitInfo.docMode = 'report'; |
3652 |
08 Dec 15 |
olle |
// Get list of selected extract source items |
3652 |
08 Dec 15 |
olle |
var selItemsList = []; |
3652 |
08 Dec 15 |
olle |
for (var column = 0; column < 6; column++) |
3652 |
08 Dec 15 |
olle |
1658 |
{ |
3652 |
08 Dec 15 |
olle |
for (var row = 0; row < 8; row++) |
3652 |
08 Dec 15 |
olle |
1660 |
{ |
3652 |
08 Dec 15 |
olle |
var well = Plate.getWell(row, column); |
3652 |
08 Dec 15 |
olle |
var dna = well.extract; |
3652 |
08 Dec 15 |
olle |
if (dna != null) |
3652 |
08 Dec 15 |
olle |
1664 |
{ |
3685 |
12 Jan 16 |
olle |
dna.bioWell = well; |
3652 |
08 Dec 15 |
olle |
dna.fpaPos = inspectstartplate.wellRowColumnToWellStr(row, column); |
3652 |
08 Dec 15 |
olle |
dna.fpbPos = inspectstartplate.wellRowColumnToWellStr(row, column + 6); |
3652 |
08 Dec 15 |
olle |
selItemsList[selItemsList.length] = dna; |
3652 |
08 Dec 15 |
olle |
1669 |
} |
3652 |
08 Dec 15 |
olle |
1670 |
} |
3652 |
08 Dec 15 |
olle |
1671 |
} |
3652 |
08 Dec 15 |
olle |
var numItems = selItemsList.length; |
3652 |
08 Dec 15 |
olle |
var totNumItems = numItems; |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < totNumItems; i++) |
3652 |
08 Dec 15 |
olle |
1675 |
{ |
3652 |
08 Dec 15 |
olle |
var item = null; |
3652 |
08 Dec 15 |
olle |
item = selItemsList[i]; |
3652 |
08 Dec 15 |
olle |
submitInfo.items[submitInfo.items.length] = item; |
3652 |
08 Dec 15 |
olle |
1679 |
} |
3652 |
08 Dec 15 |
olle |
1680 |
|
3652 |
08 Dec 15 |
olle |
// Library preparation dilution |
3652 |
08 Dec 15 |
olle |
var libraryPreparationProtocolName = ''; |
3652 |
08 Dec 15 |
olle |
var libraryPreparationProtocol = frm.libraryPreparationProtocol.value; |
3652 |
08 Dec 15 |
olle |
if (libraryPreparationProtocol) |
3652 |
08 Dec 15 |
olle |
1685 |
{ |
3652 |
08 Dec 15 |
olle |
libraryPreparationProtocolName = protocolMap[libraryPreparationProtocol]; |
3652 |
08 Dec 15 |
olle |
1687 |
} |
3652 |
08 Dec 15 |
olle |
submitInfo.libraryPreparationProtocol = parseInt(libraryPreparationProtocol, 10); |
3652 |
08 Dec 15 |
olle |
submitInfo.libraryPreparationProtocolName = libraryPreparationProtocolName; |
3652 |
08 Dec 15 |
olle |
submitInfo.startPlateName = frm.plateName.value; |
3652 |
08 Dec 15 |
olle |
var now = new Date(); |
3652 |
08 Dec 15 |
olle |
var dilutionProtocolDate = inspectstartplate.formatDate(now); |
3652 |
08 Dec 15 |
olle |
submitInfo.dilutionProtocolDate = dilutionProtocolDate; |
3652 |
08 Dec 15 |
olle |
1694 |
|
3685 |
12 Jan 16 |
olle |
return submitInfo; |
3685 |
12 Jan 16 |
olle |
1696 |
} |
3685 |
12 Jan 16 |
olle |
1697 |
|
3685 |
12 Jan 16 |
olle |
var circular_reference_cache = []; |
3652 |
08 Dec 15 |
olle |
1699 |
|
3685 |
12 Jan 16 |
olle |
inspectstartplate.circular_reference_remover = function(key, value) |
3685 |
12 Jan 16 |
olle |
1701 |
{ |
3685 |
12 Jan 16 |
olle |
if (typeof value === 'object' && value !== null) |
3685 |
12 Jan 16 |
olle |
1703 |
{ |
3685 |
12 Jan 16 |
olle |
if (circular_reference_cache == null) |
3685 |
12 Jan 16 |
olle |
1705 |
{ |
3685 |
12 Jan 16 |
olle |
circular_reference_cache = []; |
3685 |
12 Jan 16 |
olle |
1707 |
} |
3685 |
12 Jan 16 |
olle |
if (circular_reference_cache.indexOf(value) !== -1) |
3685 |
12 Jan 16 |
olle |
1709 |
{ |
3685 |
12 Jan 16 |
olle |
// Circular reference found, discard key |
3685 |
12 Jan 16 |
olle |
return; |
3685 |
12 Jan 16 |
olle |
1712 |
} |
3685 |
12 Jan 16 |
olle |
// Store value in collection |
3685 |
12 Jan 16 |
olle |
circular_reference_cache.push(value); |
3685 |
12 Jan 16 |
olle |
1715 |
} |
3685 |
12 Jan 16 |
olle |
return value; |
3652 |
08 Dec 15 |
olle |
1717 |
} |
3685 |
12 Jan 16 |
olle |
1718 |
|
3652 |
08 Dec 15 |
olle |
inspectstartplate.initElements = function(element, autoInit) |
3652 |
08 Dec 15 |
olle |
1720 |
{ |
3652 |
08 Dec 15 |
olle |
if (autoInit == 'plate-col') |
3652 |
08 Dec 15 |
olle |
1722 |
{ |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler(element, 'click', inspectstartplate.toggleColumn); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler(element, 'mouseover', inspectstartplate.highlightColumn); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler(element, 'mouseout', inspectstartplate.highlightColumn); |
3652 |
08 Dec 15 |
olle |
1726 |
} |
3652 |
08 Dec 15 |
olle |
else if (autoInit == 'plate-row') |
3652 |
08 Dec 15 |
olle |
1728 |
{ |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler(element, 'click', inspectstartplate.toggleRow); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler(element, 'mouseover', inspectstartplate.highlightRow); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler(element, 'mouseout', inspectstartplate.highlightRow); |
3652 |
08 Dec 15 |
olle |
1732 |
} |
3652 |
08 Dec 15 |
olle |
else if (autoInit == 'plate-well') |
3652 |
08 Dec 15 |
olle |
1734 |
{ |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler(element, 'click', inspectstartplate.toggleWell); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler(element, 'mouseover', inspectstartplate.highlightReplicated); |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler(element, 'mouseout', inspectstartplate.highlightReplicated); |
3652 |
08 Dec 15 |
olle |
1738 |
} |
3652 |
08 Dec 15 |
olle |
else if (autoInit == 'special-select') |
3652 |
08 Dec 15 |
olle |
1740 |
{ |
3652 |
08 Dec 15 |
olle |
Events.addEventHandler(element, 'click', inspectstartplate.specialToggle) |
3652 |
08 Dec 15 |
olle |
1742 |
} |
3652 |
08 Dec 15 |
olle |
1743 |
} |
3652 |
08 Dec 15 |
olle |
1744 |
|
3652 |
08 Dec 15 |
olle |
// Restrict wells to left side of plate |
3652 |
08 Dec 15 |
olle |
inspectstartplate.restrictWells = function(wellsInput) |
3652 |
08 Dec 15 |
olle |
1747 |
{ |
3652 |
08 Dec 15 |
olle |
var wells = []; |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < wellsInput.length; i++) |
3652 |
08 Dec 15 |
olle |
1750 |
{ |
3652 |
08 Dec 15 |
olle |
well = wellsInput[i]; |
3652 |
08 Dec 15 |
olle |
if (well.column < 6) |
3652 |
08 Dec 15 |
olle |
1753 |
{ |
3652 |
08 Dec 15 |
olle |
wells[wells.length] = well; |
3652 |
08 Dec 15 |
olle |
1755 |
} |
3652 |
08 Dec 15 |
olle |
1756 |
} |
3652 |
08 Dec 15 |
olle |
return wells; |
3652 |
08 Dec 15 |
olle |
1758 |
} |
3652 |
08 Dec 15 |
olle |
1759 |
|
3652 |
08 Dec 15 |
olle |
// Toggle the selected status of a single well |
3652 |
08 Dec 15 |
olle |
inspectstartplate.toggleWell = function(event) |
3652 |
08 Dec 15 |
olle |
1762 |
{ |
3652 |
08 Dec 15 |
olle |
var row = Data.int(event.currentTarget, 'row'); |
3652 |
08 Dec 15 |
olle |
var column = Data.int(event.currentTarget, 'col'); |
3652 |
08 Dec 15 |
olle |
if (column >= 6) |
3652 |
08 Dec 15 |
olle |
1766 |
{ |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
1768 |
} |
3652 |
08 Dec 15 |
olle |
var well = Plate.getWell(row, column); |
3652 |
08 Dec 15 |
olle |
Plate.toggleSelected([well]); |
3652 |
08 Dec 15 |
olle |
1771 |
} |
3652 |
08 Dec 15 |
olle |
1772 |
|
3652 |
08 Dec 15 |
olle |
// Toggle the selected status of a complete row |
3652 |
08 Dec 15 |
olle |
inspectstartplate.toggleRow = function(event) |
3652 |
08 Dec 15 |
olle |
1775 |
{ |
3652 |
08 Dec 15 |
olle |
var row = Data.int(event.currentTarget, 'row'); |
3652 |
08 Dec 15 |
olle |
1777 |
/* |
3652 |
08 Dec 15 |
olle |
Plate.toggleSelected(Plate.getRow(row)); |
3652 |
08 Dec 15 |
olle |
1779 |
*/ |
3652 |
08 Dec 15 |
olle |
var wells = inspectstartplate.restrictWells(Plate.getRow(row)); |
3652 |
08 Dec 15 |
olle |
Plate.toggleSelected(wells); |
3652 |
08 Dec 15 |
olle |
1782 |
} |
3652 |
08 Dec 15 |
olle |
1783 |
|
3652 |
08 Dec 15 |
olle |
// Toggle the selected status of a complete column |
3652 |
08 Dec 15 |
olle |
inspectstartplate.toggleColumn = function(event) |
3652 |
08 Dec 15 |
olle |
1786 |
{ |
3652 |
08 Dec 15 |
olle |
var column = Data.int(event.currentTarget, 'col'); |
3652 |
08 Dec 15 |
olle |
if (column >= 6) |
3652 |
08 Dec 15 |
olle |
1789 |
{ |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
1791 |
} |
3652 |
08 Dec 15 |
olle |
Plate.toggleSelected(Plate.getColumn(column)); |
3652 |
08 Dec 15 |
olle |
1793 |
} |
3652 |
08 Dec 15 |
olle |
1794 |
|
3652 |
08 Dec 15 |
olle |
// Toggle the selected status of a pool |
3652 |
08 Dec 15 |
olle |
inspectstartplate.togglePool = function(event) |
3652 |
08 Dec 15 |
olle |
1797 |
{ |
3652 |
08 Dec 15 |
olle |
var pool = Data.int(event.target, 'pool-num'); |
3652 |
08 Dec 15 |
olle |
1799 |
/* |
3652 |
08 Dec 15 |
olle |
if (!isNaN(pool)) Plate.toggleSelected(Plate.getPool(pool)); |
3652 |
08 Dec 15 |
olle |
1801 |
*/ |
3652 |
08 Dec 15 |
olle |
if (!isNaN(pool) && pool < 1) |
3652 |
08 Dec 15 |
olle |
1803 |
{ |
3652 |
08 Dec 15 |
olle |
Plate.toggleSelected(Plate.getPool(pool)); |
3652 |
08 Dec 15 |
olle |
1805 |
} |
3652 |
08 Dec 15 |
olle |
1806 |
} |
3652 |
08 Dec 15 |
olle |
1807 |
|
3652 |
08 Dec 15 |
olle |
// Highlight enable/disable all wells in a column |
3652 |
08 Dec 15 |
olle |
inspectstartplate.highlightColumn = function(event) |
3652 |
08 Dec 15 |
olle |
1810 |
{ |
3652 |
08 Dec 15 |
olle |
var column = Data.int(event.currentTarget, 'col'); |
3652 |
08 Dec 15 |
olle |
if (column >= 6) |
3652 |
08 Dec 15 |
olle |
1813 |
{ |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
1815 |
} |
3652 |
08 Dec 15 |
olle |
var on = event.type == 'mouseover'; |
3652 |
08 Dec 15 |
olle |
1817 |
|
3652 |
08 Dec 15 |
olle |
Doc.addOrRemoveClass(event.currentTarget, 'highlight-column', on); |
3652 |
08 Dec 15 |
olle |
var wells = Plate.getColumn(column); |
3652 |
08 Dec 15 |
olle |
Plate.setHighlight(wells, 'highlight-column', on); |
3652 |
08 Dec 15 |
olle |
1821 |
} |
3652 |
08 Dec 15 |
olle |
1822 |
|
3652 |
08 Dec 15 |
olle |
// Highlight enable/disable all wells in a row |
3652 |
08 Dec 15 |
olle |
inspectstartplate.highlightRow = function(event) |
3652 |
08 Dec 15 |
olle |
1825 |
{ |
3652 |
08 Dec 15 |
olle |
var row = Data.int(event.currentTarget, 'row'); |
3652 |
08 Dec 15 |
olle |
var on = event.type == 'mouseover'; |
3652 |
08 Dec 15 |
olle |
1828 |
|
3652 |
08 Dec 15 |
olle |
Doc.addOrRemoveClass(event.currentTarget, 'highlight-row', on); |
3652 |
08 Dec 15 |
olle |
1830 |
/* |
3652 |
08 Dec 15 |
olle |
var wells = Plate.getRow(row); |
3652 |
08 Dec 15 |
olle |
1832 |
*/ |
3652 |
08 Dec 15 |
olle |
var wells = inspectstartplate.restrictWells(Plate.getRow(row)); |
3652 |
08 Dec 15 |
olle |
Plate.setHighlight(wells, 'highlight-row', on); |
3652 |
08 Dec 15 |
olle |
1835 |
} |
3652 |
08 Dec 15 |
olle |
1836 |
|
3652 |
08 Dec 15 |
olle |
// Highligt enable/disable all wells in a pool |
3652 |
08 Dec 15 |
olle |
inspectstartplate.highlightPool = function(event) |
3652 |
08 Dec 15 |
olle |
1839 |
{ |
3652 |
08 Dec 15 |
olle |
var pool = Data.int(event.target, 'pool-num'); |
3652 |
08 Dec 15 |
olle |
var on = event.type == 'mouseover'; |
3652 |
08 Dec 15 |
olle |
1842 |
/* |
3652 |
08 Dec 15 |
olle |
if (!isNaN(pool)) |
3652 |
08 Dec 15 |
olle |
1844 |
*/ |
3652 |
08 Dec 15 |
olle |
if (!isNaN(pool) && pool < 1) |
3652 |
08 Dec 15 |
olle |
1846 |
{ |
3652 |
08 Dec 15 |
olle |
Doc.addOrRemoveClass(event.target, 'highlight-pool', on); |
3652 |
08 Dec 15 |
olle |
var wells = Plate.getPool(pool); |
3652 |
08 Dec 15 |
olle |
Plate.setHighlight(wells, 'highlight-pool', on); |
3652 |
08 Dec 15 |
olle |
1850 |
} |
3652 |
08 Dec 15 |
olle |
1851 |
} |
3652 |
08 Dec 15 |
olle |
1852 |
|
3652 |
08 Dec 15 |
olle |
1853 |
/** |
3652 |
08 Dec 15 |
olle |
Highlight all replicated wells with the same DNA as the given well. |
3652 |
08 Dec 15 |
olle |
1855 |
*/ |
3652 |
08 Dec 15 |
olle |
inspectstartplate.highlightReplicated = function(event) |
3652 |
08 Dec 15 |
olle |
1857 |
{ |
3652 |
08 Dec 15 |
olle |
var column = Data.int(event.currentTarget, 'col'); |
3652 |
08 Dec 15 |
olle |
if (column >= 6) |
3652 |
08 Dec 15 |
olle |
1860 |
{ |
3652 |
08 Dec 15 |
olle |
return; |
3652 |
08 Dec 15 |
olle |
1862 |
} |
3652 |
08 Dec 15 |
olle |
var row = Data.int(event.currentTarget, 'row'); |
3652 |
08 Dec 15 |
olle |
var on = event.type == 'mouseover'; |
3652 |
08 Dec 15 |
olle |
1865 |
|
3652 |
08 Dec 15 |
olle |
var well = Plate.getWell(row, column); |
3652 |
08 Dec 15 |
olle |
if (well.extract && well.replicate) |
3652 |
08 Dec 15 |
olle |
1868 |
{ |
3652 |
08 Dec 15 |
olle |
// Get center coordinates for the current well |
3652 |
08 Dec 15 |
olle |
var pos = Doc.getElementPosition(well.tag); |
3652 |
08 Dec 15 |
olle |
var jsPos = new jsPoint(pos.left+pos.width/2, pos.top+pos.height/2); |
3652 |
08 Dec 15 |
olle |
1872 |
|
3652 |
08 Dec 15 |
olle |
var replicated = Plate.getWellsByName(well.extract.name); |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < replicated.length; i++) |
3652 |
08 Dec 15 |
olle |
1875 |
{ |
3652 |
08 Dec 15 |
olle |
var rep = replicated[i]; |
3652 |
08 Dec 15 |
olle |
if (rep != well) |
3652 |
08 Dec 15 |
olle |
1878 |
{ |
3652 |
08 Dec 15 |
olle |
Doc.addOrRemoveClass(rep.tag, 'highlight-replicated', on); |
3652 |
08 Dec 15 |
olle |
if (rep.line) |
3652 |
08 Dec 15 |
olle |
1881 |
{ |
3652 |
08 Dec 15 |
olle |
// Clear any recent lines |
3652 |
08 Dec 15 |
olle |
graphics.clearDrawing(rep.line); |
3652 |
08 Dec 15 |
olle |
rep.line = null; |
3652 |
08 Dec 15 |
olle |
1885 |
} |
3652 |
08 Dec 15 |
olle |
if (on) |
3652 |
08 Dec 15 |
olle |
1887 |
{ |
3652 |
08 Dec 15 |
olle |
// We draw a line between the current and replicated well |
3652 |
08 Dec 15 |
olle |
var rPos = Doc.getElementPosition(rep.tag); |
3652 |
08 Dec 15 |
olle |
rep.line = graphics.drawLine(pen, jsPos, new jsPoint(rPos.left+rPos.width/2, rPos.top+rPos.height/2)); |
3652 |
08 Dec 15 |
olle |
1891 |
} |
3652 |
08 Dec 15 |
olle |
1892 |
} |
3652 |
08 Dec 15 |
olle |
1893 |
} |
3652 |
08 Dec 15 |
olle |
1894 |
} |
3652 |
08 Dec 15 |
olle |
1895 |
} |
3652 |
08 Dec 15 |
olle |
1896 |
|
3652 |
08 Dec 15 |
olle |
// Some special toogle operations |
3652 |
08 Dec 15 |
olle |
inspectstartplate.specialToggle = function(event) |
3652 |
08 Dec 15 |
olle |
1899 |
{ |
3652 |
08 Dec 15 |
olle |
var what = Data.get(event.currentTarget, 'special'); |
3652 |
08 Dec 15 |
olle |
var wells = []; |
3652 |
08 Dec 15 |
olle |
if (what == 'all' || what == 'empty' || what == 'none') |
3652 |
08 Dec 15 |
olle |
1903 |
{ |
3652 |
08 Dec 15 |
olle |
// All wells or all empty (will be filtered later) |
3652 |
08 Dec 15 |
olle |
wells = Plate.getWells(); |
3652 |
08 Dec 15 |
olle |
1906 |
} |
3652 |
08 Dec 15 |
olle |
else if (what == 'pools' || what == 'empty-pools') |
3652 |
08 Dec 15 |
olle |
1908 |
{ |
3652 |
08 Dec 15 |
olle |
// All primary pools or all empty in the primary pools (will be filtered later) |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < Plate.poolSchema.numPools; i++) |
3652 |
08 Dec 15 |
olle |
1911 |
{ |
3652 |
08 Dec 15 |
olle |
wells = wells.concat(Plate.getPool(i)); |
3652 |
08 Dec 15 |
olle |
1913 |
} |
3652 |
08 Dec 15 |
olle |
1914 |
} |
3652 |
08 Dec 15 |
olle |
else if (what == 'stratagene') |
3652 |
08 Dec 15 |
olle |
1916 |
{ |
3652 |
08 Dec 15 |
olle |
// All wells with 'Stratagene' |
3652 |
08 Dec 15 |
olle |
var tmp = Plate.getWells(); |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < tmp.length; i++) |
3652 |
08 Dec 15 |
olle |
1920 |
{ |
3652 |
08 Dec 15 |
olle |
var well = tmp[i]; |
3652 |
08 Dec 15 |
olle |
if (well.extract && well.extract.stratagene) wells[wells.length] = well; |
3652 |
08 Dec 15 |
olle |
1923 |
} |
3652 |
08 Dec 15 |
olle |
1924 |
} |
3652 |
08 Dec 15 |
olle |
else if (what == 'external') |
3652 |
08 Dec 15 |
olle |
1926 |
{ |
3652 |
08 Dec 15 |
olle |
// All wells with 'External DNA' |
3652 |
08 Dec 15 |
olle |
var tmp = Plate.getWells(); |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < tmp.length; i++) |
3652 |
08 Dec 15 |
olle |
1930 |
{ |
3652 |
08 Dec 15 |
olle |
var well = tmp[i]; |
3652 |
08 Dec 15 |
olle |
if (well.extract && well.extract.external) wells[wells.length] = well; |
3652 |
08 Dec 15 |
olle |
1933 |
} |
3652 |
08 Dec 15 |
olle |
1934 |
} |
3652 |
08 Dec 15 |
olle |
else if (what == 'replicates') |
3652 |
08 Dec 15 |
olle |
1936 |
{ |
3652 |
08 Dec 15 |
olle |
// All wells with replicated DNA |
3652 |
08 Dec 15 |
olle |
var tmp = Plate.getWells(); |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < tmp.length; i++) |
3652 |
08 Dec 15 |
olle |
1940 |
{ |
3652 |
08 Dec 15 |
olle |
var well = tmp[i]; |
3652 |
08 Dec 15 |
olle |
if (well.extract && well.replicate) wells[wells.length] = well; |
3652 |
08 Dec 15 |
olle |
1943 |
} |
3652 |
08 Dec 15 |
olle |
1944 |
} |
3652 |
08 Dec 15 |
olle |
else if (what == 'error') |
3652 |
08 Dec 15 |
olle |
1946 |
{ |
3652 |
08 Dec 15 |
olle |
// All wells with an error |
3652 |
08 Dec 15 |
olle |
var tmp = Plate.getWells(); |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < tmp.length; i++) |
3652 |
08 Dec 15 |
olle |
1950 |
{ |
3652 |
08 Dec 15 |
olle |
var well = tmp[i]; |
3652 |
08 Dec 15 |
olle |
if (well.hasError()) wells[wells.length] = well; |
3652 |
08 Dec 15 |
olle |
1953 |
} |
3652 |
08 Dec 15 |
olle |
1954 |
} |
3652 |
08 Dec 15 |
olle |
else if (what == 'warning') |
3652 |
08 Dec 15 |
olle |
1956 |
{ |
3652 |
08 Dec 15 |
olle |
// All wells with a warning |
3652 |
08 Dec 15 |
olle |
var tmp = Plate.getWells(); |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < tmp.length; i++) |
3652 |
08 Dec 15 |
olle |
1960 |
{ |
3652 |
08 Dec 15 |
olle |
var well = tmp[i]; |
3652 |
08 Dec 15 |
olle |
if (well.warning) wells[wells.length] = well; |
3652 |
08 Dec 15 |
olle |
1963 |
} |
3652 |
08 Dec 15 |
olle |
1964 |
} |
3652 |
08 Dec 15 |
olle |
1965 |
|
3652 |
08 Dec 15 |
olle |
// Extra filter for empty wells only |
3652 |
08 Dec 15 |
olle |
if (what.indexOf('empty') != -1) |
3652 |
08 Dec 15 |
olle |
1968 |
{ |
3652 |
08 Dec 15 |
olle |
var tmp = wells; |
3652 |
08 Dec 15 |
olle |
wells = []; |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < tmp.length; i++) |
3652 |
08 Dec 15 |
olle |
1972 |
{ |
3652 |
08 Dec 15 |
olle |
if (!tmp[i].extract) wells[wells.length] = tmp[i]; |
3652 |
08 Dec 15 |
olle |
1974 |
} |
3652 |
08 Dec 15 |
olle |
1975 |
} |
3652 |
08 Dec 15 |
olle |
1976 |
|
3652 |
08 Dec 15 |
olle |
if (what == 'none') |
3652 |
08 Dec 15 |
olle |
1978 |
{ |
3652 |
08 Dec 15 |
olle |
Plate.setSelected(wells, false); |
3652 |
08 Dec 15 |
olle |
1980 |
} |
3652 |
08 Dec 15 |
olle |
else |
3652 |
08 Dec 15 |
olle |
1982 |
{ |
3652 |
08 Dec 15 |
olle |
Plate.toggleSelected(wells); |
3652 |
08 Dec 15 |
olle |
1984 |
} |
3652 |
08 Dec 15 |
olle |
1985 |
} |
3652 |
08 Dec 15 |
olle |
1986 |
|
3652 |
08 Dec 15 |
olle |
// Format value as a date in format yyyy-mm-dd |
3652 |
08 Dec 15 |
olle |
inspectstartplate.asDate = function(value) |
3652 |
08 Dec 15 |
olle |
1989 |
{ |
3652 |
08 Dec 15 |
olle |
if (!value) return ''; |
3652 |
08 Dec 15 |
olle |
if (value.length == 8) |
3652 |
08 Dec 15 |
olle |
1992 |
{ |
3652 |
08 Dec 15 |
olle |
value = value.substr(0, 4) + '-' + value.substr(4, 2) + '-' + value.substr(6, 2); |
3652 |
08 Dec 15 |
olle |
1994 |
} |
3652 |
08 Dec 15 |
olle |
return value; |
3652 |
08 Dec 15 |
olle |
1996 |
} |
3652 |
08 Dec 15 |
olle |
1997 |
|
3652 |
08 Dec 15 |
olle |
// Format date value in format yyyy-mm-dd |
3652 |
08 Dec 15 |
olle |
inspectstartplate.formatDate = function(date) |
3652 |
08 Dec 15 |
olle |
2000 |
{ |
3652 |
08 Dec 15 |
olle |
if (!date) return ''; |
3652 |
08 Dec 15 |
olle |
var year = date.getFullYear(); |
3652 |
08 Dec 15 |
olle |
var month = (date.getMonth() + 1); |
3652 |
08 Dec 15 |
olle |
var day = date.getDate(); |
3652 |
08 Dec 15 |
olle |
var monthStr = '' + month; |
3652 |
08 Dec 15 |
olle |
if (month < 10) |
3652 |
08 Dec 15 |
olle |
2007 |
{ |
3652 |
08 Dec 15 |
olle |
monthStr = '0' + month; |
3652 |
08 Dec 15 |
olle |
2009 |
} |
3652 |
08 Dec 15 |
olle |
var dayStr = '' + day; |
3652 |
08 Dec 15 |
olle |
if (day < 10) |
3652 |
08 Dec 15 |
olle |
2012 |
{ |
3652 |
08 Dec 15 |
olle |
dayStr = '0' + day; |
3652 |
08 Dec 15 |
olle |
2014 |
} |
3652 |
08 Dec 15 |
olle |
var dateStr = '' + year + '-' + monthStr + '-' + dayStr; |
3652 |
08 Dec 15 |
olle |
return dateStr; |
3652 |
08 Dec 15 |
olle |
2017 |
} |
3652 |
08 Dec 15 |
olle |
2018 |
|
3652 |
08 Dec 15 |
olle |
return inspectstartplate; |
3652 |
08 Dec 15 |
olle |
2020 |
}(); |
3652 |
08 Dec 15 |
olle |
2021 |
|
3652 |
08 Dec 15 |
olle |
Doc.onLoad(InspectStartPlate.initPage); |
3652 |
08 Dec 15 |
olle |
Doc.addElementInitializer(InspectStartPlate.initElements); |
3652 |
08 Dec 15 |
olle |
2024 |
|
3652 |
08 Dec 15 |
olle |
2025 |
|
3652 |
08 Dec 15 |
olle |
var Dna = function() |
3652 |
08 Dec 15 |
olle |
2027 |
{ |
3652 |
08 Dec 15 |
olle |
var dna = {}; |
3652 |
08 Dec 15 |
olle |
var flagged = []; |
3652 |
08 Dec 15 |
olle |
var info = []; |
3652 |
08 Dec 15 |
olle |
2031 |
|
3652 |
08 Dec 15 |
olle |
2032 |
/** |
3652 |
08 Dec 15 |
olle |
Create a new DNA object by name. More information |
3652 |
08 Dec 15 |
olle |
about the DNA is automatically loaded from the database. |
3652 |
08 Dec 15 |
olle |
2035 |
*/ |
3652 |
08 Dec 15 |
olle |
dna.createByName = function(name) |
3652 |
08 Dec 15 |
olle |
2037 |
{ |
3652 |
08 Dec 15 |
olle |
var tmp = {}; |
3652 |
08 Dec 15 |
olle |
tmp.name = name; |
3652 |
08 Dec 15 |
olle |
tmp.stratagene = Meludi.isStratagene(name) |
3652 |
08 Dec 15 |
olle |
tmp.external = Meludi.isExternal(name); |
3652 |
08 Dec 15 |
olle |
tmp.info = dna.infoByName(name); |
3667 |
15 Dec 15 |
olle |
//alert("inspect_start_plate.js::dna.createByName(name): name = " + name + " info = " + JSON.stringify(tmp.info)); |
3652 |
08 Dec 15 |
olle |
tmp.id = tmp.info.id; |
3652 |
08 Dec 15 |
olle |
return tmp; |
3652 |
08 Dec 15 |
olle |
2046 |
} |
3652 |
08 Dec 15 |
olle |
2047 |
|
3652 |
08 Dec 15 |
olle |
2048 |
/** |
3667 |
15 Dec 15 |
olle |
Create a new DNA object by parent name. More information |
3667 |
15 Dec 15 |
olle |
about the DNA is automatically loaded from the database. |
3667 |
15 Dec 15 |
olle |
2051 |
*/ |
3693 |
15 Jan 16 |
olle |
dna.createByParentName = function(parentName, name, id) |
3667 |
15 Dec 15 |
olle |
2053 |
{ |
3693 |
15 Jan 16 |
olle |
//alert("inspect_start_plate.js::dna.createByParentName(parentName, name, id): parentName = " + parentName + " name = " + name + " id = " + id); |
3667 |
15 Dec 15 |
olle |
var tmp = {}; |
3667 |
15 Dec 15 |
olle |
tmp.name = name; |
3693 |
15 Jan 16 |
olle |
tmp.id = id; |
3667 |
15 Dec 15 |
olle |
tmp.stratagene = Meludi.isStratagene(parentName) |
3667 |
15 Dec 15 |
olle |
tmp.external = Meludi.isExternal(parentName); |
3667 |
15 Dec 15 |
olle |
var parentDna = dna.infoByName(parentName); |
3667 |
15 Dec 15 |
olle |
// Copy some info to original info |
3667 |
15 Dec 15 |
olle |
var info = {}; |
3667 |
15 Dec 15 |
olle |
info.origBioWell = parentDna.bioWell; |
3667 |
15 Dec 15 |
olle |
info.origQubitConc = parentDna.QubitConc; |
3667 |
15 Dec 15 |
olle |
info.origDeltaCt = parentDna.deltaCt; |
3667 |
15 Dec 15 |
olle |
info.origId = parentDna.id; |
3667 |
15 Dec 15 |
olle |
info.origName = parentDna.name; |
3679 |
18 Dec 15 |
olle |
info.origDescription = parentDna.comment; |
3667 |
15 Dec 15 |
olle |
// Reset info for created item |
3667 |
15 Dec 15 |
olle |
info.bioWell = null; |
3667 |
15 Dec 15 |
olle |
info.QubitConc = null; |
3667 |
15 Dec 15 |
olle |
info.deltaCt = null; |
3667 |
15 Dec 15 |
olle |
info.id = null; |
3667 |
15 Dec 15 |
olle |
// Set tmp.info to new JSONObject info |
3667 |
15 Dec 15 |
olle |
tmp.info = info; |
3667 |
15 Dec 15 |
olle |
return tmp; |
3667 |
15 Dec 15 |
olle |
2077 |
} |
3667 |
15 Dec 15 |
olle |
2078 |
|
3667 |
15 Dec 15 |
olle |
2079 |
/** |
3652 |
08 Dec 15 |
olle |
Create a new DNA object by info object. |
3652 |
08 Dec 15 |
olle |
2081 |
*/ |
3652 |
08 Dec 15 |
olle |
dna.createByInfo = function(info) |
3652 |
08 Dec 15 |
olle |
2083 |
{ |
3652 |
08 Dec 15 |
olle |
var tmp = {}; |
3652 |
08 Dec 15 |
olle |
tmp.name = info.name; |
3652 |
08 Dec 15 |
olle |
tmp.stratagene = Meludi.isStratagene(tmp.name); |
3652 |
08 Dec 15 |
olle |
tmp.external = Meludi.isExternal(tmp.name); |
3652 |
08 Dec 15 |
olle |
tmp.id = info.id; |
3652 |
08 Dec 15 |
olle |
tmp.info = info; |
3652 |
08 Dec 15 |
olle |
return tmp; |
3652 |
08 Dec 15 |
olle |
2091 |
} |
3652 |
08 Dec 15 |
olle |
2092 |
|
3652 |
08 Dec 15 |
olle |
2093 |
/** |
3652 |
08 Dec 15 |
olle |
Get information about a DNA item with a given name. |
3652 |
08 Dec 15 |
olle |
2095 |
*/ |
3652 |
08 Dec 15 |
olle |
dna.infoByName = function(name) |
3652 |
08 Dec 15 |
olle |
2097 |
{ |
3652 |
08 Dec 15 |
olle |
var key = 'N'+name; |
3652 |
08 Dec 15 |
olle |
if (!info[key]) |
3652 |
08 Dec 15 |
olle |
2100 |
{ |
3652 |
08 Dec 15 |
olle |
dna.loadInfoByNames([name]); |
3652 |
08 Dec 15 |
olle |
if (!info[key]) info[key] = {}; |
3652 |
08 Dec 15 |
olle |
2103 |
} |
3652 |
08 Dec 15 |
olle |
return info[key]; |
3652 |
08 Dec 15 |
olle |
2105 |
} |
3652 |
08 Dec 15 |
olle |
2106 |
|
3652 |
08 Dec 15 |
olle |
2107 |
/** |
3652 |
08 Dec 15 |
olle |
Load and cache DNA information for all DNA items with a name in the |
3652 |
08 Dec 15 |
olle |
given list. |
3652 |
08 Dec 15 |
olle |
2110 |
*/ |
3652 |
08 Dec 15 |
olle |
dna.loadInfoByNames = function(names) |
3652 |
08 Dec 15 |
olle |
2112 |
{ |
3652 |
08 Dec 15 |
olle |
var newNames = []; |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < names.length; i++) |
3652 |
08 Dec 15 |
olle |
2115 |
{ |
3652 |
08 Dec 15 |
olle |
if (!info['N'+names[i]]) newNames[newNames.length] = names[i]; |
3652 |
08 Dec 15 |
olle |
2117 |
} |
3652 |
08 Dec 15 |
olle |
2118 |
|
3652 |
08 Dec 15 |
olle |
var submitInfo = {}; |
3652 |
08 Dec 15 |
olle |
submitInfo.names = newNames; |
3652 |
08 Dec 15 |
olle |
2121 |
|
3652 |
08 Dec 15 |
olle |
if (newNames.length > 0) |
3652 |
08 Dec 15 |
olle |
2123 |
{ |
3652 |
08 Dec 15 |
olle |
var url = '../Dna.servlet?ID='+App.getSessionId(); |
3652 |
08 Dec 15 |
olle |
url += '&cmd=GetDnaInfoFromNames'; |
3652 |
08 Dec 15 |
olle |
var response = Wizard.syncJsonRequest(url, 'POST', JSON.stringify(submitInfo)); |
3652 |
08 Dec 15 |
olle |
dna.cacheInfo(response.dna); |
3652 |
08 Dec 15 |
olle |
2128 |
} |
3652 |
08 Dec 15 |
olle |
2129 |
} |
3652 |
08 Dec 15 |
olle |
2130 |
|
3652 |
08 Dec 15 |
olle |
dna.cacheInfo = function(dnaList) |
3652 |
08 Dec 15 |
olle |
2132 |
{ |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < dnaList.length; i++) |
3652 |
08 Dec 15 |
olle |
2134 |
{ |
3652 |
08 Dec 15 |
olle |
var r = dnaList[i]; |
3652 |
08 Dec 15 |
olle |
info['N'+r.name] = r; |
3652 |
08 Dec 15 |
olle |
info['I'+r.id] = r; |
3652 |
08 Dec 15 |
olle |
if (r.flag) flagged[flagged.length] = r; |
3652 |
08 Dec 15 |
olle |
2139 |
} |
3652 |
08 Dec 15 |
olle |
2140 |
} |
3652 |
08 Dec 15 |
olle |
2141 |
|
3652 |
08 Dec 15 |
olle |
dna.unflag = function(r) |
3652 |
08 Dec 15 |
olle |
2143 |
{ |
3652 |
08 Dec 15 |
olle |
if (!r.info || !r.info.flag) return false; |
3652 |
08 Dec 15 |
olle |
2145 |
|
3652 |
08 Dec 15 |
olle |
r.info.flag = null; |
3652 |
08 Dec 15 |
olle |
for (var i = 0; i < flagged.length; i++) |
3652 |
08 Dec 15 |
olle |
2148 |
{ |
3652 |
08 Dec 15 |
olle |
if (r.id == flagged[i].id) |
3652 |
08 Dec 15 |
olle |
2150 |
{ |
3652 |
08 Dec 15 |
olle |
flagged.splice(i, 1); |
3652 |
08 Dec 15 |
olle |
break; |
3652 |
08 Dec 15 |
olle |
2153 |
} |
3652 |
08 Dec 15 |
olle |
2154 |
} |
3652 |
08 Dec 15 |
olle |
return true; |
3652 |
08 Dec 15 |
olle |
2156 |
} |
3652 |
08 Dec 15 |
olle |
2157 |
|
3652 |
08 Dec 15 |
olle |
dna.flag = function(r, flag) |
3652 |
08 Dec 15 |
olle |
2159 |
{ |
3652 |
08 Dec 15 |
olle |
if (!r.info || r.info.flag) return false; |
3652 |
08 Dec 15 |
olle |
r.info.flag = flag; |
3652 |
08 Dec 15 |
olle |
flagged[flagged.length] = r.info; |
3652 |
08 Dec 15 |
olle |
2163 |
} |
3652 |
08 Dec 15 |
olle |
2164 |
|
3652 |
08 Dec 15 |
olle |
dna.getFlagged = function() |
3652 |
08 Dec 15 |
olle |
2166 |
{ |
3652 |
08 Dec 15 |
olle |
return flagged; |
3652 |
08 Dec 15 |
olle |
2168 |
} |
3652 |
08 Dec 15 |
olle |
2169 |
|
3652 |
08 Dec 15 |
olle |
return dna; |
3652 |
08 Dec 15 |
olle |
2171 |
}(); |
3652 |
08 Dec 15 |
olle |
2172 |
|
3652 |
08 Dec 15 |
olle |
2173 |
|
3652 |
08 Dec 15 |
olle |
2174 |
|
3652 |
08 Dec 15 |
olle |
var WellPainter = function() |
3652 |
08 Dec 15 |
olle |
2176 |
{ |
3652 |
08 Dec 15 |
olle |
var painter = {}; |
3652 |
08 Dec 15 |
olle |
2178 |
|
3652 |
08 Dec 15 |
olle |
// Add class indicators for replicates and QC assigned wells |
3652 |
08 Dec 15 |
olle |
painter.getClassNameForWell = function(well) |
3652 |
08 Dec 15 |
olle |
2181 |
{ |
3652 |
08 Dec 15 |
olle |
var cls = ''; |
3652 |
08 Dec 15 |
olle |
if (well.extract) |
3652 |
08 Dec 15 |
olle |
2184 |
{ |
3652 |
08 Dec 15 |
olle |
if (well.replicate) cls += ' replicate'; |
3652 |
08 Dec 15 |
olle |
if (well.extract.qc) cls += ' qc'; |
3652 |
08 Dec 15 |
olle |
2187 |
} |
3652 |
08 Dec 15 |
olle |
if (well.column == Plate.columns-1) cls += ' last-child'; |
3652 |
08 Dec 15 |
olle |
2189 |
|
3652 |
08 Dec 15 |
olle |
return cls; |
3652 |
08 Dec 15 |
olle |
2191 |
} |
3652 |
08 Dec 15 |
olle |
2192 |
|
3652 |
08 Dec 15 |
olle |
painter.getWellText = function(well) |
3652 |
08 Dec 15 |
olle |
2194 |
{ |
3652 |
08 Dec 15 |
olle |
var frm = document.forms['meludi']; |
3652 |
08 Dec 15 |
olle |
var text = ''; |
3652 |
08 Dec 15 |
olle |
if (well.duplicates) |
3652 |
08 Dec 15 |
olle |
2198 |
{ |
3652 |
08 Dec 15 |
olle |
well.setError('Duplicate DNA in this location'); |
3652 |
08 Dec 15 |
olle |
text += '<div class="name">'+Strings.encodeTags(well.duplicates.join(', '))+'</div>'; |
3652 |
08 Dec 15 |
olle |
2201 |
} |
3652 |
08 Dec 15 |
olle |
else if (well.extract) |
3652 |
08 Dec 15 |
olle |
2203 |
{ |
3652 |
08 Dec 15 |
olle |
// The well contains DNA |
3652 |
08 Dec 15 |
olle |
var dna = well.extract; |
3652 |
08 Dec 15 |
olle |
var info = dna.info; |
3652 |
08 Dec 15 |
olle |
// --- DNA aliquot name |
3652 |
08 Dec 15 |
olle |
text += '<div class="name">'+Strings.encodeTags(dna.name)+'</div>'; |
3667 |
15 Dec 15 |
olle |
//alert("inspect_start_plate.js::getWellText(): info = " + JSON.stringify(info)); |
3652 |
08 Dec 15 |
olle |
2210 |
|
3652 |
08 Dec 15 |
olle |
var warningMsg = []; |
3652 |
08 Dec 15 |
olle |
// --- Bioplate location |
3667 |
15 Dec 15 |
olle |
if (info.origBioWell) |
3652 |
08 Dec 15 |
olle |
2214 |
{ |
3667 |
15 Dec 15 |
olle |
var origDnaWell = info.origBioWell; |
3667 |
15 Dec 15 |
olle |
text += '<div class="location">'+Strings.encodeTags(origDnaWell.bioPlate.name+'['+origDnaWell.location)+']</div>'; |
3652 |
08 Dec 15 |
olle |
2217 |
} |
3652 |
08 Dec 15 |
olle |
else if (info.preNormalized) |
3652 |
08 Dec 15 |
olle |
2219 |
{ |
3652 |
08 Dec 15 |
olle |
text += '<div class="location">PreNormalized</div>'; |
3652 |
08 Dec 15 |
olle |
2221 |
} |
3652 |
08 Dec 15 |
olle |
else if (!dna.stratagene && !dna.external) |
3652 |
08 Dec 15 |
olle |
2223 |
{ |
3652 |
08 Dec 15 |
olle |
if (!painter.hasClass('plate', 'hide-location')) |
3652 |
08 Dec 15 |
olle |
2225 |
{ |
3652 |
08 Dec 15 |
olle |
warningMsg[warningMsg.length] = 'No location'; |
3652 |
08 Dec 15 |
olle |
2227 |
} |
3652 |
08 Dec 15 |
olle |
2228 |
} |
3652 |
08 Dec 15 |
olle |
2229 |
|
3667 |
15 Dec 15 |
olle |
if (info && info.origId && !dna.stratagene && !dna.external) |
3652 |
08 Dec 15 |
olle |
2231 |
{ |
3652 |
08 Dec 15 |
olle |
// Calculations for each aliquot |
3667 |
15 Dec 15 |
olle |
var origDeltaCt = info.origDeltaCt; |
3667 |
15 Dec 15 |
olle |
var dilutionFactor = painter.fetchDilutionFactor(origDeltaCt); |
3652 |
08 Dec 15 |
olle |
var VOL_ALIQUOT = 10.0; // µl |
3652 |
08 Dec 15 |
olle |
var volDNA = VOL_ALIQUOT/dilutionFactor; |
3652 |
08 Dec 15 |
olle |
var water = VOL_ALIQUOT - volDNA; |
3652 |
08 Dec 15 |
olle |
// Prepare for future modification of solution volume depending on other parameters |
3652 |
08 Dec 15 |
olle |
var volAliquotSolution = VOL_ALIQUOT; |
3652 |
08 Dec 15 |
olle |
var volDnaInSolution = volAliquotSolution/dilutionFactor; |
3652 |
08 Dec 15 |
olle |
var waterInSolution = volAliquotSolution - volDnaInSolution; |
3652 |
08 Dec 15 |
olle |
var removedVolume = 2 * volDnaInSolution; // µl |
3667 |
15 Dec 15 |
olle |
var origConc = info.origQubitConc; // ng/µl |
3667 |
15 Dec 15 |
olle |
var calcConc = origConc/dilutionFactor; |
3652 |
08 Dec 15 |
olle |
//var usedQuantityPerAliquout = Math.ceil(VOL_ALIQUOT*origConc/dilutionFactor/1000); // µg |
3652 |
08 Dec 15 |
olle |
//var usedQuantityPerAliquout = VOL_ALIQUOT*origConc/dilutionFactor/1000; // µg |
3652 |
08 Dec 15 |
olle |
//var usedQuantity = volDNA*origConc; // ng |
3652 |
08 Dec 15 |
olle |
var usedQuantity = volDnaInSolution*origConc; // ng |
3652 |
08 Dec 15 |
olle |
dna.usedQuantity = dna.qc ? QUANTITY_QC : usedQuantity/1000; // µg |
3667 |
15 Dec 15 |
olle |
//alert("inspect_start_plate.js::painter.getWellText(): name = " + dna.name + " removedVolume = " + removedVolume + " origDeltaCt = " + origDeltaCt + " dilutionFactor = " + dilutionFactor + " origConc = " + origConc + " usedQuantity = " + usedQuantity + " ng"); |
3652 |
08 Dec 15 |
olle |
2251 |
|
3652 |
08 Dec 15 |
olle |
2252 |
/* |
3652 |
08 Dec 15 |
olle |
dna.usedQuantity = dna.qc ? QUANTITY_QC : QUANTITY_REGULAR; // µg |
3652 |
08 Dec 15 |
olle |
dna.dilutionConc = 1000 * dna.usedQuantity / TOTAL_VOLUME; // ng/µl |
3652 |
08 Dec 15 |
olle |
2255 |
|
3667 |
15 Dec 15 |
olle |
var volDNA = Math.ceil(10000*dna.usedQuantity/info.origQubitConc) / 10; // µl, rounded to 1 decimal |
3652 |
08 Dec 15 |
olle |
var water = TOTAL_VOLUME - volDNA; |
3652 |
08 Dec 15 |
olle |
2258 |
*/ |
3652 |
08 Dec 15 |
olle |
2259 |
|
3652 |
08 Dec 15 |
olle |
var MINIMAL_DNA_VOLUME = frm.min_vol_dna.value; |
3682 |
04 Jan 16 |
olle |
if (volDnaInSolution < MINIMAL_DNA_VOLUME) |
3652 |
08 Dec 15 |
olle |
2262 |
{ |
3652 |
08 Dec 15 |
olle |
2263 |
/* |
3652 |
08 Dec 15 |
olle |
// Large mix since we do not want to take less than 1µl |
3652 |
08 Dec 15 |
olle |
volDNA = MINIMAL_DNA_VOLUME; |
3667 |
15 Dec 15 |
olle |
dna.usedQuantity = volDNA * info.origQubitConc / 1000; // µg |
3652 |
08 Dec 15 |
olle |
var totalVolume = 1000 * dna.usedQuantity / dna.dilutionConc; // µl |
3652 |
08 Dec 15 |
olle |
water = totalVolume - volDNA; |
3652 |
08 Dec 15 |
olle |
warningMsg[warningMsg.length] = 'Large mix'; |
3652 |
08 Dec 15 |
olle |
2270 |
*/ |
3682 |
04 Jan 16 |
olle |
warningMsg[warningMsg.length] = 'DNA vol ' + Numbers.formatNumber(volDnaInSolution, 2) + 'µl < ' + MINIMAL_DNA_VOLUME + 'µl'; |
3652 |
08 Dec 15 |
olle |
2272 |
} |
3652 |
08 Dec 15 |
olle |
2273 |
|
3652 |
08 Dec 15 |
olle |
// Store dilution data |
3652 |
08 Dec 15 |
olle |
info.dilutionFactor = dilutionFactor; |
3652 |
08 Dec 15 |
olle |
info.volAliquotSolution = volAliquotSolution; |
3652 |
08 Dec 15 |
olle |
info.volDnaInSolution = volDnaInSolution; |
3652 |
08 Dec 15 |
olle |
info.waterInSolution = waterInSolution; |
3652 |
08 Dec 15 |
olle |
2279 |
/* |
3652 |
08 Dec 15 |
olle |
if (info.remainingQuantity != null) |
3652 |
08 Dec 15 |
olle |
2281 |
{ |
3652 |
08 Dec 15 |
olle |
//text += '<div class="quantity">'+Numbers.formatNumber(info.remainingQuantity, 2) + 'µg</div>'; |
3652 |
08 Dec 15 |
olle |
var quantityLeft = 1000.0*info.remainingQuantity - 2*usedQuantity; // ng |
3652 |
08 Dec 15 |
olle |
//alert("select_dna.js::painter.getWellText(): name = " + dna.name + " info.remainingQuantity = " + info.remainingQuantity + " µg usedQuantity = " + usedQuantity + " ng quantityLeft = " + quantityLeft + " ng"); |
3652 |
08 Dec 15 |
olle |
//text += '<div class="quantity">'+Numbers.formatNumber(quantityLeft, 2) + 'µg '+Numbers.formatNumber(volDNA, 1)+'µl</div>'; |
3652 |
08 Dec 15 |
olle |
text += '<div class="quantity">'+Numbers.formatNumber(usedQuantity, 2) + 'ng '+Numbers.formatNumber(volDNA, 1)+'µl</div>'; |
3652 |
08 Dec 15 |
olle |
2287 |
|
3652 |
08 Dec 15 |
olle |
// Must have at least 1.1µg or 1.22µg (if default values are used) |
3652 |
08 Dec 15 |
olle |
var remainLimit = dna.qc ? QUANTITY_QC : QUANTITY_REGULAR; |
3652 |
08 Dec 15 |
olle |
2290 |
*/ |
3652 |
08 Dec 15 |
olle |
2291 |
/* |
3652 |
08 Dec 15 |
olle |
if (info.remainingQuantity < remainLimit) |
3652 |
08 Dec 15 |
olle |
2293 |
{ |
3652 |
08 Dec 15 |
olle |
well.setError('Not enough DNA'); |
3652 |
08 Dec 15 |
olle |
2295 |
} |
3652 |
08 Dec 15 |
olle |
// Warning if near the limit |
3652 |
08 Dec 15 |
olle |
if (info.remainingQuantity < LOW_QUANTITY_WARNING_LIMIT && !info.preNormalized) |
3652 |
08 Dec 15 |
olle |
2298 |
{ |
3652 |
08 Dec 15 |
olle |
warningMsg[warningMsg.length] = 'Low quantity'; |
3652 |
08 Dec 15 |
olle |
2300 |
} |
3652 |
08 Dec 15 |
olle |
2301 |
*/ |
3652 |
08 Dec 15 |
olle |
2302 |
/* |
3652 |
08 Dec 15 |
olle |
if (quantityLeft < 1000.0*remainLimit) |
3652 |
08 Dec 15 |
olle |
2304 |
{ |
3652 |
08 Dec 15 |
olle |
well.setError('Not enough DNA'); |
3652 |
08 Dec 15 |
olle |
2306 |
} |
3652 |
08 Dec 15 |
olle |
// Warning if near the limit |
3652 |
08 Dec 15 |
olle |
if (quantityLeft < 1000.0*LOW_QUANTITY_WARNING_LIMIT && !info.preNormalized) |
3652 |
08 Dec 15 |
olle |
2309 |
{ |
3652 |
08 Dec 15 |
olle |
warningMsg[warningMsg.length] = 'Low quantity'; |
3652 |
08 Dec 15 |
olle |
2311 |
} |
3652 |
08 Dec 15 |
olle |
2312 |
*/ |
3652 |
08 Dec 15 |
olle |
2313 |
/* |
3652 |
08 Dec 15 |
olle |
2314 |
} |
3652 |
08 Dec 15 |
olle |
else |
3652 |
08 Dec 15 |
olle |
2316 |
{ |
3652 |
08 Dec 15 |
olle |
warningMsg[warningMsg.length] = 'No quantity'; |
3652 |
08 Dec 15 |
olle |
2318 |
} |
3652 |
08 Dec 15 |
olle |
2319 |
*/ |
3652 |
08 Dec 15 |
olle |
// --- Used volume+water |
3667 |
15 Dec 15 |
olle |
if (info.origQubitConc != null) |
3652 |
08 Dec 15 |
olle |
2322 |
{ |
3652 |
08 Dec 15 |
olle |
text += '<div class="volumes"><span class="volume">'+Numbers.formatNumber(volDNA, 2)+'</span> + <span class="water">'+Numbers.formatNumber(water, 2)+'µl</span></div>'; |
3652 |
08 Dec 15 |
olle |
2324 |
} |
3652 |
08 Dec 15 |
olle |
// --- ΔCt |
3667 |
15 Dec 15 |
olle |
if (info.origDeltaCt != null) |
3652 |
08 Dec 15 |
olle |
2327 |
{ |
3667 |
15 Dec 15 |
olle |
text += '<div class="quality-score">ΔCt='+Numbers.formatNumber(info.origDeltaCt, 2) + '</div>'; |
3667 |
15 Dec 15 |
olle |
if (info.origDeltaCt > QUALITY_SCORE_WARNING_LIMIT) |
3652 |
08 Dec 15 |
olle |
2330 |
{ |
3652 |
08 Dec 15 |
olle |
if (!painter.hasClass('plate', 'hide-quality-score')) |
3652 |
08 Dec 15 |
olle |
2332 |
{ |
3652 |
08 Dec 15 |
olle |
warningMsg[warningMsg.length] = 'High ΔCt value'; |
3652 |
08 Dec 15 |
olle |
2334 |
} |
3652 |
08 Dec 15 |
olle |
2335 |
} |
3652 |
08 Dec 15 |
olle |
2336 |
} |
3652 |
08 Dec 15 |
olle |
else |
3652 |
08 Dec 15 |
olle |
2338 |
{ |
3652 |
08 Dec 15 |
olle |
if (!painter.hasClass('plate', 'hide-quality-score')) |
3652 |
08 Dec 15 |
olle |
2340 |
{ |
3652 |
08 Dec 15 |
olle |
warningMsg[warningMsg.length] = 'No ΔCt value'; |
3652 |
08 Dec 15 |
olle |
2342 |
} |
3652 |
08 Dec 15 |
olle |
2343 |
} |
3652 |
08 Dec 15 |
olle |
// --- QubitConc |
3667 |
15 Dec 15 |
olle |
if (info.origQubitConc) |
3652 |
08 Dec 15 |
olle |
2346 |
{ |
3667 |
15 Dec 15 |
olle |
text += '<div class="origqubitconc">'+Numbers.formatNumber(info.origQubitConc, 2) + 'ng/µl (orig.)</div>'; |
3667 |
15 Dec 15 |
olle |
text += '<div class="calcqubitconc">'+Numbers.formatNumber(calcConc, 2) + 'ng/µl (calc.)</div>'; |
3652 |
08 Dec 15 |
olle |
2349 |
} |
3652 |
08 Dec 15 |
olle |
else |
3652 |
08 Dec 15 |
olle |
2351 |
{ |
3667 |
15 Dec 15 |
olle |
if (!painter.hasClass('plate', 'hide-origqubitconc')) |
3652 |
08 Dec 15 |
olle |
2353 |
{ |
3652 |
08 Dec 15 |
olle |
warningMsg[warningMsg.length] = 'No QubitConc value'; |
3652 |
08 Dec 15 |
olle |
2355 |
} |
3652 |
08 Dec 15 |
olle |
2356 |
} |
3652 |
08 Dec 15 |
olle |
2357 |
/* |
3652 |
08 Dec 15 |
olle |
if (info.QiacubeDate) |
3652 |
08 Dec 15 |
olle |
2359 |
{ |
3652 |
08 Dec 15 |
olle |
text += '<div class="qiacube-date">'+info.QiacubeDate+'</div>'; |
3652 |
08 Dec 15 |
olle |
2361 |
} |
3652 |
08 Dec 15 |
olle |
else if (info.DilutionDate) |
3652 |
08 Dec 15 |
olle |
2363 |
{ |
3652 |
08 Dec 15 |
olle |
text += '<div class="dilution-date">'+info.DilutionDate+'</div>'; |
3652 |
08 Dec 15 |
olle |
2365 |
} |
3652 |
08 Dec 15 |
olle |
else |
3652 |
08 Dec 15 |
olle |
2367 |
{ |
3652 |
08 Dec 15 |
olle |
warningMsg[warningMsg.length] = info.preNormalized ? 'No DilutionDate value' : 'No QiacubeDate value'; |
3652 |
08 Dec 15 |
olle |
2369 |
} |
3652 |
08 Dec 15 |
olle |
2370 |
*/ |
3652 |
08 Dec 15 |
olle |
if (info.AutoProcessing) |
3652 |
08 Dec 15 |
olle |
2372 |
{ |
3652 |
08 Dec 15 |
olle |
warningMsg[warningMsg.length] = info.AutoProcessing; |
3652 |
08 Dec 15 |
olle |
2374 |
} |
3652 |
08 Dec 15 |
olle |
2375 |
/* |
3652 |
08 Dec 15 |
olle |
dna.usedQuantity = dna.qc ? QUANTITY_QC : QUANTITY_REGULAR; // µg |
3652 |
08 Dec 15 |
olle |
dna.dilutionConc = 1000 * dna.usedQuantity / TOTAL_VOLUME; // ng/µl |
3652 |
08 Dec 15 |
olle |
2378 |
|
3667 |
15 Dec 15 |
olle |
var volDNA = Math.ceil(10000*dna.usedQuantity/info.origQubitConc) / 10; // µl, rounded to 1 decimal |
3652 |
08 Dec 15 |
olle |
var water = TOTAL_VOLUME - volDNA; |
3652 |
08 Dec 15 |
olle |
2381 |
|
3652 |
08 Dec 15 |
olle |
if (volDNA < MINIMAL_DNA_VOLUME) |
3652 |
08 Dec 15 |
olle |
2383 |
{ |
3652 |
08 Dec 15 |
olle |
// Large mix since we do not want to take less than 1µl |
3652 |
08 Dec 15 |
olle |
volDNA = MINIMAL_DNA_VOLUME; |
3667 |
15 Dec 15 |
olle |
dna.usedQuantity = volDNA * info.origQubitConc / 1000; // µg |
3652 |
08 Dec 15 |
olle |
var totalVolume = 1000 * dna.usedQuantity / dna.dilutionConc; // µl |
3652 |
08 Dec 15 |
olle |
water = totalVolume - volDNA; |
3652 |
08 Dec 15 |
olle |
warningMsg[warningMsg.length] = 'Large mix'; |
3652 |
08 Dec 15 |
olle |
2390 |
} |
3652 |
08 Dec 15 |
olle |
2391 |
|
3652 |
08 Dec 15 |
olle |
if (info.remainingQuantity) |
3652 |
08 Dec 15 |
olle |
2393 |
{ |
3652 |
08 Dec 15 |
olle |
//text += '<div class="quantity">'+Numbers.formatNumber(info.remainingQuantity, 2) + 'µg</div>'; |
3652 |
08 Dec 15 |
olle |
text += '<div class="quantity">'+Numbers.formatNumber(info.remainingQuantity, 2) + 'µg '+Numbers.formatNumber(volDNA, 1)+'µl</div>'; |
3652 |
08 Dec 15 |
olle |
// Must have at least 1.1µg or 1.22µg (if default values are used) |
3652 |
08 Dec 15 |
olle |
var remainLimit = dna.qc ? QUANTITY_QC : QUANTITY_REGULAR; |
3652 |
08 Dec 15 |
olle |
if (info.remainingQuantity < remainLimit) |
3652 |
08 Dec 15 |
olle |
2399 |
{ |
3652 |
08 Dec 15 |
olle |
well.setError('Not enough DNA'); |
3652 |
08 Dec 15 |
olle |
2401 |
} |
3652 |
08 Dec 15 |
olle |
// Warning if near the limit |
3652 |
08 Dec 15 |
olle |
if (info.remainingQuantity < LOW_QUANTITY_WARNING_LIMIT && !info.preNormalized) |
3652 |
08 Dec 15 |
olle |
2404 |
{ |
3652 |
08 Dec 15 |
olle |
warningMsg[warningMsg.length] = 'Low quantity'; |
3652 |
08 Dec 15 |
olle |
2406 |
} |
3652 |
08 Dec 15 |
olle |
2407 |
} |
3652 |
08 Dec 15 |
olle |
else |
3652 |
08 Dec 15 |
olle |
2409 |
{ |
3652 |
08 Dec 15 |
olle |
warningMsg[warningMsg.length] = 'No quantity'; |
3652 |
08 Dec 15 |
olle |
2411 |
} |
3677 |
18 Dec 15 |
olle |
if (info.origDeltaCt) |
3652 |
08 Dec 15 |
olle |
2413 |
{ |
3677 |
18 Dec 15 |
olle |
text += '<div class="quality-score">ΔCt='+Numbers.formatNumber(info.origDeltaCt, 1) + '</div>'; |
3677 |
18 Dec 15 |
olle |
if (info.origDeltaCt > QUALITY_SCORE_WARNING_LIMIT) warningMsg[warningMsg.length] = 'High ΔCt value'; |
3652 |
08 Dec 15 |
olle |
2416 |
} |
3652 |
08 Dec 15 |
olle |
else |
3652 |
08 Dec 15 |
olle |
2418 |
{ |
3652 |
08 Dec 15 |
olle |
warningMsg[warningMsg.length] = 'No ΔCt value'; |
3652 |
08 Dec 15 |
olle |
2420 |
} |
3667 |
15 Dec 15 |
olle |
if (info.origQubitConc) |
3652 |
08 Dec 15 |
olle |
2422 |
{ |
3667 |
15 Dec 15 |
olle |
text += '<div class="origqubitconc">'+Numbers.formatNumber(info.origQubitConc, 2) + 'ng/µl</div>'; |
3652 |
08 Dec 15 |
olle |
text += '<div class="volumes"><span class="volume">'+Numbers.formatNumber(volDNA, 1)+'</span> + <span class="water">'+Numbers.formatNumber(water, 1)+'µl</span></div>'; |
3652 |
08 Dec 15 |
olle |
2425 |
} |
3652 |
08 Dec 15 |
olle |
else |
3652 |
08 Dec 15 |
olle |
2427 |
{ |
3652 |
08 Dec 15 |
olle |
warningMsg[warningMsg.length] = 'No QubitConc value'; |
3652 |
08 Dec 15 |
olle |
2429 |
} |
3652 |
08 Dec 15 |
olle |
if (info.QiacubeDate) |
3652 |
08 Dec 15 |
olle |
2431 |
{ |
3652 |
08 Dec 15 |
olle |
text += '<div class="qiacube-date">'+info.QiacubeDate+'</div>'; |
3652 |
08 Dec 15 |
olle |
2433 |
} |
3652 |
08 Dec 15 |
olle |
else if (info.DilutionDate) |
3652 |
08 Dec 15 |
olle |
2435 |
{ |
3652 |
08 Dec 15 |
olle |
text += '<div class="dilution-date">'+info.DilutionDate+'</div>'; |
3652 |
08 Dec 15 |
olle |
2437 |
} |
3652 |
08 Dec 15 |
olle |
else |
3652 |
08 Dec 15 |
olle |
2439 |
{ |
3652 |
08 Dec 15 |
olle |
warningMsg[warningMsg.length] = info.preNormalized ? 'No DilutionDate value' : 'No QiacubeDate value'; |
3652 |
08 Dec 15 |
olle |
2441 |
} |
3652 |
08 Dec 15 |
olle |
if (info.AutoProcessing) |
3652 |
08 Dec 15 |
olle |
2443 |
{ |
3652 |
08 Dec 15 |
olle |
warningMsg[warningMsg.length] = info.AutoProcessing; |
3652 |
08 Dec 15 |
olle |
2445 |
} |
3652 |
08 Dec 15 |
olle |
2446 |
*/ |
3652 |
08 Dec 15 |
olle |
2447 |
} |
3667 |
15 Dec 15 |
olle |
else if (!dna.origId) |
3652 |
08 Dec 15 |
olle |
2449 |
{ |
3652 |
08 Dec 15 |
olle |
well.setError('DNA not found'); |
3652 |
08 Dec 15 |
olle |
2451 |
} |
3652 |
08 Dec 15 |
olle |
if (dna.comment) |
3652 |
08 Dec 15 |
olle |
2453 |
{ |
3652 |
08 Dec 15 |
olle |
text += '<div class="comment">'+Strings.encodeTags(dna.comment)+'</div>'; |
3652 |
08 Dec 15 |
olle |
2455 |
} |
3652 |
08 Dec 15 |
olle |
if (info && info.comment) |
3652 |
08 Dec 15 |
olle |
2457 |
{ |
3652 |
08 Dec 15 |
olle |
text += '<div class="comment">'+Strings.encodeTags(info.comment)+'</div>'; |
3652 |
08 Dec 15 |
olle |
2459 |
} |
3652 |
08 Dec 15 |
olle |
if (warningMsg.length > 0) |
3652 |
08 Dec 15 |
olle |
2461 |
{ |
3652 |
08 Dec 15 |
olle |
well.setWarning(warningMsg.join('; ')); |
3652 |
08 Dec 15 |
olle |
2463 |
} |
3652 |
08 Dec 15 |
olle |
// Index 1 & 2 primers |
3652 |
08 Dec 15 |
olle |
var row = well.row + 1; |
3652 |
08 Dec 15 |
olle |
var column = well.column + 1; |
3652 |
08 Dec 15 |
olle |
var index2 = 'A50' + row; |
3652 |
08 Dec 15 |
olle |
var index1 = 'A70' + column; |
3652 |
08 Dec 15 |
olle |
if (column > 9) |
3652 |
08 Dec 15 |
olle |
2470 |
{ |
3652 |
08 Dec 15 |
olle |
index1 = 'A7' + column; |
3652 |
08 Dec 15 |
olle |
2472 |
} |
3652 |
08 Dec 15 |
olle |
text += '<div class="indexprimer">'+index2+'</div>'; |
3652 |
08 Dec 15 |
olle |
text += '<div class="indexprimer">'+index1+'</div>'; |
3652 |
08 Dec 15 |
olle |
2475 |
} |
3652 |
08 Dec 15 |
olle |
else if (well.copyText) |
3652 |
08 Dec 15 |
olle |
2477 |
{ |
3652 |
08 Dec 15 |
olle |
text = '<div class="copy-text">'+well.copyText+'</div>'; |
3652 |
08 Dec 15 |
olle |
2479 |
} |
3652 |
08 Dec 15 |
olle |
else |
3652 |
08 Dec 15 |
olle |
2481 |
{ |
3652 |
08 Dec 15 |
olle |
text = 'empty'; |
3652 |
08 Dec 15 |
olle |
2483 |
} |
3652 |
08 Dec 15 |
olle |
if (well.duplicate) |
3652 |
08 Dec 15 |
olle |
2485 |
{ |
3652 |
08 Dec 15 |
olle |
well.setError('Duplicate barcode'); |
3652 |
08 Dec 15 |
olle |
2487 |
} |
3652 |
08 Dec 15 |
olle |
2488 |
|
3652 |
08 Dec 15 |
olle |
var bc = Doc.element('barcode.'+well.row+'.'+well.column); |
3652 |
08 Dec 15 |
olle |
if (bc) |
3652 |
08 Dec 15 |
olle |
2491 |
{ |
3652 |
08 Dec 15 |
olle |
var cls = 'barcode-well' |
3652 |
08 Dec 15 |
olle |
cls += well.column == 0 ? ' barcode-left' : ' barcode-right'; |
3652 |
08 Dec 15 |
olle |
2494 |
|
3652 |
08 Dec 15 |
olle |
if (well.barcode) |
3652 |
08 Dec 15 |
olle |
2496 |
{ |
3652 |
08 Dec 15 |
olle |
bc.innerHTML = well.barcode.name; |
3652 |
08 Dec 15 |
olle |
var indexSet = painter.barcodeVariant ? painter.barcodeVariant.indexSets[well.column] : null; |
3652 |
08 Dec 15 |
olle |
if (indexSet) |
3652 |
08 Dec 15 |
olle |
2500 |
{ |
3652 |
08 Dec 15 |
olle |
cls += ' ' + indexSet.color; |
3652 |
08 Dec 15 |
olle |
2502 |
} |
3652 |
08 Dec 15 |
olle |
if (well.defaultBarcode && well.barcode != well.defaultBarcode) |
3652 |
08 Dec 15 |
olle |
2504 |
{ |
3652 |
08 Dec 15 |
olle |
cls += ' bg-modified'; |
3652 |
08 Dec 15 |
olle |
2506 |
} |
3652 |
08 Dec 15 |
olle |
if (well.duplicate) |
3652 |
08 Dec 15 |
olle |
2508 |
{ |
3652 |
08 Dec 15 |
olle |
cls += ' duplicate'; |
3652 |
08 Dec 15 |
olle |
2510 |
} |
3652 |
08 Dec 15 |
olle |
2511 |
} |
3652 |
08 Dec 15 |
olle |
bc.className = cls; |
3652 |
08 Dec 15 |
olle |
2513 |
} |
3652 |
08 Dec 15 |
olle |
return text; |
3652 |
08 Dec 15 |
olle |
2515 |
} |
3652 |
08 Dec 15 |
olle |
2516 |
|
3652 |
08 Dec 15 |
olle |
2517 |
/** |
3652 |
08 Dec 15 |
olle |
* Returns `true` if HTML element with id 'elementId' has |
3652 |
08 Dec 15 |
olle |
* class 'cls', else `false`. |
3652 |
08 Dec 15 |
olle |
2520 |
*/ |
3652 |
08 Dec 15 |
olle |
painter.hasClass = function(elementId, cls) |
3652 |
08 Dec 15 |
olle |
2522 |
{ |
3652 |
08 Dec 15 |
olle |
var element = document.getElementById(elementId); |
3652 |
08 Dec 15 |
olle |
return (' ' + element.className + ' ').indexOf(' ' + cls + ' ') > -1; |
3652 |
08 Dec 15 |
olle |
2525 |
} |
3652 |
08 Dec 15 |
olle |
2526 |
|
3652 |
08 Dec 15 |
olle |
painter.fetchDilutionFactor = function(deltaCt) |
3652 |
08 Dec 15 |
olle |
2528 |
{ |
3652 |
08 Dec 15 |
olle |
var dilutionFactor = 1.0; |
3652 |
08 Dec 15 |
olle |
2530 |
/* |
3652 |
08 Dec 15 |
olle |
// Illumina ladder dilution chart |
3652 |
08 Dec 15 |
olle |
if (deltaCt > 0.5 && deltaCt <= 1.5) |
3652 |
08 Dec 15 |
olle |
2533 |
{ |
3652 |
08 Dec 15 |
olle |
dilutionFactor = 2.0; |
3652 |
08 Dec 15 |
olle |
2535 |
} |
3652 |
08 Dec 15 |
olle |
if (deltaCt > -0.5 && deltaCt <= 0.5) |
3652 |
08 Dec 15 |
olle |
2537 |
{ |
3652 |
08 Dec 15 |
olle |
dilutionFactor = 4.0; |
3652 |
08 Dec 15 |
olle |
2539 |
} |
3652 |
08 Dec 15 |
olle |
if (deltaCt > -1.5 && deltaCt <= -0.5) |
3652 |
08 Dec 15 |
olle |
2541 |
{ |
3652 |
08 Dec 15 |
olle |
dilutionFactor = 8.0; |
3652 |
08 Dec 15 |
olle |
2543 |
} |
3652 |
08 Dec 15 |
olle |
if (deltaCt <=- 1.5) |
3652 |
08 Dec 15 |
olle |
2545 |
{ |
3652 |
08 Dec 15 |
olle |
dilutionFactor = 16.0; |
3652 |
08 Dec 15 |
olle |
2547 |
} |
3652 |
08 Dec 15 |
olle |
2548 |
*/ |
3652 |
08 Dec 15 |
olle |
// Dilution curve fitted to centers of ladder steps in Illumina ladder dilution chart (Mats Jönsson 2015-09-28) |
3652 |
08 Dec 15 |
olle |
var fact = 2.8284271247; |
3652 |
08 Dec 15 |
olle |
var expFact = 0.6931471806; |
3652 |
08 Dec 15 |
olle |
dilutionFactor = fact * Math.exp(-expFact*deltaCt); |
3652 |
08 Dec 15 |
olle |
// Apply cut-offs restricting the dilution factor to [1.0, 16.0] |
3652 |
08 Dec 15 |
olle |
if (dilutionFactor < 1.0) |
3652 |
08 Dec 15 |
olle |
2555 |
{ |
3652 |
08 Dec 15 |
olle |
dilutionFactor = 1.0; |
3652 |
08 Dec 15 |
olle |
2557 |
} |
3652 |
08 Dec 15 |
olle |
if (dilutionFactor > 16.0) |
3652 |
08 Dec 15 |
olle |
2559 |
{ |
3652 |
08 Dec 15 |
olle |
dilutionFactor = 16.0; |
3652 |
08 Dec 15 |
olle |
2561 |
} |
3652 |
08 Dec 15 |
olle |
return dilutionFactor; |
3652 |
08 Dec 15 |
olle |
2563 |
} |
3652 |
08 Dec 15 |
olle |
2564 |
|
3652 |
08 Dec 15 |
olle |
return painter; |
3652 |
08 Dec 15 |
olle |
2566 |
}(); |