@sjcrh/proteinpaint-server 2.144.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.
@@ -213,6 +213,42 @@ function termdb_test_default() {
213
213
  // small list of terms for sunburst rings
214
214
  sunburst_twLst: [{ id: "sex", q: {} }]
215
215
  },
216
+ assayAvailability: {
217
+ // term used below must be annotated on samples rather than patients(root). otherwise matrix will pull wrong samples for geneVariant term
218
+ byDt: {
219
+ // snvindel, differentiating sample origin
220
+ 1: {
221
+ byOrigin: {
222
+ germline: {
223
+ term_id: "assayavailability_germline",
224
+ label: "Germline",
225
+ // human readable label of this origin
226
+ yes: { value: ["1"] },
227
+ no: { value: ["2"] }
228
+ },
229
+ somatic: {
230
+ term_id: "wgs_curated",
231
+ label: "Somatic",
232
+ yes: { value: ["1"] },
233
+ no: { value: ["0"] }
234
+ // the category doesn't exist in termdb but is still supplied since somatic.no{} is required
235
+ }
236
+ }
237
+ },
238
+ // fusion
239
+ 2: {
240
+ term_id: "assayavailability_fusion",
241
+ yes: { value: ["1"] },
242
+ no: { value: ["2"] }
243
+ },
244
+ // cnv
245
+ 4: {
246
+ term_id: "assayavailability_cnv",
247
+ yes: { value: ["1"] },
248
+ no: { value: ["2"] }
249
+ }
250
+ }
251
+ },
216
252
  queries: {
217
253
  snvindel: {
218
254
  forTrack: true,
@@ -278,7 +314,8 @@ function termdb_test_default() {
278
314
  },
279
315
  rnaseqGeneCount: {
280
316
  storage_type: "HDF5",
281
- file: "files/hg38/TermdbTest/rnaseq/TermdbTest.geneCounts.h5"
317
+ newformat: true,
318
+ file: "files/hg38/TermdbTest/rnaseq/TermdbTest.geneCounts.new.h5"
282
319
  },
283
320
  singleCell: {
284
321
  samples: {
@@ -312,42 +349,10 @@ function termdb_test_default() {
312
349
  WSImages: {
313
350
  type: "H&E",
314
351
  imageBySampleFolder: "files/hg38/TermdbTest/wsimages"
315
- }
316
- },
317
- assayAvailability: {
318
- // term used below must be annotated on samples rather than patients(root). otherwise matrix will pull wrong samples for geneVariant term
319
- byDt: {
320
- // snvindel, differentiating sample origin
321
- 1: {
322
- byOrigin: {
323
- germline: {
324
- term_id: "assayavailability_germline",
325
- label: "Germline",
326
- // human readable label of this origin
327
- yes: { value: ["1"] },
328
- no: { value: ["2"] }
329
- },
330
- somatic: {
331
- term_id: "wgs_curated",
332
- label: "Somatic",
333
- yes: { value: ["1"] },
334
- no: { value: ["0"] }
335
- // the category doesn't exist in termdb but is still supplied since somatic.no{} is required
336
- }
337
- }
338
- },
339
- // fusion
340
- 2: {
341
- term_id: "assayavailability_fusion",
342
- yes: { value: ["1"] },
343
- no: { value: ["2"] }
344
- },
345
- // cnv
346
- 4: {
347
- term_id: "assayavailability_cnv",
348
- yes: { value: ["1"] },
349
- no: { value: ["2"] }
350
- }
352
+ },
353
+ trackLst: {
354
+ jsonFile: "files/hg38/TermdbTest/trackLst/facet.json",
355
+ activeTracks: ["bw 1", "bed 1"]
351
356
  }
352
357
  }
353
358
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjcrh/proteinpaint-server",
3
- "version": "2.144.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.143.0",
67
- "@sjcrh/proteinpaint-shared": "2.143.0",
68
- "@sjcrh/proteinpaint-types": "2.144.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",
@@ -48,7 +48,11 @@ async function runGrin2(genomes, req, res) {
48
48
  const pyInput = {
49
49
  genedb: path.join(serverconfig.tpmasterdir, g.genedb.dbfile),
50
50
  chromosomelist: {},
51
- lesion: ""
51
+ lesion: "",
52
+ devicePixelRatio: parsedRequest.devicePixelRatio || 2,
53
+ plot_width: parsedRequest.plot_width || 1e3,
54
+ plot_height: parsedRequest.plot_height || 400,
55
+ pngDotRadius: parsedRequest.pngDotRadius || 2
52
56
  };
53
57
  for (const c in g.majorchr) {
54
58
  if (ds.queries.singleSampleMutation?.discoPlot?.skipChrM) {
@@ -89,6 +93,7 @@ async function runGrin2(genomes, req, res) {
89
93
  const topGeneTable = resultData.topGeneTable || null;
90
94
  const totalProcessTime = downloadTimeToPrint + grin2AnalysisTimeToPrint;
91
95
  return res.json({
96
+ resultData,
92
97
  pngImg,
93
98
  topGeneTable,
94
99
  rustResult: parsedRustResult,
@@ -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
  }