@sjcrh/proteinpaint-server 2.137.1 → 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.
@@ -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",
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",
64
+ "@sjcrh/proteinpaint-r": "2.137.2-0",
65
+ "@sjcrh/proteinpaint-rust": "2.137.2-0",
66
66
  "@sjcrh/proteinpaint-shared": "2.137.1",
67
- "@sjcrh/proteinpaint-types": "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
  }