@sjcrh/proteinpaint-server 2.57.1-1 → 2.58.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 +2 -2
- package/routes/genesetOverrepresentation.js +0 -1
- package/routes/healthcheck.js +13 -0
- package/routes/hicdata.genome.js +93 -0
- package/routes/termdb.cluster.js +1 -1
- package/routes/termdb.topVariablyExpressedGenes.js +1 -1
- package/src/app.js +503 -263
- package/src/mds3.gdc.filter.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sjcrh/proteinpaint-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.58.0",
|
|
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",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@sjcrh/augen": "2.46.0",
|
|
64
|
-
"@sjcrh/proteinpaint-rust": "2.
|
|
64
|
+
"@sjcrh/proteinpaint-rust": "2.58.0",
|
|
65
65
|
"better-sqlite3": "^9.4.1",
|
|
66
66
|
"body-parser": "^1.15.2",
|
|
67
67
|
"canvas": "~2.11.2",
|
package/routes/healthcheck.js
CHANGED
|
@@ -7,6 +7,19 @@ const api = {
|
|
|
7
7
|
return async (req, res) => {
|
|
8
8
|
try {
|
|
9
9
|
const health = await getStat(genomes);
|
|
10
|
+
const q = req.query;
|
|
11
|
+
if (q.dslabel) {
|
|
12
|
+
for (const gn in genomes) {
|
|
13
|
+
const ds = genomes[gn]?.datasets?.[q.dslabel];
|
|
14
|
+
if (!ds?.getHealth)
|
|
15
|
+
continue;
|
|
16
|
+
if (!health.byDataset)
|
|
17
|
+
health.byDataset = {};
|
|
18
|
+
if (!health.byDataset[q.dslabel])
|
|
19
|
+
health.byDataset[q.dslabel] = {};
|
|
20
|
+
health.byDataset[q.dslabel][gn] = ds.getHealth(ds);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
10
23
|
res.send(health);
|
|
11
24
|
} catch (e) {
|
|
12
25
|
res.send({ status: "error", error: e.message || e });
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { fileurl } from "#src/utils.js";
|
|
2
|
+
import { spawn } from "child_process";
|
|
3
|
+
import readline from "readline";
|
|
4
|
+
import serverconfig from "#src/serverconfig.js";
|
|
5
|
+
const api = {
|
|
6
|
+
endpoint: "hicgenome",
|
|
7
|
+
methods: {
|
|
8
|
+
get: {
|
|
9
|
+
init,
|
|
10
|
+
request: {
|
|
11
|
+
typeId: "HicdataRequest"
|
|
12
|
+
},
|
|
13
|
+
response: {
|
|
14
|
+
typeId: "HicdataResponse"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
post: {
|
|
18
|
+
alternativeFor: "get",
|
|
19
|
+
init
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
function init() {
|
|
24
|
+
return async (req, res) => {
|
|
25
|
+
const data = [];
|
|
26
|
+
const erroutput = [];
|
|
27
|
+
const [e, file, isurl] = fileurl({ query: req.query });
|
|
28
|
+
if (e)
|
|
29
|
+
res.send({ error: "illegal file name" });
|
|
30
|
+
const matrixType = req.query.matrixType == "log(oe)" ? "oe" : req.query.matrixType ? req.query.matrixType : "observed";
|
|
31
|
+
const promises = req.query.chrlst.map((lead, i) => {
|
|
32
|
+
return req.query.chrlst.slice(0, i + 1).map((follow, j) => {
|
|
33
|
+
if (j <= i) {
|
|
34
|
+
return new Promise((resolve, reject) => {
|
|
35
|
+
const pos1 = req.query.nochr ? lead.replace("chr", "") : lead;
|
|
36
|
+
const pos2 = req.query.nochr ? follow.replace("chr", "") : follow;
|
|
37
|
+
const par = [
|
|
38
|
+
matrixType,
|
|
39
|
+
req.query.nmeth || "NONE",
|
|
40
|
+
file,
|
|
41
|
+
pos1,
|
|
42
|
+
pos2,
|
|
43
|
+
req.query.isfrag ? "FRAG" : "BP",
|
|
44
|
+
req.query.resolution
|
|
45
|
+
];
|
|
46
|
+
const ps = spawn(serverconfig.hicstraw, par);
|
|
47
|
+
const rl = readline.createInterface({ input: ps.stdout });
|
|
48
|
+
const items = [];
|
|
49
|
+
let linenot3fields = 0;
|
|
50
|
+
let fieldnotnumerical = 0;
|
|
51
|
+
rl.on("line", (line) => {
|
|
52
|
+
const l = line.split(" ");
|
|
53
|
+
if (l.length != 3) {
|
|
54
|
+
linenot3fields++;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const n1 = Number.parseInt(l[0]);
|
|
58
|
+
const n2 = Number.parseInt(l[1]);
|
|
59
|
+
const v = req.query.matrixType == "log(oe)" ? Math.log(Number.parseFloat(l[2])) : Number.parseFloat(l[2]);
|
|
60
|
+
if (Number.isNaN(n1) || Number.isNaN(n2) || Number.isNaN(v)) {
|
|
61
|
+
fieldnotnumerical++;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (req.query.mincutoff != void 0 && v <= req.query.mincutoff) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
items.push([n1, n2, v]);
|
|
68
|
+
});
|
|
69
|
+
data.push({ items, lead, follow });
|
|
70
|
+
ps.stderr.on("data", (i2) => erroutput.push(`${lead} - ${follow}: `, i2));
|
|
71
|
+
ps.on("close", () => {
|
|
72
|
+
if (erroutput.length)
|
|
73
|
+
reject({ error: erroutput.join("") });
|
|
74
|
+
if (linenot3fields)
|
|
75
|
+
reject({ error: `${linenot3fields} lines have other than 3 fields` });
|
|
76
|
+
if (fieldnotnumerical)
|
|
77
|
+
reject(`${fieldnotnumerical} lines have non-numerical values in any of the 3 fields`);
|
|
78
|
+
resolve();
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}).flat();
|
|
84
|
+
Promise.allSettled(promises).then(() => res.send({ data, error: erroutput.join("") })).catch((e2) => {
|
|
85
|
+
res.send({ error: e2?.message || e2 });
|
|
86
|
+
if (e2 instanceof Error && e2.stack)
|
|
87
|
+
console.log(e2);
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
api
|
|
93
|
+
};
|
package/routes/termdb.cluster.js
CHANGED
|
@@ -32,7 +32,7 @@ function init({ genomes }) {
|
|
|
32
32
|
if (!ds)
|
|
33
33
|
throw "invalid dataset name";
|
|
34
34
|
if (ds.__gdc && !ds.__gdc.doneCaching)
|
|
35
|
-
throw "The server has not finished caching the case IDs: try again in
|
|
35
|
+
throw "The server has not finished caching the case IDs: try again in about 2 minutes.";
|
|
36
36
|
if (q.dataType == dtgeneexpression) {
|
|
37
37
|
if (!ds.queries?.geneExpression)
|
|
38
38
|
throw "no geneExpression data on this dataset";
|
|
@@ -110,7 +110,7 @@ function gdcValidateQuery(ds, genome) {
|
|
|
110
110
|
return serverconfig.features.gdcGenes;
|
|
111
111
|
}
|
|
112
112
|
if (!ds.__gdc.doneCaching)
|
|
113
|
-
throw "The server has not finished caching the case IDs: try again in
|
|
113
|
+
throw "The server has not finished caching the case IDs: try again in about 2 minutes.";
|
|
114
114
|
const caseLst = await gdcGetCasesWithExpressionDataFromCohort(q, ds);
|
|
115
115
|
if (caseLst.length == 0) {
|
|
116
116
|
return [];
|