@sjcrh/proteinpaint-server 2.114.0 → 2.115.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 +6 -5
- package/routes/correlationVolcano.js +4 -1
- package/routes/samplewsimages.js +23 -35
- package/routes/termdb.topMutatedGenes.js +51 -0
- package/routes/wsisamples.js +74 -0
- package/src/app.js +501 -611
- package/src/serverconfig.js +1 -1
- package/routes/gdc.topMutatedGenes.js +0 -275
package/src/serverconfig.js
CHANGED
|
@@ -126,7 +126,7 @@ if (serverconfig.debugmode && !serverconfig.binpath.includes('sjcrh/')) {
|
|
|
126
126
|
const routeSetters = []
|
|
127
127
|
const defaultDir = path.join(serverconfig.binpath, 'src/test/routes')
|
|
128
128
|
// will add testing routes as needed and if found, such as in dev environment
|
|
129
|
-
const testRouteSetters = ['gdc.js', 'specs.js', 'readme.js', '
|
|
129
|
+
const testRouteSetters = ['gdc.js', 'specs.js', 'readme.js', 'coverage.js']
|
|
130
130
|
if (serverconfig.features.sse === undefined) serverconfig.features.sse = true
|
|
131
131
|
if (typeof serverconfig.features.sse !== 'boolean') {
|
|
132
132
|
throw `serverconfig.features.sse must be either undefined or boolean`
|
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
import { gdcTopMutatedGenePayload } from "#types/checkers";
|
|
2
|
-
import { mclasscnvgain, mclasscnvloss, dtsnvindel } from "#shared/common.js";
|
|
3
|
-
import ky from "ky";
|
|
4
|
-
const api = {
|
|
5
|
-
endpoint: "gdc/topMutatedGenes",
|
|
6
|
-
methods: {
|
|
7
|
-
get: {
|
|
8
|
-
init,
|
|
9
|
-
...gdcTopMutatedGenePayload
|
|
10
|
-
},
|
|
11
|
-
post: {
|
|
12
|
-
init,
|
|
13
|
-
...gdcTopMutatedGenePayload
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
function init({ genomes }) {
|
|
18
|
-
return async (req, res) => {
|
|
19
|
-
const q = req.query;
|
|
20
|
-
const g = genomes.hg38;
|
|
21
|
-
if (!g)
|
|
22
|
-
throw "hg38 missing";
|
|
23
|
-
const ds = g.datasets.GDC;
|
|
24
|
-
if (!ds)
|
|
25
|
-
throw "hg38 GDC missing";
|
|
26
|
-
try {
|
|
27
|
-
const genes = await getGenesGraphql(q, ds);
|
|
28
|
-
const payload = { genes };
|
|
29
|
-
res.send(payload);
|
|
30
|
-
} catch (e) {
|
|
31
|
-
res.send({ status: "error", error: e.message || e });
|
|
32
|
-
if (e.stack)
|
|
33
|
-
console.log(e.stack);
|
|
34
|
-
else
|
|
35
|
-
console.trace(e);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
const queryV2 = {
|
|
40
|
-
query: `
|
|
41
|
-
query GenesTable(
|
|
42
|
-
$caseFilters: FiltersArgument
|
|
43
|
-
$genesTable_filters: FiltersArgument
|
|
44
|
-
$genesTable_size: Int
|
|
45
|
-
$genesTable_offset: Int
|
|
46
|
-
$score: String
|
|
47
|
-
$ssmCase: FiltersArgument
|
|
48
|
-
$geneCaseFilter: FiltersArgument
|
|
49
|
-
$ssmTested: FiltersArgument
|
|
50
|
-
$cnvTested: FiltersArgument
|
|
51
|
-
$cnvGainFilters: FiltersArgument
|
|
52
|
-
$cnvLossFilters: FiltersArgument
|
|
53
|
-
$sort: [Sort]
|
|
54
|
-
) {
|
|
55
|
-
genesTableViewer: viewer {
|
|
56
|
-
explore {
|
|
57
|
-
cases {
|
|
58
|
-
hits(first: 0, case_filters: $ssmTested) {
|
|
59
|
-
total
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
filteredCases: cases {
|
|
63
|
-
hits(first: 0, case_filters: $geneCaseFilter) {
|
|
64
|
-
total
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
cnvCases: cases {
|
|
68
|
-
hits(first: 0, case_filters: $cnvTested) {
|
|
69
|
-
total
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
genes {
|
|
73
|
-
hits(
|
|
74
|
-
first: $genesTable_size
|
|
75
|
-
offset: $genesTable_offset
|
|
76
|
-
filters: $genesTable_filters
|
|
77
|
-
case_filters: $caseFilters
|
|
78
|
-
score: $score
|
|
79
|
-
sort: $sort
|
|
80
|
-
) {
|
|
81
|
-
total
|
|
82
|
-
edges {
|
|
83
|
-
node {
|
|
84
|
-
id
|
|
85
|
-
numCases: score
|
|
86
|
-
symbol
|
|
87
|
-
name
|
|
88
|
-
cytoband
|
|
89
|
-
biotype
|
|
90
|
-
gene_id
|
|
91
|
-
is_cancer_gene_census
|
|
92
|
-
ssm_case: case {
|
|
93
|
-
hits(first: 0, filters: $ssmCase) {
|
|
94
|
-
total
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
cnv_case: case {
|
|
98
|
-
hits(first: 0, filters: $cnvTested) {
|
|
99
|
-
total
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
case_cnv_gain: case {
|
|
103
|
-
hits(first: 0, filters: $cnvGainFilters) {
|
|
104
|
-
total
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
case_cnv_loss: case {
|
|
108
|
-
hits(first: 0, filters: $cnvLossFilters) {
|
|
109
|
-
total
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}`,
|
|
119
|
-
getVariables: (q) => {
|
|
120
|
-
const variables = {
|
|
121
|
-
caseFilters: { op: "and", content: [] },
|
|
122
|
-
genesTable_filters: { op: "and", content: [] },
|
|
123
|
-
genesTable_size: q.maxGenes || 50,
|
|
124
|
-
genesTable_offset: 0,
|
|
125
|
-
score: "case.project.project_id",
|
|
126
|
-
ssmCase: {
|
|
127
|
-
op: "and",
|
|
128
|
-
content: [
|
|
129
|
-
{
|
|
130
|
-
op: "in",
|
|
131
|
-
content: {
|
|
132
|
-
field: "cases.available_variation_data",
|
|
133
|
-
value: ["ssm"]
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
op: "NOT",
|
|
138
|
-
content: {
|
|
139
|
-
field: "genes.case.ssm.observation.observation_id",
|
|
140
|
-
value: "MISSING"
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
]
|
|
144
|
-
},
|
|
145
|
-
geneCaseFilter: {
|
|
146
|
-
content: [
|
|
147
|
-
{
|
|
148
|
-
content: {
|
|
149
|
-
field: "cases.available_variation_data",
|
|
150
|
-
value: ["ssm"]
|
|
151
|
-
},
|
|
152
|
-
op: "in"
|
|
153
|
-
}
|
|
154
|
-
],
|
|
155
|
-
op: "and"
|
|
156
|
-
},
|
|
157
|
-
ssmTested: {
|
|
158
|
-
content: [
|
|
159
|
-
{
|
|
160
|
-
content: {
|
|
161
|
-
field: "cases.available_variation_data",
|
|
162
|
-
value: ["ssm"]
|
|
163
|
-
},
|
|
164
|
-
op: "in"
|
|
165
|
-
}
|
|
166
|
-
],
|
|
167
|
-
op: "and"
|
|
168
|
-
},
|
|
169
|
-
cnvTested: {
|
|
170
|
-
op: "and",
|
|
171
|
-
content: [
|
|
172
|
-
{
|
|
173
|
-
content: {
|
|
174
|
-
field: "cases.available_variation_data",
|
|
175
|
-
value: ["cnv"]
|
|
176
|
-
},
|
|
177
|
-
op: "in"
|
|
178
|
-
}
|
|
179
|
-
]
|
|
180
|
-
},
|
|
181
|
-
cnvGainFilters: {
|
|
182
|
-
op: "and",
|
|
183
|
-
content: [
|
|
184
|
-
{
|
|
185
|
-
content: {
|
|
186
|
-
field: "cases.available_variation_data",
|
|
187
|
-
value: ["cnv"]
|
|
188
|
-
},
|
|
189
|
-
op: "in"
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
content: {
|
|
193
|
-
field: "cnvs.cnv_change",
|
|
194
|
-
value: ["Gain"]
|
|
195
|
-
},
|
|
196
|
-
op: "in"
|
|
197
|
-
}
|
|
198
|
-
]
|
|
199
|
-
},
|
|
200
|
-
cnvLossFilters: {
|
|
201
|
-
op: "and",
|
|
202
|
-
content: [
|
|
203
|
-
{
|
|
204
|
-
content: {
|
|
205
|
-
field: "cases.available_variation_data",
|
|
206
|
-
value: ["cnv"]
|
|
207
|
-
},
|
|
208
|
-
op: "in"
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
content: {
|
|
212
|
-
field: "cnvs.cnv_change",
|
|
213
|
-
value: ["Loss"]
|
|
214
|
-
},
|
|
215
|
-
op: "in"
|
|
216
|
-
}
|
|
217
|
-
]
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
if (q.filter0) {
|
|
221
|
-
variables.ssmCase.content.push(JSON.parse(JSON.stringify(q.filter0)));
|
|
222
|
-
variables.caseFilters.content.push(JSON.parse(JSON.stringify(q.filter0)));
|
|
223
|
-
variables.geneCaseFilter.content.push(JSON.parse(JSON.stringify(q.filter0)));
|
|
224
|
-
variables.cnvLossFilters.content.push(JSON.parse(JSON.stringify(q.filter0)));
|
|
225
|
-
variables.cnvGainFilters.content.push(JSON.parse(JSON.stringify(q.filter0)));
|
|
226
|
-
variables.cnvTested.content.push(JSON.parse(JSON.stringify(q.filter0)));
|
|
227
|
-
}
|
|
228
|
-
if (q.geneFilter == "CGC") {
|
|
229
|
-
variables.genesTable_filters.content.push(geneCGC());
|
|
230
|
-
variables.cnvLossFilters.content.push(geneCGC());
|
|
231
|
-
variables.cnvGainFilters.content.push(geneCGC());
|
|
232
|
-
}
|
|
233
|
-
return variables;
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
async function getGenesGraphql(q, ds) {
|
|
237
|
-
const { host, headers } = ds.getHostHeaders(q);
|
|
238
|
-
const query = queryV2.query;
|
|
239
|
-
const variables = queryV2.getVariables(q);
|
|
240
|
-
const re = await ky.post(host.graphql, {
|
|
241
|
-
timeout: false,
|
|
242
|
-
// do not let ky timeout
|
|
243
|
-
headers,
|
|
244
|
-
json: { query, variables }
|
|
245
|
-
}).json();
|
|
246
|
-
const genes = [];
|
|
247
|
-
for (const g of re.data.genesTableViewer.explore.genes.hits.edges) {
|
|
248
|
-
if (typeof g.node != "object")
|
|
249
|
-
throw "node missing from re.data.genesTableViewer.explore.genes.hits.edges[]";
|
|
250
|
-
const mutationStat = [];
|
|
251
|
-
if (Number.isInteger(g.node.case_cnv_gain?.hits?.total) && g.node.case_cnv_gain.hits.total > 0)
|
|
252
|
-
mutationStat.push({ class: mclasscnvgain, count: g.node.case_cnv_gain.hits.total });
|
|
253
|
-
if (Number.isInteger(g.node.case_cnv_loss?.hits?.total) && g.node.case_cnv_loss.hits.total > 0)
|
|
254
|
-
mutationStat.push({ class: mclasscnvloss, count: g.node.case_cnv_loss.hits.total });
|
|
255
|
-
if (Number.isInteger(g.node.ssm_case?.hits?.total) && g.node.ssm_case.hits.total > 0)
|
|
256
|
-
mutationStat.push({ dt: dtsnvindel, count: g.node.ssm_case.hits.total });
|
|
257
|
-
genes.push({
|
|
258
|
-
gene: g.node.symbol,
|
|
259
|
-
mutationStat
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
return genes;
|
|
263
|
-
}
|
|
264
|
-
function geneCGC() {
|
|
265
|
-
return {
|
|
266
|
-
content: {
|
|
267
|
-
field: "genes.is_cancer_gene_census",
|
|
268
|
-
value: ["true"]
|
|
269
|
-
},
|
|
270
|
-
op: "in"
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
export {
|
|
274
|
-
api
|
|
275
|
-
};
|