Skip to content

Commit 3db2be4

Browse files
committed
handle schema updates on for single-cell
1 parent 8c43012 commit 3db2be4

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/components/researchPortal/singleCellBrowser/ResearchSingleCellBrowser.vue

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@
486486
<research-dot-plot
487487
style="display:flex; align-self: center"
488488
:data="markerGenes || expressionStatsAll"
489-
data-blah="pct_nz_group"
489+
data-blah="pct_cells_expression"
490490
yKey="cell_type"
491491
xKey="gene"
492492
yLabel="Cell Type"
@@ -834,7 +834,7 @@
834834
835835
tableColumns: [
836836
{key: "tissue", label: "Tissue", class:"capitalize"},
837-
{key: "totalCells", label: "Total Cells", formatter: (val) => val.toLocaleString()}
837+
{key: "totalCells", label: "Total Cells", formatter: (val) => val?.toLocaleString()}
838838
],
839839
currentDatasetsPage: 1,
840840
totalDatasets: null,
@@ -888,7 +888,7 @@
888888
sortable: true,
889889
formatter: (val) => typeof val === 'number' ? val.toPrecision(3) : ''
890890
},{
891-
key: 'pct_nz_group',
891+
key: 'pct_cells_expression',
892892
label: '% Expressing',
893893
sortable: true,
894894
formatter: (val) => typeof val === 'number' ? (val * 100).toFixed(1) + '%' : ''
@@ -1142,7 +1142,7 @@
11421142
this.fields = await scUtils.fetchFields(fieldsEnpoint, this.datasetId);
11431143
if(this.fields){
11441144
if(!this.totalCells){
1145-
this.totalCells = this.fields.NAME.length;
1145+
this.totalCells = this.fields.NAME?.length | this.fields.ID?.length;
11461146
}
11471147
llog('fields', this.fields);
11481148
}else{
@@ -1176,7 +1176,15 @@
11761176
const markersEnpoint = this.selectedBI+this.BIendpoints.markers;
11771177
if(markersEnpoint){
11781178
const url = markersEnpoint;
1179-
this.markers = await scUtils.fetchMarkers(url, this.datasetId);
1179+
const markersRaw = await scUtils.fetchMarkers(url, this.datasetId);
1180+
//remap params to handle older/newer versions
1181+
const markersNormalized = markersRaw.map(m => ({
1182+
...m,
1183+
mean_expression: m.mean_expression ?? m.mean_expression_raw ?? 0,
1184+
pct_cells_expression: m.pct_cells_expression ?? m.pct_nz_group ?? 0,
1185+
// Add other fallback mappings here if needed
1186+
}));
1187+
this.markers = markersNormalized;
11801188
llog('markers', this.markers);
11811189
if(this.markers){
11821190
if(Array.isArray(this.markers)){

0 commit comments

Comments
 (0)