@sjcrh/proteinpaint-server 2.35.2-0 → 2.37.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.35.2-0",
3
+ "version": "2.37.0",
4
4
  "description": "a genomics visualization tool for exploring a cohort's genotype and phenotype data",
5
5
  "main": "server.js",
6
6
  "bin": "start.js",
@@ -57,7 +57,7 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@sjcrh/augen": "2.35.0",
60
- "@sjcrh/proteinpaint-rust": "2.34.0",
60
+ "@sjcrh/proteinpaint-rust": "2.37.0",
61
61
  "better-sqlite3": "^7.5.3",
62
62
  "body-parser": "^1.15.2",
63
63
  "canvas": "~2.9.3",
@@ -1,32 +1,17 @@
1
- // import { gettermbyidRequest, gettermbyidResponse } from '#shared/types/routes/termdb.termbyid'
1
+ import { gettermsbyidsRequest, gettermsbyidsResponse } from '#shared/types/routes/termdb.termsbyids.js'
2
2
  import { copy_term } from '#src/termdb.js'
3
3
 
4
4
  export const api: any = {
5
- endpoint: 'termdb/termbyid',
5
+ endpoint: 'termdb/termsbyids',
6
6
  methods: {
7
7
  get: {
8
8
  init,
9
9
  request: {
10
- typeId: 'gettermbyidRequest'
10
+ typeId: 'gettermsbyidsRequest'
11
11
  },
12
12
  response: {
13
- typeId: 'gettermbyidResponse'
14
- },
15
- examples: [
16
- {
17
- request: {
18
- body: {
19
- genome: 'hg38-test',
20
- dslabel: 'TermdbTest',
21
- embedder: 'localhost',
22
- gettermbyid: 'subcohort'
23
- }
24
- },
25
- response: {
26
- header: { status: 200 }
27
- }
28
- }
29
- ]
13
+ typeId: 'gettermsbyidsResponse'
14
+ }
30
15
  },
31
16
  post: {
32
17
  alternativeFor: 'get',
@@ -46,7 +31,7 @@ function init({ genomes }) {
46
31
  const tdb = ds.cohort.termdb
47
32
  if (!tdb) throw 'invalid termdb object'
48
33
 
49
- await trigger_gettermbyid(q, res, tdb) // as getcategoriesResponse
34
+ await trigger_gettermsbyid(q, res, tdb) // as getcategoriesResponse
50
35
  } catch (e) {
51
36
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
52
37
  // @ts-ignore
@@ -56,13 +41,23 @@ function init({ genomes }) {
56
41
  }
57
42
  }
58
43
 
59
- async function trigger_gettermbyid(
60
- q: { gettermbyid: any },
61
- res: { send: (arg0: { term: any }) => void },
44
+ async function trigger_gettermsbyid(
45
+ q: { ids: any },
46
+ res: { send: (arg0: { terms: any }) => void },
62
47
  tdb: { q: { termjsonByOneid: (arg0: any) => any } }
63
48
  ) {
64
- const t = tdb.q.termjsonByOneid(q.gettermbyid)
49
+ const terms = {}
50
+ for (const id of q.ids) {
51
+ const term = tdb.q.termjsonByOneid(id)
52
+ if (term) {
53
+ if (term.type == 'categorical' && !term.values && !term.groupsetting?.inuse) {
54
+ term.values = {}
55
+ term.samplecount = {}
56
+ }
57
+ }
58
+ terms[id] = term ? copy_term(term) : undefined
59
+ }
65
60
  res.send({
66
- term: t ? copy_term(t) : undefined
61
+ terms
67
62
  })
68
63
  }
@@ -31,7 +31,11 @@ function init({ genomes }) {
31
31
  const ds = genome.datasets?.[q.dslabel]
32
32
  if (!ds) throw 'invalid dslabel'
33
33
  if (!ds.queries?.topVariablyExpressedGenes) throw 'not supported on dataset'
34
+
35
+ const t: number = new Date().getTime()
34
36
  const genes = await ds.queries.topVariablyExpressedGenes.getGenes(q)
37
+ if (serverconfig.debugmode) console.log('topVariablyExpressedGenes', new Date().getTime() - t, 'ms')
38
+
35
39
  res.send({ genes } as TermdbTopVariablyExpressedGenesResponse)
36
40
  } catch (e: any) {
37
41
  res.send({ status: 'error', error: e.message || e })
@@ -139,7 +143,7 @@ function gdcValidateQuery(ds: any, genome: any) {
139
143
  // limit the case_ids length, and restrict pool to CGC genes, otherwise the request times out !!!
140
144
  // must revert asap
141
145
  return {
142
- case_ids: caseLst.slice(0, 20),
146
+ case_ids: caseLst, //.slice(0, 20),
143
147
  gene_ids: tempGetCGCgenes(genome),
144
148
  selection_size: Number(q.maxGenes)
145
149
  }