@sjcrh/proteinpaint-server 2.83.0 → 2.85.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.
Files changed (49) hide show
  1. package/package.json +8 -9
  2. package/routes/_template_.js +14 -11
  3. package/routes/brainImaging.js +100 -57
  4. package/routes/brainImagingSamples.js +120 -0
  5. package/routes/burden.js +27 -59
  6. package/routes/dataset.js +9 -17
  7. package/routes/dsdata.js +11 -14
  8. package/routes/dzimages.js +11 -16
  9. package/routes/gdc.maf.js +8 -23
  10. package/routes/gdc.mafBuild.js +9 -9
  11. package/routes/gdc.topMutatedGenes.js +7 -7
  12. package/routes/genelookup.js +16 -34
  13. package/routes/genesetEnrichment.js +18 -14
  14. package/routes/genesetOverrepresentation.js +9 -14
  15. package/routes/healthcheck.js +26 -32
  16. package/routes/hicdata.js +7 -28
  17. package/routes/hicgenome.js +6 -27
  18. package/routes/hicstat.js +4 -22
  19. package/routes/isoformlst.js +8 -11
  20. package/routes/ntseq.js +8 -11
  21. package/routes/pdomain.js +8 -11
  22. package/routes/sampledzimages.js +12 -12
  23. package/routes/samplewsimages.js +6 -10
  24. package/routes/snp.js +8 -10
  25. package/routes/termdb.DE.js +8 -10
  26. package/routes/termdb.boxplot.js +37 -39
  27. package/routes/termdb.categories.js +4 -45
  28. package/routes/termdb.cluster.js +9 -9
  29. package/routes/termdb.cohort.summary.js +5 -8
  30. package/routes/termdb.cohorts.js +3 -7
  31. package/routes/{termdb.getdescrstats.js → termdb.descrstats.js} +8 -45
  32. package/routes/termdb.numericcategories.js +51 -0
  33. package/routes/{termdb.getpercentile.js → termdb.percentile.js} +4 -46
  34. package/routes/{termdb.getrootterm.js → termdb.rootterm.js} +4 -24
  35. package/routes/{termdb.getSampleImages.js → termdb.sampleImages.js} +9 -9
  36. package/routes/termdb.singleSampleMutation.js +3 -7
  37. package/routes/termdb.singlecellDEgenes.js +8 -8
  38. package/routes/termdb.singlecellData.js +4 -8
  39. package/routes/termdb.singlecellSamples.js +8 -8
  40. package/routes/{termdb.gettermchildren.js → termdb.termchildren.js} +8 -28
  41. package/routes/termdb.termsbyids.js +9 -16
  42. package/routes/{termdb.getTopTermsByType.js → termdb.topTermsByType.js} +9 -10
  43. package/routes/termdb.topVariablyExpressedGenes.js +8 -8
  44. package/routes/termdb.violin.js +8 -46
  45. package/routes/tileserver.js +5 -10
  46. package/routes/wsimages.js +10 -9
  47. package/src/app.js +2409 -2954
  48. package/src/serverconfig.js +9 -0
  49. package/routes/termdb.getnumericcategories.js +0 -91
@@ -2,18 +2,14 @@ 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
6
  import { gdcValidate_query_singleSampleMutation } from "#src/mds3.gdc.js";
6
7
  const api = {
7
8
  endpoint: "termdb/singleSampleMutation",
8
9
  methods: {
9
10
  get: {
10
- init,
11
- request: {
12
- typeId: "TermdbSingleSampleMutationRequest"
13
- },
14
- response: {
15
- typeId: "TermdbSingleSampleMutationResponse"
16
- }
11
+ ...termdbSingleSampleMutationPayload,
12
+ init
17
13
  }
18
14
  }
19
15
  };
@@ -1,15 +1,15 @@
1
+ import { termdbSingleCellDEgenesPayload } from "#types";
1
2
  import { gdc_validate_query_singleCell_DEgenes } from "#src/mds3.gdc.js";
2
3
  const api = {
3
4
  endpoint: "termdb/singlecellDEgenes",
4
5
  methods: {
5
- all: {
6
- init,
7
- request: {
8
- typeId: "TermdbSinglecellDEgenesRequest"
9
- },
10
- response: {
11
- typeId: "TermdbSinglecellDEgenesResponse"
12
- }
6
+ get: {
7
+ ...termdbSingleCellDEgenesPayload,
8
+ init
9
+ },
10
+ post: {
11
+ ...termdbSingleCellDEgenesPayload,
12
+ init
13
13
  }
14
14
  }
15
15
  };
@@ -1,17 +1,13 @@
1
+ import { termdbSingleCellDataPayload } from "#types";
1
2
  const api = {
2
3
  endpoint: "termdb/singlecellData",
3
4
  methods: {
4
5
  get: {
5
- init,
6
- request: {
7
- typeId: "TermdbSinglecellDataRequest"
8
- },
9
- response: {
10
- typeId: "TermdbSinglecellDataResponse"
11
- }
6
+ ...termdbSingleCellDataPayload,
7
+ init
12
8
  },
13
9
  post: {
14
- alternativeFor: "get",
10
+ ...termdbSingleCellDataPayload,
15
11
  init
16
12
  }
17
13
  }
@@ -4,20 +4,20 @@ 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
8
  import { validate_query_singleCell_DEgenes } from "./termdb.singlecellDEgenes.ts";
8
9
  import { gdc_validate_query_singleCell_samples, gdc_validate_query_singleCell_data } from "#src/mds3.gdc.js";
9
10
  import ky from "ky";
10
11
  const api = {
11
12
  endpoint: "termdb/singlecellSamples",
12
13
  methods: {
13
- all: {
14
- init,
15
- request: {
16
- typeId: "TermdbSinglecellsamplesRequest"
17
- },
18
- response: {
19
- typeId: "TermdbSinglecellsamplesResponse"
20
- }
14
+ get: {
15
+ ...termdbSingleCellSamplesPayload,
16
+ init
17
+ },
18
+ post: {
19
+ ...termdbSingleCellSamplesPayload,
20
+ init
21
21
  }
22
22
  }
23
23
  };
@@ -1,35 +1,14 @@
1
+ import { termChildrenPayload } from "#types";
1
2
  import { copy_term, get_ds_tdb } from "#src/termdb.js";
2
3
  const api = {
3
4
  endpoint: "termdb/termchildren",
4
5
  methods: {
5
6
  get: {
6
- init,
7
- request: {
8
- typeId: "gettermchildrenRequest"
9
- },
10
- response: {
11
- typeId: "gettermchildrenResponse"
12
- },
13
- examples: [
14
- {
15
- request: {
16
- body: {
17
- genome: "hg38-test",
18
- dslabel: "TermdbTest",
19
- embedder: "localhost",
20
- get_children: 1,
21
- cohortValues: "ABC",
22
- tid: "GO:0000001"
23
- }
24
- },
25
- response: {
26
- header: { status: 200 }
27
- }
28
- }
29
- ]
7
+ ...termChildrenPayload,
8
+ init
30
9
  },
31
10
  post: {
32
- alternativeFor: "get",
11
+ ...termChildrenPayload,
33
12
  init
34
13
  }
35
14
  }
@@ -46,7 +25,8 @@ function init({ genomes }) {
46
25
  throw "invalid dataset name";
47
26
  if (!tdb)
48
27
  throw "invalid termdb object";
49
- await trigger_children(q, res, tdb);
28
+ const result = await trigger_children(q, tdb);
29
+ res.send(result);
50
30
  } catch (e) {
51
31
  res.send({ error: e instanceof Error ? e.message : e });
52
32
  if (e instanceof Error && e.stack)
@@ -54,13 +34,13 @@ function init({ genomes }) {
54
34
  }
55
35
  };
56
36
  }
57
- async function trigger_children(q, res, tdb) {
37
+ async function trigger_children(q, tdb) {
58
38
  if (!q.tid)
59
39
  throw "no parent term id";
60
40
  const cohortValues = q.cohortValues ? q.cohortValues : "";
61
41
  const treeFilter = q.treeFilter ? q.treeFilter : "";
62
42
  const terms = await tdb.q.getTermChildren(q.tid, cohortValues, treeFilter);
63
- res.send({ lst: terms.map(copy_term) });
43
+ return { lst: terms.map(copy_term) };
64
44
  }
65
45
  export {
66
46
  api
@@ -1,18 +1,14 @@
1
+ import { termsByIdsPayload } from "#types";
1
2
  import { copy_term } from "#src/termdb.js";
2
3
  const api = {
3
4
  endpoint: "termdb/termsbyids",
4
5
  methods: {
5
6
  get: {
6
- init,
7
- request: {
8
- typeId: "gettermsbyidsRequest"
9
- },
10
- response: {
11
- typeId: "gettermsbyidsResponse"
12
- }
7
+ ...termsByIdsPayload,
8
+ init
13
9
  },
14
10
  post: {
15
- alternativeFor: "get",
11
+ ...termsByIdsPayload,
16
12
  init
17
13
  }
18
14
  }
@@ -30,7 +26,8 @@ function init({ genomes }) {
30
26
  const tdb = ds.cohort.termdb;
31
27
  if (!tdb)
32
28
  throw "invalid termdb object";
33
- await trigger_gettermsbyid(q, res, tdb);
29
+ const results = await trigger_gettermsbyid(q, tdb);
30
+ res.send(results);
34
31
  } catch (e) {
35
32
  res.send({ error: e instanceof Error ? e.message : e });
36
33
  if (e instanceof Error && e.stack)
@@ -38,10 +35,8 @@ function init({ genomes }) {
38
35
  }
39
36
  };
40
37
  }
41
- async function trigger_gettermsbyid(q, res, tdb) {
42
- const terms = {
43
- terms: {}
44
- };
38
+ async function trigger_gettermsbyid(q, tdb) {
39
+ const terms = {};
45
40
  for (const id of q.ids) {
46
41
  const term = tdb.q.termjsonByOneid(id);
47
42
  if (term) {
@@ -52,9 +47,7 @@ async function trigger_gettermsbyid(q, res, tdb) {
52
47
  }
53
48
  terms[id] = term ? copy_term(term) : void 0;
54
49
  }
55
- res.send({
56
- terms
57
- });
50
+ return { terms };
58
51
  }
59
52
  export {
60
53
  api
@@ -1,17 +1,17 @@
1
+ import { termdbTopTermsByTypePayload } from "#types";
1
2
  import { run_rust } from "@sjcrh/proteinpaint-rust";
2
3
  import { get_samples } from "#src/termdb.sql.js";
3
4
  import { TermTypes } from "#shared/terms.js";
4
5
  const api = {
5
6
  endpoint: "termdb/getTopTermsByType",
6
7
  methods: {
7
- all: {
8
- init,
9
- request: {
10
- typeId: "TermdbTopTermsByTypeRequest"
11
- },
12
- response: {
13
- typeId: "TermdbTopTermsByTypeResponse"
14
- }
8
+ get: {
9
+ ...termdbTopTermsByTypePayload,
10
+ init
11
+ },
12
+ post: {
13
+ ...termdbTopTermsByTypePayload,
14
+ init
15
15
  }
16
16
  }
17
17
  };
@@ -28,7 +28,6 @@ function init({ genomes }) {
28
28
  throw "invalid dslabel";
29
29
  if (!ds.queries[type])
30
30
  throw "not supported on dataset";
31
- const t = Date.now();
32
31
  const terms = await ds.queries[type].getTopTerms(q);
33
32
  res.send({ terms });
34
33
  } catch (e) {
@@ -96,7 +95,7 @@ async function computeTopTerms(file, samples, type) {
96
95
  return varMetabolite;
97
96
  }
98
97
  function gdcValidateQuery(ds, genome, type) {
99
- ds.queries[type].getTopTerms = async (q) => {
98
+ ds.queries[type].getTopTerms = async () => {
100
99
  return [];
101
100
  };
102
101
  }
@@ -1,3 +1,4 @@
1
+ import { termdbTopVariablyExpressedGenesPayload } from "#types";
1
2
  import { run_rust } from "@sjcrh/proteinpaint-rust";
2
3
  import serverconfig from "#src/serverconfig.js";
3
4
  import { get_samples } from "#src/termdb.sql.js";
@@ -7,14 +8,13 @@ import { joinUrl } from "#src/helpers.ts";
7
8
  const api = {
8
9
  endpoint: "termdb/topVariablyExpressedGenes",
9
10
  methods: {
10
- all: {
11
- init,
12
- request: {
13
- typeId: "TermdbTopVariablyExpressedGenesRequest"
14
- },
15
- response: {
16
- typeId: "TermdbTopVariablyExpressedGenesResponse"
17
- }
11
+ get: {
12
+ ...termdbTopVariablyExpressedGenesPayload,
13
+ init
14
+ },
15
+ post: {
16
+ ...termdbTopVariablyExpressedGenesPayload,
17
+ init
18
18
  }
19
19
  }
20
20
  };
@@ -1,53 +1,15 @@
1
+ import { violinPayload } from "#types";
1
2
  import { trigger_getViolinPlotData } from "#src/termdb.violin.js";
2
3
  const api = {
3
4
  endpoint: "termdb/violin",
4
5
  methods: {
5
- all: {
6
- init,
7
- request: {
8
- typeId: "getViolinRequest"
9
- },
10
- response: {
11
- typeId: "getViolinResponse"
12
- },
13
- examples: [
14
- {
15
- request: {
16
- body: {
17
- genome: "hg38-test",
18
- dslabel: "TermdbTest",
19
- embedder: "localhost",
20
- devicePixelRatio: 2.200000047683716,
21
- maxThickness: 150,
22
- screenThickness: 1218,
23
- filter: {
24
- type: "tvslst",
25
- in: true,
26
- join: "",
27
- lst: [
28
- {
29
- tag: "cohortFilter",
30
- type: "tvs",
31
- tvs: { term: { id: "subcohort", type: "categorical" }, values: [{ key: "ABC", label: "ABC" }] }
32
- }
33
- ]
34
- },
35
- svgw: 227.27272234672367,
36
- orientation: "horizontal",
37
- datasymbol: "bean",
38
- radius: 5,
39
- strokeWidth: 0.2,
40
- axisHeight: 60,
41
- rightMargin: 50,
42
- unit: "abs",
43
- termid: "agedx"
44
- }
45
- },
46
- response: {
47
- header: { status: 200 }
48
- }
49
- }
50
- ]
6
+ get: {
7
+ ...violinPayload,
8
+ init
9
+ },
10
+ post: {
11
+ ...violinPayload,
12
+ init
51
13
  }
52
14
  }
53
15
  };
@@ -1,20 +1,15 @@
1
+ import { tilePayload } from "#types";
1
2
  import ky from "ky";
2
3
  import serverconfig from "#src/serverconfig.js";
3
- const routePath = "tileserver";
4
4
  const api = {
5
- endpoint: `${routePath}/layer/slide/:sampleId/zoomify/:TileGroup/:z-:x-:y@1x.jpg`,
5
+ endpoint: `tileserver/layer/slide/:sampleId/zoomify/:TileGroup/:z-:x-:y@1x.jpg`,
6
6
  methods: {
7
7
  get: {
8
- init,
9
- request: {
10
- typeId: "any"
11
- },
12
- response: {
13
- typeId: "any"
14
- }
8
+ ...tilePayload,
9
+ init
15
10
  },
16
11
  post: {
17
- alternativeFor: "get",
12
+ ...tilePayload,
18
13
  init
19
14
  }
20
15
  }
@@ -4,21 +4,17 @@ import path from "path";
4
4
  import serverconfig from "#src/serverconfig.js";
5
5
  import { CookieJar } from "tough-cookie";
6
6
  import { promisify } from "util";
7
+ import { wsImagesPayload } from "#types";
7
8
  const routePath = "wsimages";
8
9
  const api = {
9
10
  endpoint: `${routePath}`,
10
11
  methods: {
11
12
  get: {
12
- init,
13
- request: {
14
- typeId: "GetWSImagesRequest"
15
- },
16
- response: {
17
- typeId: "GetWSImagesResponse"
18
- }
13
+ ...wsImagesPayload,
14
+ init
19
15
  },
20
16
  post: {
21
- alternativeFor: "get",
17
+ ...wsImagesPayload,
22
18
  init
23
19
  }
24
20
  }
@@ -101,7 +97,12 @@ function init({ genomes }) {
101
97
  ]
102
98
  }
103
99
  }).json();
104
- res.status(200).json({ sessionId, slide_dimensions: getWsiImageResponse.slide_dimensions });
100
+ const payload = {
101
+ status: "ok",
102
+ sessionId,
103
+ slide_dimensions: getWsiImageResponse.slide_dimensions
104
+ };
105
+ res.status(200).json(payload);
105
106
  } catch (e) {
106
107
  console.log(e);
107
108
  res.send({