Skip to content

Commit c7f5b84

Browse files
committed
Add ability to auto-assign libraries to lane
1 parent 55379fd commit c7f5b84

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

singlecell/resources/web/singlecell/panel/LibraryExportPanel.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,17 @@ Ext4.define('SingleCell.panel.LibraryExportPanel', {
135135
fieldLabel: 'Hashing Library Prefix',
136136
labelWidth: 160,
137137
value: 'H'
138+
},{
139+
xtype: 'checkbox',
140+
itemId: 'autoAssignLane',
141+
fieldLabel: 'Auto-assign to Lanes',
142+
helpPopup: 'If the lane is null, samples will be auto-assigned to lanes, starting with 1, and incrementing whenever Max Data Per Lane is reached',
143+
checked: true
144+
},{
145+
xtype: 'ldk-numberfield',
146+
itemId: 'laneDataMax',
147+
fieldLabel: 'Max Data Per Lane',
148+
value: 700
138149
},{
139150
xtype: 'ldk-numberfield',
140151
itemId: 'defaultVolume',
@@ -551,6 +562,8 @@ Ext4.define('SingleCell.panel.LibraryExportPanel', {
551562
const includeBlanks = btn.up('singlecell-libraryexportpanel').down('#includeBlanks').getValue();
552563
const doReverseComplement = btn.up('singlecell-libraryexportpanel').doReverseComplement;
553564
const hashingPrefix = btn.up('singlecell-libraryexportpanel').down('#hashingPrefix') ? btn.up('singlecell-libraryexportpanel').down('#hashingPrefix').getValue() : 'H';
565+
const autoAssignLane = btn.up('singlecell-libraryexportpanel').down('#autoAssignLane') ? btn.up('singlecell-libraryexportpanel').down('#autoAssignLane').getValue() : false;
566+
const laneDataMax = btn.up('singlecell-libraryexportpanel').down('#laneDataMax') ? btn.up('singlecell-libraryexportpanel').down('#laneDataMax').getValue() : -1;
554567

555568
var isMatchingApplication = function(application, libraryType, readsetApplication, rowLevelApplication){
556569
if (!application && !rowLevelApplication){
@@ -606,6 +619,8 @@ Ext4.define('SingleCell.panel.LibraryExportPanel', {
606619

607620
var sortedRows = results.rows;
608621
var totalCellsByReadset = {};
622+
let currentLane = 1;
623+
let dataInActiveLane = 0;
609624
Ext4.Array.forEach(results.rows, function(row){
610625
if (row.plateId && row['sortId/cells']) {
611626
totalCellsByReadset[row.plateId] = totalCellsByReadset[row.plateId] || 0;
@@ -839,6 +854,20 @@ Ext4.define('SingleCell.panel.LibraryExportPanel', {
839854
//barcode5s = [barcode5s.join(',')];
840855
}
841856

857+
// The goal is to assign samples per lane, incrementing as we reach lane capacity
858+
if (totalData && autoAssignLane && !r.laneAssignment) {
859+
const dataAfterLane = dataInActiveLane + totalData;
860+
if (dataAfterLane > laneDataMax) {
861+
currentLane++;
862+
dataInActiveLane = totalData;
863+
}
864+
else {
865+
dataInActiveLane = dataAfterLane;
866+
}
867+
868+
r.laneAssignment = currentLane;
869+
}
870+
842871
Ext4.Array.forEach(barcode5s, function (bc, idx) {
843872
bc = doRC ? doReverseComplement(bc) : bc;
844873
const bc3 = barcode3s.length ? barcode3s[idx] : '';

0 commit comments

Comments
 (0)