@sjcrh/proteinpaint-server 2.95.0 → 2.96.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjcrh/proteinpaint-server",
3
- "version": "2.95.0",
3
+ "version": "2.96.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",
@@ -60,8 +60,8 @@
60
60
  "dependencies": {
61
61
  "@sjcrh/augen": "2.87.0",
62
62
  "@sjcrh/proteinpaint-rust": "2.84.0",
63
- "@sjcrh/proteinpaint-shared": "2.95.0",
64
- "@sjcrh/proteinpaint-types": "2.95.0",
63
+ "@sjcrh/proteinpaint-shared": "2.96.0",
64
+ "@sjcrh/proteinpaint-types": "2.96.0",
65
65
  "better-sqlite3": "^9.4.1",
66
66
  "body-parser": "^1.15.2",
67
67
  "canvas": "~2.11.2",
@@ -117,6 +117,9 @@ function init({ genomes }) {
117
117
  setHiddenPlots(q.tw, plots);
118
118
  if (overlayTerm && overlayTerm.term?.values)
119
119
  setHiddenPlots(overlayTerm, plots);
120
+ if (q.orderByMedian == true) {
121
+ plots.sort((a, b) => a.boxplot.p50 - b.boxplot.p50);
122
+ }
120
123
  const returnData = {
121
124
  absMin,
122
125
  absMax,
@@ -177,7 +180,7 @@ function setUncomputableValues(values) {
177
180
  return null;
178
181
  }
179
182
  function numericBins(overlayTerm, data) {
180
- const overlayBins = data.refs.byTermId[overlayTerm?.term?.id]?.bins ?? [];
183
+ const overlayBins = data.refs.byTermId[overlayTerm?.$id]?.bins ?? [];
181
184
  return new Map(overlayBins.map((bin) => [bin.label, bin]));
182
185
  }
183
186
  export {
@@ -54,7 +54,7 @@ async function validate_query_singleCell(ds, genome) {
54
54
  if (q.samples.src == "gdcapi") {
55
55
  gdc_validate_query_singleCell_samples(ds, genome);
56
56
  } else if (q.samples.src == "native") {
57
- validateSamplesNative(q.samples, ds);
57
+ validateSamplesNative(q.samples, q.data, ds);
58
58
  } else {
59
59
  throw "unknown singleCell.samples.src";
60
60
  }
@@ -78,20 +78,40 @@ async function validate_query_singleCell(ds, genome) {
78
78
  validate_query_singleCell_DEgenes(ds);
79
79
  }
80
80
  }
81
- async function validateSamplesNative(S, ds) {
82
- const samples = {};
81
+ async function validateSamplesNative(S, D, ds) {
82
+ const samples = /* @__PURE__ */ new Map();
83
+ for (const plot of D.plots) {
84
+ try {
85
+ for (const fn of await fs.promises.readdir(path.join(serverconfig.tpmasterdir, plot.folder))) {
86
+ let sampleName = fn;
87
+ if (plot.fileSuffix) {
88
+ if (!fn.endsWith(plot.fileSuffix))
89
+ continue;
90
+ sampleName = fn.split(plot.fileSuffix)[0];
91
+ }
92
+ if (!sampleName)
93
+ continue;
94
+ const sid = ds.cohort.termdb.q.sampleName2id(sampleName);
95
+ if (sid == void 0)
96
+ continue;
97
+ samples.set(sid, { sample: sampleName });
98
+ }
99
+ } catch (e) {
100
+ console.log("cannot readdir on singleCell.data.plot[].folder", e);
101
+ }
102
+ }
83
103
  if (S.sampleColumns) {
84
104
  for (const term of S.sampleColumns) {
85
105
  const s2v = ds.cohort.termdb.q.getAllValues4term(term.termid);
86
- for (const [s, v] of s2v.entries()) {
87
- if (!samples[s])
88
- samples[s] = { sample: ds.cohort.termdb.q.id2sampleName(s) };
89
- samples[s][term.termid] = v;
106
+ for (const [sid, v] of s2v.entries()) {
107
+ if (!samples.has(sid))
108
+ continue;
109
+ samples.get(sid)[term.termid] = v;
90
110
  }
91
111
  }
92
112
  }
93
113
  S.get = () => {
94
- return { samples: Object.values(samples) };
114
+ return { samples: [...samples.values()] };
95
115
  };
96
116
  }
97
117
  function validateDataNative(D, ds) {
@@ -227,6 +247,9 @@ function gdc_validateGeneExpression(G, ds, genome) {
227
247
  G.get = async (q) => {
228
248
  try {
229
249
  const fileid = q.sample.eID;
250
+ if (ds.__gdc.scrnaAnalysis2hdf5.size == 0) {
251
+ throw "GDC scRNA file mapping is not cached";
252
+ }
230
253
  const hdf5id = ds.__gdc.scrnaAnalysis2hdf5.get(fileid);
231
254
  if (!hdf5id)
232
255
  throw "cannot map eID to hdf5 id";