@sjcrh/proteinpaint-server 2.138.3-4 → 2.138.3-7
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/dataset/protected.test.js +6 -2
- package/dataset/termdb.test.js +4 -3
- package/package.json +4 -4
- package/routes/termdb.config.js +4 -2
- package/routes/termdb.filterTermValues.js +16 -20
- package/src/app.js +191 -105
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import termdbTestInit from "./termdb.test.js";
|
|
2
|
+
const minSampleSize = 10;
|
|
2
3
|
function protected_test_default() {
|
|
3
4
|
const ds = termdbTestInit();
|
|
4
5
|
if (!ds.cohort)
|
|
5
6
|
ds.cohort = { termdb: {} };
|
|
6
|
-
ds.cohort.termdb.
|
|
7
|
-
return
|
|
7
|
+
ds.cohort.termdb.checkAccessToSampleData = (_, data) => {
|
|
8
|
+
return {
|
|
9
|
+
minSampleSize,
|
|
10
|
+
canAccess: data.sampleCount >= minSampleSize
|
|
11
|
+
};
|
|
8
12
|
};
|
|
9
13
|
return ds;
|
|
10
14
|
}
|
package/dataset/termdb.test.js
CHANGED
|
@@ -114,10 +114,11 @@ function termdb_test_default() {
|
|
|
114
114
|
name: "Demographics",
|
|
115
115
|
plots: [
|
|
116
116
|
{
|
|
117
|
-
chartType: "
|
|
118
|
-
settings: {
|
|
117
|
+
chartType: "violin",
|
|
118
|
+
settings: { violin: { showStats: false } },
|
|
119
119
|
term: {
|
|
120
|
-
id: "agedx"
|
|
120
|
+
id: "agedx",
|
|
121
|
+
q: { mode: "continuous" }
|
|
121
122
|
}
|
|
122
123
|
},
|
|
123
124
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sjcrh/proteinpaint-server",
|
|
3
|
-
"version": "2.138.3-
|
|
3
|
+
"version": "2.138.3-7",
|
|
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",
|
|
@@ -62,9 +62,9 @@
|
|
|
62
62
|
"@sjcrh/augen": "2.136.0",
|
|
63
63
|
"@sjcrh/proteinpaint-python": "2.135.2-0",
|
|
64
64
|
"@sjcrh/proteinpaint-r": "2.137.2-0",
|
|
65
|
-
"@sjcrh/proteinpaint-rust": "2.
|
|
66
|
-
"@sjcrh/proteinpaint-shared": "2.
|
|
67
|
-
"@sjcrh/proteinpaint-types": "2.138.3-
|
|
65
|
+
"@sjcrh/proteinpaint-rust": "2.138.3-7",
|
|
66
|
+
"@sjcrh/proteinpaint-shared": "2.138.3-7",
|
|
67
|
+
"@sjcrh/proteinpaint-types": "2.138.3-7",
|
|
68
68
|
"@types/express": "^5.0.0",
|
|
69
69
|
"@types/express-session": "^1.18.1",
|
|
70
70
|
"better-sqlite3": "^9.4.1",
|
package/routes/termdb.config.js
CHANGED
|
@@ -265,10 +265,12 @@ function getAllowedTermTypes(ds) {
|
|
|
265
265
|
for (const t of ds.cohort.termdb.allowedTermTypes)
|
|
266
266
|
typeSet.add(t);
|
|
267
267
|
}
|
|
268
|
-
if (ds
|
|
268
|
+
if (ds.queries?.geneExpression)
|
|
269
269
|
typeSet.add(TermTypes.GENE_EXPRESSION);
|
|
270
|
-
if (ds
|
|
270
|
+
if (ds.queries?.metaboliteIntensity)
|
|
271
271
|
typeSet.add(TermTypes.METABOLITE_INTENSITY);
|
|
272
|
+
if (ds.queries?.ssGSEA)
|
|
273
|
+
typeSet.add(TermTypes.SSGSEA);
|
|
272
274
|
return [...typeSet];
|
|
273
275
|
}
|
|
274
276
|
function getSelectCohort(ds, req) {
|
|
@@ -21,34 +21,30 @@ function init({ genomes }) {
|
|
|
21
21
|
if (!g)
|
|
22
22
|
throw "invalid genome name";
|
|
23
23
|
const ds = g.datasets?.[req.query.dslabel];
|
|
24
|
-
getFilters(req.query, ds
|
|
24
|
+
res.send(await getFilters(req.query, ds));
|
|
25
25
|
} catch (e) {
|
|
26
|
-
|
|
26
|
+
if (e.stack)
|
|
27
|
+
console.log(e.stack);
|
|
27
28
|
res.send({ status: "error", error: e.message || e });
|
|
28
29
|
}
|
|
29
30
|
};
|
|
30
31
|
}
|
|
31
|
-
async function getFilters(query, ds
|
|
32
|
+
async function getFilters(query, ds) {
|
|
32
33
|
if (!query.filterByUserSites)
|
|
33
34
|
authApi.mayAdjustFilter(query, ds, query.terms);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
tw2List[tw.term.id] = getList(samplesPerFilter, filtersData, tw, query.showAll);
|
|
46
|
-
}
|
|
47
|
-
res.send({ ...tw2List });
|
|
48
|
-
} catch (e) {
|
|
49
|
-
console.log(e);
|
|
50
|
-
res.send({ error: e.message || e });
|
|
35
|
+
const samplesPerFilter = await getSamplesPerFilter(query, ds);
|
|
36
|
+
const filtersData = await getData(
|
|
37
|
+
{
|
|
38
|
+
terms: query.terms,
|
|
39
|
+
__protected__: query.__protected__
|
|
40
|
+
},
|
|
41
|
+
ds
|
|
42
|
+
);
|
|
43
|
+
const tw2List = {};
|
|
44
|
+
for (const tw of query.terms) {
|
|
45
|
+
tw2List[tw.term.id] = getList(samplesPerFilter, filtersData, tw, query.showAll);
|
|
51
46
|
}
|
|
47
|
+
return { ...tw2List };
|
|
52
48
|
}
|
|
53
49
|
function getList(samplesPerFilter, filtersData, tw, showAll) {
|
|
54
50
|
const values = Object.values(tw.term.values);
|