@sjcrh/proteinpaint-server 2.122.0 → 2.123.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/dataset/termdb.test.js +1 -1
- package/package.json +4 -6
- package/routes/burden.js +3 -4
- package/routes/correlationVolcano.js +2 -4
- package/routes/samplewsimages.js +9 -0
- package/routes/termdb.DE.js +2 -4
- package/routes/termdb.cluster.js +2 -4
- package/routes/termdb.config.js +2 -3
- package/routes/termdb.rootterm.js +3 -3
- package/routes/termdb.termchildren.js +3 -3
- package/routes/termdb.violin.js +2 -5
- package/src/app.js +563 -496
- package/src/run_R.js +0 -66
- package/utils/binom.R +0 -17
- package/utils/burden-ci95.R +0 -134
- package/utils/burden-main.R +0 -46
- package/utils/corr.R +0 -38
- package/utils/cuminc.R +0 -279
- package/utils/density.R +0 -36
- package/utils/edge.R +0 -283
- package/utils/fdr.R +0 -9
- package/utils/fisher.2x3.R +0 -12
- package/utils/fisher.R +0 -9
- package/utils/getBurden.R +0 -371
- package/utils/getGeneFromMatrix.R +0 -40
- package/utils/hclust.R +0 -110
- package/utils/km.R +0 -13
- package/utils/lowess.R +0 -9
- package/utils/regression.R +0 -154
- package/utils/regression.utils.R +0 -804
- package/utils/survival.R +0 -92
- package/utils/wilcoxon.R +0 -73
package/dataset/termdb.test.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sjcrh/proteinpaint-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.123.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",
|
|
@@ -67,9 +67,10 @@
|
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@sjcrh/augen": "2.121.0",
|
|
69
69
|
"@sjcrh/proteinpaint-python": "2.118.0",
|
|
70
|
-
"@sjcrh/proteinpaint-
|
|
70
|
+
"@sjcrh/proteinpaint-r": "2.123.0",
|
|
71
|
+
"@sjcrh/proteinpaint-rust": "2.123.0",
|
|
71
72
|
"@sjcrh/proteinpaint-shared": "2.121.0",
|
|
72
|
-
"@sjcrh/proteinpaint-types": "2.
|
|
73
|
+
"@sjcrh/proteinpaint-types": "2.123.0",
|
|
73
74
|
"@types/express": "^5.0.0",
|
|
74
75
|
"@types/express-session": "^1.18.1",
|
|
75
76
|
"better-sqlite3": "^9.4.1",
|
|
@@ -110,12 +111,9 @@
|
|
|
110
111
|
"start.js",
|
|
111
112
|
"src/app.js",
|
|
112
113
|
"src/serverconfig.js",
|
|
113
|
-
"src/run_R.js",
|
|
114
114
|
"src/mds3.gdc.filter.js",
|
|
115
115
|
"src/checkReadingFrame.js",
|
|
116
116
|
"src/bedj.parseBed.js",
|
|
117
|
-
"utils/*.R",
|
|
118
|
-
"utils/*.py",
|
|
119
117
|
"LICENSE/*"
|
|
120
118
|
],
|
|
121
119
|
"bugs": {
|
package/routes/burden.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { burdenPayload } from "#types/checkers";
|
|
2
|
-
import run_R from "
|
|
2
|
+
import { run_R } from "@sjcrh/proteinpaint-r";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import serverconfig from "#src/serverconfig.js";
|
|
5
5
|
const api = {
|
|
@@ -57,7 +57,7 @@ async function getBurdenResult(q, cumburden) {
|
|
|
57
57
|
let result = cumburden.db.connection.prepare("SELECT * FROM estimates WHERE id=?").get(id);
|
|
58
58
|
if (!result) {
|
|
59
59
|
result = { id, status: null, input: jsonInput };
|
|
60
|
-
const estJson = await run_R(
|
|
60
|
+
const estJson = await run_R("burden-main.R", jsonInput, []);
|
|
61
61
|
const estimate = JSON.parse(estJson);
|
|
62
62
|
const ages = Object.keys(estimate[0]).filter((k) => k.startsWith("["));
|
|
63
63
|
const overall = { chc: 0 };
|
|
@@ -92,7 +92,6 @@ function normalizeInput(q, cumburden) {
|
|
|
92
92
|
files: cumburden.files,
|
|
93
93
|
boosubdir: cumburden.bootsubdir
|
|
94
94
|
};
|
|
95
|
-
normalized.binpath = serverconfig.binpath;
|
|
96
95
|
const jsonInput = JSON.stringify(normalized);
|
|
97
96
|
return { id, jsonInput };
|
|
98
97
|
}
|
|
@@ -102,7 +101,7 @@ async function compute95ci(result, cumburden) {
|
|
|
102
101
|
throw "result{} does not have .input";
|
|
103
102
|
const input = structuredClone(result.input);
|
|
104
103
|
input.burden = Object.values(result.estimate).filter((est) => est.chc !== 0);
|
|
105
|
-
const lowup = await run_R(
|
|
104
|
+
const lowup = await run_R("burden-ci95.R", JSON.stringify(input), []);
|
|
106
105
|
const { low, up, overall } = JSON.parse(lowup);
|
|
107
106
|
const ci95 = { 0: {} };
|
|
108
107
|
for (const est of Object.values(result.estimate)) {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { CorrelationVolcanoPayload } from "#types/checkers";
|
|
2
2
|
import { getData } from "../src/termdb.matrix.js";
|
|
3
|
-
import run_R from "
|
|
4
|
-
import serverconfig from "../src/serverconfig.js";
|
|
3
|
+
import { run_R } from "@sjcrh/proteinpaint-r";
|
|
5
4
|
import { mayLog } from "#src/helpers.ts";
|
|
6
|
-
import path from "path";
|
|
7
5
|
import { getStdDev } from "#shared/descriptive.stats.js";
|
|
8
6
|
import { formatElapsedTime } from "#shared/time.js";
|
|
9
7
|
const minArrayLength = 3;
|
|
@@ -91,7 +89,7 @@ async function compute(q, ds, genome) {
|
|
|
91
89
|
};
|
|
92
90
|
const time1 = Date.now();
|
|
93
91
|
const output = {
|
|
94
|
-
terms: JSON.parse(await run_R(
|
|
92
|
+
terms: JSON.parse(await run_R("corr.R", JSON.stringify(input)))
|
|
95
93
|
};
|
|
96
94
|
const elapsedMs = Date.now() - time1;
|
|
97
95
|
const formattedTime = formatElapsedTime(elapsedMs);
|
package/routes/samplewsimages.js
CHANGED
|
@@ -30,6 +30,15 @@ function init({ genomes }) {
|
|
|
30
30
|
if (annotations) {
|
|
31
31
|
wsimage.overlays = annotations;
|
|
32
32
|
}
|
|
33
|
+
if (ds.queries.WSImages.getZoomInPoints) {
|
|
34
|
+
const zoomInPoints = await ds.queries.WSImages.getZoomInPoints(
|
|
35
|
+
sampleId,
|
|
36
|
+
wsimage.filename
|
|
37
|
+
);
|
|
38
|
+
if (zoomInPoints) {
|
|
39
|
+
wsimage.zoomInPoints = zoomInPoints;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
33
42
|
}
|
|
34
43
|
}
|
|
35
44
|
res.send({ sampleWSImages: wsimages });
|
package/routes/termdb.DE.js
CHANGED
|
@@ -4,7 +4,7 @@ import { diffExpPayload } from "#types/checkers";
|
|
|
4
4
|
import { run_rust } from "@sjcrh/proteinpaint-rust";
|
|
5
5
|
import { getData } from "../src/termdb.matrix.js";
|
|
6
6
|
import { get_ds_tdb } from "../src/termdb.js";
|
|
7
|
-
import run_R from "
|
|
7
|
+
import { run_R } from "@sjcrh/proteinpaint-r";
|
|
8
8
|
import { mayLog } from "#src/helpers.ts";
|
|
9
9
|
import serverconfig from "../src/serverconfig.js";
|
|
10
10
|
import imagesize from "image-size";
|
|
@@ -223,9 +223,7 @@ async function run_DE(param, ds, term_results, term_results2) {
|
|
|
223
223
|
const sample_size_limit = 8;
|
|
224
224
|
if (group1names.length <= sample_size_limit && group2names.length <= sample_size_limit || param.method == "edgeR" || param.method == "limma") {
|
|
225
225
|
const time12 = (/* @__PURE__ */ new Date()).valueOf();
|
|
226
|
-
const result2 = JSON.parse(
|
|
227
|
-
await run_R(path.join(serverconfig.binpath, "utils", "edge.R"), JSON.stringify(expression_input))
|
|
228
|
-
);
|
|
226
|
+
const result2 = JSON.parse(await run_R("edge.R", JSON.stringify(expression_input)));
|
|
229
227
|
mayLog("Time taken to run edgeR:", formatElapsedTime(Date.now() - time12));
|
|
230
228
|
param.method = "edgeR";
|
|
231
229
|
const ql_imagePath = path.join(serverconfig.cachedir, result2.edgeR_ql_image_name[0]);
|
package/routes/termdb.cluster.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import run_R from "
|
|
2
|
+
import { run_R } from "@sjcrh/proteinpaint-r";
|
|
3
3
|
import { run_rust } from "@sjcrh/proteinpaint-rust";
|
|
4
4
|
import { termdbClusterPayload } from "#types/checkers";
|
|
5
5
|
import * as utils from "#src/utils.js";
|
|
@@ -172,9 +172,7 @@ async function doClustering(data, q, numCases = 1e3) {
|
|
|
172
172
|
}
|
|
173
173
|
if (inputData.matrix.length == 0)
|
|
174
174
|
throw "Clustering matrix is empty";
|
|
175
|
-
const Routput = JSON.parse(
|
|
176
|
-
await run_R(path.join(serverconfig.binpath, "utils", "hclust.R"), JSON.stringify(inputData))
|
|
177
|
-
);
|
|
175
|
+
const Routput = JSON.parse(await run_R("hclust.R", JSON.stringify(inputData)));
|
|
178
176
|
const row_names_index = Routput.RowOrder.map((row) => inputData.row_names.indexOf(row.name));
|
|
179
177
|
const col_names_index = Routput.ColOrder.map((col) => inputData.col_names.indexOf(col.name));
|
|
180
178
|
const output_matrix = [];
|
package/routes/termdb.config.js
CHANGED
|
@@ -41,7 +41,6 @@ function make(q, req, res, ds, genome) {
|
|
|
41
41
|
const c = {
|
|
42
42
|
selectCohort: getSelectCohort(ds, req),
|
|
43
43
|
supportedChartTypes: tdb.q?.getSupportedChartTypes(req),
|
|
44
|
-
hiddenTermIds: tdb.hiddenTermIds,
|
|
45
44
|
renamedChartTypes: ds.cohort.renamedChartTypes,
|
|
46
45
|
allowedTermTypes: getAllowedTermTypes(ds),
|
|
47
46
|
termMatch2geneSet: tdb.termMatch2geneSet,
|
|
@@ -76,8 +75,6 @@ function make(q, req, res, ds, genome) {
|
|
|
76
75
|
c.timeUnit = tdb.timeUnit;
|
|
77
76
|
if (tdb.cohortStartTimeMsg)
|
|
78
77
|
c.cohortStartTimeMsg = tdb.cohortStartTimeMsg;
|
|
79
|
-
if (tdb.displaySampleIds)
|
|
80
|
-
c.displaySampleIds = tdb.displaySampleIds;
|
|
81
78
|
if (tdb.hasAncestry)
|
|
82
79
|
c.hasAncestry = tdb.hasAncestry;
|
|
83
80
|
if (tdb.logscaleBase2)
|
|
@@ -104,6 +101,8 @@ function make(q, req, res, ds, genome) {
|
|
|
104
101
|
c.requiredAuth = authApi.getRequiredCredForDsEmbedder(q.dslabel, q.embedder);
|
|
105
102
|
const info = authApi.getNonsensitiveInfo(req);
|
|
106
103
|
c.clientAuthResult = info?.clientAuthResult || {};
|
|
104
|
+
if (tdb.displaySampleIds)
|
|
105
|
+
c.displaySampleIds = tdb.displaySampleIds(c.clientAuthResult);
|
|
107
106
|
res.send({ termdbConfig: c });
|
|
108
107
|
}
|
|
109
108
|
function addRestrictAncestries(c, tdb) {
|
|
@@ -25,7 +25,7 @@ function init({ genomes }) {
|
|
|
25
25
|
throw "invalid dataset name";
|
|
26
26
|
if (!tdb)
|
|
27
27
|
throw "invalid termdb object";
|
|
28
|
-
await trigger_rootterm(q, res, tdb);
|
|
28
|
+
await trigger_rootterm(req, q, res, tdb);
|
|
29
29
|
} catch (e) {
|
|
30
30
|
res.send({ error: e instanceof Error ? e.message : e });
|
|
31
31
|
if (e instanceof Error && e.stack)
|
|
@@ -33,10 +33,10 @@ function init({ genomes }) {
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
async function trigger_rootterm(q, res, tdb) {
|
|
36
|
+
async function trigger_rootterm(req, q, res, tdb) {
|
|
37
37
|
const cohortValues = q.cohortValues ? q.cohortValues : "";
|
|
38
38
|
const treeFilter = q.treeFilter ? q.treeFilter : "";
|
|
39
|
-
res.send({ lst: await tdb.q.getRootTerms(cohortValues, treeFilter) });
|
|
39
|
+
res.send({ lst: await tdb.q.getRootTerms(req, cohortValues, treeFilter) });
|
|
40
40
|
}
|
|
41
41
|
export {
|
|
42
42
|
api
|
|
@@ -25,7 +25,7 @@ function init({ genomes }) {
|
|
|
25
25
|
throw "invalid dataset name";
|
|
26
26
|
if (!tdb)
|
|
27
27
|
throw "invalid termdb object";
|
|
28
|
-
const result = await trigger_children(q, tdb);
|
|
28
|
+
const result = await trigger_children(req, q, tdb);
|
|
29
29
|
res.send(result);
|
|
30
30
|
} catch (e) {
|
|
31
31
|
res.send({ error: e instanceof Error ? e.message : e });
|
|
@@ -34,12 +34,12 @@ function init({ genomes }) {
|
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
async function trigger_children(q, tdb) {
|
|
37
|
+
async function trigger_children(req, q, tdb) {
|
|
38
38
|
if (!q.tid)
|
|
39
39
|
throw "no parent term id";
|
|
40
40
|
const cohortValues = q.cohortValues ? q.cohortValues : "";
|
|
41
41
|
const treeFilter = q.treeFilter ? q.treeFilter : "";
|
|
42
|
-
const terms = await tdb.q.getTermChildren(q.tid, cohortValues, treeFilter);
|
|
42
|
+
const terms = await tdb.q.getTermChildren(req, q.tid, cohortValues, treeFilter);
|
|
43
43
|
return { lst: terms.map(copy_term) };
|
|
44
44
|
}
|
|
45
45
|
export {
|
package/routes/termdb.violin.js
CHANGED
|
@@ -7,9 +7,7 @@ import { getOrderedLabels } from "../src/termdb.barchart.js";
|
|
|
7
7
|
import { summaryStats } from "#shared/descriptive.stats.js";
|
|
8
8
|
import { isNumericTerm } from "#shared/terms.js";
|
|
9
9
|
import { numericBins, parseValues } from "./termdb.boxplot.ts";
|
|
10
|
-
import
|
|
11
|
-
import run_R from "../src/run_R.js";
|
|
12
|
-
import path from "path";
|
|
10
|
+
import { run_R } from "@sjcrh/proteinpaint-r";
|
|
13
11
|
const api = {
|
|
14
12
|
endpoint: "termdb/violin",
|
|
15
13
|
methods: {
|
|
@@ -238,8 +236,7 @@ async function getDensity(values) {
|
|
|
238
236
|
return result.plot;
|
|
239
237
|
}
|
|
240
238
|
async function getDensities(plot2Values, min, max) {
|
|
241
|
-
const
|
|
242
|
-
const plot2Density = JSON.parse(await run_R(densityScript, JSON.stringify({ plot2Values, min, max })));
|
|
239
|
+
const plot2Density = JSON.parse(await run_R("density.R", JSON.stringify({ plot2Values, min, max })));
|
|
243
240
|
const densities = {};
|
|
244
241
|
for (const plot in plot2Density) {
|
|
245
242
|
const result = plot2Density[plot];
|