@sjcrh/proteinpaint-server 2.86.1 → 2.87.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 -10
- package/routes/_template_.js +1 -1
- package/routes/brainImaging.js +1 -1
- package/routes/burden.js +1 -1
- package/routes/dataset.js +1 -1
- package/routes/dsdata.js +1 -1
- package/routes/dzimages.js +1 -1
- package/routes/gdc.maf.js +2 -2
- package/routes/gdc.mafBuild.js +2 -2
- package/routes/gdc.topMutatedGenes.js +1 -1
- package/routes/genelookup.js +1 -1
- package/routes/genesetEnrichment.js +5 -3
- package/routes/genesetOverrepresentation.js +1 -1
- package/routes/healthcheck.js +1 -1
- package/routes/hicdata.js +1 -1
- package/routes/hicgenome.js +1 -1
- package/routes/hicstat.js +1 -1
- package/routes/isoformlst.js +1 -1
- package/routes/ntseq.js +1 -1
- package/routes/pdomain.js +1 -1
- package/routes/sampledzimages.js +1 -1
- package/routes/samplewsimages.js +1 -1
- package/routes/snp.js +1 -1
- package/routes/termdb.DE.js +1 -1
- package/routes/termdb.boxplot.js +22 -15
- package/routes/termdb.categories.js +1 -1
- package/routes/termdb.cluster.js +1 -1
- package/routes/termdb.cohort.summary.js +1 -1
- package/routes/termdb.cohorts.js +1 -1
- package/routes/termdb.descrstats.js +1 -1
- package/routes/termdb.numericcategories.js +1 -1
- package/routes/termdb.percentile.js +1 -1
- package/routes/termdb.rootterm.js +1 -1
- package/routes/termdb.sampleImages.js +1 -1
- package/routes/termdb.singleSampleMutation.js +1 -1
- package/routes/termdb.singlecellDEgenes.js +1 -1
- package/routes/termdb.singlecellData.js +1 -1
- package/routes/termdb.singlecellSamples.js +5 -5
- package/routes/termdb.termchildren.js +1 -1
- package/routes/termdb.termsbyids.js +1 -1
- package/routes/termdb.topTermsByType.js +1 -1
- package/routes/termdb.topVariablyExpressedGenes.js +1 -1
- package/routes/termdb.violin.js +1 -1
- package/routes/tileserver.js +1 -1
- package/routes/wsimages.js +1 -1
- package/src/app.js +215 -169
- package/utils/gsea.py +13 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sjcrh/proteinpaint-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.87.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",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"bin": "start.js",
|
|
9
9
|
"imports": {
|
|
10
10
|
"#types": "@sjcrh/proteinpaint-types",
|
|
11
|
-
"#types
|
|
11
|
+
"#types/checkers": "@sjcrh/proteinpaint-types/checkers",
|
|
12
12
|
"#shared/*": "@sjcrh/proteinpaint-shared/*",
|
|
13
13
|
"#src/*": "./src/*",
|
|
14
14
|
"#routes/*": "./routes/*"
|
|
@@ -55,17 +55,13 @@
|
|
|
55
55
|
"ts-node": "^10.9.1",
|
|
56
56
|
"ts-patch": "^3.0.2",
|
|
57
57
|
"tsx": "^4.7.1",
|
|
58
|
-
"
|
|
59
|
-
"typedoc-plugin-missing-exports": "^3.0.0",
|
|
60
|
-
"typedoc-plugin-replace-text": "^4.0.0",
|
|
61
|
-
"typescript": "^5.6.3",
|
|
62
|
-
"typia": "^4.1.14"
|
|
58
|
+
"typescript": "^5.6.3"
|
|
63
59
|
},
|
|
64
60
|
"dependencies": {
|
|
65
|
-
"@sjcrh/augen": "2.
|
|
61
|
+
"@sjcrh/augen": "2.87.0",
|
|
66
62
|
"@sjcrh/proteinpaint-rust": "2.84.0",
|
|
67
|
-
"@sjcrh/proteinpaint-shared": "2.
|
|
68
|
-
"@sjcrh/proteinpaint-types": "2.
|
|
63
|
+
"@sjcrh/proteinpaint-shared": "2.87.0",
|
|
64
|
+
"@sjcrh/proteinpaint-types": "2.87.0",
|
|
69
65
|
"better-sqlite3": "^9.4.1",
|
|
70
66
|
"body-parser": "^1.15.2",
|
|
71
67
|
"canvas": "~2.11.2",
|
package/routes/_template_.js
CHANGED
package/routes/brainImaging.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import serverconfig from "#src/serverconfig.js";
|
|
3
|
-
import { brainImagingPayload } from "#types";
|
|
3
|
+
import { brainImagingPayload } from "#types/checkers";
|
|
4
4
|
import { spawn } from "child_process";
|
|
5
5
|
import { getData } from "../src/termdb.matrix.js";
|
|
6
6
|
import { isNumericTerm } from "@sjcrh/proteinpaint-shared/terms.js";
|
package/routes/burden.js
CHANGED
package/routes/dataset.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as mds2_init from "#src/mds2.init.js";
|
|
2
2
|
import * as mds3_init from "#src/mds3.init.js";
|
|
3
3
|
import * as common from "#shared/common.js";
|
|
4
|
-
import { datasetPayload } from "#types";
|
|
4
|
+
import { datasetPayload } from "#types/checkers";
|
|
5
5
|
const api = {
|
|
6
6
|
endpoint: "getDataset",
|
|
7
7
|
// should rename to simply 'dataset', method is based on HTTP method
|
package/routes/dsdata.js
CHANGED
|
@@ -2,7 +2,7 @@ import path from "path";
|
|
|
2
2
|
import { spawn } from "child_process";
|
|
3
3
|
import serverconfig from "#src/serverconfig.js";
|
|
4
4
|
import * as common from "#shared/common.js";
|
|
5
|
-
import { dsDataPayload } from "#types";
|
|
5
|
+
import { dsDataPayload } from "#types/checkers";
|
|
6
6
|
const api = {
|
|
7
7
|
// route endpoint
|
|
8
8
|
// - no need for trailing slash
|
package/routes/dzimages.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import serverconfig from "#src/serverconfig.js";
|
|
3
3
|
import { illegalpath } from "#src/utils.js";
|
|
4
|
-
import { dzImagesPayload } from "#types";
|
|
4
|
+
import { dzImagesPayload } from "#types/checkers";
|
|
5
5
|
const api = {
|
|
6
6
|
endpoint: `dzimages/:sampleId`,
|
|
7
7
|
methods: {
|
package/routes/gdc.maf.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { gdcMafPayload } from "#types";
|
|
1
|
+
import { gdcMafPayload } from "#types/checkers";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import got from "got";
|
|
4
4
|
import serverconfig from "#src/serverconfig.js";
|
|
@@ -72,7 +72,7 @@ async function listMafFiles(q, ds) {
|
|
|
72
72
|
let re;
|
|
73
73
|
try {
|
|
74
74
|
re = JSON.parse(response.body);
|
|
75
|
-
} catch (
|
|
75
|
+
} catch (_) {
|
|
76
76
|
throw "invalid JSON from " + api.endpoint;
|
|
77
77
|
}
|
|
78
78
|
if (!Number.isInteger(re.data?.pagination?.total))
|
package/routes/gdc.mafBuild.js
CHANGED
|
@@ -2,7 +2,7 @@ import got from "got";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { run_rust_stream } from "@sjcrh/proteinpaint-rust";
|
|
4
4
|
import serverconfig from "#src/serverconfig.js";
|
|
5
|
-
import { gdcMafPayload } from "#types";
|
|
5
|
+
import { gdcMafPayload } from "#types/checkers";
|
|
6
6
|
import { maxTotalSizeCompressed } from "./gdc.maf.ts";
|
|
7
7
|
const api = {
|
|
8
8
|
endpoint: "gdc/mafBuild",
|
|
@@ -80,7 +80,7 @@ async function getFileLstUnderSizeLimit(lst, host, headers) {
|
|
|
80
80
|
let re;
|
|
81
81
|
try {
|
|
82
82
|
re = JSON.parse(response.body);
|
|
83
|
-
} catch (
|
|
83
|
+
} catch (_) {
|
|
84
84
|
throw "invalid json from getFileLstUnderSizeLimit";
|
|
85
85
|
}
|
|
86
86
|
if (!Array.isArray(re.data?.hits))
|
package/routes/genelookup.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { genesetEnrichmentPayload } from "#types";
|
|
1
|
+
import { genesetEnrichmentPayload } from "#types/checkers";
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { spawn } from "child_process";
|
|
@@ -55,7 +55,9 @@ async function run_genesetEnrichment_analysis(q, genomes) {
|
|
|
55
55
|
geneset_group: q.geneSetGroup,
|
|
56
56
|
cachedir: serverconfig.cachedir,
|
|
57
57
|
geneset_name: q.geneset_name,
|
|
58
|
-
pickle_file: q.pickle_file
|
|
58
|
+
pickle_file: q.pickle_file,
|
|
59
|
+
genedb: path.join(serverconfig.tpmasterdir, genomes[q.genome].genedb.dbfile),
|
|
60
|
+
filter_non_coding_genes: q.filter_non_coding_genes
|
|
59
61
|
};
|
|
60
62
|
const gsea_output = await run_gsea(
|
|
61
63
|
`${serverconfig.binpath}/utils/gsea.py`,
|
|
@@ -88,7 +90,7 @@ async function run_genesetEnrichment_analysis(q, genomes) {
|
|
|
88
90
|
async function run_gsea(path2, data) {
|
|
89
91
|
try {
|
|
90
92
|
await fs.promises.stat(path2);
|
|
91
|
-
} catch (
|
|
93
|
+
} catch (_) {
|
|
92
94
|
throw `${path2} does not exist`;
|
|
93
95
|
}
|
|
94
96
|
return new Promise((resolve, reject) => {
|
package/routes/healthcheck.js
CHANGED
package/routes/hicdata.js
CHANGED
package/routes/hicgenome.js
CHANGED
package/routes/hicstat.js
CHANGED
package/routes/isoformlst.js
CHANGED
package/routes/ntseq.js
CHANGED
package/routes/pdomain.js
CHANGED
package/routes/sampledzimages.js
CHANGED
package/routes/samplewsimages.js
CHANGED
package/routes/snp.js
CHANGED
package/routes/termdb.DE.js
CHANGED
package/routes/termdb.boxplot.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { boxplotPayload } from "#types";
|
|
1
|
+
import { boxplotPayload } from "#types/checkers";
|
|
2
2
|
import { getData } from "../src/termdb.matrix.js";
|
|
3
3
|
import { boxplot_getvalue } from "../src/utils.js";
|
|
4
4
|
import { sortKey2values } from "../src/termdb.violin.js";
|
|
@@ -71,7 +71,7 @@ function init({ genomes }) {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
const plots = [];
|
|
74
|
-
let absMin = null, absMax = null
|
|
74
|
+
let absMin = null, absMax = null;
|
|
75
75
|
for (const [key, values] of sortKey2values(data, key2values, overlayTerm)) {
|
|
76
76
|
const sortedValues = values.sort((a, b) => a - b);
|
|
77
77
|
if (absMin === null || sortedValues[0] < absMin)
|
|
@@ -87,26 +87,23 @@ function init({ genomes }) {
|
|
|
87
87
|
throw "boxplot_getvalue failed [termdb.boxplot init()]";
|
|
88
88
|
const descrStats = setDescrStats(boxplot, sortedValues);
|
|
89
89
|
const _plot = {
|
|
90
|
-
// values,
|
|
91
90
|
boxplot,
|
|
92
91
|
descrStats
|
|
93
92
|
};
|
|
94
93
|
if (overlayTerm) {
|
|
95
94
|
const _key = overlayTerm?.term?.values?.[key]?.label || key;
|
|
96
95
|
const plotLabel = `${_key}, n=${values.length}`;
|
|
97
|
-
|
|
98
|
-
maxLabelLgth = plotLabel.length;
|
|
96
|
+
const overlayBins = numericBins(overlayTerm, data);
|
|
99
97
|
const plot = Object.assign(_plot, {
|
|
100
98
|
color: overlayTerm?.term?.values?.[key]?.color || null,
|
|
101
99
|
key: _key,
|
|
100
|
+
overlayBins: overlayBins.has(key) ? overlayBins.get(key) : null,
|
|
102
101
|
seriesId: key
|
|
103
102
|
});
|
|
104
103
|
plot.boxplot.label = plotLabel;
|
|
105
104
|
plots.push(plot);
|
|
106
105
|
} else {
|
|
107
106
|
const plotLabel = `${sampleType}, n=${values.length}`;
|
|
108
|
-
if (maxLabelLgth === null || plotLabel.length > maxLabelLgth)
|
|
109
|
-
maxLabelLgth = plotLabel.length;
|
|
110
107
|
const plot = Object.assign(_plot, {
|
|
111
108
|
key: sampleType
|
|
112
109
|
});
|
|
@@ -114,16 +111,15 @@ function init({ genomes }) {
|
|
|
114
111
|
plots.push(plot);
|
|
115
112
|
}
|
|
116
113
|
}
|
|
117
|
-
if (absMin == null || absMax == null
|
|
118
|
-
throw "absMin
|
|
114
|
+
if (absMin == null || absMax == null)
|
|
115
|
+
throw "absMin or absMax is null [termdb.boxplot init()]";
|
|
119
116
|
if (q.tw.term?.values)
|
|
120
|
-
|
|
117
|
+
setHiddenPlots(q.tw, plots);
|
|
121
118
|
if (overlayTerm && overlayTerm.term?.values)
|
|
122
|
-
|
|
119
|
+
setHiddenPlots(overlayTerm, plots);
|
|
123
120
|
const returnData = {
|
|
124
121
|
absMin,
|
|
125
122
|
absMax,
|
|
126
|
-
maxLabelLgth,
|
|
127
123
|
plots,
|
|
128
124
|
uncomputableValues: setUncomputableValues(uncomputableValues)
|
|
129
125
|
};
|
|
@@ -135,11 +131,18 @@ function init({ genomes }) {
|
|
|
135
131
|
}
|
|
136
132
|
};
|
|
137
133
|
}
|
|
138
|
-
function
|
|
139
|
-
for (const v of Object.values(term.term
|
|
134
|
+
function setHiddenPlots(term, plots) {
|
|
135
|
+
for (const v of Object.values(term.term?.values)) {
|
|
140
136
|
const plot = plots.find((p) => p.key === v.label);
|
|
141
137
|
if (plot)
|
|
142
|
-
plot.
|
|
138
|
+
plot.isHidden = v?.uncomputable;
|
|
139
|
+
}
|
|
140
|
+
if (term.q?.hiddenValues) {
|
|
141
|
+
for (const key of Object.keys(term.q.hiddenValues)) {
|
|
142
|
+
const plot = plots.find((p) => p.key === key);
|
|
143
|
+
if (plot)
|
|
144
|
+
plot.isHidden = true;
|
|
145
|
+
}
|
|
143
146
|
}
|
|
144
147
|
return plots;
|
|
145
148
|
}
|
|
@@ -171,6 +174,10 @@ function setUncomputableValues(values) {
|
|
|
171
174
|
} else
|
|
172
175
|
return null;
|
|
173
176
|
}
|
|
177
|
+
function numericBins(overlayTerm, data) {
|
|
178
|
+
const overlayBins = data.refs.byTermId[overlayTerm?.term?.id]?.bins ?? [];
|
|
179
|
+
return new Map(overlayBins.map((bin) => [bin.label, bin]));
|
|
180
|
+
}
|
|
174
181
|
export {
|
|
175
182
|
api
|
|
176
183
|
};
|
package/routes/termdb.cluster.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import run_R from "#src/run_R.js";
|
|
3
|
-
import { termdbClusterPayload } from "#types";
|
|
3
|
+
import { termdbClusterPayload } from "#types/checkers";
|
|
4
4
|
import * as utils from "#src/utils.js";
|
|
5
5
|
import serverconfig from "#src/serverconfig.js";
|
|
6
6
|
import { gdc_validate_query_geneExpression } from "#src/mds3.gdc.js";
|
package/routes/termdb.cohorts.js
CHANGED
|
@@ -2,7 +2,7 @@ import fs from "fs";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { read_file } from "#src/utils.js";
|
|
4
4
|
import serverconfig from "#src/serverconfig.js";
|
|
5
|
-
import { termdbSingleSampleMutationPayload } from "#types";
|
|
5
|
+
import { termdbSingleSampleMutationPayload } from "#types/checkers";
|
|
6
6
|
import { gdcValidate_query_singleSampleMutation } from "#src/mds3.gdc.js";
|
|
7
7
|
const api = {
|
|
8
8
|
endpoint: "termdb/singleSampleMutation",
|
|
@@ -4,7 +4,7 @@ import { read_file } from "#src/utils.js";
|
|
|
4
4
|
import run_R from "#src/run_R.js";
|
|
5
5
|
import { run_rust } from "@sjcrh/proteinpaint-rust";
|
|
6
6
|
import serverconfig from "#src/serverconfig.js";
|
|
7
|
-
import { termdbSingleCellSamplesPayload } from "#types";
|
|
7
|
+
import { termdbSingleCellSamplesPayload } from "#types/checkers";
|
|
8
8
|
import { validate_query_singleCell_DEgenes } from "./termdb.singlecellDEgenes.ts";
|
|
9
9
|
import { gdc_validate_query_singleCell_samples, gdc_validate_query_singleCell_data } from "#src/mds3.gdc.js";
|
|
10
10
|
import ky from "ky";
|
|
@@ -179,7 +179,7 @@ function validateGeneExpressionNative(G) {
|
|
|
179
179
|
const rdsfile = path.join(serverconfig.tpmasterdir, G.folder, (q.sample.eID || q.sample.sID) + ".rds");
|
|
180
180
|
try {
|
|
181
181
|
await fs.promises.stat(rdsfile);
|
|
182
|
-
} catch (
|
|
182
|
+
} catch (_) {
|
|
183
183
|
return {};
|
|
184
184
|
}
|
|
185
185
|
let out;
|
|
@@ -187,7 +187,7 @@ function validateGeneExpressionNative(G) {
|
|
|
187
187
|
out = JSON.parse(
|
|
188
188
|
await run_R(path.join(serverconfig.binpath, "utils", "getGeneFromMatrix.R"), null, [rdsfile, q.gene])
|
|
189
189
|
);
|
|
190
|
-
} catch (
|
|
190
|
+
} catch (_) {
|
|
191
191
|
return {};
|
|
192
192
|
}
|
|
193
193
|
console.log("out:", out);
|
|
@@ -198,7 +198,7 @@ function validateGeneExpressionNative(G) {
|
|
|
198
198
|
const rdsfile = path.join(serverconfig.tpmasterdir, G.folder, (q.sample.eID || q.sample.sID) + ".h5");
|
|
199
199
|
try {
|
|
200
200
|
await fs.promises.stat(rdsfile);
|
|
201
|
-
} catch (
|
|
201
|
+
} catch (_) {
|
|
202
202
|
return {};
|
|
203
203
|
}
|
|
204
204
|
const read_hdf5_input_type = { gene: q.gene, hdf5_file: rdsfile };
|
|
@@ -215,7 +215,7 @@ function validateGeneExpressionNative(G) {
|
|
|
215
215
|
console.log(line);
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
|
-
} catch (
|
|
218
|
+
} catch (_) {
|
|
219
219
|
return {};
|
|
220
220
|
}
|
|
221
221
|
return out;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { termdbTopTermsByTypePayload } from "#types";
|
|
1
|
+
import { termdbTopTermsByTypePayload } from "#types/checkers";
|
|
2
2
|
import { run_rust } from "@sjcrh/proteinpaint-rust";
|
|
3
3
|
import { get_samples } from "#src/termdb.sql.js";
|
|
4
4
|
import { TermTypes } from "#shared/terms.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { termdbTopVariablyExpressedGenesPayload } from "#types";
|
|
1
|
+
import { termdbTopVariablyExpressedGenesPayload } from "#types/checkers";
|
|
2
2
|
import { run_rust } from "@sjcrh/proteinpaint-rust";
|
|
3
3
|
import serverconfig from "#src/serverconfig.js";
|
|
4
4
|
import { get_samples } from "#src/termdb.sql.js";
|
package/routes/termdb.violin.js
CHANGED
package/routes/tileserver.js
CHANGED
package/routes/wsimages.js
CHANGED
|
@@ -4,7 +4,7 @@ import path from "path";
|
|
|
4
4
|
import serverconfig from "#src/serverconfig.js";
|
|
5
5
|
import { CookieJar } from "tough-cookie";
|
|
6
6
|
import { promisify } from "util";
|
|
7
|
-
import { wsImagesPayload } from "#types";
|
|
7
|
+
import { wsImagesPayload } from "#types/checkers";
|
|
8
8
|
const routePath = "wsimages";
|
|
9
9
|
const api = {
|
|
10
10
|
endpoint: `${routePath}`,
|