@sjcrh/proteinpaint-server 2.145.0 → 2.145.1-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.
@@ -314,7 +314,8 @@ function termdb_test_default() {
314
314
  },
315
315
  rnaseqGeneCount: {
316
316
  storage_type: "HDF5",
317
- file: "files/hg38/TermdbTest/rnaseq/TermdbTest.geneCounts.h5"
317
+ newformat: true,
318
+ file: "files/hg38/TermdbTest/rnaseq/TermdbTest.geneCounts.new.h5"
318
319
  },
319
320
  singleCell: {
320
321
  samples: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjcrh/proteinpaint-server",
3
- "version": "2.145.0",
3
+ "version": "2.145.1-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",
@@ -62,10 +62,10 @@
62
62
  "dependencies": {
63
63
  "@sjcrh/augen": "2.143.0",
64
64
  "@sjcrh/proteinpaint-python": "2.144.0",
65
- "@sjcrh/proteinpaint-r": "2.137.2-0",
66
- "@sjcrh/proteinpaint-rust": "2.145.0",
67
- "@sjcrh/proteinpaint-shared": "2.143.0",
68
- "@sjcrh/proteinpaint-types": "2.145.0",
65
+ "@sjcrh/proteinpaint-r": "2.145.1-0",
66
+ "@sjcrh/proteinpaint-rust": "2.145.1-0",
67
+ "@sjcrh/proteinpaint-shared": "2.145.1-0",
68
+ "@sjcrh/proteinpaint-types": "2.145.1-0",
69
69
  "@types/express": "^5.0.0",
70
70
  "@types/express-session": "^1.18.1",
71
71
  "better-sqlite3": "^9.4.1",
@@ -204,7 +204,12 @@ async function run_DE(param, ds, term_results, term_results2) {
204
204
  const sample_size_limit = 8;
205
205
  if (group1names.length <= sample_size_limit && group2names.length <= sample_size_limit || param.method == "edgeR" || param.method == "limma") {
206
206
  const time12 = (/* @__PURE__ */ new Date()).valueOf();
207
- const result2 = JSON.parse(await run_R("edge.R", JSON.stringify(expression_input)));
207
+ let result2;
208
+ if (q.newformat) {
209
+ result2 = JSON.parse(await run_R("edge_newh5.R", JSON.stringify(expression_input)));
210
+ } else {
211
+ result2 = JSON.parse(await run_R("edge.R", JSON.stringify(expression_input)));
212
+ }
208
213
  mayLog("Time taken to run edgeR:", formatElapsedTime(Date.now() - time12));
209
214
  param.method = "edgeR";
210
215
  const ql_imagePath = path.join(serverconfig.cachedir, result2.edgeR_ql_image_name[0]);
@@ -254,15 +259,30 @@ async function validate_query_rnaseqGeneCount(ds) {
254
259
  if (ds.queries.rnaseqGeneCount.storage_type == "text") {
255
260
  samples = (await get_header_txt(q.file, null)).split(" ").slice(4);
256
261
  } else if (ds.queries.rnaseqGeneCount.storage_type == "HDF5") {
257
- const get_samples_from_hdf5 = {
258
- input_file: q.file,
259
- data_type: "get_samples"
260
- };
261
- const time1 = (/* @__PURE__ */ new Date()).valueOf();
262
- const result = await run_rust("DEanalysis", JSON.stringify(get_samples_from_hdf5));
263
- const time2 = (/* @__PURE__ */ new Date()).valueOf();
264
- mayLog("Time taken to query gene expression:", time2 - time1, "ms");
265
- samples = result.split(",");
262
+ if (q.newformat) {
263
+ const get_samples_from_hdf5 = {
264
+ hdf5_file: q.file,
265
+ validate: true
266
+ };
267
+ const time1 = (/* @__PURE__ */ new Date()).valueOf();
268
+ const result = await run_rust("readH5", JSON.stringify(get_samples_from_hdf5));
269
+ const time2 = (/* @__PURE__ */ new Date()).valueOf();
270
+ mayLog("Time taken to query gene expression:", time2 - time1, "ms");
271
+ const vr = JSON.parse(result);
272
+ if (vr.status !== "success") throw vr.message;
273
+ if (!Array.isArray(vr.samples)) throw "HDF5 file has no samples, please check file.";
274
+ samples = vr.samples;
275
+ } else {
276
+ const get_samples_from_hdf5 = {
277
+ input_file: q.file,
278
+ data_type: "get_samples"
279
+ };
280
+ const time1 = (/* @__PURE__ */ new Date()).valueOf();
281
+ const result = await run_rust("DEanalysis", JSON.stringify(get_samples_from_hdf5));
282
+ const time2 = (/* @__PURE__ */ new Date()).valueOf();
283
+ mayLog("Time taken to query gene expression:", time2 - time1, "ms");
284
+ samples = result.split(",");
285
+ }
266
286
  } else throw "unknown storage type:" + ds.queries.rnaseqGeneCount.storage_type;
267
287
  q.allSampleSet = new Set(samples);
268
288
  const unknownSamples = [];
@@ -140,7 +140,7 @@ function setUncomputableValues(values) {
140
140
  function parseValues(q, data, sampleType, isLog, overlayTerm, divideTerm) {
141
141
  const chart2plot2values = /* @__PURE__ */ new Map();
142
142
  const uncomputableValues = {};
143
- let absMin = null, absMax = null;
143
+ let absMin = Infinity, absMax = -Infinity;
144
144
  for (const val of Object.values(data.samples)) {
145
145
  const value = val[q.tw.$id];
146
146
  if (!Number.isFinite(value?.value)) continue;
@@ -175,8 +175,8 @@ function parseValues(q, data, sampleType, isLog, overlayTerm, divideTerm) {
175
175
  if (!plot2values.has(plot)) plot2values.set(plot, []);
176
176
  const values = plot2values.get(plot);
177
177
  values.push(value.value);
178
- if (absMin === null || value.value < absMin) absMin = value.value;
179
- if (absMax === null || value.value > absMax) absMax = value.value;
178
+ if (value.value < absMin) absMin = value.value;
179
+ if (value.value > absMax) absMax = value.value;
180
180
  }
181
181
  return { absMax, absMin, chart2plot2values, uncomputableValues };
182
182
  }