@sjcrh/proteinpaint-server 2.28.0 → 2.29.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.
- package/package.json +1 -1
- package/routes/termdb.categories.ts +212 -0
- package/server.js +1 -1
- package/routes/termdb.getCategories.ts +0 -80
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
// import { getgetCategoriesRequest, getgetCategoriesResponse } from '#shared/types/routes/termdb.getCategories'
|
|
2
|
-
import { trigger_getcategories } from '#src/termdb.js'
|
|
3
|
-
|
|
4
|
-
export const api: any = {
|
|
5
|
-
endpoint: 'termdb/getCategories',
|
|
6
|
-
methods: {
|
|
7
|
-
get: {
|
|
8
|
-
init,
|
|
9
|
-
request: {
|
|
10
|
-
typeId: 'getgetCategoriesRequest'
|
|
11
|
-
},
|
|
12
|
-
response: {
|
|
13
|
-
typeId: 'getgetCategoriesResponse'
|
|
14
|
-
},
|
|
15
|
-
examples: [
|
|
16
|
-
{
|
|
17
|
-
request: {
|
|
18
|
-
body: {
|
|
19
|
-
genome: 'hg38-test',
|
|
20
|
-
dslabel: 'TermdbTest',
|
|
21
|
-
embedder: 'localhost',
|
|
22
|
-
getcategories: 1,
|
|
23
|
-
tid: 'diaggrp',
|
|
24
|
-
filter: {
|
|
25
|
-
type: 'tvslst',
|
|
26
|
-
in: true,
|
|
27
|
-
join: '',
|
|
28
|
-
lst: [
|
|
29
|
-
{
|
|
30
|
-
tag: 'cohortFilter',
|
|
31
|
-
type: 'tvs',
|
|
32
|
-
tvs: {
|
|
33
|
-
term: {
|
|
34
|
-
name: 'Cohort',
|
|
35
|
-
type: 'categorical',
|
|
36
|
-
values: { ABC: { label: 'ABC' }, XYZ: { label: 'XYZ' } },
|
|
37
|
-
id: 'subcohort',
|
|
38
|
-
isleaf: false,
|
|
39
|
-
groupsetting: { disabled: true }
|
|
40
|
-
},
|
|
41
|
-
values: [{ key: 'ABC', label: 'ABC' }]
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
response: {
|
|
49
|
-
header: { status: 200 }
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
]
|
|
53
|
-
},
|
|
54
|
-
post: {
|
|
55
|
-
alternativeFor: 'get',
|
|
56
|
-
init
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function init({ genomes }) {
|
|
62
|
-
return async (req: any, res: any): Promise<void> => {
|
|
63
|
-
const q = req.query // as getgetCategoriesRequest
|
|
64
|
-
try {
|
|
65
|
-
const g = genomes[req.query.genome]
|
|
66
|
-
const ds = g.datasets[req.query.dslabel]
|
|
67
|
-
const tdb = ds.cohort.termdb
|
|
68
|
-
|
|
69
|
-
if (!g) throw 'invalid genome name'
|
|
70
|
-
if (!ds) throw 'invalid dataset name'
|
|
71
|
-
if (!tdb) throw 'invalid termdb object'
|
|
72
|
-
await trigger_getcategories(q, res, tdb, ds, g) // as getgetCategoriesResponse
|
|
73
|
-
} catch (e) {
|
|
74
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
75
|
-
// @ts-ignore
|
|
76
|
-
res.send({ error: e?.message || e })
|
|
77
|
-
if (e instanceof Error && e.stack) console.log(e)
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|