@sjcrh/proteinpaint-server 2.86.1 → 2.87.1

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.
Files changed (49) hide show
  1. package/dataset/termdb.test.js +0 -11
  2. package/package.json +6 -10
  3. package/routes/_template_.js +1 -1
  4. package/routes/brainImaging.js +1 -1
  5. package/routes/burden.js +1 -1
  6. package/routes/dataset.js +1 -1
  7. package/routes/dsdata.js +1 -1
  8. package/routes/dzimages.js +1 -1
  9. package/routes/gdc.maf.js +2 -2
  10. package/routes/gdc.mafBuild.js +2 -2
  11. package/routes/gdc.topMutatedGenes.js +1 -1
  12. package/routes/genelookup.js +1 -1
  13. package/routes/genesetEnrichment.js +5 -3
  14. package/routes/genesetOverrepresentation.js +1 -1
  15. package/routes/healthcheck.js +1 -1
  16. package/routes/hicdata.js +1 -1
  17. package/routes/hicgenome.js +1 -1
  18. package/routes/hicstat.js +1 -1
  19. package/routes/isoformlst.js +1 -1
  20. package/routes/ntseq.js +1 -1
  21. package/routes/pdomain.js +1 -1
  22. package/routes/sampledzimages.js +1 -1
  23. package/routes/samplewsimages.js +1 -1
  24. package/routes/snp.js +1 -1
  25. package/routes/termdb.DE.js +1 -1
  26. package/routes/termdb.boxplot.js +34 -25
  27. package/routes/termdb.categories.js +1 -1
  28. package/routes/termdb.cluster.js +1 -1
  29. package/routes/termdb.cohort.summary.js +2 -2
  30. package/routes/termdb.cohorts.js +3 -1
  31. package/routes/termdb.config.js +5 -5
  32. package/routes/termdb.descrstats.js +1 -1
  33. package/routes/termdb.numericcategories.js +1 -1
  34. package/routes/termdb.percentile.js +1 -1
  35. package/routes/termdb.rootterm.js +1 -1
  36. package/routes/termdb.sampleImages.js +1 -1
  37. package/routes/termdb.singleSampleMutation.js +1 -1
  38. package/routes/termdb.singlecellDEgenes.js +1 -1
  39. package/routes/termdb.singlecellData.js +1 -1
  40. package/routes/termdb.singlecellSamples.js +5 -5
  41. package/routes/termdb.termchildren.js +1 -1
  42. package/routes/termdb.termsbyids.js +1 -1
  43. package/routes/termdb.topTermsByType.js +1 -1
  44. package/routes/termdb.topVariablyExpressedGenes.js +1 -1
  45. package/routes/termdb.violin.js +1 -1
  46. package/routes/tileserver.js +1 -1
  47. package/routes/wsimages.js +1 -1
  48. package/src/app.js +364 -298
  49. package/utils/gsea.py +13 -3
@@ -26,17 +26,6 @@ var termdb_test_default = {
26
26
  db: {
27
27
  file: "files/hg38/TermdbTest/db"
28
28
  },
29
- allowedChartTypes: [
30
- "summary",
31
- "survival",
32
- "matrix",
33
- "sampleScatter",
34
- "cuminc",
35
- "dataDownload",
36
- "sampleView",
37
- "regression",
38
- "facet"
39
- ],
40
29
  termdb: {
41
30
  displaySampleIds: true,
42
31
  // allow to display sample-level data
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjcrh/proteinpaint-server",
3
- "version": "2.86.1",
3
+ "version": "2.87.1",
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",
@@ -8,7 +8,7 @@
8
8
  "bin": "start.js",
9
9
  "imports": {
10
10
  "#types": "@sjcrh/proteinpaint-types",
11
- "#types/*": "@sjcrh/proteinpaint-types/*",
11
+ "#types/checkers": "@sjcrh/proteinpaint-types/checkers",
12
12
  "#shared/*": "@sjcrh/proteinpaint-shared/*",
13
13
  "#src/*": "./src/*",
14
14
  "#routes/*": "./routes/*"
@@ -55,17 +55,13 @@
55
55
  "ts-node": "^10.9.1",
56
56
  "ts-patch": "^3.0.2",
57
57
  "tsx": "^4.7.1",
58
- "typedoc": "^0.26.11",
59
- "typedoc-plugin-missing-exports": "^3.0.0",
60
- "typedoc-plugin-replace-text": "^4.0.0",
61
- "typescript": "^5.6.3",
62
- "typia": "^4.1.14"
58
+ "typescript": "^5.6.3"
63
59
  },
64
60
  "dependencies": {
65
- "@sjcrh/augen": "2.86.0",
61
+ "@sjcrh/augen": "2.87.0",
66
62
  "@sjcrh/proteinpaint-rust": "2.84.0",
67
- "@sjcrh/proteinpaint-shared": "2.86.0",
68
- "@sjcrh/proteinpaint-types": "2.86.0",
63
+ "@sjcrh/proteinpaint-shared": "2.87.1",
64
+ "@sjcrh/proteinpaint-types": "2.87.1",
69
65
  "better-sqlite3": "^9.4.1",
70
66
  "body-parser": "^1.15.2",
71
67
  "canvas": "~2.11.2",
@@ -1,4 +1,4 @@
1
- import { snpPayload } from "#types";
1
+ import { snpPayload } from "#types/checkers";
2
2
  const api = {
3
3
  // route endpoint
4
4
  // - no need for trailing slash
@@ -1,6 +1,6 @@
1
1
  import path from "path";
2
2
  import serverconfig from "#src/serverconfig.js";
3
- import { brainImagingPayload } from "#types";
3
+ import { brainImagingPayload } from "#types/checkers";
4
4
  import { spawn } from "child_process";
5
5
  import { getData } from "../src/termdb.matrix.js";
6
6
  import { isNumericTerm } from "@sjcrh/proteinpaint-shared/terms.js";
package/routes/burden.js CHANGED
@@ -1,4 +1,4 @@
1
- import { burdenPayload } from "#types";
1
+ import { burdenPayload } from "#types/checkers";
2
2
  import run_R from "#src/run_R.js";
3
3
  import path from "path";
4
4
  import serverconfig from "#src/serverconfig.js";
package/routes/dataset.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as mds2_init from "#src/mds2.init.js";
2
2
  import * as mds3_init from "#src/mds3.init.js";
3
3
  import * as common from "#shared/common.js";
4
- import { datasetPayload } from "#types";
4
+ import { datasetPayload } from "#types/checkers";
5
5
  const api = {
6
6
  endpoint: "getDataset",
7
7
  // should rename to simply 'dataset', method is based on HTTP method
package/routes/dsdata.js CHANGED
@@ -2,7 +2,7 @@ import path from "path";
2
2
  import { spawn } from "child_process";
3
3
  import serverconfig from "#src/serverconfig.js";
4
4
  import * as common from "#shared/common.js";
5
- import { dsDataPayload } from "#types";
5
+ import { dsDataPayload } from "#types/checkers";
6
6
  const api = {
7
7
  // route endpoint
8
8
  // - no need for trailing slash
@@ -1,7 +1,7 @@
1
1
  import path from "path";
2
2
  import serverconfig from "#src/serverconfig.js";
3
3
  import { illegalpath } from "#src/utils.js";
4
- import { dzImagesPayload } from "#types";
4
+ import { dzImagesPayload } from "#types/checkers";
5
5
  const api = {
6
6
  endpoint: `dzimages/:sampleId`,
7
7
  methods: {
package/routes/gdc.maf.js CHANGED
@@ -1,4 +1,4 @@
1
- import { gdcMafPayload } from "#types";
1
+ import { gdcMafPayload } from "#types/checkers";
2
2
  import path from "path";
3
3
  import got from "got";
4
4
  import serverconfig from "#src/serverconfig.js";
@@ -72,7 +72,7 @@ async function listMafFiles(q, ds) {
72
72
  let re;
73
73
  try {
74
74
  re = JSON.parse(response.body);
75
- } catch (e) {
75
+ } catch (_) {
76
76
  throw "invalid JSON from " + api.endpoint;
77
77
  }
78
78
  if (!Number.isInteger(re.data?.pagination?.total))
@@ -2,7 +2,7 @@ import got from "got";
2
2
  import path from "path";
3
3
  import { run_rust_stream } from "@sjcrh/proteinpaint-rust";
4
4
  import serverconfig from "#src/serverconfig.js";
5
- import { gdcMafPayload } from "#types";
5
+ import { gdcMafPayload } from "#types/checkers";
6
6
  import { maxTotalSizeCompressed } from "./gdc.maf.ts";
7
7
  const api = {
8
8
  endpoint: "gdc/mafBuild",
@@ -80,7 +80,7 @@ async function getFileLstUnderSizeLimit(lst, host, headers) {
80
80
  let re;
81
81
  try {
82
82
  re = JSON.parse(response.body);
83
- } catch (e) {
83
+ } catch (_) {
84
84
  throw "invalid json from getFileLstUnderSizeLimit";
85
85
  }
86
86
  if (!Array.isArray(re.data?.hits))
@@ -1,4 +1,4 @@
1
- import { gdcTopMutatedGenePayload } from "#types";
1
+ import { gdcTopMutatedGenePayload } from "#types/checkers";
2
2
  import { mclasscnvgain, mclasscnvloss, dtsnvindel } from "#shared/common.js";
3
3
  import ky from "ky";
4
4
  const api = {
@@ -1,5 +1,5 @@
1
1
  import { getResult } from "#src/gene.js";
2
- import { geneLookupPayload } from "#types";
2
+ import { geneLookupPayload } from "#types/checkers";
3
3
  const api = {
4
4
  endpoint: "genelookup",
5
5
  methods: {
@@ -1,4 +1,4 @@
1
- import { genesetEnrichmentPayload } from "#types";
1
+ import { genesetEnrichmentPayload } from "#types/checkers";
2
2
  import fs from "fs";
3
3
  import path from "path";
4
4
  import { spawn } from "child_process";
@@ -55,7 +55,9 @@ async function run_genesetEnrichment_analysis(q, genomes) {
55
55
  geneset_group: q.geneSetGroup,
56
56
  cachedir: serverconfig.cachedir,
57
57
  geneset_name: q.geneset_name,
58
- pickle_file: q.pickle_file
58
+ pickle_file: q.pickle_file,
59
+ genedb: path.join(serverconfig.tpmasterdir, genomes[q.genome].genedb.dbfile),
60
+ filter_non_coding_genes: q.filter_non_coding_genes
59
61
  };
60
62
  const gsea_output = await run_gsea(
61
63
  `${serverconfig.binpath}/utils/gsea.py`,
@@ -88,7 +90,7 @@ async function run_genesetEnrichment_analysis(q, genomes) {
88
90
  async function run_gsea(path2, data) {
89
91
  try {
90
92
  await fs.promises.stat(path2);
91
- } catch (e) {
93
+ } catch (_) {
92
94
  throw `${path2} does not exist`;
93
95
  }
94
96
  return new Promise((resolve, reject) => {
@@ -1,4 +1,4 @@
1
- import { genesetOverrepresentationPayload } from "#types";
1
+ import { genesetOverrepresentationPayload } from "#types/checkers";
2
2
  import { run_rust } from "@sjcrh/proteinpaint-rust";
3
3
  import serverconfig from "#src/serverconfig.js";
4
4
  import path from "path";
@@ -1,5 +1,5 @@
1
1
  import { getStat } from "#src/health.ts";
2
- import { healthcheckPayload } from "#types";
2
+ import { healthcheckPayload } from "#types/checkers";
3
3
  const api = {
4
4
  endpoint: "healthcheck",
5
5
  methods: {
package/routes/hicdata.js CHANGED
@@ -1,4 +1,4 @@
1
- import { hicdataPayload } from "#types";
1
+ import { hicdataPayload } from "#types/checkers";
2
2
  import { fileurl } from "#src/utils.js";
3
3
  import { spawn } from "child_process";
4
4
  import readline from "readline";
@@ -1,4 +1,4 @@
1
- import { hicGenomePayload } from "#types";
1
+ import { hicGenomePayload } from "#types/checkers";
2
2
  import { fileurl } from "#src/utils.js";
3
3
  import { spawn } from "child_process";
4
4
  import readline from "readline";
package/routes/hicstat.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { fileurl, file_is_readable } from "#src/utils.js";
2
2
  import { do_hicstat } from "#src/hicstat.ts";
3
- import { hicstatPayload } from "#types";
3
+ import { hicstatPayload } from "#types/checkers";
4
4
  const api = {
5
5
  endpoint: "hicstat",
6
6
  methods: {
@@ -1,4 +1,4 @@
1
- import { isoformlstPayload } from "#types";
1
+ import { isoformlstPayload } from "#types/checkers";
2
2
  const api = {
3
3
  // route endpoint
4
4
  // - no need for trailing slash
package/routes/ntseq.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ntseqPayload } from "#types";
1
+ import { ntseqPayload } from "#types/checkers";
2
2
  import { get_fasta } from "#src/utils.js";
3
3
  const api = {
4
4
  endpoint: "ntseq",
package/routes/pdomain.js CHANGED
@@ -1,4 +1,4 @@
1
- import { pdomainPayload } from "#types";
1
+ import { pdomainPayload } from "#types/checkers";
2
2
  const api = {
3
3
  // route endpoint
4
4
  // - no need for trailing slash
@@ -1,7 +1,7 @@
1
1
  import fs from "fs";
2
2
  import path from "path";
3
3
  import serverconfig from "#src/serverconfig.js";
4
- import { dzImagesPayload } from "#types";
4
+ import { dzImagesPayload } from "#types/checkers";
5
5
  const api = {
6
6
  endpoint: "sampledzimages",
7
7
  methods: {
@@ -1,4 +1,4 @@
1
- import { sampleWSImagesPayload } from "#types";
1
+ import { sampleWSImagesPayload } from "#types/checkers";
2
2
  const api = {
3
3
  endpoint: "samplewsimages",
4
4
  methods: {
package/routes/snp.js CHANGED
@@ -1,4 +1,4 @@
1
- import { snpPayload } from "#types";
1
+ import { snpPayload } from "#types/checkers";
2
2
  import * as utils from "#src/utils.js";
3
3
  const api = {
4
4
  // route endpoint
@@ -1,5 +1,5 @@
1
1
  import path from "path";
2
- import { diffExpPayload } from "#types";
2
+ import { diffExpPayload } from "#types/checkers";
3
3
  import { run_rust } from "@sjcrh/proteinpaint-rust";
4
4
  import { get_ds_tdb } from "../src/termdb.js";
5
5
  import run_R from "../src/run_R.js";
@@ -1,8 +1,8 @@
1
- import { boxplotPayload } from "#types";
1
+ import { boxplotPayload } from "#types/checkers";
2
2
  import { getData } from "../src/termdb.matrix.js";
3
3
  import { boxplot_getvalue } from "../src/utils.js";
4
4
  import { sortKey2values } from "../src/termdb.violin.js";
5
- import { roundValue } from "#shared/roundValue.js";
5
+ import { roundValueAuto } from "#shared/roundValue.js";
6
6
  const api = {
7
7
  endpoint: "termdb/boxplot",
8
8
  methods: {
@@ -71,7 +71,7 @@ function init({ genomes }) {
71
71
  }
72
72
  }
73
73
  const plots = [];
74
- let absMin = null, absMax = null, maxLabelLgth = null;
74
+ let absMin = null, absMax = null;
75
75
  for (const [key, values] of sortKey2values(data, key2values, overlayTerm)) {
76
76
  const sortedValues = values.sort((a, b) => a - b);
77
77
  if (absMin === null || sortedValues[0] < absMin)
@@ -87,26 +87,23 @@ function init({ genomes }) {
87
87
  throw "boxplot_getvalue failed [termdb.boxplot init()]";
88
88
  const descrStats = setDescrStats(boxplot, sortedValues);
89
89
  const _plot = {
90
- // values,
91
90
  boxplot,
92
91
  descrStats
93
92
  };
94
93
  if (overlayTerm) {
95
94
  const _key = overlayTerm?.term?.values?.[key]?.label || key;
96
95
  const plotLabel = `${_key}, n=${values.length}`;
97
- if (maxLabelLgth === null || plotLabel.length > maxLabelLgth)
98
- maxLabelLgth = plotLabel.length;
96
+ const overlayBins = numericBins(overlayTerm, data);
99
97
  const plot = Object.assign(_plot, {
100
98
  color: overlayTerm?.term?.values?.[key]?.color || null,
101
99
  key: _key,
100
+ overlayBins: overlayBins.has(key) ? overlayBins.get(key) : null,
102
101
  seriesId: key
103
102
  });
104
103
  plot.boxplot.label = plotLabel;
105
104
  plots.push(plot);
106
105
  } else {
107
106
  const plotLabel = `${sampleType}, n=${values.length}`;
108
- if (maxLabelLgth === null || plotLabel.length > maxLabelLgth)
109
- maxLabelLgth = plotLabel.length;
110
107
  const plot = Object.assign(_plot, {
111
108
  key: sampleType
112
109
  });
@@ -114,16 +111,15 @@ function init({ genomes }) {
114
111
  plots.push(plot);
115
112
  }
116
113
  }
117
- if (absMin == null || absMax == null || maxLabelLgth == null)
118
- throw "absMin, absMax, or maxLabelLgth is null [termdb.boxplot init()]";
114
+ if (absMin == null || absMax == null)
115
+ throw "absMin or absMax is null [termdb.boxplot init()]";
119
116
  if (q.tw.term?.values)
120
- setUncomputablePlots(q.tw, plots);
117
+ setHiddenPlots(q.tw, plots);
121
118
  if (overlayTerm && overlayTerm.term?.values)
122
- setUncomputablePlots(overlayTerm, plots);
119
+ setHiddenPlots(overlayTerm, plots);
123
120
  const returnData = {
124
121
  absMin,
125
122
  absMax,
126
- maxLabelLgth,
127
123
  plots,
128
124
  uncomputableValues: setUncomputableValues(uncomputableValues)
129
125
  };
@@ -135,15 +131,24 @@ function init({ genomes }) {
135
131
  }
136
132
  };
137
133
  }
138
- function setUncomputablePlots(term, plots) {
139
- for (const v of Object.values(term.term.values)) {
134
+ function setHiddenPlots(term, plots) {
135
+ for (const v of Object.values(term.term?.values)) {
140
136
  const plot = plots.find((p) => p.key === v.label);
141
137
  if (plot)
142
- plot.uncomputable = v.uncomputable;
138
+ plot.isHidden = v?.uncomputable;
139
+ }
140
+ if (term.q?.hiddenValues) {
141
+ for (const key of Object.keys(term.q.hiddenValues)) {
142
+ const plot = plots.find((p) => p.key === key);
143
+ if (plot)
144
+ plot.isHidden = true;
145
+ }
143
146
  }
144
147
  return plots;
145
148
  }
146
149
  function setDescrStats(boxplot, sortedValues) {
150
+ if (sortedValues.length < 5)
151
+ return [{ id: "total", label: "Total", value: sortedValues.length }];
147
152
  const mean = sortedValues.reduce((s2, i) => s2 + i, 0) / sortedValues.length;
148
153
  let s = 0;
149
154
  for (const v of sortedValues) {
@@ -154,15 +159,15 @@ function setDescrStats(boxplot, sortedValues) {
154
159
  const variance = squareDiffs / (sortedValues.length - 1);
155
160
  return [
156
161
  { id: "total", label: "Total", value: sortedValues.length },
157
- { id: "min", label: "Minimum", value: roundValue(sortedValues[0], 2) },
158
- { id: "p25", label: "1st quartile", value: roundValue(boxplot.p25, 2) },
159
- { id: "median", label: "Median", value: roundValue(boxplot.p50, 2) },
160
- { id: "mean", label: "Mean", value: roundValue(mean, 2) },
161
- { id: "p75", label: "3rd quartile", value: roundValue(boxplot.p75, 2) },
162
- { id: "max", label: "Maximum", value: roundValue(sortedValues[sortedValues.length - 1], 2) },
163
- { id: "sd", label: "Standard deviation", value: isNaN(sd) ? null : roundValue(sd, 2) },
164
- { id: "variance", label: "Variance", value: roundValue(variance, 2) },
165
- { id: "iqr", label: "Inter-quartile range", value: roundValue(boxplot.iqr, 2) }
162
+ { id: "min", label: "Minimum", value: roundValueAuto(sortedValues[0]) },
163
+ { id: "p25", label: "1st quartile", value: roundValueAuto(boxplot.p25) },
164
+ { id: "median", label: "Median", value: roundValueAuto(boxplot.p50) },
165
+ { id: "mean", label: "Mean", value: roundValueAuto(mean) },
166
+ { id: "p75", label: "3rd quartile", value: roundValueAuto(boxplot.p75) },
167
+ { id: "max", label: "Maximum", value: roundValueAuto(sortedValues[sortedValues.length - 1]) },
168
+ { id: "sd", label: "Standard deviation", value: isNaN(sd) ? null : roundValueAuto(sd) },
169
+ { id: "variance", label: "Variance", value: roundValueAuto(variance) },
170
+ { id: "iqr", label: "Inter-quartile range", value: roundValueAuto(boxplot.iqr) }
166
171
  ];
167
172
  }
168
173
  function setUncomputableValues(values) {
@@ -171,6 +176,10 @@ function setUncomputableValues(values) {
171
176
  } else
172
177
  return null;
173
178
  }
179
+ function numericBins(overlayTerm, data) {
180
+ const overlayBins = data.refs.byTermId[overlayTerm?.term?.id]?.bins ?? [];
181
+ return new Map(overlayBins.map((bin) => [bin.label, bin]));
182
+ }
174
183
  export {
175
184
  api
176
185
  };
@@ -1,4 +1,4 @@
1
- import { termdbCategoriesPayload } from "#types";
1
+ import { termdbCategoriesPayload } from "#types/checkers";
2
2
  import { getOrderedLabels } from "#src/termdb.barchart.js";
3
3
  import { getData } from "#src/termdb.matrix.js";
4
4
  const api = {
@@ -1,6 +1,6 @@
1
1
  import path from "path";
2
2
  import run_R from "#src/run_R.js";
3
- import { termdbClusterPayload } from "#types";
3
+ import { termdbClusterPayload } from "#types/checkers";
4
4
  import * as utils from "#src/utils.js";
5
5
  import serverconfig from "#src/serverconfig.js";
6
6
  import { gdc_validate_query_geneExpression } from "#src/mds3.gdc.js";
@@ -1,4 +1,4 @@
1
- import { termdbCohortSummaryPayload } from "#types";
1
+ import { termdbCohortSummaryPayload } from "#types/checkers";
2
2
  import { get_ds_tdb } from "#src/termdb.js";
3
3
  import { mayCopyFromCookie } from "#src/utils.js";
4
4
  const api = {
@@ -19,7 +19,7 @@ function init({ genomes }) {
19
19
  if (!genome)
20
20
  throw "invalid genome";
21
21
  const [ds] = get_ds_tdb(genome, q);
22
- const count = ds.cohort.termdb.q.getCohortSampleCount(q.cohort);
22
+ const count = ds.cohort.termdb.q?.getCohortSampleCount?.(q.cohort) || 1;
23
23
  res.send({ count });
24
24
  } catch (e) {
25
25
  res.send({ error: e.message || e });
@@ -1,4 +1,4 @@
1
- import { termdbCohortsPayload } from "#types";
1
+ import { termdbCohortsPayload } from "#types/checkers";
2
2
  import { get_ds_tdb } from "#src/termdb.js";
3
3
  import { mayCopyFromCookie } from "#src/utils.js";
4
4
  const api = {
@@ -31,6 +31,8 @@ function init({ genomes }) {
31
31
  };
32
32
  }
33
33
  function getCohortsData(ds) {
34
+ if (!ds.cohort.db)
35
+ return { cohorts: [], features: [], cfeatures: [] };
34
36
  const features = ds.cohort.db.connection.prepare("select * from features").all();
35
37
  const cohorts = ds.cohort.db.connection.prepare(
36
38
  `select * from cohorts where cohort in (select distinct(cohort) from cohort_features)
@@ -2,7 +2,7 @@ import serverconfig from "#src/serverconfig.js";
2
2
  import { authApi } from "#src/auth.js";
3
3
  import { get_ds_tdb } from "#src/termdb.js";
4
4
  import { mayCopyFromCookie } from "#src/utils.js";
5
- import { mayComputeTermtypeByCohort } from "#src/termdb.server.init.js";
5
+ import { mayComputeTermtypeByCohort } from "#src/termdb.server.init.ts";
6
6
  import { TermTypes } from "#shared/terms.js";
7
7
  const api = {
8
8
  endpoint: "termdb/config",
@@ -39,11 +39,11 @@ function init({ genomes }) {
39
39
  }
40
40
  function make(q, res, ds, genome) {
41
41
  const tdb = ds.cohort.termdb;
42
+ const auth = { embedder: q.embedder };
42
43
  const c = {
43
44
  selectCohort: tdb.selectCohort,
44
45
  // optional
45
- supportedChartTypes: tdb.q?.getSupportedChartTypes(q.embedder),
46
- allowedChartTypes: ds.cohort.allowedChartTypes,
46
+ supportedChartTypes: tdb.q?.getSupportedChartTypes(auth),
47
47
  hiddenChartTypes: ds.cohort.hiddenChartTypes,
48
48
  renamedChartTypes: ds.cohort.renamedChartTypes,
49
49
  allowedTermTypes: getAllowedTermTypes(ds),
@@ -242,8 +242,8 @@ function getAllowedTermTypes(ds) {
242
242
  mayComputeTermtypeByCohort(ds);
243
243
  const typeSet = /* @__PURE__ */ new Set();
244
244
  for (const r of ds.cohort.termdb.termtypeByCohort) {
245
- if (r.type)
246
- typeSet.add(r.type);
245
+ if (r.termType)
246
+ typeSet.add(r.termType);
247
247
  }
248
248
  if (ds.cohort.termdb.allowedTermTypes) {
249
249
  for (const t of ds.cohort.termdb.allowedTermTypes)
@@ -1,4 +1,4 @@
1
- import { descrStatsPayload } from "#types";
1
+ import { descrStatsPayload } from "#types/checkers";
2
2
  import Summarystats from "#shared/descriptive.stats.js";
3
3
  import { getData } from "#src/termdb.matrix.js";
4
4
  const api = {
@@ -1,4 +1,4 @@
1
- import { numericCategoriesPayload } from "#types";
1
+ import { numericCategoriesPayload } from "#types/checkers";
2
2
  import * as termdbsql from "#src/termdb.sql.js";
3
3
  const api = {
4
4
  endpoint: "termdb/numericcategories",
@@ -1,4 +1,4 @@
1
- import { percentilePayload } from "#types";
1
+ import { percentilePayload } from "#types/checkers";
2
2
  import * as termdbsql from "#src/termdb.sql.js";
3
3
  import computePercentile from "#shared/compute.percentile.js";
4
4
  const api = {
@@ -1,4 +1,4 @@
1
- import { rootTermPayload } from "#types";
1
+ import { rootTermPayload } from "#types/checkers";
2
2
  import { get_ds_tdb } from "#src/termdb.js";
3
3
  const api = {
4
4
  endpoint: "termdb/rootterm",
@@ -1,4 +1,4 @@
1
- import { termdbSampleImagesPayload } from "#types";
1
+ import { termdbSampleImagesPayload } from "#types/checkers";
2
2
  import path from "path";
3
3
  import fs from "fs";
4
4
  import serverconfig from "#src/serverconfig.js";
@@ -2,7 +2,7 @@ import fs from "fs";
2
2
  import path from "path";
3
3
  import { read_file } from "#src/utils.js";
4
4
  import serverconfig from "#src/serverconfig.js";
5
- import { termdbSingleSampleMutationPayload } from "#types";
5
+ import { termdbSingleSampleMutationPayload } from "#types/checkers";
6
6
  import { gdcValidate_query_singleSampleMutation } from "#src/mds3.gdc.js";
7
7
  const api = {
8
8
  endpoint: "termdb/singleSampleMutation",
@@ -1,4 +1,4 @@
1
- import { termdbSingleCellDEgenesPayload } from "#types";
1
+ import { termdbSingleCellDEgenesPayload } from "#types/checkers";
2
2
  import { gdc_validate_query_singleCell_DEgenes } from "#src/mds3.gdc.js";
3
3
  const api = {
4
4
  endpoint: "termdb/singlecellDEgenes",
@@ -1,4 +1,4 @@
1
- import { termdbSingleCellDataPayload } from "#types";
1
+ import { termdbSingleCellDataPayload } from "#types/checkers";
2
2
  const api = {
3
3
  endpoint: "termdb/singlecellData",
4
4
  methods: {
@@ -4,7 +4,7 @@ import { read_file } from "#src/utils.js";
4
4
  import run_R from "#src/run_R.js";
5
5
  import { run_rust } from "@sjcrh/proteinpaint-rust";
6
6
  import serverconfig from "#src/serverconfig.js";
7
- import { termdbSingleCellSamplesPayload } from "#types";
7
+ import { termdbSingleCellSamplesPayload } from "#types/checkers";
8
8
  import { validate_query_singleCell_DEgenes } from "./termdb.singlecellDEgenes.ts";
9
9
  import { gdc_validate_query_singleCell_samples, gdc_validate_query_singleCell_data } from "#src/mds3.gdc.js";
10
10
  import ky from "ky";
@@ -179,7 +179,7 @@ function validateGeneExpressionNative(G) {
179
179
  const rdsfile = path.join(serverconfig.tpmasterdir, G.folder, (q.sample.eID || q.sample.sID) + ".rds");
180
180
  try {
181
181
  await fs.promises.stat(rdsfile);
182
- } catch (e) {
182
+ } catch (_) {
183
183
  return {};
184
184
  }
185
185
  let out;
@@ -187,7 +187,7 @@ function validateGeneExpressionNative(G) {
187
187
  out = JSON.parse(
188
188
  await run_R(path.join(serverconfig.binpath, "utils", "getGeneFromMatrix.R"), null, [rdsfile, q.gene])
189
189
  );
190
- } catch (e) {
190
+ } catch (_) {
191
191
  return {};
192
192
  }
193
193
  console.log("out:", out);
@@ -198,7 +198,7 @@ function validateGeneExpressionNative(G) {
198
198
  const rdsfile = path.join(serverconfig.tpmasterdir, G.folder, (q.sample.eID || q.sample.sID) + ".h5");
199
199
  try {
200
200
  await fs.promises.stat(rdsfile);
201
- } catch (e) {
201
+ } catch (_) {
202
202
  return {};
203
203
  }
204
204
  const read_hdf5_input_type = { gene: q.gene, hdf5_file: rdsfile };
@@ -215,7 +215,7 @@ function validateGeneExpressionNative(G) {
215
215
  console.log(line);
216
216
  }
217
217
  }
218
- } catch (e) {
218
+ } catch (_) {
219
219
  return {};
220
220
  }
221
221
  return out;
@@ -1,4 +1,4 @@
1
- import { termChildrenPayload } from "#types";
1
+ import { termChildrenPayload } from "#types/checkers";
2
2
  import { copy_term, get_ds_tdb } from "#src/termdb.js";
3
3
  const api = {
4
4
  endpoint: "termdb/termchildren",
@@ -1,4 +1,4 @@
1
- import { termsByIdsPayload } from "#types";
1
+ import { termsByIdsPayload } from "#types/checkers";
2
2
  import { copy_term } from "#src/termdb.js";
3
3
  const api = {
4
4
  endpoint: "termdb/termsbyids",
@@ -1,4 +1,4 @@
1
- import { termdbTopTermsByTypePayload } from "#types";
1
+ import { termdbTopTermsByTypePayload } from "#types/checkers";
2
2
  import { run_rust } from "@sjcrh/proteinpaint-rust";
3
3
  import { get_samples } from "#src/termdb.sql.js";
4
4
  import { TermTypes } from "#shared/terms.js";
@@ -1,4 +1,4 @@
1
- import { termdbTopVariablyExpressedGenesPayload } from "#types";
1
+ import { termdbTopVariablyExpressedGenesPayload } from "#types/checkers";
2
2
  import { run_rust } from "@sjcrh/proteinpaint-rust";
3
3
  import serverconfig from "#src/serverconfig.js";
4
4
  import { get_samples } from "#src/termdb.sql.js";
@@ -1,4 +1,4 @@
1
- import { violinPayload } from "#types";
1
+ import { violinPayload } from "#types/checkers";
2
2
  import { trigger_getViolinPlotData } from "#src/termdb.violin.js";
3
3
  const api = {
4
4
  endpoint: "termdb/violin",