Skip to content

Commit 8119303

Browse files
committed
Add calculated field and code to catch HTO libraries with single HTO
1 parent 45d7f14 commit 8119303

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ Ext4.define('SingleCell.panel.LibraryExportPanel', {
634634
',readsetId,readsetId/name,readsetId/application,readsetId/librarytype,readsetId/barcode5,readsetId/barcode5/sequence,readsetId/barcode3,readsetId/barcode3/sequence,readsetId/totalFiles,readsetId/concentration' +
635635
',tcrReadsetId,tcrReadsetId/name,tcrReadsetId/application,tcrReadsetId/librarytype,tcrReadsetId/barcode5,tcrReadsetId/barcode5/sequence,tcrReadsetId/barcode3,tcrReadsetId/barcode3/sequence,tcrReadsetId/totalFiles,tcrReadsetId/concentration' +
636636
',hashingReadsetId,hashingReadsetId/name,hashingReadsetId/application,hashingReadsetId/librarytype,hashingReadsetId/barcode5,hashingReadsetId/barcode5/sequence,hashingReadsetId/barcode3,hashingReadsetId/barcode3/sequence,hashingReadsetId/totalFiles,hashingReadsetId/concentration' +
637-
',citeseqReadsetId,citeseqReadsetId/name,citeseqReadsetId/application,citeseqReadsetId/librarytype,citeseqReadsetId/barcode5,citeseqReadsetId/barcode5/sequence,citeseqReadsetId/barcode3,citeseqReadsetId/barcode3/sequence,citeseqReadsetId/totalFiles,citeseqReadsetId/concentration',
637+
',citeseqReadsetId,citeseqReadsetId/name,citeseqReadsetId/application,citeseqReadsetId/librarytype,citeseqReadsetId/barcode5,citeseqReadsetId/barcode5/sequence,citeseqReadsetId/barcode3,citeseqReadsetId/barcode3/sequence,citeseqReadsetId/totalFiles,citeseqReadsetId/concentration,uniqueHtos',
638638
scope: this,
639639
filterArray: [LABKEY.Filter.create('plateId', plateIds.join(';'), LABKEY.Filter.Types.IN)],
640640
failure: LDK.Utils.getErrorCallback(),
@@ -661,6 +661,7 @@ Ext4.define('SingleCell.panel.LibraryExportPanel', {
661661
if (expectedPairs) {
662662
sortedRows = [];
663663
var missingRows = [];
664+
var errorMsgs = [];
664665
Ext4.Array.forEach(expectedPairs, function(p){
665666
var found = false;
666667
Ext4.Array.forEach(results.rows, function(row){
@@ -679,6 +680,11 @@ Ext4.define('SingleCell.panel.LibraryExportPanel', {
679680
if (row['hashingReadsetId'] && row['hashingReadsetId/application'] && row['hashingReadsetId/application'] === 'Cell Hashing') {
680681
sortedRows.push(Ext4.apply({targetApplication: '10x HTO', laneAssignment: (p.length > 2 ? p[2] : null), plateAlias: (p.length > 3 ? p[3] : null)}, row));
681682
found = true;
683+
684+
if (row.uniqueHtos <=1) {
685+
errorMsgs.push(row['hashingReadsetId/name'] + ': only ' + row.uniqueHtos + ' present')
686+
}
687+
682688
return false;
683689
}
684690
}
@@ -713,6 +719,11 @@ Ext4.define('SingleCell.panel.LibraryExportPanel', {
713719
Ext4.Msg.alert('Error', 'The following plates were not found:<br>' + missingRows.join('<br>'));
714720
return;
715721
}
722+
723+
if (errorMsgs.length){
724+
Ext4.Msg.alert('Error', 'The following lanes had HTO libraries, without multiple HTOs:<br>' + errorMsgs.join('<br>'));
725+
return;
726+
}
716727
}
717728

718729
var barcodes = 'Illumina';

singlecell/src/org/labkey/singlecell/SingleCellTableCustomizer.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,18 @@ private void customizeCdnas(AbstractTableInfo ti)
9494
}
9595

9696
LDKService.get().applyNaturalSort(ti, "plateId");
97+
98+
String uniqueHTOs = "uniqueHtos";
99+
if (ti.getColumn(uniqueHTOs) == null)
100+
{
101+
SQLFragment sql = new SQLFragment("(SELECT count(DISTINCT s.hto) as expr FROM " + SingleCellSchema.NAME + "." + SingleCellSchema.TABLE_SORTS + " s WHERE s.rowid IN (SELECT DISTINCT sortId FROM " + SingleCellSchema.NAME + "." + SingleCellSchema.TABLE_CDNAS + " c WHERE c.plateid = " + ExprColumn.STR_TABLE_ALIAS + ".plateid AND c.container = " + ExprColumn.STR_TABLE_ALIAS + ".container))");
102+
ExprColumn newCol = new ExprColumn(ti, uniqueHTOs, sql, JdbcType.INTEGER, ti.getColumn("plateId"), ti.getColumn("container"));
103+
newCol.setLabel("Distinct HTOs In Lane");
104+
DetailsURL details = DetailsURL.fromString("/query/executeQuery.view?schemaName=singlecell&query.queryName=cdna_libraries&query.plateId~eq=${plateId}", ti.getUserSchema().getContainer());
105+
newCol.setURL(details);
106+
107+
ti.addColumn(newCol);
108+
}
97109
}
98110

99111
private void customizeSorts(AbstractTableInfo ti)

0 commit comments

Comments
 (0)