@sjcrh/proteinpaint-server 2.116.1-0 → 2.116.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/dataset/termdb.test.js +7 -3
- package/package.json +3 -3
- package/routes/termdb.config.js +2 -8
- package/routes/termdb.topMutatedGenes.js +91 -0
- package/src/app.js +98 -42
package/dataset/termdb.test.js
CHANGED
|
@@ -20,6 +20,7 @@ var termdb_test_default = {
|
|
|
20
20
|
file: "files/hg38/TermdbTest/db"
|
|
21
21
|
},
|
|
22
22
|
termdb: {
|
|
23
|
+
allowedTermTypes: ["geneVariant"],
|
|
23
24
|
displaySampleIds: true,
|
|
24
25
|
// allow to display sample-level data
|
|
25
26
|
timeUnit: "years",
|
|
@@ -83,7 +84,12 @@ var termdb_test_default = {
|
|
|
83
84
|
ignoreCnvValues: true
|
|
84
85
|
}
|
|
85
86
|
},
|
|
86
|
-
termid2totalsize2: {}
|
|
87
|
+
termid2totalsize2: {},
|
|
88
|
+
regression: {
|
|
89
|
+
settings: {
|
|
90
|
+
coxDisclaimer: "This is a test disclaimer for the cox regression analysis."
|
|
91
|
+
}
|
|
92
|
+
}
|
|
87
93
|
},
|
|
88
94
|
scatterplots: {
|
|
89
95
|
plots: [
|
|
@@ -127,8 +133,6 @@ var termdb_test_default = {
|
|
|
127
133
|
sunburst_twLst: [{ id: "sex", q: {} }]
|
|
128
134
|
},
|
|
129
135
|
queries: {
|
|
130
|
-
// temporary fix for genomeBrowser app to show gene model
|
|
131
|
-
defaultBlock2GeneMode: true,
|
|
132
136
|
snvindel: {
|
|
133
137
|
forTrack: true,
|
|
134
138
|
byrange: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sjcrh/proteinpaint-server",
|
|
3
|
-
"version": "2.116.1-
|
|
3
|
+
"version": "2.116.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",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@sjcrh/augen": "2.116.0",
|
|
69
69
|
"@sjcrh/proteinpaint-rust": "2.116.0",
|
|
70
|
-
"@sjcrh/proteinpaint-shared": "2.116.
|
|
71
|
-
"@sjcrh/proteinpaint-types": "2.116.1-
|
|
70
|
+
"@sjcrh/proteinpaint-shared": "2.116.1-1",
|
|
71
|
+
"@sjcrh/proteinpaint-types": "2.116.1-1",
|
|
72
72
|
"@types/express": "^5.0.0",
|
|
73
73
|
"@types/express-session": "^1.18.1",
|
|
74
74
|
"better-sqlite3": "^9.4.1",
|
package/routes/termdb.config.js
CHANGED
|
@@ -2,7 +2,6 @@ import serverconfig from "#src/serverconfig.js";
|
|
|
2
2
|
import { authApi } from "#src/auth.js";
|
|
3
3
|
import { get_ds_tdb } from "#src/termdb.js";
|
|
4
4
|
import { mayCopyFromCookie } from "#src/utils.js";
|
|
5
|
-
import { mayComputeTermtypeByCohort } from "#src/termdb.server.init.ts";
|
|
6
5
|
import { TermTypes } from "#shared/terms.js";
|
|
7
6
|
const api = {
|
|
8
7
|
endpoint: "termdb/config",
|
|
@@ -142,11 +141,10 @@ function addNonDictionaryQueries(c, ds, genome) {
|
|
|
142
141
|
if (!q)
|
|
143
142
|
return;
|
|
144
143
|
c.queries = {
|
|
145
|
-
defaultCoord: q.defaultCoord || genome.defaultcoord
|
|
144
|
+
defaultCoord: q.defaultCoord || genome.defaultcoord,
|
|
145
|
+
gbRestrictMode: q.gbRestrictMode
|
|
146
146
|
};
|
|
147
147
|
const q2 = c.queries;
|
|
148
|
-
if (q.defaultBlock2GeneMode)
|
|
149
|
-
q2.defaultBlock2GeneMode = q.defaultBlock2GeneMode;
|
|
150
148
|
if (q.snvindel) {
|
|
151
149
|
q2.snvindel = {
|
|
152
150
|
allowSNPs: q.snvindel.allowSNPs,
|
|
@@ -256,7 +254,6 @@ function addNonDictionaryQueries(c, ds, genome) {
|
|
|
256
254
|
}
|
|
257
255
|
}
|
|
258
256
|
function getAllowedTermTypes(ds) {
|
|
259
|
-
mayComputeTermtypeByCohort(ds);
|
|
260
257
|
const typeSet = /* @__PURE__ */ new Set();
|
|
261
258
|
for (const r of ds.cohort.termdb.termtypeByCohort) {
|
|
262
259
|
if (r.termType)
|
|
@@ -266,9 +263,6 @@ function getAllowedTermTypes(ds) {
|
|
|
266
263
|
for (const t of ds.cohort.termdb.allowedTermTypes)
|
|
267
264
|
typeSet.add(t);
|
|
268
265
|
}
|
|
269
|
-
if (ds?.queries?.defaultBlock2GeneMode) {
|
|
270
|
-
typeSet.add("geneVariant");
|
|
271
|
-
}
|
|
272
266
|
if (ds?.queries?.geneExpression)
|
|
273
267
|
typeSet.add(TermTypes.GENE_EXPRESSION);
|
|
274
268
|
if (ds?.queries?.metaboliteIntensity)
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { topMutatedGenePayload } from "#types/checkers";
|
|
2
|
+
import { get_samples } from "#src/termdb.sql.js";
|
|
3
|
+
import { mayLog } from "#src/helpers.ts";
|
|
2
4
|
const api = {
|
|
3
5
|
endpoint: "termdb/topMutatedGenes",
|
|
4
6
|
methods: {
|
|
@@ -42,7 +44,96 @@ function validate_query_getTopMutatedGenes(ds, genome) {
|
|
|
42
44
|
return;
|
|
43
45
|
if (typeof q.get == "function")
|
|
44
46
|
return;
|
|
47
|
+
if (!q.arguments) {
|
|
48
|
+
q.arguments = [];
|
|
49
|
+
q.arguments.push({ id: "maxGenes", label: "Gene Count", type: "number", value: 50 });
|
|
50
|
+
if (ds.queries.snvindel) {
|
|
51
|
+
q.arguments.push({ id: "snv_mfndi", label: "Protein-changing mutation", type: "boolean", value: true });
|
|
52
|
+
q.arguments.push({ id: "snv_splice", label: "Splice mutation", type: "boolean", value: true });
|
|
53
|
+
q.arguments.push({ id: "snv_utr", label: "UTR mutation", type: "boolean", value: true });
|
|
54
|
+
q.arguments.push({ id: "snv_s", label: "Silent mutation", type: "boolean", value: true });
|
|
55
|
+
}
|
|
56
|
+
if (ds.queries.svfusion) {
|
|
57
|
+
q.arguments.push({ id: "sv", label: "Structural variation", type: "boolean", value: true });
|
|
58
|
+
q.arguments.push({ id: "fusion", label: "RNA fusion", type: "boolean", value: true });
|
|
59
|
+
}
|
|
60
|
+
if (ds.queries.cnv) {
|
|
61
|
+
q.arguments.push({
|
|
62
|
+
id: "cnv",
|
|
63
|
+
type: "boolean",
|
|
64
|
+
label: "CNV",
|
|
65
|
+
checked: false,
|
|
66
|
+
noStyle: true,
|
|
67
|
+
//This is a hack
|
|
68
|
+
options: [
|
|
69
|
+
{
|
|
70
|
+
id: "cnv_ms",
|
|
71
|
+
label: "Max size",
|
|
72
|
+
type: "radio",
|
|
73
|
+
options: [
|
|
74
|
+
{ id: "cnv_1mb", label: "<1Mb", value: "cnv_1mb" },
|
|
75
|
+
{ id: "cnv_2mb", label: "<2Mb", value: "cnv_2mb" },
|
|
76
|
+
{ id: "cnv_4mb", label: "<4Mb", value: "cnv_4mb" }
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: "cnv_logratio",
|
|
81
|
+
label: "Min absolute log(ratio)",
|
|
82
|
+
type: "radio",
|
|
83
|
+
options: [
|
|
84
|
+
{ id: "_01", label: ">0.1", value: "_01" },
|
|
85
|
+
{ id: "_02", label: ">0.2", value: "_02" },
|
|
86
|
+
{ id: "_03", label: ">0.3", value: "_03" }
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
45
93
|
q.get = async (param) => {
|
|
94
|
+
let sampleStatement = "";
|
|
95
|
+
if (param.filter) {
|
|
96
|
+
const lst = await get_samples(param.filter, ds);
|
|
97
|
+
if (lst.length == 0)
|
|
98
|
+
throw "empty sample filter";
|
|
99
|
+
sampleStatement = `WHERE sample IN (${lst.map((i) => i.id).join(",")})`;
|
|
100
|
+
}
|
|
101
|
+
const fields = [];
|
|
102
|
+
if (param.snv_mfndi)
|
|
103
|
+
fields.push("snv_mfndi");
|
|
104
|
+
if (param.snv_splice)
|
|
105
|
+
fields.push("snv_splice");
|
|
106
|
+
if (param.snv_utr)
|
|
107
|
+
fields.push("snv_utr");
|
|
108
|
+
if (param.snv_s)
|
|
109
|
+
fields.push("snv_s");
|
|
110
|
+
if (param.sv)
|
|
111
|
+
fields.push("sv");
|
|
112
|
+
if (param.fusion)
|
|
113
|
+
fields.push("fusion");
|
|
114
|
+
if (param.cnv == 1 && param.cnv_ms?.type && param.cnv_logratio?.type) {
|
|
115
|
+
fields.push(param.cnv_ms.type + param.cnv_logratio.type);
|
|
116
|
+
}
|
|
117
|
+
if (!fields.length)
|
|
118
|
+
throw "no fields";
|
|
119
|
+
const query = `WITH
|
|
120
|
+
filtered AS (
|
|
121
|
+
SELECT genesymbol, ${fields.join("+")} AS total FROM genesamplemutationcount
|
|
122
|
+
${sampleStatement}
|
|
123
|
+
)
|
|
124
|
+
SELECT genesymbol, SUM(total) AS count
|
|
125
|
+
FROM filtered
|
|
126
|
+
GROUP BY genesymbol
|
|
127
|
+
ORDER BY count DESC
|
|
128
|
+
LIMIT ${param.maxGenes || 20}`;
|
|
129
|
+
const t = Date.now();
|
|
130
|
+
const genes = ds.cohort.db.connection.prepare(query).all();
|
|
131
|
+
mayLog("Top mutated gene sql", Date.now() - t, "ms");
|
|
132
|
+
const results = [];
|
|
133
|
+
for (const g of genes) {
|
|
134
|
+
results.push({ gene: g.genesymbol });
|
|
135
|
+
}
|
|
136
|
+
return results;
|
|
46
137
|
};
|
|
47
138
|
}
|
|
48
139
|
export {
|