@sjcrh/proteinpaint-server 2.137.1-2 → 2.137.2-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -118,7 +118,7 @@ function termdb_test_default() {
118
118
  plots: [
119
119
  {
120
120
  chartType: "barchart",
121
- settings: { barchart: { colorBars: true } },
121
+ settings: { barchart: { colorBars: true, showPercent: true } },
122
122
  term: {
123
123
  id: "agedx"
124
124
  }
@@ -126,12 +126,12 @@ function termdb_test_default() {
126
126
  {
127
127
  chartType: "barchart",
128
128
  term: { id: "sex" },
129
- settings: { barchart: { colorBars: true } }
129
+ settings: { barchart: { colorBars: true, showPercent: true } }
130
130
  },
131
131
  {
132
132
  chartType: "barchart",
133
133
  term: { id: "genetic_race" },
134
- settings: { barchart: { colorBars: true } }
134
+ settings: { barchart: { colorBars: true, showPercent: true } }
135
135
  }
136
136
  ]
137
137
  },
@@ -141,7 +141,7 @@ function termdb_test_default() {
141
141
  {
142
142
  chartType: "barchart",
143
143
  term: { id: "diaggrp" },
144
- settings: { barchart: { colorBars: true } }
144
+ settings: { barchart: { colorBars: true, showPercent: true } }
145
145
  }
146
146
  ]
147
147
  },
@@ -151,12 +151,12 @@ function termdb_test_default() {
151
151
  {
152
152
  chartType: "barchart",
153
153
  term: { id: "hrtavg" },
154
- settings: { barchart: { colorBars: true } }
154
+ settings: { barchart: { colorBars: true, showPercent: true } }
155
155
  },
156
156
  {
157
157
  chartType: "barchart",
158
158
  term: { id: "aaclassic_5" },
159
- settings: { barchart: { colorBars: true } }
159
+ settings: { barchart: { colorBars: true, showPercent: true } }
160
160
  }
161
161
  ]
162
162
  },
@@ -264,14 +264,43 @@ function termdb_test_default() {
264
264
  },
265
265
  geneExpression: {
266
266
  src: "native",
267
- file: "files/hg38/TermdbTest/TermdbTest.fpkm.matrix.h5"
267
+ file: "files/hg38/TermdbTest/rnaseq/TermdbTest.fpkm.matrix.h5"
268
268
  },
269
269
  topVariablyExpressedGenes: {
270
270
  src: "native"
271
271
  },
272
272
  rnaseqGeneCount: {
273
273
  storage_type: "HDF5",
274
- file: "files/hg38/TermdbTest/TermdbTest.geneCounts.h5"
274
+ file: "files/hg38/TermdbTest/rnaseq/TermdbTest.geneCounts.h5"
275
+ },
276
+ singleCell: {
277
+ samples: {
278
+ sampleColumns: [{ termid: "sex" }],
279
+ extraSampleTabLabel: "sex"
280
+ },
281
+ data: {
282
+ sameLegend: true,
283
+ src: "native",
284
+ plots: [
285
+ {
286
+ name: "scRNA",
287
+ folder: "files/hg38/TermdbTest/scrna/umap",
288
+ fileSuffix: "_umap.txt",
289
+ colorColumns: [
290
+ {
291
+ index: 3,
292
+ name: "CellType"
293
+ }
294
+ ],
295
+ coordsColumns: { x: 1, y: 2 },
296
+ selected: true
297
+ }
298
+ ]
299
+ },
300
+ geneExpression: {
301
+ src: "native",
302
+ folder: "files/hg38/TermdbTest/scrna/geneExpHdf5"
303
+ }
275
304
  },
276
305
  WSImages: {
277
306
  type: "H&E",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjcrh/proteinpaint-server",
3
- "version": "2.137.1-2",
3
+ "version": "2.137.2-0",
4
4
  "type": "module",
5
5
  "description": "a genomics visualization tool for exploring a cohort's genotype and phenotype data",
6
6
  "main": "src/app.js",
@@ -61,10 +61,10 @@
61
61
  "dependencies": {
62
62
  "@sjcrh/augen": "2.136.0",
63
63
  "@sjcrh/proteinpaint-python": "2.135.2-0",
64
- "@sjcrh/proteinpaint-r": "2.130.0",
65
- "@sjcrh/proteinpaint-rust": "2.136.0",
66
- "@sjcrh/proteinpaint-shared": "2.136.0",
67
- "@sjcrh/proteinpaint-types": "2.137.1-0",
64
+ "@sjcrh/proteinpaint-r": "2.137.2-0",
65
+ "@sjcrh/proteinpaint-rust": "2.137.2-0",
66
+ "@sjcrh/proteinpaint-shared": "2.137.1",
67
+ "@sjcrh/proteinpaint-types": "2.137.2-0",
68
68
  "@types/express": "^5.0.0",
69
69
  "@types/express-session": "^1.18.1",
70
70
  "better-sqlite3": "^9.4.1",
@@ -37,14 +37,15 @@ function getList(samplesPerFilter, filtersData, tw) {
37
37
  }
38
38
  const annotations = data.filter((s) => s != void 0).map((sample) => sample[tw.$id]?.value);
39
39
  const sampleValues = Array.from(new Set(annotations));
40
+ const filteredValues = [];
40
41
  for (const value of values) {
41
- value.value = value.label;
42
- const label = value.label;
43
- value.disabled = !sampleValues.includes(label);
42
+ const label = value.label.replace(/["']/g, "");
43
+ const disabled = !sampleValues.includes(value.key || value.label);
44
+ filteredValues.push({ value: value.key || value.label, label, disabled });
44
45
  }
45
- values.unshift({ label: "", value: "" });
46
- values.sort((a, b) => a.label.localeCompare(b.label));
47
- return values;
46
+ filteredValues.unshift({ label: "", value: "" });
47
+ filteredValues.sort((a, b) => a.label.localeCompare(b.label));
48
+ return filteredValues;
48
49
  }
49
50
  async function getFilters(query, ds, genome, res) {
50
51
  try {
@@ -55,7 +55,7 @@ async function validate_query_singleCell(ds, genome) {
55
55
  throw "singleCell.samples{} not object";
56
56
  if (typeof q.samples.get == "function") {
57
57
  } else {
58
- validateSamplesNative(q.samples, q.data, ds);
58
+ await validateSamplesNative(q.samples, q.data, ds);
59
59
  }
60
60
  if (typeof q.data != "object")
61
61
  throw "singleCell.data{} not object";
@@ -99,32 +99,31 @@ function validateImages(images) {
99
99
  async function validateSamplesNative(S, D, ds) {
100
100
  const samples = /* @__PURE__ */ new Map();
101
101
  for (const plot of D.plots) {
102
- try {
103
- for (const fn of await fs.promises.readdir(path.join(serverconfig.tpmasterdir, plot.folder))) {
104
- let sampleName = fn;
105
- if (plot.fileSuffix) {
106
- if (!fn.endsWith(plot.fileSuffix))
107
- continue;
108
- sampleName = fn.split(plot.fileSuffix)[0];
109
- }
110
- if (!sampleName)
111
- continue;
112
- const sid = ds.cohort.termdb.q.sampleName2id(sampleName);
113
- if (sid == void 0)
114
- continue;
115
- samples.set(sid, { sample: sampleName });
102
+ for (const fn of await fs.promises.readdir(path.join(serverconfig.tpmasterdir, plot.folder))) {
103
+ let sampleName = fn;
104
+ if (plot.fileSuffix) {
105
+ if (!fn.endsWith(plot.fileSuffix))
106
+ throw `singlecell.sample file name ${fn} does not end with required suffix ${plot.fileSuffix}`;
107
+ sampleName = fn.split(plot.fileSuffix)[0];
116
108
  }
117
- } catch (e) {
118
- console.log("cannot readdir on singleCell.data.plot[].folder", e);
109
+ if (!sampleName)
110
+ throw `singlecell.sample: cannot derive sample name from file name ${fn}`;
111
+ const sid = ds.cohort.termdb.q.sampleName2id(sampleName);
112
+ if (sid == void 0)
113
+ throw `singlecell.sample: unknown sample name ${sampleName}`;
114
+ samples.set(sid, { sample: sampleName });
119
115
  }
120
116
  }
121
117
  if (S.sampleColumns) {
122
- for (const term of S.sampleColumns) {
123
- const s2v = ds.cohort.termdb.q.getAllValues4term(term.termid);
118
+ for (const { termid } of S.sampleColumns) {
119
+ const term = ds.cohort.termdb.q.termjsonByOneid(termid);
120
+ if (!term)
121
+ throw "unknown termid from singlecell.samples.sampleColumns[]";
122
+ const s2v = ds.cohort.termdb.q.getAllValues4term(termid);
124
123
  for (const [sid, v] of s2v.entries()) {
125
124
  if (!samples.has(sid))
126
125
  continue;
127
- samples.get(sid)[term.termid] = v;
126
+ samples.get(sid)[termid] = term.values?.[v]?.label || v;
128
127
  }
129
128
  }
130
129
  }