Skip to content

Commit

Permalink
Add sample disposition column
Browse files Browse the repository at this point in the history
  • Loading branch information
bbimber committed Mar 15, 2024
1 parent 77aacca commit 213639f
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<column name="sortId/sampleId/sampledate" />
<column name="sortId/sampleId/stim" />
<column name="sortId/sampleId/assayType" />
<column name="sortId/sampleId/disposition" />
<column name="sortId/sampleId/tissue" />
<column name="sortId/population" />
<column name="sortId/replicate" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<column name="sortId/sampleId/sampledate" />
<column name="sortId/sampleId/stim" />
<column name="sortId/sampleId/tissue" />
<column name="sortId/sampleId/assayType" />
<column name="sortId/population" />
<column name="sortId/cells" />
<column name="sortId/hto" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE singlecell.samples ADD disposition VARCHAR(1000);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE singlecell.samples ADD disposition VARCHAR(1000);
3 changes: 3 additions & 0 deletions singlecell/resources/schemas/singlecell.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
<fkDisplayColumnName useRawValue="true"/>
</fk>
</column>
<column columnName="disposition">
<columnTitle>Sample Disposition</columnTitle>
</column>
<column columnName="assaytype">
<columnTitle>Assay Type</columnTitle>
<nullable>true</nullable>
Expand Down
9 changes: 8 additions & 1 deletion singlecell/resources/web/singlecell/panel/PoolImportPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ Ext4.define('SingleCell.panel.PoolImportPanel', {
alwaysShow: true,
allowBlank: false,
transform: 'assaytype'
},{
name: 'disposition',
labels: ['Sample Disposition'],
allowRowSpan: false,
allowBlank: true
},{
name: 'tube_num',
labels: ['Tube #', 'Stim #'],
Expand Down Expand Up @@ -681,6 +686,7 @@ Ext4.define('SingleCell.panel.PoolImportPanel', {
stim: r.stim,
celltype: r.celltype,
assaytype: r.assaytype || 'None',
disposition: r.disposition,
tissue: r.tissue,
objectId: r.objectId,
population: r.population,
Expand Down Expand Up @@ -913,6 +919,7 @@ Ext4.define('SingleCell.panel.PoolImportPanel', {
celltype: row.celltype,
tissue: row.tissue,
assaytype: row.assaytype || 'None',
disposition: row.disposition,
objectId: guid,
workbook: row.workbook
});
Expand Down Expand Up @@ -1201,7 +1208,7 @@ Ext4.define('SingleCell.panel.PoolImportPanel', {
},

getSampleKey: function(data){
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('|');
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('|');
},

getSortKey: function(data){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ private static List<Map<String, Object>> parseRows(SimpleApiJsonForm form, Strin
@RequiresPermission(ReadPermission.class)
public static class GetMatchingSamplesAction extends ReadOnlyApiAction<SimpleApiJsonForm>
{
final List<String> FIELDS = Arrays.asList("subjectId", "sampledate", "subjectid", "celltype", "tissue", "assaytype", "stim");
final List<String> FIELDS = Arrays.asList("subjectId", "sampledate", "subjectid", "celltype", "tissue", "assaytype", "disposition", "stim");

@Override
public Object execute(SimpleApiJsonForm form, BindException errors) throws Exception
Expand Down
2 changes: 1 addition & 1 deletion singlecell/src/org/labkey/singlecell/SingleCellModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public String getName()
@Override
public @Nullable Double getSchemaVersion()
{
return 20.005;
return 20.006;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.labkey.api.data.JdbcType;
import org.labkey.api.data.SQLFragment;
import org.labkey.api.data.TableInfo;
import org.labkey.api.gwt.client.FacetingBehaviorType;
import org.labkey.api.ldk.LDKService;
import org.labkey.api.ldk.table.AbstractTableCustomizer;
import org.labkey.api.query.DetailsURL;
Expand Down Expand Up @@ -201,11 +202,22 @@ private void customizeReadsets(AbstractTableInfo ti)
"END)");
ExprColumn newCol = new ExprColumn(ti, totalCells, sql, JdbcType.INTEGER, ti.getColumn("rowid"));
newCol.setLabel("cDNA/Total Cells");
UserSchema us = QueryService.get().getUserSchema(ti.getUserSchema().getUser(), (ti.getUserSchema().getContainer().isWorkbook() ? ti.getUserSchema().getContainer().getParent() : ti.getUserSchema().getContainer()), SingleCellSchema.NAME);
newCol.setFk(QueryForeignKey.from(us, ti.getContainerFilter())
.table(SingleCellSchema.TABLE_CDNAS)
.key("rowid")
.display("rowid"));
ti.addColumn(newCol);
}

String assayTypes = "assayTypes";
if (ti.getColumn(assayTypes) == null)
{
SQLFragment sql = new SQLFragment("(SELECT ").append(
ti.getSqlDialect().getGroupConcat(new SQLFragment("sm.assaytype"), true, true, new SQLFragment("','"))).append(" as expr " +
" FROM " + SingleCellSchema.NAME + "." + SingleCellSchema.TABLE_CDNAS + " c " +
" JOIN " + SingleCellSchema.NAME + "." + SingleCellSchema.TABLE_SORTS + " ss ON (c.sortid = ss.rowid) " +
" JOIN " + SingleCellSchema.NAME + "." + SingleCellSchema.TABLE_SAMPLES + " sm ON (ss.sampleid = sm.rowid) " +
" WHERE c.readsetid = " + ExprColumn.STR_TABLE_ALIAS + ".rowid OR c.tcrreadsetid = " + ExprColumn.STR_TABLE_ALIAS + ".rowid)");

ExprColumn newCol = new ExprColumn(ti, assayTypes, sql, JdbcType.VARCHAR, ti.getColumn("rowid"));
newCol.setLabel("cDNA/Assay Types");
newCol.setFacetingBehaviorType(FacetingBehaviorType.ALWAYS_OFF);
ti.addColumn(newCol);
}
}
Expand Down

0 comments on commit 213639f

Please sign in to comment.