@sjcrh/proteinpaint-server 2.58.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",
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",
@@ -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
  }