Skip to content

Commit 213639f

Browse files
committed
Add sample disposition column
1 parent 77aacca commit 213639f

File tree

9 files changed

+34
-8
lines changed

9 files changed

+34
-8
lines changed

singlecell/resources/queries/singlecell/cdna_libraries/.qview.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<column name="sortId/sampleId/sampledate" />
77
<column name="sortId/sampleId/stim" />
88
<column name="sortId/sampleId/assayType" />
9+
<column name="sortId/sampleId/disposition" />
910
<column name="sortId/sampleId/tissue" />
1011
<column name="sortId/population" />
1112
<column name="sortId/replicate" />

singlecell/resources/queries/singlecell/cdna_libraries/Cohort Info.qview.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<column name="sortId/sampleId/sampledate" />
77
<column name="sortId/sampleId/stim" />
88
<column name="sortId/sampleId/tissue" />
9+
<column name="sortId/sampleId/assayType" />
910
<column name="sortId/population" />
1011
<column name="sortId/cells" />
1112
<column name="sortId/hto" />
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE singlecell.samples ADD disposition VARCHAR(1000);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE singlecell.samples ADD disposition VARCHAR(1000);

singlecell/resources/schemas/singlecell.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@
5555
<fkDisplayColumnName useRawValue="true"/>
5656
</fk>
5757
</column>
58+
<column columnName="disposition">
59+
<columnTitle>Sample Disposition</columnTitle>
60+
</column>
5861
<column columnName="assaytype">
5962
<columnTitle>Assay Type</columnTitle>
6063
<nullable>true</nullable>

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ Ext4.define('SingleCell.panel.PoolImportPanel', {
5959
alwaysShow: true,
6060
allowBlank: false,
6161
transform: 'assaytype'
62+
},{
63+
name: 'disposition',
64+
labels: ['Sample Disposition'],
65+
allowRowSpan: false,
66+
allowBlank: true
6267
},{
6368
name: 'tube_num',
6469
labels: ['Tube #', 'Stim #'],
@@ -681,6 +686,7 @@ Ext4.define('SingleCell.panel.PoolImportPanel', {
681686
stim: r.stim,
682687
celltype: r.celltype,
683688
assaytype: r.assaytype || 'None',
689+
disposition: r.disposition,
684690
tissue: r.tissue,
685691
objectId: r.objectId,
686692
population: r.population,
@@ -913,6 +919,7 @@ Ext4.define('SingleCell.panel.PoolImportPanel', {
913919
celltype: row.celltype,
914920
tissue: row.tissue,
915921
assaytype: row.assaytype || 'None',
922+
disposition: row.disposition,
916923
objectId: guid,
917924
workbook: row.workbook
918925
});
@@ -1201,7 +1208,7 @@ Ext4.define('SingleCell.panel.PoolImportPanel', {
12011208
},
12021209

12031210
getSampleKey: function(data){
1204-
return [data.sampleId, data.subjectId, data.stim, data.assaytype, data.tissue, (Ext4.isDate(data.sampleDate) ? Ext4.Date.format(data.sampleDate, 'Y-m-d') : data.sampleDate)].join('|');
1211+
return [data.sampleId, data.subjectId, data.stim, data.assaytype, data.disposition, data.tissue, (Ext4.isDate(data.sampleDate) ? Ext4.Date.format(data.sampleDate, 'Y-m-d') : data.sampleDate)].join('|');
12051212
},
12061213

12071214
getSortKey: function(data){

singlecell/src/org/labkey/singlecell/SingleCellController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ private static List<Map<String, Object>> parseRows(SimpleApiJsonForm form, Strin
381381
@RequiresPermission(ReadPermission.class)
382382
public static class GetMatchingSamplesAction extends ReadOnlyApiAction<SimpleApiJsonForm>
383383
{
384-
final List<String> FIELDS = Arrays.asList("subjectId", "sampledate", "subjectid", "celltype", "tissue", "assaytype", "stim");
384+
final List<String> FIELDS = Arrays.asList("subjectId", "sampledate", "subjectid", "celltype", "tissue", "assaytype", "disposition", "stim");
385385

386386
@Override
387387
public Object execute(SimpleApiJsonForm form, BindException errors) throws Exception

singlecell/src/org/labkey/singlecell/SingleCellModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public String getName()
6767
@Override
6868
public @Nullable Double getSchemaVersion()
6969
{
70-
return 20.005;
70+
return 20.006;
7171
}
7272

7373
@Override

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

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import org.labkey.api.data.JdbcType;
55
import org.labkey.api.data.SQLFragment;
66
import org.labkey.api.data.TableInfo;
7+
import org.labkey.api.gwt.client.FacetingBehaviorType;
78
import org.labkey.api.ldk.LDKService;
89
import org.labkey.api.ldk.table.AbstractTableCustomizer;
910
import org.labkey.api.query.DetailsURL;
@@ -201,11 +202,22 @@ private void customizeReadsets(AbstractTableInfo ti)
201202
"END)");
202203
ExprColumn newCol = new ExprColumn(ti, totalCells, sql, JdbcType.INTEGER, ti.getColumn("rowid"));
203204
newCol.setLabel("cDNA/Total Cells");
204-
UserSchema us = QueryService.get().getUserSchema(ti.getUserSchema().getUser(), (ti.getUserSchema().getContainer().isWorkbook() ? ti.getUserSchema().getContainer().getParent() : ti.getUserSchema().getContainer()), SingleCellSchema.NAME);
205-
newCol.setFk(QueryForeignKey.from(us, ti.getContainerFilter())
206-
.table(SingleCellSchema.TABLE_CDNAS)
207-
.key("rowid")
208-
.display("rowid"));
205+
ti.addColumn(newCol);
206+
}
207+
208+
String assayTypes = "assayTypes";
209+
if (ti.getColumn(assayTypes) == null)
210+
{
211+
SQLFragment sql = new SQLFragment("(SELECT ").append(
212+
ti.getSqlDialect().getGroupConcat(new SQLFragment("sm.assaytype"), true, true, new SQLFragment("','"))).append(" as expr " +
213+
" FROM " + SingleCellSchema.NAME + "." + SingleCellSchema.TABLE_CDNAS + " c " +
214+
" JOIN " + SingleCellSchema.NAME + "." + SingleCellSchema.TABLE_SORTS + " ss ON (c.sortid = ss.rowid) " +
215+
" JOIN " + SingleCellSchema.NAME + "." + SingleCellSchema.TABLE_SAMPLES + " sm ON (ss.sampleid = sm.rowid) " +
216+
" WHERE c.readsetid = " + ExprColumn.STR_TABLE_ALIAS + ".rowid OR c.tcrreadsetid = " + ExprColumn.STR_TABLE_ALIAS + ".rowid)");
217+
218+
ExprColumn newCol = new ExprColumn(ti, assayTypes, sql, JdbcType.VARCHAR, ti.getColumn("rowid"));
219+
newCol.setLabel("cDNA/Assay Types");
220+
newCol.setFacetingBehaviorType(FacetingBehaviorType.ALWAYS_OFF);
209221
ti.addColumn(newCol);
210222
}
211223
}

0 commit comments

Comments
 (0)