Skip to content

Commit d642007

Browse files
committed
Better handling of single- vs. dual-indexes for 10x import
1 parent 92eccfc commit d642007

File tree

2 files changed

+31
-33
lines changed

2 files changed

+31
-33
lines changed

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

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Ext4.define('SingleCell.panel.LibraryExportPanel', {
162162
r[0] = 'VDJ';
163163
r.unshift(val);
164164
}
165-
else if (val.startsWith('H')){
165+
else if (val.startsWith('H') || val.startsWith('M')){
166166
val = val.substr(1);
167167
val = val.replace('_', '-');
168168
r[0] = 'HTO';
@@ -581,7 +581,7 @@ Ext4.define('SingleCell.panel.LibraryExportPanel', {
581581
schemaName: 'singlecell',
582582
queryName: 'cdna_libraries',
583583
sort: 'plateId,well/addressByColumn',
584-
columns: 'rowid,plateid' +
584+
columns: 'rowid,plateid,cells' +
585585
',readsetId,readsetId/name,readsetId/application,readsetId/librarytype,readsetId/barcode5,readsetId/barcode5/sequence,readsetId/barcode3,readsetId/barcode3/sequence,readsetId/totalFiles,readsetId/concentration' +
586586
',tcrReadsetId,tcrReadsetId/name,tcrReadsetId/application,tcrReadsetId/librarytype,tcrReadsetId/barcode5,tcrReadsetId/barcode5/sequence,tcrReadsetId/barcode3,tcrReadsetId/barcode3/sequence,tcrReadsetId/totalFiles,tcrReadsetId/concentration' +
587587
',hashingReadsetId,hashingReadsetId/name,hashingReadsetId/application,hashingReadsetId/librarytype,hashingReadsetId/barcode5,hashingReadsetId/barcode5/sequence,hashingReadsetId/barcode3,hashingReadsetId/barcode3/sequence,hashingReadsetId/totalFiles,hashingReadsetId/concentration' +
@@ -598,6 +598,14 @@ Ext4.define('SingleCell.panel.LibraryExportPanel', {
598598
}
599599

600600
var sortedRows = results.rows;
601+
var totalCellsByReadset = {};
602+
Ext4.Array.forEach(results.rows, function(row){
603+
if (row.plateId && row.cells) {
604+
totalCellsByReadset[row.plateId] = totalCellsByReadset[row.plateId] || 0;
605+
totalCellsByReadset[row.plateId] = totalCellsByReadset[row.plateId] + row.cells;
606+
}
607+
}, this);
608+
601609
if (expectedPairs) {
602610
sortedRows = [];
603611
var missingRows = [];
@@ -874,10 +882,14 @@ Ext4.define('SingleCell.panel.LibraryExportPanel', {
874882

875883
var delim = instrument.startsWith('Novogene') ? '\t' : ',';
876884
Ext4.Array.forEach(sortedRows, function (r) {
877-
processType(readsetIds, rows, r, 'readsetId', 'GEX', 500, 0.01, 'G', null, false, 70, runMap);
878-
processType(readsetIds, rows, r, 'tcrReadsetId', 'TCR', 700, 0.01, 'T', null, false, 45, runMap);
879-
processType(readsetIds, rows, r, 'hashingReadsetId', 'HTO', 182, 0.05, 'H', 'Cell hashing, 190bp amplicon. Please QC individually and pool in equal amounts per lane', true, 20, runMap);
880-
processType(readsetIds, rows, r, 'citeseqReadsetId', 'CITE', 182, 0.05, 'C', 'CITE-Seq, 190bp amplicon. Please QC individually and pool in equal amounts per lane', false, 20, runMap);
885+
var totalCells = totalCellsByReadset[r.plateId];
886+
console.log(totalCells);
887+
var gexData = totalCells > 15000 ? 70 : 50;
888+
var tcrData = totalCells > 15000 ? 45 : 25;
889+
processType(readsetIds, rows, r, 'readsetId', 'GEX', 500, 0.01, 'G', null, false, gexData, runMap, totalCells);
890+
processType(readsetIds, rows, r, 'tcrReadsetId', 'TCR', 700, 0.01, 'T', null, false, tcrData, runMap, totalCells);
891+
processType(readsetIds, rows, r, 'hashingReadsetId', 'HTO', 182, 0.05, 'H', 'Cell hashing, 190bp amplicon. Please QC individually and pool in equal amounts per lane', true, 20, runMap, totalCells);
892+
processType(readsetIds, rows, r, 'citeseqReadsetId', 'CITE', 182, 0.05, 'C', 'CITE-Seq, 190bp amplicon. Please QC individually and pool in equal amounts per lane', false, 20, runMap, totalCells);
881893
}, this);
882894

883895
//add missing barcodes:

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

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ Ext4.define('SingleCell.panel.PoolImportPanel', {
201201
val = val.replace(/^MS[- ]Idx/ig, 'MultiSeq-Idx');
202202
val = val.replace(/^MultiSeq[- ]Idx[- ]RP/ig, 'MultiSeq-Idx-RP');
203203

204+
if (val.length() <= 3) {
205+
val = panel.down('#useDualIndex').getValue() ? 'SI-TN-' + val : 'SI-NA-' + val;
206+
}
207+
204208
return val;
205209
}
206210
else if (val && type === 'BioLegend') {
@@ -227,7 +231,7 @@ Ext4.define('SingleCell.panel.PoolImportPanel', {
227231
return null;
228232
}
229233

230-
var barcodeSeries = panel.down('#citeseqBarcodeSeries').getValue();
234+
var barcodeSeries = panel.down('#useDualIndex').getValue() ? 'SI-TN-' + val : 'SI-NA-' + val;
231235
val = val.toUpperCase();
232236
var re = new RegExp('^' + barcodeSeries + '-', 'i');
233237
if (!val.match(re)) {
@@ -247,7 +251,7 @@ Ext4.define('SingleCell.panel.PoolImportPanel', {
247251
return;
248252
}
249253

250-
var barcodeSeries = panel.down('#barcodeSeries').getValue();
254+
var barcodeSeries = panel.down('#useDualIndex').getValue() ? 'SI-TT-' + val : 'SI-GA-' + val;
251255
val = val.toUpperCase();
252256
var re = new RegExp('^' + barcodeSeries + '-', 'i');
253257
if (!val.match(re)) {
@@ -499,27 +503,7 @@ Ext4.define('SingleCell.panel.PoolImportPanel', {
499503
},{
500504
xtype: 'checkbox',
501505
fieldLabel: 'Use 10x V2/HT (Dual Index)',
502-
itemId: 'useDualIndex',
503-
listeners: {
504-
change: function(field, val){
505-
field.up('panel').down('#barcodeSeries').setValue(field.getValue() ? 'SI-TT' : 'SI-GA');
506-
field.up('panel').down('#citeseqBarcodeSeries').setValue(field.getValue() ? 'SI-TN' : 'SI-NA');
507-
}
508-
}
509-
},{
510-
xtype: 'ldk-simplecombo',
511-
fieldLabel: '10x GEX/TCR Barcode Series',
512-
itemId: 'barcodeSeries',
513-
forceSelection: true,
514-
storeValues: ['SI-GA', 'SI-TT'],
515-
value: 'SI-GA'
516-
},{
517-
xtype: 'ldk-simplecombo',
518-
fieldLabel: '10x Cite-Seq Barcode Series',
519-
itemId: 'citeseqBarcodeSeries',
520-
forceSelection: true,
521-
storeValues: ['SI-NA', 'SI-TN'],
522-
value: 'SI-NA'
506+
itemId: 'useDualIndex'
523507
},{
524508
xtype: 'ldk-simplelabkeycombo',
525509
fieldLabel: 'Hashing Type',
@@ -927,7 +911,6 @@ Ext4.define('SingleCell.panel.PoolImportPanel', {
927911
subjectid = subjectid.length === 1 ? subjectid[0] : null;
928912

929913
const requireConc = this.down('#requireConc').getValue();
930-
const isDualIndex = this.down('#useDualIndex').getValue();
931914

932915
if (idxValues.length === 1){
933916
if (requireConc && !conc[0]) {
@@ -936,11 +919,14 @@ Ext4.define('SingleCell.panel.PoolImportPanel', {
936919

937920
var guid = LABKEY.Utils.generateUUID();
938921
LDK.Assert.assertNotEmpty('Expected non-null workbook', workbook);
922+
923+
// These are the dual-index 10x barcode series.
924+
var isDualIndex = idxValues[0].startsWith('SI-TN') || idxValues[0].startsWith('SI-TT');
925+
939926
readsetRows.push({
940927
name: poolName + '-' + type,
941-
// SI- is a proxy for being 10x (i.e. not multiseq)
942-
barcode5: isDualIndex && idxValues[0].startsWith('SI-') ? idxValues[0] + '_F' : idxValues[0],
943-
barcode3: isDualIndex && idxValues[0].startsWith('SI-') ? idxValues[0] + '_R' : null,
928+
barcode5: isDualIndex ? idxValues[0] + '_F' : idxValues[0],
929+
barcode3: isDualIndex ? idxValues[0] + '_R' : null,
944930
concentration: conc[0],
945931
fragmentSize: fragment[0],
946932
platform: 'ILLUMINA',

0 commit comments

Comments
 (0)