@sjcrh/proteinpaint-server 2.57.0 → 2.57.1-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 +2 -2
- package/routes/genesetOverrepresentation.js +56 -0
- package/routes/termdb.categories.js +17 -3
- package/routes/termdb.cluster.js +1 -0
- package/routes/termdb.config.js +2 -0
- package/src/app.js +737 -403
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sjcrh/proteinpaint-server",
|
|
3
|
-
"version": "2.57.
|
|
3
|
+
"version": "2.57.1-1",
|
|
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.57.1-1",
|
|
65
65
|
"better-sqlite3": "^9.4.1",
|
|
66
66
|
"body-parser": "^1.15.2",
|
|
67
67
|
"canvas": "~2.11.2",
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { run_rust } from "@sjcrh/proteinpaint-rust";
|
|
2
|
+
const api = {
|
|
3
|
+
endpoint: "genesetOverrepresentation",
|
|
4
|
+
methods: {
|
|
5
|
+
all: {
|
|
6
|
+
init,
|
|
7
|
+
request: {
|
|
8
|
+
typeId: "genesetOverrepresentationRequest"
|
|
9
|
+
},
|
|
10
|
+
response: {
|
|
11
|
+
typeId: "genesetOverrepresentationResponse"
|
|
12
|
+
// will combine this with type checker
|
|
13
|
+
//valid: (t) => {}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
function init({ genomes }) {
|
|
19
|
+
return async (req, res) => {
|
|
20
|
+
try {
|
|
21
|
+
const results = await run_genesetOverrepresentation_analysis(
|
|
22
|
+
req.query,
|
|
23
|
+
genomes
|
|
24
|
+
);
|
|
25
|
+
res.send(results);
|
|
26
|
+
} catch (e) {
|
|
27
|
+
res.send({ status: "error", error: e.message || e });
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
async function run_genesetOverrepresentation_analysis(q, genomes) {
|
|
32
|
+
if (!genomes[q.genome].termdbs)
|
|
33
|
+
throw "termdb database is not available for " + q.genome;
|
|
34
|
+
const gene_overrepresentation_input = {
|
|
35
|
+
sample_genes: q.sample_genes,
|
|
36
|
+
background_genes: q.background_genes,
|
|
37
|
+
db: genomes[q.genome].termdbs.msigdb.cohort.db.connection.name,
|
|
38
|
+
gene_set_group: q.geneSetGroup
|
|
39
|
+
};
|
|
40
|
+
const time1 = (/* @__PURE__ */ new Date()).valueOf();
|
|
41
|
+
const rust_output = await run_rust("genesetORA", JSON.stringify(gene_overrepresentation_input));
|
|
42
|
+
const time2 = (/* @__PURE__ */ new Date()).valueOf();
|
|
43
|
+
console.log("Time taken to run rust gene over representation pipeline:", time2 - time1, "ms");
|
|
44
|
+
let result;
|
|
45
|
+
for (const line of rust_output.split("\n")) {
|
|
46
|
+
if (line.startsWith("pathway_p_values:")) {
|
|
47
|
+
result = JSON.parse(line.replace("pathway_p_values:", ""));
|
|
48
|
+
} else {
|
|
49
|
+
console.log(line);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
api
|
|
56
|
+
};
|
|
@@ -87,10 +87,23 @@ function init({ genomes }) {
|
|
|
87
87
|
async function trigger_getcategories(q, res, tdb, ds, genome) {
|
|
88
88
|
if (!q.tid)
|
|
89
89
|
throw ".tid missing";
|
|
90
|
-
|
|
90
|
+
let term;
|
|
91
|
+
if (q.type == "geneVariant") {
|
|
92
|
+
term = { id: q.name, name: q.name, type: "geneVariant", isleaf: true };
|
|
93
|
+
if (q.gene) {
|
|
94
|
+
term.gene = q.gene;
|
|
95
|
+
} else {
|
|
96
|
+
term.chr = q.chr;
|
|
97
|
+
term.start = q.start;
|
|
98
|
+
term.stop = q.stop;
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
term = tdb.q.termjsonByOneid(q.tid);
|
|
102
|
+
}
|
|
103
|
+
const tw = q.type == "geneVariant" ? { $id: q.gene || q.name || q.tid, term, q: { isAtomic: true } } : { $id: q.tid, id: q.tid, term, q: q.term1_q || getDefaultQ(term, q) };
|
|
91
104
|
const arg = {
|
|
92
105
|
filter: q.filter,
|
|
93
|
-
terms:
|
|
106
|
+
terms: [tw],
|
|
94
107
|
currentGeneNames: q.currentGeneNames,
|
|
95
108
|
// optional, from mds3 mayAddGetCategoryArgs()
|
|
96
109
|
rglst: q.rglst
|
|
@@ -112,7 +125,8 @@ async function trigger_getcategories(q, res, tdb, ds, genome) {
|
|
|
112
125
|
}
|
|
113
126
|
const sampleCountedFor = /* @__PURE__ */ new Set();
|
|
114
127
|
for (const [sampleId, sampleData] of Object.entries(samples)) {
|
|
115
|
-
const
|
|
128
|
+
const key = tw.$id;
|
|
129
|
+
const values = sampleData[key].values;
|
|
116
130
|
sampleCountedFor.clear();
|
|
117
131
|
for (const value of values) {
|
|
118
132
|
if (!dtClassMap.has(value.dt)) {
|
package/routes/termdb.cluster.js
CHANGED
package/routes/termdb.config.js
CHANGED