5493 |
13 Jun 19 |
nicklas |
var Demux = function() |
5493 |
13 Jun 19 |
nicklas |
2 |
{ |
5493 |
13 Jun 19 |
nicklas |
var demux = {}; |
5493 |
13 Jun 19 |
nicklas |
var debug = 0; |
5493 |
13 Jun 19 |
nicklas |
5 |
|
5493 |
13 Jun 19 |
nicklas |
var JOB_IMAGE = { 'DONE': 'ok.png', 'ERROR': 'error.png'}; |
5493 |
13 Jun 19 |
nicklas |
7 |
|
5493 |
13 Jun 19 |
nicklas |
// Page initialization |
5493 |
13 Jun 19 |
nicklas |
demux.initPage = function() |
5493 |
13 Jun 19 |
nicklas |
10 |
{ |
5493 |
13 Jun 19 |
nicklas |
// Step 1 |
5493 |
13 Jun 19 |
nicklas |
Events.addEventHandler('demuxJobs', 'change', demux.demuxJobOnChange); |
5493 |
13 Jun 19 |
nicklas |
13 |
|
5493 |
13 Jun 19 |
nicklas |
// Step 2 |
5493 |
13 Jun 19 |
nicklas |
Events.addEventHandler('step-2', 'wizard-initialize', demux.initializeStep2); |
5493 |
13 Jun 19 |
nicklas |
Events.addEventHandler('outcomeSuccessful', 'click', demux.outcomeOnChange); |
5493 |
13 Jun 19 |
nicklas |
Events.addEventHandler('outcomeFailed', 'click', demux.outcomeOnChange); |
5493 |
13 Jun 19 |
nicklas |
Events.addEventHandler('deleteItemsCreatedByFailedJob', 'click', demux.outcomeOnChange); |
5493 |
13 Jun 19 |
nicklas |
19 |
|
5493 |
13 Jun 19 |
nicklas |
// Navigation |
5493 |
13 Jun 19 |
nicklas |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
5493 |
13 Jun 19 |
nicklas |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
5493 |
13 Jun 19 |
nicklas |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
5493 |
13 Jun 19 |
nicklas |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
5493 |
13 Jun 19 |
nicklas |
25 |
|
5493 |
13 Jun 19 |
nicklas |
// Final registration |
5493 |
13 Jun 19 |
nicklas |
Events.addEventHandler('wizard', 'wizard-submit', demux.submit); |
5493 |
13 Jun 19 |
nicklas |
28 |
|
5493 |
13 Jun 19 |
nicklas |
Wizard.showLoadingAnimation('Loading bioassays...'); |
5493 |
13 Jun 19 |
nicklas |
var url = '../DemuxMerge.servlet?ID='+App.getSessionId(); |
5493 |
13 Jun 19 |
nicklas |
url += '&cmd=GetUnconfirmedDemuxJobs&pipeline=MIPS'; |
5493 |
13 Jun 19 |
nicklas |
Wizard.asyncJsonRequest(url, demux.initializeStep1); |
5493 |
13 Jun 19 |
nicklas |
33 |
} |
5493 |
13 Jun 19 |
nicklas |
34 |
|
5493 |
13 Jun 19 |
nicklas |
// --- Step 1 ----------------------------------- |
5493 |
13 Jun 19 |
nicklas |
demux.initializeStep1 = function(response) |
5493 |
13 Jun 19 |
nicklas |
37 |
{ |
5493 |
13 Jun 19 |
nicklas |
var frm = document.forms['reggie']; |
5493 |
13 Jun 19 |
nicklas |
var jobs = response.jobs; |
5493 |
13 Jun 19 |
nicklas |
if (jobs.length == 0) |
5493 |
13 Jun 19 |
nicklas |
41 |
{ |
5493 |
13 Jun 19 |
nicklas |
Wizard.setFatalError('No jobs available for confirmation.'); |
5493 |
13 Jun 19 |
nicklas |
return; |
5493 |
13 Jun 19 |
nicklas |
44 |
} |
5493 |
13 Jun 19 |
nicklas |
45 |
|
5493 |
13 Jun 19 |
nicklas |
for (var jobNo=0; jobNo < jobs.length; jobNo++) |
5493 |
13 Jun 19 |
nicklas |
47 |
{ |
5493 |
13 Jun 19 |
nicklas |
var job = jobs[jobNo]; |
5493 |
13 Jun 19 |
nicklas |
var name = job.status == 'ERROR' ? job.name + ' ( ! )' : job.name; |
5493 |
13 Jun 19 |
nicklas |
if (job.partial) |
5493 |
13 Jun 19 |
nicklas |
51 |
{ |
5493 |
13 Jun 19 |
nicklas |
name += ' [partially confirmed]'; |
5493 |
13 Jun 19 |
nicklas |
53 |
} |
5493 |
13 Jun 19 |
nicklas |
var option = new Option(name, job.id); |
5493 |
13 Jun 19 |
nicklas |
option.job = job; |
5493 |
13 Jun 19 |
nicklas |
frm.demuxJobs.options[frm.demuxJobs.length] = option; |
5493 |
13 Jun 19 |
nicklas |
57 |
} |
5493 |
13 Jun 19 |
nicklas |
58 |
|
5493 |
13 Jun 19 |
nicklas |
demux.demuxJobOnChange(); |
5493 |
13 Jun 19 |
nicklas |
60 |
|
5493 |
13 Jun 19 |
nicklas |
Doc.show('step-1'); |
5493 |
13 Jun 19 |
nicklas |
Doc.show('gonext'); |
5493 |
13 Jun 19 |
nicklas |
63 |
|
5493 |
13 Jun 19 |
nicklas |
frm.demuxJobs.focus(); |
5493 |
13 Jun 19 |
nicklas |
65 |
} |
5493 |
13 Jun 19 |
nicklas |
66 |
|
5493 |
13 Jun 19 |
nicklas |
demux.demuxJobOnChange = function() |
5493 |
13 Jun 19 |
nicklas |
68 |
{ |
5493 |
13 Jun 19 |
nicklas |
var frm = document.forms['reggie']; |
5493 |
13 Jun 19 |
nicklas |
var job = frm.demuxJobs[frm.demuxJobs.selectedIndex].job; |
5493 |
13 Jun 19 |
nicklas |
71 |
|
5493 |
13 Jun 19 |
nicklas |
Doc.element('startDate').innerHTML = Reggie.reformatDate(job.started); |
5493 |
13 Jun 19 |
nicklas |
Doc.element('endDate').innerHTML = Reggie.reformatDate(job.ended); |
5493 |
13 Jun 19 |
nicklas |
Doc.element('jobStatus').innerHTML = '<img src="../images/'+JOB_IMAGE[job.status]+'"> '+Strings.encodeTags(job.statusMessage); |
5493 |
13 Jun 19 |
nicklas |
75 |
|
5493 |
13 Jun 19 |
nicklas |
var demuxedSequences = job.demuxedSequences; |
5620 |
20 Sep 19 |
nicklas |
var fcHtml = '<table id="fc-info-table"><tr>'; |
5620 |
20 Sep 19 |
nicklas |
fcHtml += '<th>ID</th>'; |
5620 |
20 Sep 19 |
nicklas |
fcHtml += '<th>PF_READS</th>'; |
5620 |
20 Sep 19 |
nicklas |
fcHtml += '<th>PF_UNUSED_PCT</th>'; |
5620 |
20 Sep 19 |
nicklas |
fcHtml += '<th>PF_NNNN_PCT</th>'; |
5620 |
20 Sep 19 |
nicklas |
fcHtml += '<th>Demultiplex metrics</th>'; |
5620 |
20 Sep 19 |
nicklas |
fcHtml += '<th>Warnings</th></tr>'; |
5493 |
13 Jun 19 |
nicklas |
var fcNames = ''; |
5493 |
13 Jun 19 |
nicklas |
var warningsHtml = ''; |
5493 |
13 Jun 19 |
nicklas |
var skippedTilesHtml = ''; |
5493 |
13 Jun 19 |
nicklas |
for (var dxNo = 0; dxNo < demuxedSequences.length; dxNo++) |
5493 |
13 Jun 19 |
nicklas |
88 |
{ |
5493 |
13 Jun 19 |
nicklas |
var dx = demuxedSequences[dxNo]; |
5493 |
13 Jun 19 |
nicklas |
var fc = dx.seqRun.flowCell; |
5493 |
13 Jun 19 |
nicklas |
91 |
|
5493 |
13 Jun 19 |
nicklas |
var pfReads = dx.PF_READS == null ? '-' : Reggie.formatNumber(dx.PF_READS/1000000, 'M', 2); |
5493 |
13 Jun 19 |
nicklas |
var pfUnused = dx.PF_UNUSED_PCT == null ? '-' : Reggie.formatNumber(dx.PF_UNUSED_PCT, '%', 2); |
5493 |
13 Jun 19 |
nicklas |
var pfNNNN = dx.PF_NNNN_PCT == null ? '-' : Reggie.formatNumber(dx.PF_NNNN_PCT, '%', 2); |
5493 |
13 Jun 19 |
nicklas |
95 |
|
5493 |
13 Jun 19 |
nicklas |
if (fcNames.length > 0) fcNames += ', '; |
5493 |
13 Jun 19 |
nicklas |
fcNames += Strings.encodeTags(fc.FlowCellID); |
5493 |
13 Jun 19 |
nicklas |
98 |
|
5493 |
13 Jun 19 |
nicklas |
fcHtml += '<tr><td>'+Strings.encodeTags(fc.FlowCellID)+'</td>'; |
5493 |
13 Jun 19 |
nicklas |
fcHtml += '<td>' + pfReads + '</td>'; |
5493 |
13 Jun 19 |
nicklas |
fcHtml += '<td>' + pfUnused + ' </td>'; |
5493 |
13 Jun 19 |
nicklas |
fcHtml += '<td>' + pfNNNN + '</td>'; |
5620 |
20 Sep 19 |
nicklas |
103 |
|
5620 |
20 Sep 19 |
nicklas |
fcHtml += '<td>'; |
5620 |
20 Sep 19 |
nicklas |
if (dx.DemultiplexMetrics) |
5620 |
20 Sep 19 |
nicklas |
106 |
{ |
5620 |
20 Sep 19 |
nicklas |
fcHtml += '<span class="link metrics-link" data-file-id="'+dx.DemultiplexMetrics.id+'" title="View metrics data from the demux">'+dx.DemultiplexMetrics.name+'</span>'; |
5620 |
20 Sep 19 |
nicklas |
108 |
} |
5620 |
20 Sep 19 |
nicklas |
fcHtml += '</td>'; |
5620 |
20 Sep 19 |
nicklas |
110 |
|
5493 |
13 Jun 19 |
nicklas |
fcHtml += '<td>'+dx.DEMUX_WARNING.length+'</td>'; |
5493 |
13 Jun 19 |
nicklas |
fcHtml += '</tr>'; |
5493 |
13 Jun 19 |
nicklas |
113 |
|
5493 |
13 Jun 19 |
nicklas |
var pools = fc.pools; |
5526 |
25 Jun 19 |
nicklas |
var poolNames = []; |
5526 |
25 Jun 19 |
nicklas |
var libPlateNames = []; |
5493 |
13 Jun 19 |
nicklas |
for (var poolNo = 0; poolNo < pools.length; poolNo++) |
5493 |
13 Jun 19 |
nicklas |
118 |
{ |
5493 |
13 Jun 19 |
nicklas |
var pool = pools[poolNo]; |
5526 |
25 Jun 19 |
nicklas |
poolNames[poolNames.length] = pool.name; |
5526 |
25 Jun 19 |
nicklas |
if (pool.libPlates) |
5493 |
13 Jun 19 |
nicklas |
122 |
{ |
5526 |
25 Jun 19 |
nicklas |
for (var plateNo = 0; plateNo < pool.libPlates.length; plateNo++) |
5526 |
25 Jun 19 |
nicklas |
124 |
{ |
5526 |
25 Jun 19 |
nicklas |
var plateName = pool.libPlates[plateNo].name; |
5526 |
25 Jun 19 |
nicklas |
if (libPlateNames.indexOf(plateName) == -1) |
5526 |
25 Jun 19 |
nicklas |
127 |
{ |
5526 |
25 Jun 19 |
nicklas |
libPlateNames[libPlateNames.length] = plateName; |
5526 |
25 Jun 19 |
nicklas |
129 |
} |
5526 |
25 Jun 19 |
nicklas |
130 |
} |
5493 |
13 Jun 19 |
nicklas |
131 |
} |
5493 |
13 Jun 19 |
nicklas |
132 |
} |
5493 |
13 Jun 19 |
nicklas |
133 |
|
5493 |
13 Jun 19 |
nicklas |
if (dx.DEMUX_WARNING.length > 0) |
5493 |
13 Jun 19 |
nicklas |
135 |
{ |
5493 |
13 Jun 19 |
nicklas |
for (var warnNo = 0; warnNo < dx.DEMUX_WARNING.length; warnNo++) |
5493 |
13 Jun 19 |
nicklas |
137 |
{ |
5493 |
13 Jun 19 |
nicklas |
warningsHtml += '<li class="warning">'+Strings.encodeTags(fc.FlowCellID)+': '+Strings.encodeTags(dx.DEMUX_WARNING[warnNo]); |
5493 |
13 Jun 19 |
nicklas |
139 |
} |
5493 |
13 Jun 19 |
nicklas |
140 |
} |
5493 |
13 Jun 19 |
nicklas |
141 |
|
5493 |
13 Jun 19 |
nicklas |
if (dx.SKIPPED_TILES.length > 0) |
5493 |
13 Jun 19 |
nicklas |
143 |
{ |
5493 |
13 Jun 19 |
nicklas |
dx.SKIPPED_TILES.sort(); |
5493 |
13 Jun 19 |
nicklas |
var lastLaneNo = 0; |
5493 |
13 Jun 19 |
nicklas |
for (var tileNo = 0; tileNo < dx.SKIPPED_TILES.length; tileNo++) |
5493 |
13 Jun 19 |
nicklas |
147 |
{ |
5493 |
13 Jun 19 |
nicklas |
var tmp = dx.SKIPPED_TILES[tileNo]; |
5493 |
13 Jun 19 |
nicklas |
var i = tmp.indexOf(':'); |
5493 |
13 Jun 19 |
nicklas |
var laneNo = tmp.substring(0, i); |
5493 |
13 Jun 19 |
nicklas |
var tile = tmp.substring(i+1); |
5493 |
13 Jun 19 |
nicklas |
if (lastLaneNo != laneNo) |
5493 |
13 Jun 19 |
nicklas |
153 |
{ |
5493 |
13 Jun 19 |
nicklas |
skippedTilesHtml += '<li class="warning">' + Strings.encodeTags(fc.FlowCellID) + ' - lane ' +laneNo + ': '; |
5493 |
13 Jun 19 |
nicklas |
lastLaneNo = laneNo; |
5493 |
13 Jun 19 |
nicklas |
156 |
} |
5493 |
13 Jun 19 |
nicklas |
else |
5493 |
13 Jun 19 |
nicklas |
158 |
{ |
5493 |
13 Jun 19 |
nicklas |
skippedTilesHtml += ', '; |
5493 |
13 Jun 19 |
nicklas |
160 |
} |
5493 |
13 Jun 19 |
nicklas |
skippedTilesHtml += Strings.encodeTags(tile); |
5493 |
13 Jun 19 |
nicklas |
162 |
} |
5493 |
13 Jun 19 |
nicklas |
163 |
} |
5493 |
13 Jun 19 |
nicklas |
164 |
} |
5493 |
13 Jun 19 |
nicklas |
fcHtml += '</table>'; |
5493 |
13 Jun 19 |
nicklas |
166 |
|
5493 |
13 Jun 19 |
nicklas |
Doc.element('flowCellsInDemux').innerHTML = job.status == 'ERROR' ? fcNames : fcHtml; |
5526 |
25 Jun 19 |
nicklas |
Doc.element('pools').innerHTML = Strings.encodeTags(poolNames.join(', ')); |
5526 |
25 Jun 19 |
nicklas |
Doc.element('libPlates').innerHTML = Strings.encodeTags(libPlateNames.join(', ')) || 'n/a'; |
5493 |
13 Jun 19 |
nicklas |
Doc.element('comments').innerHTML = Strings.encodeTags(job.comments); |
5493 |
13 Jun 19 |
nicklas |
Doc.element('warnings').innerHTML = warningsHtml; |
5493 |
13 Jun 19 |
nicklas |
Doc.element('skippedTiles').innerHTML = skippedTilesHtml; |
5493 |
13 Jun 19 |
nicklas |
Doc.showHide('skippedTilesRow', skippedTilesHtml != ''); |
5620 |
20 Sep 19 |
nicklas |
174 |
|
5620 |
20 Sep 19 |
nicklas |
// Add click handler to file links |
5620 |
20 Sep 19 |
nicklas |
var clickableItems = document.getElementsByClassName('metrics-link'); |
5620 |
20 Sep 19 |
nicklas |
for (var i = 0; i < clickableItems.length; i++) |
5620 |
20 Sep 19 |
nicklas |
178 |
{ |
5620 |
20 Sep 19 |
nicklas |
Events.addEventHandler(clickableItems[i], 'click', Files.viewFileOnClick); |
5620 |
20 Sep 19 |
nicklas |
180 |
} |
5620 |
20 Sep 19 |
nicklas |
181 |
|
5493 |
13 Jun 19 |
nicklas |
182 |
} |
5493 |
13 Jun 19 |
nicklas |
183 |
|
5493 |
13 Jun 19 |
nicklas |
184 |
|
5493 |
13 Jun 19 |
nicklas |
demux.initializeStep2 = function() |
5493 |
13 Jun 19 |
nicklas |
186 |
{ |
5493 |
13 Jun 19 |
nicklas |
var frm = document.forms['reggie']; |
5493 |
13 Jun 19 |
nicklas |
var job = frm.demuxJobs[frm.demuxJobs.selectedIndex].job; |
5493 |
13 Jun 19 |
nicklas |
189 |
|
5493 |
13 Jun 19 |
nicklas |
if (job.partial) |
5493 |
13 Jun 19 |
nicklas |
191 |
{ |
5493 |
13 Jun 19 |
nicklas |
Doc.element('outcomeFailed').disabled = true; |
5493 |
13 Jun 19 |
nicklas |
Wizard.setInputStatus('outcome', 'warning', 'Some libraries have already been confirmed.'); |
5493 |
13 Jun 19 |
nicklas |
194 |
} |
5493 |
13 Jun 19 |
nicklas |
195 |
|
5493 |
13 Jun 19 |
nicklas |
var url = '../DemuxMerge.servlet?ID='+App.getSessionId(); |
5493 |
13 Jun 19 |
nicklas |
url += '&cmd=GetMergedSequences&job='+job.id; |
5797 |
18 Dec 19 |
nicklas |
url += '&pipeline=MIPS'; |
5493 |
13 Jun 19 |
nicklas |
199 |
|
5788 |
13 Dec 19 |
nicklas |
Wizard.showLoadingAnimation('Loading demuxed sequences...'); |
5493 |
13 Jun 19 |
nicklas |
Wizard.asyncJsonRequest(url, demux.mergedSequencesLoaded); |
5493 |
13 Jun 19 |
nicklas |
202 |
} |
5493 |
13 Jun 19 |
nicklas |
203 |
|
5493 |
13 Jun 19 |
nicklas |
demux.mergedSequencesLoaded = function(response) |
5493 |
13 Jun 19 |
nicklas |
205 |
{ |
5493 |
13 Jun 19 |
nicklas |
var frm = document.forms['reggie']; |
5493 |
13 Jun 19 |
nicklas |
var job = frm.demuxJobs[frm.demuxJobs.selectedIndex].job; |
5493 |
13 Jun 19 |
nicklas |
var isError = job.status == 'ERROR'; |
5493 |
13 Jun 19 |
nicklas |
209 |
|
5493 |
13 Jun 19 |
nicklas |
Wizard.setCurrentStep(2); |
5493 |
13 Jun 19 |
nicklas |
Doc.show('goregister'); |
5493 |
13 Jun 19 |
nicklas |
Doc.show('gocancel'); |
5493 |
13 Jun 19 |
nicklas |
213 |
|
5493 |
13 Jun 19 |
nicklas |
var mergedSeq = response.mergedSequences; |
5797 |
18 Dec 19 |
nicklas |
mergedSeq.sort(demux.sortByLibPlate); |
5493 |
13 Jun 19 |
nicklas |
job.mergedSequences = mergedSeq; |
5493 |
13 Jun 19 |
nicklas |
217 |
|
5493 |
13 Jun 19 |
nicklas |
var html = '<table id="mergedSequencesTable">'; |
5493 |
13 Jun 19 |
nicklas |
html += '<thead class="bg-filled-100">'; |
5493 |
13 Jun 19 |
nicklas |
// Header row |
5493 |
13 Jun 19 |
nicklas |
html += '<tr>'; |
5493 |
13 Jun 19 |
nicklas |
html += '<th></th>'; |
5797 |
18 Dec 19 |
nicklas |
html += '<th></th>'; |
5797 |
18 Dec 19 |
nicklas |
html += '<th></th>'; |
5797 |
18 Dec 19 |
nicklas |
html += '<th></th>'; |
5493 |
13 Jun 19 |
nicklas |
html += '<th class="dottedleft"></th>'; |
5802 |
19 Dec 19 |
nicklas |
html += '<th class="dottedleft" colspan="3">Reads</th>'; |
5551 |
12 Aug 19 |
nicklas |
html += '<th class="dottedleft" colspan="2">Actions</th>'; |
5493 |
13 Jun 19 |
nicklas |
html += '<th class="dottedleft">Comment</th>'; |
5493 |
13 Jun 19 |
nicklas |
html += '</tr>'; |
5493 |
13 Jun 19 |
nicklas |
html += '<tr>'; |
5797 |
18 Dec 19 |
nicklas |
html += '<th>Plate</th>'; |
5493 |
13 Jun 19 |
nicklas |
html += '<th>Library</th>'; |
5797 |
18 Dec 19 |
nicklas |
html += '<th>MIPS_Panel</th>'; |
5797 |
18 Dec 19 |
nicklas |
html += '<th>Barcode</th>'; |
5797 |
18 Dec 19 |
nicklas |
html += '<th class="dottedleft">Pool</th>'; |
5493 |
13 Jun 19 |
nicklas |
html += '<th class="dottedleft">READS</th>'; |
5493 |
13 Jun 19 |
nicklas |
html += '<th>PF_READS</th>'; |
5493 |
13 Jun 19 |
nicklas |
html += '<th class="warning-col"></th>'; |
5551 |
12 Aug 19 |
nicklas |
html += '<th class="dottedleft">Flag DNA</th>'; |
5788 |
13 Dec 19 |
nicklas |
html += '<th>Align</th>'; |
5493 |
13 Jun 19 |
nicklas |
html += '<th class="dottedleft"></th>'; |
5493 |
13 Jun 19 |
nicklas |
html += '</tr>'; |
5493 |
13 Jun 19 |
nicklas |
html += '</thead>'; |
5493 |
13 Jun 19 |
nicklas |
html += '<tbody>'; |
5493 |
13 Jun 19 |
nicklas |
246 |
|
5493 |
13 Jun 19 |
nicklas |
var yellowImg = '<img src="../images/yellow-label.png">'; |
5493 |
13 Jun 19 |
nicklas |
var lastPoolName = mergedSeq[0].pools[0].name; |
5493 |
13 Jun 19 |
nicklas |
for (var mergedNo = 0; mergedNo < mergedSeq.length; mergedNo++) |
5493 |
13 Jun 19 |
nicklas |
250 |
{ |
5493 |
13 Jun 19 |
nicklas |
var merged = mergedSeq[mergedNo]; |
5493 |
13 Jun 19 |
nicklas |
var lib = merged.lib; |
5493 |
13 Jun 19 |
nicklas |
var pools = merged.pools; |
5493 |
13 Jun 19 |
nicklas |
var warning = null; |
5493 |
13 Jun 19 |
nicklas |
255 |
|
5493 |
13 Jun 19 |
nicklas |
merged.stratagene = Reggie.isStratagene(merged.name); |
5493 |
13 Jun 19 |
nicklas |
merged.external = Reggie.isExternal(merged.name); |
5493 |
13 Jun 19 |
nicklas |
var isYellow = lib.specimen && lib.specimen.YellowLabel != null; |
5493 |
13 Jun 19 |
nicklas |
var img = isYellow ? yellowImg : ''; |
5493 |
13 Jun 19 |
nicklas |
260 |
|
6716 |
29 Apr 22 |
nicklas |
var reads = Reggie.formatCount(merged.READS, '-'); |
6716 |
29 Apr 22 |
nicklas |
var pfReads = Reggie.formatCount(merged.PF_READS, '-'); |
5493 |
13 Jun 19 |
nicklas |
263 |
|
5493 |
13 Jun 19 |
nicklas |
var flagChecked = false; |
5552 |
12 Aug 19 |
nicklas |
var alignChecked = !merged.stratagene; |
5493 |
13 Jun 19 |
nicklas |
merged.alreadyConfirmed = merged.AnalysisResult != null; |
5493 |
13 Jun 19 |
nicklas |
267 |
|
5493 |
13 Jun 19 |
nicklas |
html += '<tr class="highlight ' + (isYellow ? 'yellow-specimen' : '') + '"'; |
5493 |
13 Jun 19 |
nicklas |
if (pools[0].name != lastPoolName) |
5493 |
13 Jun 19 |
nicklas |
270 |
{ |
5493 |
13 Jun 19 |
nicklas |
lastPoolName = pools[0].name; |
5493 |
13 Jun 19 |
nicklas |
html += 'style="border-top: 1px solid #000000;"'; |
5493 |
13 Jun 19 |
nicklas |
273 |
} |
5797 |
18 Dec 19 |
nicklas |
html += '><td>'+Strings.encodeTags(lib.bioWell.bioPlate.name+' '+lib.bioWell.location)+'</td>'; |
5797 |
18 Dec 19 |
nicklas |
html += '<td class="prompt if-yellow">'+img+Strings.encodeTags(merged.name)+'</td>'; |
5797 |
18 Dec 19 |
nicklas |
html += '<td>'+Strings.encodeTags(lib.MIPSPanel)+'</td>'; |
5797 |
18 Dec 19 |
nicklas |
html += '<td>'+Strings.encodeTags(lib.barcode.name)+'</td>'; |
5493 |
13 Jun 19 |
nicklas |
html += '<td class="dottedleft">'; |
5493 |
13 Jun 19 |
nicklas |
for (var poolNo = 0; poolNo < pools.length; poolNo++) |
5493 |
13 Jun 19 |
nicklas |
280 |
{ |
5493 |
13 Jun 19 |
nicklas |
if (poolNo > 0) html += ', '; |
5493 |
13 Jun 19 |
nicklas |
html += Strings.encodeTags(pools[poolNo].name); |
5493 |
13 Jun 19 |
nicklas |
283 |
} |
5493 |
13 Jun 19 |
nicklas |
html += '</td>'; |
5493 |
13 Jun 19 |
nicklas |
html += '<td class="dottedleft">'+reads+'</td>'; |
5493 |
13 Jun 19 |
nicklas |
html += '<td>'+pfReads+'</td>'; |
5493 |
13 Jun 19 |
nicklas |
html += '<td class="warning-col">'; |
5802 |
19 Dec 19 |
nicklas |
if (merged.PF_READS == null || merged.PF_READS < 10000) |
5802 |
19 Dec 19 |
nicklas |
289 |
{ |
5802 |
19 Dec 19 |
nicklas |
html += '<img src="../images/warning.png" title="Less than 10k reads passed filter">'; |
5802 |
19 Dec 19 |
nicklas |
291 |
} |
5493 |
13 Jun 19 |
nicklas |
html += '</td>'; |
5493 |
13 Jun 19 |
nicklas |
293 |
|
5493 |
13 Jun 19 |
nicklas |
if (merged.alreadyConfirmed) |
5493 |
13 Jun 19 |
nicklas |
295 |
{ |
5551 |
12 Aug 19 |
nicklas |
html += '<td class="dottedleft" colspan="2"></td>'; |
5493 |
13 Jun 19 |
nicklas |
html += '<td class="dottedleft italic comment" style="padding-left: 2px;">Already confirmed</td>'; |
5493 |
13 Jun 19 |
nicklas |
298 |
} |
5493 |
13 Jun 19 |
nicklas |
else |
5493 |
13 Jun 19 |
nicklas |
300 |
{ |
5493 |
13 Jun 19 |
nicklas |
// Do not allow flagging external or stratagene |
5493 |
13 Jun 19 |
nicklas |
if (merged.stratagene || merged.external) |
5493 |
13 Jun 19 |
nicklas |
303 |
{ |
5493 |
13 Jun 19 |
nicklas |
html += '<td class="dottedleft">-</td>'; |
5493 |
13 Jun 19 |
nicklas |
305 |
} |
5493 |
13 Jun 19 |
nicklas |
else |
5493 |
13 Jun 19 |
nicklas |
307 |
{ |
5493 |
13 Jun 19 |
nicklas |
html += '<td class="dottedleft"><input type="checkbox" name="flag.'+merged.id+'"'+(flagChecked ? ' checked':'')+'></td>'; |
5493 |
13 Jun 19 |
nicklas |
309 |
} |
5493 |
13 Jun 19 |
nicklas |
310 |
|
5788 |
13 Dec 19 |
nicklas |
html += '<td><input type="checkbox" name="mipsAlign.'+merged.id+'" '+(alignChecked ? ' checked':'')+'></td>'; |
5493 |
13 Jun 19 |
nicklas |
html += '<td class="dottedleft comment"><input type="text" name="comment.'+merged.id+'"></td>'; |
5493 |
13 Jun 19 |
nicklas |
313 |
} |
5493 |
13 Jun 19 |
nicklas |
html += '</tr>'; |
5493 |
13 Jun 19 |
nicklas |
315 |
} |
5493 |
13 Jun 19 |
nicklas |
html += '</tbody>'; |
5493 |
13 Jun 19 |
nicklas |
html += '</table>'; |
5493 |
13 Jun 19 |
nicklas |
Doc.element('mergedSequences').innerHTML = html; |
5493 |
13 Jun 19 |
nicklas |
319 |
|
5493 |
13 Jun 19 |
nicklas |
if (isError) |
5493 |
13 Jun 19 |
nicklas |
321 |
{ |
5493 |
13 Jun 19 |
nicklas |
Doc.element('outcomeSuccessful').disabled = true; |
5493 |
13 Jun 19 |
nicklas |
Doc.element('outcomeFailed').checked = true; |
5493 |
13 Jun 19 |
nicklas |
frm.deleteItemsCreatedByFailedJob.checked = true; |
5493 |
13 Jun 19 |
nicklas |
frm.demuxAgain.checked = true; |
5493 |
13 Jun 19 |
nicklas |
demux.outcomeOnChange(); |
5493 |
13 Jun 19 |
nicklas |
327 |
} |
5493 |
13 Jun 19 |
nicklas |
328 |
} |
5493 |
13 Jun 19 |
nicklas |
329 |
|
5493 |
13 Jun 19 |
nicklas |
330 |
/** |
5493 |
13 Jun 19 |
nicklas |
Sort by the name of the first pool. |
5493 |
13 Jun 19 |
nicklas |
332 |
*/ |
5493 |
13 Jun 19 |
nicklas |
demux.sortByPool = function(a, b) |
5493 |
13 Jun 19 |
nicklas |
334 |
{ |
5493 |
13 Jun 19 |
nicklas |
var p1 = a.pools[0].name; |
5493 |
13 Jun 19 |
nicklas |
var p2 = b.pools[0].name; |
5493 |
13 Jun 19 |
nicklas |
if (p1 < p2) return -1; |
5493 |
13 Jun 19 |
nicklas |
if (p1 > p2) return 1; |
5493 |
13 Jun 19 |
nicklas |
if (a.name < b.name) return -1; |
5493 |
13 Jun 19 |
nicklas |
if (a.name > b.name) return 1; |
5493 |
13 Jun 19 |
nicklas |
return a.id - b.id; |
5493 |
13 Jun 19 |
nicklas |
342 |
} |
5797 |
18 Dec 19 |
nicklas |
343 |
|
5797 |
18 Dec 19 |
nicklas |
344 |
/** |
5797 |
18 Dec 19 |
nicklas |
Sort by library plate location. |
5797 |
18 Dec 19 |
nicklas |
346 |
*/ |
5797 |
18 Dec 19 |
nicklas |
demux.sortByLibPlate = function(a, b) |
5797 |
18 Dec 19 |
nicklas |
348 |
{ |
5797 |
18 Dec 19 |
nicklas |
var p1 = a.lib.bioWell.bioPlate.name; |
5797 |
18 Dec 19 |
nicklas |
var p2 = b.lib.bioWell.bioPlate.name; |
5797 |
18 Dec 19 |
nicklas |
if (p1 < p2) return -1; |
5797 |
18 Dec 19 |
nicklas |
if (p1 > p2) return 1; |
5797 |
18 Dec 19 |
nicklas |
var w1 = a.lib.bioWell; |
5797 |
18 Dec 19 |
nicklas |
var w2 = b.lib.bioWell; |
5797 |
18 Dec 19 |
nicklas |
if (w1.column != w2.column) return w1.column - w2.column; |
5797 |
18 Dec 19 |
nicklas |
return w1.row - w2.row; |
5797 |
18 Dec 19 |
nicklas |
357 |
} |
5493 |
13 Jun 19 |
nicklas |
358 |
|
5493 |
13 Jun 19 |
nicklas |
demux.outcomeOnChange = function() |
5493 |
13 Jun 19 |
nicklas |
360 |
{ |
5493 |
13 Jun 19 |
nicklas |
var frm = document.forms['reggie']; |
5493 |
13 Jun 19 |
nicklas |
var failed = Doc.element('outcomeFailed').checked; |
5493 |
13 Jun 19 |
nicklas |
var deleteItems = frm.deleteItemsCreatedByFailedJob.checked; |
5493 |
13 Jun 19 |
nicklas |
frm.demuxAgain.disabled = !failed; |
5493 |
13 Jun 19 |
nicklas |
frm.deleteItemsCreatedByFailedJob.disabled = !failed; |
5493 |
13 Jun 19 |
nicklas |
if (frm.demuxAgain.disabled) frm.demuxAgain.checked = false; |
5493 |
13 Jun 19 |
nicklas |
if (frm.deleteItemsCreatedByFailedJob.disabled) frm.deleteItemsCreatedByFailedJob.checked = false; |
5493 |
13 Jun 19 |
nicklas |
368 |
|
5493 |
13 Jun 19 |
nicklas |
var job = frm.demuxJobs[frm.demuxJobs.selectedIndex].job; |
5493 |
13 Jun 19 |
nicklas |
var mergedSequences = job.mergedSequences; |
5493 |
13 Jun 19 |
nicklas |
371 |
|
5493 |
13 Jun 19 |
nicklas |
for (var mergeNo = 0; mergeNo < mergedSequences.length; mergeNo++) |
5493 |
13 Jun 19 |
nicklas |
373 |
{ |
5493 |
13 Jun 19 |
nicklas |
var merge = mergedSequences[mergeNo]; |
5493 |
13 Jun 19 |
nicklas |
if (frm['flag.'+merge.id]) |
5493 |
13 Jun 19 |
nicklas |
376 |
{ |
5493 |
13 Jun 19 |
nicklas |
frm['flag.'+merge.id].disabled = failed; |
5493 |
13 Jun 19 |
nicklas |
demux.resetCheckbox(frm['flag.'+merge.id]); |
5493 |
13 Jun 19 |
nicklas |
379 |
} |
5788 |
13 Dec 19 |
nicklas |
if (frm['mipsAlign.'+merge.id]) |
5493 |
13 Jun 19 |
nicklas |
381 |
{ |
5788 |
13 Dec 19 |
nicklas |
frm['mipsAlign.'+merge.id].disabled = failed; |
5788 |
13 Dec 19 |
nicklas |
demux.resetCheckbox(frm['mipsAlign.'+merge.id]); |
5493 |
13 Jun 19 |
nicklas |
384 |
} |
5493 |
13 Jun 19 |
nicklas |
if (frm['comment.'+merge.id]) |
5493 |
13 Jun 19 |
nicklas |
386 |
{ |
5493 |
13 Jun 19 |
nicklas |
frm['comment.'+merge.id].disabled = deleteItems; |
5493 |
13 Jun 19 |
nicklas |
388 |
} |
5493 |
13 Jun 19 |
nicklas |
389 |
} |
5493 |
13 Jun 19 |
nicklas |
390 |
} |
5493 |
13 Jun 19 |
nicklas |
391 |
|
5493 |
13 Jun 19 |
nicklas |
392 |
/** |
5493 |
13 Jun 19 |
nicklas |
A disabled checkbox is forced to be unchecked, the old value is stored in |
5493 |
13 Jun 19 |
nicklas |
'oldChecked'. An enabled checkbox with 'oldChecked' set is checked. |
5493 |
13 Jun 19 |
nicklas |
395 |
*/ |
5493 |
13 Jun 19 |
nicklas |
demux.resetCheckbox = function(checkbox) |
5493 |
13 Jun 19 |
nicklas |
397 |
{ |
5493 |
13 Jun 19 |
nicklas |
if (checkbox.disabled) |
5493 |
13 Jun 19 |
nicklas |
399 |
{ |
5493 |
13 Jun 19 |
nicklas |
checkbox.oldChecked = checkbox.checked; |
5493 |
13 Jun 19 |
nicklas |
checkbox.checked = false; |
5493 |
13 Jun 19 |
nicklas |
402 |
} |
5493 |
13 Jun 19 |
nicklas |
else if (checkbox.oldChecked != null) |
5493 |
13 Jun 19 |
nicklas |
404 |
{ |
5493 |
13 Jun 19 |
nicklas |
checkbox.checked = checkbox.oldChecked; |
5493 |
13 Jun 19 |
nicklas |
checkbox.oldChecked = null; |
5493 |
13 Jun 19 |
nicklas |
407 |
} |
5493 |
13 Jun 19 |
nicklas |
408 |
} |
5493 |
13 Jun 19 |
nicklas |
409 |
|
5493 |
13 Jun 19 |
nicklas |
demux.submit = function() |
5493 |
13 Jun 19 |
nicklas |
411 |
{ |
5493 |
13 Jun 19 |
nicklas |
412 |
|
5493 |
13 Jun 19 |
nicklas |
var frm = document.forms['reggie']; |
5493 |
13 Jun 19 |
nicklas |
var failed = Doc.element('outcomeFailed').checked; |
5493 |
13 Jun 19 |
nicklas |
var submitInfo = {}; |
5493 |
13 Jun 19 |
nicklas |
submitInfo.failed = failed; |
5493 |
13 Jun 19 |
nicklas |
submitInfo.deleteItemsCreatedByFailedJob = frm.deleteItemsCreatedByFailedJob.checked; |
5493 |
13 Jun 19 |
nicklas |
submitInfo.demuxAgain = frm.demuxAgain.checked; |
5493 |
13 Jun 19 |
nicklas |
419 |
|
5493 |
13 Jun 19 |
nicklas |
var job = frm.demuxJobs[frm.demuxJobs.selectedIndex].job; |
5493 |
13 Jun 19 |
nicklas |
var demuxedSequences = job.demuxedSequences; |
5493 |
13 Jun 19 |
nicklas |
var mergedSequences = job.mergedSequences; |
5493 |
13 Jun 19 |
nicklas |
423 |
|
5493 |
13 Jun 19 |
nicklas |
var dx = []; |
5493 |
13 Jun 19 |
nicklas |
submitInfo.demuxedSequences = dx; |
5493 |
13 Jun 19 |
nicklas |
for (var demuxNo = 0; demuxNo < demuxedSequences.length; demuxNo++) |
5493 |
13 Jun 19 |
nicklas |
427 |
{ |
5493 |
13 Jun 19 |
nicklas |
var tmp = {}; |
5493 |
13 Jun 19 |
nicklas |
tmp.id = demuxedSequences[demuxNo].id; |
5493 |
13 Jun 19 |
nicklas |
dx[dx.length] = tmp; |
5493 |
13 Jun 19 |
nicklas |
431 |
} |
5493 |
13 Jun 19 |
nicklas |
432 |
|
5493 |
13 Jun 19 |
nicklas |
var merged = []; |
5493 |
13 Jun 19 |
nicklas |
submitInfo.mergedSequences = merged; |
5493 |
13 Jun 19 |
nicklas |
for (var mergeNo = 0; mergeNo < mergedSequences.length; mergeNo++) |
5493 |
13 Jun 19 |
nicklas |
436 |
{ |
5493 |
13 Jun 19 |
nicklas |
var merge = mergedSequences[mergeNo]; |
5493 |
13 Jun 19 |
nicklas |
if (!merge.alreadyConfirmed) |
5493 |
13 Jun 19 |
nicklas |
439 |
{ |
5493 |
13 Jun 19 |
nicklas |
var tmp = {}; |
5493 |
13 Jun 19 |
nicklas |
tmp.id = merge.id; |
5493 |
13 Jun 19 |
nicklas |
tmp.flag = frm['flag.'+merge.id] && frm['flag.'+merge.id].checked; |
5788 |
13 Dec 19 |
nicklas |
tmp.mipsAlign = frm['mipsAlign.'+merge.id].checked; |
5493 |
13 Jun 19 |
nicklas |
tmp.comment = frm['comment.'+merge.id].value; |
5493 |
13 Jun 19 |
nicklas |
merged[merged.length] = tmp; |
5493 |
13 Jun 19 |
nicklas |
446 |
} |
5493 |
13 Jun 19 |
nicklas |
447 |
} |
5493 |
13 Jun 19 |
nicklas |
448 |
|
5493 |
13 Jun 19 |
nicklas |
var url = '../DemuxMerge.servlet?ID='+App.getSessionId(); |
5551 |
12 Aug 19 |
nicklas |
url += '&cmd=RegisterDemuxAndMerge&pipeline=MIPS'; |
5493 |
13 Jun 19 |
nicklas |
451 |
|
5493 |
13 Jun 19 |
nicklas |
Wizard.showLoadingAnimation('Performing registration...'); |
5493 |
13 Jun 19 |
nicklas |
Wizard.asyncJsonRequest(url, demux.submissionResults, 'POST', JSON.stringify(submitInfo)); |
5493 |
13 Jun 19 |
nicklas |
454 |
} |
5493 |
13 Jun 19 |
nicklas |
455 |
|
5493 |
13 Jun 19 |
nicklas |
demux.submissionResults = function(response) |
5493 |
13 Jun 19 |
nicklas |
457 |
{ |
5493 |
13 Jun 19 |
nicklas |
Wizard.showFinalMessage(response.messages); |
5493 |
13 Jun 19 |
nicklas |
Doc.show('gorestart'); |
5493 |
13 Jun 19 |
nicklas |
460 |
} |
5493 |
13 Jun 19 |
nicklas |
461 |
|
5493 |
13 Jun 19 |
nicklas |
462 |
|
5493 |
13 Jun 19 |
nicklas |
return demux; |
5493 |
13 Jun 19 |
nicklas |
464 |
}(); |
5493 |
13 Jun 19 |
nicklas |
465 |
|
5493 |
13 Jun 19 |
nicklas |
Doc.onLoad(Demux.initPage); |
5493 |
13 Jun 19 |
nicklas |
467 |
|