@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.
- package/package.json +8 -9
- package/routes/_template_.js +14 -11
- package/routes/brainImaging.js +100 -57
- package/routes/brainImagingSamples.js +120 -0
- package/routes/burden.js +27 -59
- package/routes/dataset.js +9 -17
- package/routes/dsdata.js +11 -14
- package/routes/dzimages.js +11 -16
- package/routes/gdc.maf.js +8 -23
- package/routes/gdc.mafBuild.js +9 -9
- package/routes/gdc.topMutatedGenes.js +7 -7
- package/routes/genelookup.js +16 -34
- package/routes/genesetEnrichment.js +18 -14
- package/routes/genesetOverrepresentation.js +9 -14
- package/routes/healthcheck.js +26 -32
- package/routes/hicdata.js +7 -28
- package/routes/hicgenome.js +6 -27
- package/routes/hicstat.js +4 -22
- package/routes/isoformlst.js +8 -11
- package/routes/ntseq.js +8 -11
- package/routes/pdomain.js +8 -11
- package/routes/sampledzimages.js +12 -12
- package/routes/samplewsimages.js +6 -10
- package/routes/snp.js +8 -10
- package/routes/termdb.DE.js +8 -10
- package/routes/termdb.boxplot.js +37 -39
- package/routes/termdb.categories.js +4 -45
- package/routes/termdb.cluster.js +9 -9
- package/routes/termdb.cohort.summary.js +5 -8
- package/routes/termdb.cohorts.js +3 -7
- package/routes/{termdb.getdescrstats.js → termdb.descrstats.js} +8 -45
- package/routes/termdb.numericcategories.js +51 -0
- package/routes/{termdb.getpercentile.js → termdb.percentile.js} +4 -46
- package/routes/{termdb.getrootterm.js → termdb.rootterm.js} +4 -24
- package/routes/{termdb.getSampleImages.js → termdb.sampleImages.js} +9 -9
- package/routes/termdb.singleSampleMutation.js +3 -7
- package/routes/termdb.singlecellDEgenes.js +8 -8
- package/routes/termdb.singlecellData.js +4 -8
- package/routes/termdb.singlecellSamples.js +8 -8
- package/routes/{termdb.gettermchildren.js → termdb.termchildren.js} +8 -28
- package/routes/termdb.termsbyids.js +9 -16
- package/routes/{termdb.getTopTermsByType.js → termdb.topTermsByType.js} +9 -10
- package/routes/termdb.topVariablyExpressedGenes.js +8 -8
- package/routes/termdb.violin.js +8 -46
- package/routes/tileserver.js +5 -10
- package/routes/wsimages.js +10 -9
- package/src/app.js +2409 -2954
- package/src/serverconfig.js +9 -0
- package/routes/termdb.getnumericcategories.js +0 -91
package/routes/sampledzimages.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
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
5
|
const api = {
|
|
5
6
|
endpoint: "sampledzimages",
|
|
6
7
|
methods: {
|
|
7
8
|
get: {
|
|
8
9
|
init,
|
|
9
|
-
|
|
10
|
-
typeId: "GetSampleDZImagesRequest"
|
|
11
|
-
},
|
|
12
|
-
response: {
|
|
13
|
-
typeId: "GetSampleDZImagesResponse"
|
|
14
|
-
}
|
|
10
|
+
...dzImagesPayload
|
|
15
11
|
},
|
|
16
12
|
post: {
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
init,
|
|
14
|
+
...dzImagesPayload
|
|
19
15
|
}
|
|
20
16
|
}
|
|
21
17
|
};
|
|
22
18
|
function init({ genomes }) {
|
|
23
19
|
return async (req, res) => {
|
|
20
|
+
const q = req.query;
|
|
24
21
|
try {
|
|
25
|
-
const g = genomes[
|
|
22
|
+
const g = genomes[q.genome];
|
|
26
23
|
if (!g)
|
|
27
24
|
throw "invalid genome name";
|
|
28
|
-
const ds = g.datasets[
|
|
25
|
+
const ds = g.datasets[q.dslabel];
|
|
29
26
|
if (!ds)
|
|
30
27
|
throw "invalid dataset name";
|
|
31
|
-
const sampleId =
|
|
28
|
+
const sampleId = q.sample_id || "";
|
|
32
29
|
const sampleDZImagesPath = path.join(
|
|
33
30
|
`${serverconfig.tpmasterdir}/${ds.queries.DZImages.imageBySampleFolder}`,
|
|
34
31
|
sampleId
|
|
35
32
|
);
|
|
36
33
|
const sampleDZImages = getDZImages(sampleDZImagesPath);
|
|
37
|
-
res.send(
|
|
34
|
+
res.send(
|
|
35
|
+
{ sampleDZImages }
|
|
36
|
+
/*satisfies DZImagesResponse*/
|
|
37
|
+
);
|
|
38
38
|
} catch (e) {
|
|
39
39
|
console.log(e);
|
|
40
40
|
res.status(404).send("Sample images not found");
|
package/routes/samplewsimages.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
+
import { sampleWSImagesPayload } from "#types";
|
|
1
2
|
const api = {
|
|
2
3
|
endpoint: "samplewsimages",
|
|
3
4
|
methods: {
|
|
4
5
|
get: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
typeId: "GetSampleWSImagesRequest"
|
|
8
|
-
},
|
|
9
|
-
response: {
|
|
10
|
-
typeId: "GetSampleWSImagesResponse"
|
|
11
|
-
}
|
|
6
|
+
...sampleWSImagesPayload,
|
|
7
|
+
init
|
|
12
8
|
},
|
|
13
9
|
post: {
|
|
14
|
-
|
|
10
|
+
...sampleWSImagesPayload,
|
|
15
11
|
init
|
|
16
12
|
}
|
|
17
13
|
}
|
|
@@ -35,8 +31,8 @@ function init({ genomes }) {
|
|
|
35
31
|
}
|
|
36
32
|
};
|
|
37
33
|
}
|
|
38
|
-
function validate_query_getSampleWSImages(ds
|
|
39
|
-
const q = ds.queries
|
|
34
|
+
function validate_query_getSampleWSImages(ds) {
|
|
35
|
+
const q = ds.queries?.WSImages;
|
|
40
36
|
if (!q)
|
|
41
37
|
return;
|
|
42
38
|
nativeValidateQuery(ds);
|
package/routes/snp.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { snpPayload } from "#types";
|
|
1
2
|
import * as utils from "#src/utils.js";
|
|
2
3
|
const api = {
|
|
3
4
|
// route endpoint
|
|
@@ -7,16 +8,11 @@ const api = {
|
|
|
7
8
|
endpoint: "snp",
|
|
8
9
|
methods: {
|
|
9
10
|
get: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
typeId: "any"
|
|
13
|
-
},
|
|
14
|
-
response: {
|
|
15
|
-
typeId: "any"
|
|
16
|
-
}
|
|
11
|
+
...snpPayload,
|
|
12
|
+
init
|
|
17
13
|
},
|
|
18
14
|
post: {
|
|
19
|
-
|
|
15
|
+
...snpPayload,
|
|
20
16
|
init
|
|
21
17
|
}
|
|
22
18
|
}
|
|
@@ -24,10 +20,12 @@ const api = {
|
|
|
24
20
|
function init({ genomes }) {
|
|
25
21
|
return async function handle_snp(req, res) {
|
|
26
22
|
try {
|
|
27
|
-
const
|
|
23
|
+
const q = req.query;
|
|
24
|
+
const n = q.genome;
|
|
28
25
|
if (!n)
|
|
29
26
|
throw "no genome";
|
|
30
|
-
|
|
27
|
+
const results = await searchSNP(q, genomes[n]);
|
|
28
|
+
res.send({ results });
|
|
31
29
|
} catch (e) {
|
|
32
30
|
if (e.stack)
|
|
33
31
|
console.log(e.stack);
|
package/routes/termdb.DE.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
+
import { diffExpPayload } from "#types";
|
|
2
3
|
import { run_rust } from "@sjcrh/proteinpaint-rust";
|
|
3
4
|
import { get_ds_tdb } from "../src/termdb.js";
|
|
4
5
|
import run_R from "../src/run_R.js";
|
|
@@ -6,16 +7,13 @@ import serverconfig from "../src/serverconfig.js";
|
|
|
6
7
|
const api = {
|
|
7
8
|
endpoint: "DEanalysis",
|
|
8
9
|
methods: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// will combine this with type checker
|
|
17
|
-
//valid: (t) => {}
|
|
18
|
-
}
|
|
10
|
+
get: {
|
|
11
|
+
...diffExpPayload,
|
|
12
|
+
init
|
|
13
|
+
},
|
|
14
|
+
post: {
|
|
15
|
+
...diffExpPayload,
|
|
16
|
+
init
|
|
19
17
|
}
|
|
20
18
|
}
|
|
21
19
|
};
|
package/routes/termdb.boxplot.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
+
import { boxplotPayload } from "#types";
|
|
1
2
|
import { getData } from "../src/termdb.matrix.js";
|
|
2
3
|
import { boxplot_getvalue } from "../src/utils.js";
|
|
3
4
|
import { sortKey2values } from "../src/termdb.violin.js";
|
|
4
5
|
const api = {
|
|
5
6
|
endpoint: "termdb/boxplot",
|
|
6
7
|
methods: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
examples: []
|
|
8
|
+
get: {
|
|
9
|
+
...boxplotPayload,
|
|
10
|
+
init
|
|
11
|
+
},
|
|
12
|
+
post: {
|
|
13
|
+
...boxplotPayload,
|
|
14
|
+
init
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
17
|
};
|
|
@@ -43,14 +42,18 @@ function init({ genomes }) {
|
|
|
43
42
|
const sampleType = `All ${data.sampleType?.plural_name || "samples"}`;
|
|
44
43
|
const key2values = /* @__PURE__ */ new Map();
|
|
45
44
|
const overlayTerm = q.divideTw;
|
|
46
|
-
for (const
|
|
45
|
+
for (const val of Object.values(data.samples)) {
|
|
47
46
|
const value = val[q.tw.$id];
|
|
48
47
|
if (!Number.isFinite(value?.value))
|
|
49
48
|
continue;
|
|
49
|
+
if (q.tw.term.values?.[value.value]?.uncomputable)
|
|
50
|
+
continue;
|
|
50
51
|
if (overlayTerm) {
|
|
51
52
|
if (!val[overlayTerm?.$id])
|
|
52
53
|
continue;
|
|
53
54
|
const value2 = val[overlayTerm.$id];
|
|
55
|
+
if (overlayTerm.term?.values?.[value2.key]?.uncomputable)
|
|
56
|
+
continue;
|
|
54
57
|
if (!key2values.has(value2.key))
|
|
55
58
|
key2values.set(value2.key, []);
|
|
56
59
|
key2values.get(value2.key).push(value.value);
|
|
@@ -64,57 +67,52 @@ function init({ genomes }) {
|
|
|
64
67
|
let absMin, absMax, maxLabelLgth;
|
|
65
68
|
for (const [key, values] of sortKey2values(data, key2values, overlayTerm)) {
|
|
66
69
|
const sortedValues = values.sort((a, b) => a - b);
|
|
67
|
-
if (
|
|
70
|
+
if (absMin === null || absMin === void 0 || sortedValues[0] < absMin)
|
|
68
71
|
absMin = sortedValues[0];
|
|
69
|
-
if (
|
|
72
|
+
if (absMax === null || absMax === void 0 || sortedValues[sortedValues.length - 1] > absMax)
|
|
70
73
|
absMax = sortedValues[sortedValues.length - 1];
|
|
71
74
|
const vs = sortedValues.map((v) => {
|
|
72
75
|
const value = { value: v };
|
|
73
76
|
return value;
|
|
74
77
|
});
|
|
78
|
+
const _plot = {
|
|
79
|
+
// label,
|
|
80
|
+
// values,
|
|
81
|
+
// plotValueCount: values.length
|
|
82
|
+
boxplot: boxplot_getvalue(vs),
|
|
83
|
+
min: sortedValues[0],
|
|
84
|
+
max: sortedValues[sortedValues.length - 1]
|
|
85
|
+
};
|
|
75
86
|
if (overlayTerm) {
|
|
76
87
|
let label = overlayTerm?.term?.values?.[key]?.label || key;
|
|
77
88
|
label = `${label}, n=${values.length}`;
|
|
78
|
-
if (!maxLabelLgth || label.length > maxLabelLgth
|
|
89
|
+
if (!maxLabelLgth || label.length > maxLabelLgth)
|
|
79
90
|
maxLabelLgth = label.length;
|
|
80
|
-
const plot = {
|
|
81
|
-
// label,
|
|
82
|
-
// values,
|
|
91
|
+
const plot = Object.assign(_plot, {
|
|
83
92
|
seriesId: key,
|
|
84
|
-
color: overlayTerm?.term?.values?.[key]?.color || null
|
|
85
|
-
|
|
86
|
-
//Need sd and mean?
|
|
87
|
-
// plotValueCount: values.length,
|
|
88
|
-
min: sortedValues[0],
|
|
89
|
-
max: sortedValues[sortedValues.length - 1]
|
|
90
|
-
};
|
|
93
|
+
color: overlayTerm?.term?.values?.[key]?.color || null
|
|
94
|
+
});
|
|
91
95
|
plot.boxplot.label = label;
|
|
92
96
|
plots.push(plot);
|
|
93
97
|
} else {
|
|
94
98
|
const label = `${sampleType}, n=${values.length}`;
|
|
95
99
|
if (!maxLabelLgth || label.length > maxLabelLgth.length)
|
|
96
100
|
maxLabelLgth = label.length;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
// values,
|
|
100
|
-
// plotValueCount: values.length,
|
|
101
|
-
boxplot: boxplot_getvalue(vs),
|
|
102
|
-
min: sortedValues[0],
|
|
103
|
-
max: sortedValues[sortedValues.length - 1]
|
|
104
|
-
};
|
|
105
|
-
plot.boxplot.label = label;
|
|
106
|
-
plots.push(plot);
|
|
101
|
+
_plot.boxplot.label = label;
|
|
102
|
+
plots.push(_plot);
|
|
107
103
|
}
|
|
108
104
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
105
|
+
const returnData = {
|
|
106
|
+
absMin,
|
|
107
|
+
absMax,
|
|
108
|
+
maxLabelLgth,
|
|
109
|
+
plots
|
|
110
|
+
};
|
|
111
|
+
res.send(returnData);
|
|
114
112
|
} catch (e) {
|
|
115
113
|
res.send({ error: e?.message || e });
|
|
116
114
|
if (e instanceof Error && e.stack)
|
|
117
|
-
console.
|
|
115
|
+
console.error(e);
|
|
118
116
|
}
|
|
119
117
|
};
|
|
120
118
|
}
|
|
@@ -1,56 +1,15 @@
|
|
|
1
|
+
import { termdbCategoriesPayload } from "#types";
|
|
1
2
|
import { getOrderedLabels } from "#src/termdb.barchart.js";
|
|
2
3
|
import { getData } from "#src/termdb.matrix.js";
|
|
3
4
|
const api = {
|
|
4
5
|
endpoint: "termdb/categories",
|
|
5
6
|
methods: {
|
|
6
7
|
get: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
typeId: "getcategoriesRequest"
|
|
10
|
-
},
|
|
11
|
-
response: {
|
|
12
|
-
typeId: "getcategoriesResponse"
|
|
13
|
-
},
|
|
14
|
-
examples: [
|
|
15
|
-
{
|
|
16
|
-
request: {
|
|
17
|
-
body: {
|
|
18
|
-
genome: "hg38-test",
|
|
19
|
-
dslabel: "TermdbTest",
|
|
20
|
-
embedder: "localhost",
|
|
21
|
-
term: { id: "diaggrp" },
|
|
22
|
-
filter: {
|
|
23
|
-
type: "tvslst",
|
|
24
|
-
in: true,
|
|
25
|
-
join: "",
|
|
26
|
-
lst: [
|
|
27
|
-
{
|
|
28
|
-
tag: "cohortFilter",
|
|
29
|
-
type: "tvs",
|
|
30
|
-
tvs: {
|
|
31
|
-
term: {
|
|
32
|
-
name: "Cohort",
|
|
33
|
-
type: "categorical",
|
|
34
|
-
values: { ABC: { label: "ABC" }, XYZ: { label: "XYZ" } },
|
|
35
|
-
id: "subcohort",
|
|
36
|
-
isleaf: false,
|
|
37
|
-
groupsetting: { disabled: true }
|
|
38
|
-
},
|
|
39
|
-
values: [{ key: "ABC", label: "ABC" }]
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
response: {
|
|
47
|
-
header: { status: 200 }
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
]
|
|
8
|
+
...termdbCategoriesPayload,
|
|
9
|
+
init
|
|
51
10
|
},
|
|
52
11
|
post: {
|
|
53
|
-
|
|
12
|
+
...termdbCategoriesPayload,
|
|
54
13
|
init
|
|
55
14
|
}
|
|
56
15
|
}
|
package/routes/termdb.cluster.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import run_R from "#src/run_R.js";
|
|
3
|
+
import { termdbClusterPayload } from "#types";
|
|
3
4
|
import * as utils from "#src/utils.js";
|
|
4
5
|
import serverconfig from "#src/serverconfig.js";
|
|
5
6
|
import { gdc_validate_query_geneExpression } from "#src/mds3.gdc.js";
|
|
@@ -11,14 +12,13 @@ import { getData } from "#src/termdb.matrix.js";
|
|
|
11
12
|
const api = {
|
|
12
13
|
endpoint: "termdb/cluster",
|
|
13
14
|
methods: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
15
|
+
get: {
|
|
16
|
+
...termdbClusterPayload,
|
|
17
|
+
init
|
|
18
|
+
},
|
|
19
|
+
post: {
|
|
20
|
+
...termdbClusterPayload,
|
|
21
|
+
init
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
};
|
|
@@ -135,7 +135,7 @@ async function doClustering(data, q, numCases = 1e3) {
|
|
|
135
135
|
for (const s of inputData.col_names) {
|
|
136
136
|
row.push(o[s] || 0);
|
|
137
137
|
}
|
|
138
|
-
inputData.matrix.push(getZscore(row));
|
|
138
|
+
inputData.matrix.push(q.zScoreTransformation ? getZscore(row) : row);
|
|
139
139
|
}
|
|
140
140
|
if (inputData.matrix.length == 0)
|
|
141
141
|
throw "Clustering matrix is empty";
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
+
import { termdbCohortSummaryPayload } from "#types";
|
|
1
2
|
import { get_ds_tdb } from "#src/termdb.js";
|
|
2
3
|
import { mayCopyFromCookie } from "#src/utils.js";
|
|
3
4
|
const api = {
|
|
4
5
|
endpoint: "termdb/cohort/summary",
|
|
5
6
|
methods: {
|
|
6
7
|
get: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
typeId: "any"
|
|
10
|
-
},
|
|
11
|
-
response: {
|
|
12
|
-
typeId: "any"
|
|
13
|
-
}
|
|
8
|
+
...termdbCohortSummaryPayload,
|
|
9
|
+
init
|
|
14
10
|
}
|
|
15
11
|
}
|
|
16
12
|
};
|
|
@@ -23,7 +19,8 @@ function init({ genomes }) {
|
|
|
23
19
|
if (!genome)
|
|
24
20
|
throw "invalid genome";
|
|
25
21
|
const [ds] = get_ds_tdb(genome, q);
|
|
26
|
-
|
|
22
|
+
const count = ds.cohort.termdb.q.getCohortSampleCount(q.cohort);
|
|
23
|
+
res.send({ count });
|
|
27
24
|
} catch (e) {
|
|
28
25
|
res.send({ error: e.message || e });
|
|
29
26
|
if (e.stack)
|
package/routes/termdb.cohorts.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
+
import { termdbCohortsPayload } from "#types";
|
|
1
2
|
import { get_ds_tdb } from "#src/termdb.js";
|
|
2
3
|
import { mayCopyFromCookie } from "#src/utils.js";
|
|
3
4
|
const api = {
|
|
4
5
|
endpoint: "termdb/cohorts",
|
|
5
6
|
methods: {
|
|
6
7
|
get: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
typeId: "any"
|
|
10
|
-
},
|
|
11
|
-
response: {
|
|
12
|
-
typeId: "any"
|
|
13
|
-
}
|
|
8
|
+
...termdbCohortsPayload,
|
|
9
|
+
init
|
|
14
10
|
}
|
|
15
11
|
}
|
|
16
12
|
};
|
|
@@ -1,53 +1,16 @@
|
|
|
1
|
+
import { descrStatsPayload } from "#types";
|
|
1
2
|
import Summarystats from "#shared/descriptive.stats.js";
|
|
2
3
|
import { getData } from "#src/termdb.matrix.js";
|
|
3
4
|
const api = {
|
|
4
5
|
endpoint: "termdb/descrstats",
|
|
5
6
|
methods: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
examples: [
|
|
15
|
-
{
|
|
16
|
-
request: {
|
|
17
|
-
body: {
|
|
18
|
-
genome: "hg38-test",
|
|
19
|
-
dslabel: "TermdbTest",
|
|
20
|
-
embedder: "localhost",
|
|
21
|
-
tw: { term: { id: "hrtavg" }, q: { mode: "continuous" } },
|
|
22
|
-
filter: {
|
|
23
|
-
type: "tvslst",
|
|
24
|
-
in: true,
|
|
25
|
-
join: "",
|
|
26
|
-
lst: [
|
|
27
|
-
{
|
|
28
|
-
tag: "cohortFilter",
|
|
29
|
-
type: "tvs",
|
|
30
|
-
tvs: {
|
|
31
|
-
term: {
|
|
32
|
-
name: "Cohort",
|
|
33
|
-
type: "categorical",
|
|
34
|
-
values: { ABC: { label: "ABC" }, XYZ: { label: "XYZ" } },
|
|
35
|
-
id: "subcohort",
|
|
36
|
-
isleaf: false,
|
|
37
|
-
groupsetting: { disabled: true }
|
|
38
|
-
},
|
|
39
|
-
values: [{ key: "ABC", label: "ABC" }]
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
response: {
|
|
47
|
-
header: { status: 200 }
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
]
|
|
7
|
+
get: {
|
|
8
|
+
...descrStatsPayload,
|
|
9
|
+
init
|
|
10
|
+
},
|
|
11
|
+
post: {
|
|
12
|
+
...descrStatsPayload,
|
|
13
|
+
init
|
|
51
14
|
}
|
|
52
15
|
}
|
|
53
16
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { numericCategoriesPayload } from "#types";
|
|
2
|
+
import * as termdbsql from "#src/termdb.sql.js";
|
|
3
|
+
const api = {
|
|
4
|
+
endpoint: "termdb/numericcategories",
|
|
5
|
+
methods: {
|
|
6
|
+
get: {
|
|
7
|
+
...numericCategoriesPayload,
|
|
8
|
+
init
|
|
9
|
+
},
|
|
10
|
+
post: {
|
|
11
|
+
...numericCategoriesPayload,
|
|
12
|
+
init
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
function init({ genomes }) {
|
|
17
|
+
return async (req, res) => {
|
|
18
|
+
const q = req.query;
|
|
19
|
+
try {
|
|
20
|
+
const g = genomes[req.query.genome];
|
|
21
|
+
if (!g)
|
|
22
|
+
throw "invalid genome name";
|
|
23
|
+
const ds = g.datasets[req.query.dslabel];
|
|
24
|
+
if (!ds)
|
|
25
|
+
throw "invalid dataset name";
|
|
26
|
+
const tdb = ds.cohort.termdb;
|
|
27
|
+
if (!tdb)
|
|
28
|
+
throw "invalid termdb object";
|
|
29
|
+
const result = await trigger_getnumericcategories(q, tdb, ds);
|
|
30
|
+
res.send(result);
|
|
31
|
+
} catch (e) {
|
|
32
|
+
res.send({ error: e instanceof Error ? e.message : e });
|
|
33
|
+
if (e instanceof Error && e.stack)
|
|
34
|
+
console.log(e);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
async function trigger_getnumericcategories(q, tdb, ds) {
|
|
39
|
+
if (!q.tid)
|
|
40
|
+
throw ".tid missing";
|
|
41
|
+
const arg = {
|
|
42
|
+
ds,
|
|
43
|
+
term_id: q.tid,
|
|
44
|
+
filter: q.filter
|
|
45
|
+
};
|
|
46
|
+
const lst = await termdbsql.get_summary_numericcategories(arg);
|
|
47
|
+
return { lst };
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
api
|
|
51
|
+
};
|
|
@@ -1,57 +1,15 @@
|
|
|
1
|
+
import { percentilePayload } from "#types";
|
|
1
2
|
import * as termdbsql from "#src/termdb.sql.js";
|
|
2
3
|
import computePercentile from "#shared/compute.percentile.js";
|
|
3
4
|
const api = {
|
|
4
5
|
endpoint: "termdb/getpercentile",
|
|
5
6
|
methods: {
|
|
6
7
|
get: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
typeId: "getpercentileRequest"
|
|
10
|
-
},
|
|
11
|
-
response: {
|
|
12
|
-
typeId: "getpercentileResponse"
|
|
13
|
-
},
|
|
14
|
-
examples: [
|
|
15
|
-
{
|
|
16
|
-
request: {
|
|
17
|
-
body: {
|
|
18
|
-
genome: "hg38-test",
|
|
19
|
-
dslabel: "TermdbTest",
|
|
20
|
-
embedder: "localhost",
|
|
21
|
-
getpercentile: [50],
|
|
22
|
-
tid: "agedx",
|
|
23
|
-
filter: {
|
|
24
|
-
type: "tvslst",
|
|
25
|
-
in: true,
|
|
26
|
-
join: "",
|
|
27
|
-
lst: [
|
|
28
|
-
{
|
|
29
|
-
tag: "cohortFilter",
|
|
30
|
-
type: "tvs",
|
|
31
|
-
tvs: {
|
|
32
|
-
term: {
|
|
33
|
-
name: "Cohort",
|
|
34
|
-
type: "categorical",
|
|
35
|
-
values: { ABC: { label: "ABC" }, XYZ: { label: "XYZ" } },
|
|
36
|
-
id: "subcohort",
|
|
37
|
-
isleaf: false,
|
|
38
|
-
groupsetting: { disabled: true }
|
|
39
|
-
},
|
|
40
|
-
values: [{ key: "ABC", label: "ABC" }]
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
response: {
|
|
48
|
-
header: { status: 200 }
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
]
|
|
8
|
+
...percentilePayload,
|
|
9
|
+
init
|
|
52
10
|
},
|
|
53
11
|
post: {
|
|
54
|
-
|
|
12
|
+
...percentilePayload,
|
|
55
13
|
init
|
|
56
14
|
}
|
|
57
15
|
}
|
|
@@ -1,34 +1,14 @@
|
|
|
1
|
+
import { rootTermPayload } from "#types";
|
|
1
2
|
import { get_ds_tdb } from "#src/termdb.js";
|
|
2
3
|
const api = {
|
|
3
4
|
endpoint: "termdb/rootterm",
|
|
4
5
|
methods: {
|
|
5
6
|
get: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
typeId: "getroottermRequest"
|
|
9
|
-
},
|
|
10
|
-
response: {
|
|
11
|
-
typeId: "getroottermResponse"
|
|
12
|
-
},
|
|
13
|
-
examples: [
|
|
14
|
-
{
|
|
15
|
-
request: {
|
|
16
|
-
body: {
|
|
17
|
-
genome: "hg38-test",
|
|
18
|
-
dslabel: "TermdbTest",
|
|
19
|
-
embedder: "localhost",
|
|
20
|
-
default_rootterm: 1,
|
|
21
|
-
cohortValues: "ABC"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
response: {
|
|
25
|
-
header: { status: 200 }
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
]
|
|
7
|
+
...rootTermPayload,
|
|
8
|
+
init
|
|
29
9
|
},
|
|
30
10
|
post: {
|
|
31
|
-
|
|
11
|
+
...rootTermPayload,
|
|
32
12
|
init
|
|
33
13
|
}
|
|
34
14
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import { termdbSampleImagesPayload } from "#types";
|
|
1
2
|
import path from "path";
|
|
2
3
|
import fs from "fs";
|
|
3
4
|
import serverconfig from "#src/serverconfig.js";
|
|
4
5
|
const api = {
|
|
5
6
|
endpoint: "termdb/getSampleImages",
|
|
6
7
|
methods: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
8
|
+
get: {
|
|
9
|
+
...termdbSampleImagesPayload,
|
|
10
|
+
init
|
|
11
|
+
},
|
|
12
|
+
post: {
|
|
13
|
+
...termdbSampleImagesPayload,
|
|
14
|
+
init
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
};
|
|
@@ -33,7 +33,7 @@ function init({ genomes }) {
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
function validate_query_getSampleImages(ds
|
|
36
|
+
function validate_query_getSampleImages(ds) {
|
|
37
37
|
const q = ds.queries.images;
|
|
38
38
|
if (!q)
|
|
39
39
|
return;
|