Skip to content

Commit db93852

Browse files
committed
Add feature to auto-split cell/lane for 10x import
1 parent 04a31f4 commit db93852

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

singlecell/resources/web/singlecell/panel/PoolImportPanel.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,12 @@ Ext4.define('SingleCell.panel.PoolImportPanel', {
606606
fieldLabel: 'Use 10x V2/HT (Dual Index)',
607607
itemId: 'useDualIndex',
608608
checked: true
609+
},{
610+
xtype: 'checkbox',
611+
fieldLabel: '# Cells Indicates Totla Per Lane',
612+
helpPopup: '',
613+
itemId: 'cellsReportedAsTotalPerLane',
614+
checked: true
609615
},{
610616
xtype: 'checkbox',
611617
fieldLabel: 'Use MS (Dual Index)',
@@ -822,6 +828,7 @@ Ext4.define('SingleCell.panel.PoolImportPanel', {
822828

823829
data[col.name] = cell;
824830

831+
// This indicates that the first row from the plateId has a value for cells, but this does not.
825832
if (!cell && col.name === 'cells' && lastValueByCol[colIdx]) {
826833
doSplitCellsByPool = true;
827834
}
@@ -832,7 +839,8 @@ Ext4.define('SingleCell.panel.PoolImportPanel', {
832839
}, this);
833840

834841
//split cells across rows
835-
if (doSplitCellsByPool) {
842+
var cellsReportedAsTotalPerLane = this.down('#cellsReportedAsTotalPerLane').getValue();
843+
if (cellsReportedAsTotalPerLane || doSplitCellsByPool) {
836844
var cellCountMap = {};
837845
Ext4.Array.forEach(ret, function(data) {
838846
if (data.plateId) {
@@ -844,8 +852,18 @@ Ext4.define('SingleCell.panel.PoolImportPanel', {
844852
Ext4.Array.forEach(Ext4.Object.getKeys(cellCountMap), function(plateId) {
845853
var arr = cellCountMap[plateId];
846854
var size = arr.length;
855+
856+
// Two allowable patterns:
857+
// 1) the first row has a value and rest are blank. Take this as the lane total
858+
// 2) all rows have the same value, so take the first as the lane total
847859
arr = Ext4.Array.remove(arr, null);
848860
arr = Ext4.Array.remove(arr, '');
861+
862+
// Only attempt to collapse if this was selected:
863+
if (cellsReportedAsTotalPerLane) {
864+
arr = Ext4.unique(arr);
865+
}
866+
849867
if (arr.length === 1) {
850868
cellCountMap[plateId] = arr[0] / size;
851869
}

0 commit comments

Comments
 (0)