@sjcrh/proteinpaint-server 2.58.0-0 → 2.58.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjcrh/proteinpaint-server",
3
- "version": "2.58.0-0",
3
+ "version": "2.58.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",
@@ -61,7 +61,7 @@
61
61
  },
62
62
  "dependencies": {
63
63
  "@sjcrh/augen": "2.46.0",
64
- "@sjcrh/proteinpaint-rust": "2.58.0-0",
64
+ "@sjcrh/proteinpaint-rust": "2.58.0",
65
65
  "better-sqlite3": "^9.4.1",
66
66
  "body-parser": "^1.15.2",
67
67
  "canvas": "~2.11.2",
@@ -46,7 +46,6 @@ async function run_genesetOverrepresentation_analysis(q, genomes) {
46
46
  if (line.startsWith("pathway_p_values:")) {
47
47
  result = JSON.parse(line.replace("pathway_p_values:", ""));
48
48
  } else {
49
- console.log(line);
50
49
  }
51
50
  }
52
51
  return result;
@@ -7,6 +7,19 @@ const api = {
7
7
  return async (req, res) => {
8
8
  try {
9
9
  const health = await getStat(genomes);
10
+ const q = req.query;
11
+ if (q.dslabel) {
12
+ for (const gn in genomes) {
13
+ const ds = genomes[gn]?.datasets?.[q.dslabel];
14
+ if (!ds?.getHealth)
15
+ continue;
16
+ if (!health.byDataset)
17
+ health.byDataset = {};
18
+ if (!health.byDataset[q.dslabel])
19
+ health.byDataset[q.dslabel] = {};
20
+ health.byDataset[q.dslabel][gn] = ds.getHealth(ds);
21
+ }
22
+ }
10
23
  res.send(health);
11
24
  } catch (e) {
12
25
  res.send({ status: "error", error: e.message || e });
@@ -32,7 +32,7 @@ function init({ genomes }) {
32
32
  if (!ds)
33
33
  throw "invalid dataset name";
34
34
  if (ds.__gdc && !ds.__gdc.doneCaching)
35
- throw "The server has not finished caching the case IDs: try again in ~2 minutes";
35
+ throw "The server has not finished caching the case IDs: try again in about 2 minutes.";
36
36
  if (q.dataType == dtgeneexpression) {
37
37
  if (!ds.queries?.geneExpression)
38
38
  throw "no geneExpression data on this dataset";
@@ -136,7 +136,7 @@ async function validate_query_geneExpression(ds, genome) {
136
136
  const q = ds.queries.geneExpression;
137
137
  if (!q)
138
138
  return;
139
- q.gene2density = {};
139
+ q.gene2bins = {};
140
140
  if (q.src == "gdcapi") {
141
141
  gdc_validate_query_geneExpression(ds, genome);
142
142
  return;
@@ -1,5 +1,5 @@
1
- import { get_rows_by_one_key } from "../src/termdb.sql.js";
2
1
  import Summarystats from "../shared/descriptive.stats.js";
2
+ import { getData } from "#src/termdb.matrix.js";
3
3
  const api = {
4
4
  endpoint: "termdb/descrstats",
5
5
  methods: {
@@ -64,7 +64,7 @@ function init({ genomes }) {
64
64
  const tdb = ds.cohort.termdb;
65
65
  if (!tdb)
66
66
  throw "invalid termdb object";
67
- await trigger_getdescrstats(q, res, ds);
67
+ await trigger_getdescrstats(q, res, ds, g);
68
68
  } catch (e) {
69
69
  res.send({ error: e?.message || e });
70
70
  if (e instanceof Error && e.stack)
@@ -72,20 +72,14 @@ function init({ genomes }) {
72
72
  }
73
73
  };
74
74
  }
75
- async function trigger_getdescrstats(q, res, ds) {
76
- const term = ds.cohort.termdb.q.termjsonByOneid(q.tid);
77
- if (!term)
78
- throw "invalid termid";
79
- if (term.type != "float" && term.type != "integer")
80
- throw "not numerical term";
81
- const rows = await get_rows_by_one_key({
82
- ds,
83
- key: q.tid,
84
- filter: q.filter
85
- });
75
+ async function trigger_getdescrstats(q, res, ds, genome) {
76
+ const terms = [q.tw];
77
+ const data = await getData({ filter: q.filter, terms }, ds, genome);
86
78
  const values = [];
87
- for (const { value } of rows) {
88
- if (term.values?.[value]?.uncomputable) {
79
+ for (const key in data.samples) {
80
+ const sample = data.samples[key];
81
+ const value = sample[q.tw.$id].value;
82
+ if (q.tw.values?.[value]?.uncomputable) {
89
83
  continue;
90
84
  }
91
85
  if (q.settings?.violin?.unit === "log") {
@@ -93,7 +87,7 @@ async function trigger_getdescrstats(q, res, ds) {
93
87
  continue;
94
88
  }
95
89
  }
96
- values.push(value);
90
+ values.push(parseFloat(value));
97
91
  }
98
92
  res.send(Summarystats(values));
99
93
  }
@@ -110,7 +110,7 @@ function gdcValidateQuery(ds, genome) {
110
110
  return serverconfig.features.gdcGenes;
111
111
  }
112
112
  if (!ds.__gdc.doneCaching)
113
- throw "The server has not finished caching the case IDs: try again in ~2 minutes";
113
+ throw "The server has not finished caching the case IDs: try again in about 2 minutes.";
114
114
  const caseLst = await gdcGetCasesWithExpressionDataFromCohort(q, ds);
115
115
  if (caseLst.length == 0) {
116
116
  return [];