@sjcrh/proteinpaint-server 2.98.2-1 → 2.99.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 +4 -4
- package/routes/correlationVolcano.js +3 -9
- package/routes/termdb.DE.js +7 -18
- package/routes/termdb.singlecellSamples.js +22 -56
- package/src/app.js +47 -102
- package/utils/corr.R +4 -2
- package/utils/edge.R +13 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sjcrh/proteinpaint-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.99.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",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@sjcrh/augen": "2.87.0",
|
|
62
|
-
"@sjcrh/proteinpaint-rust": "2.
|
|
63
|
-
"@sjcrh/proteinpaint-shared": "2.
|
|
64
|
-
"@sjcrh/proteinpaint-types": "2.
|
|
62
|
+
"@sjcrh/proteinpaint-rust": "2.99.0",
|
|
63
|
+
"@sjcrh/proteinpaint-shared": "2.99.0",
|
|
64
|
+
"@sjcrh/proteinpaint-types": "2.99.0",
|
|
65
65
|
"better-sqlite3": "^9.4.1",
|
|
66
66
|
"body-parser": "^1.15.2",
|
|
67
67
|
"canvas": "~2.11.2",
|
|
@@ -70,16 +70,10 @@ async function compute(q, ds, genome) {
|
|
|
70
70
|
terms: [...vtid2array.values()]
|
|
71
71
|
};
|
|
72
72
|
const time1 = Date.now();
|
|
73
|
-
const
|
|
73
|
+
const output = {
|
|
74
|
+
terms: JSON.parse(await run_R(path.join(serverconfig.binpath, "utils", "corr.R"), JSON.stringify(input)))
|
|
75
|
+
};
|
|
74
76
|
mayLog("Time taken to run correlation analysis:", Date.now() - time1);
|
|
75
|
-
let json_result;
|
|
76
|
-
for (const line of r_output.split("\n")) {
|
|
77
|
-
if (line.startsWith("adjusted_p_values:")) {
|
|
78
|
-
json_result = JSON.parse(line.replace("adjusted_p_values:", ""));
|
|
79
|
-
} else {
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
const output = { terms: json_result };
|
|
83
77
|
const result = { variableItems: [] };
|
|
84
78
|
for (const t of output.terms) {
|
|
85
79
|
const t2 = {
|
package/routes/termdb.DE.js
CHANGED
|
@@ -4,6 +4,7 @@ import { run_rust } from "@sjcrh/proteinpaint-rust";
|
|
|
4
4
|
import { getData } from "../src/termdb.matrix.js";
|
|
5
5
|
import { get_ds_tdb } from "../src/termdb.js";
|
|
6
6
|
import run_R from "../src/run_R.js";
|
|
7
|
+
import { mayLog } from "#src/helpers.ts";
|
|
7
8
|
import serverconfig from "../src/serverconfig.js";
|
|
8
9
|
const api = {
|
|
9
10
|
endpoint: "DEanalysis",
|
|
@@ -120,27 +121,15 @@ async function run_DE(param, ds, term_results) {
|
|
|
120
121
|
let result;
|
|
121
122
|
if (group1names.length <= sample_size_limit && group2names.length <= sample_size_limit || param.method == "edgeR") {
|
|
122
123
|
const time1 = (/* @__PURE__ */ new Date()).valueOf();
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (line.startsWith("adjusted_p_values:")) {
|
|
128
|
-
result = JSON.parse(line.replace("adjusted_p_values:", ""));
|
|
129
|
-
} else {
|
|
130
|
-
}
|
|
131
|
-
}
|
|
124
|
+
result = JSON.parse(
|
|
125
|
+
await run_R(path.join(serverconfig.binpath, "utils", "edge.R"), JSON.stringify(expression_input))
|
|
126
|
+
);
|
|
127
|
+
mayLog("Time taken to run edgeR:", Date.now() - time1, "ms");
|
|
132
128
|
param.method = "edgeR";
|
|
133
129
|
} else {
|
|
134
130
|
const time1 = (/* @__PURE__ */ new Date()).valueOf();
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
for (const line of rust_output.split("\n")) {
|
|
138
|
-
if (line.startsWith("adjusted_p_values:")) {
|
|
139
|
-
result = JSON.parse(line.replace("adjusted_p_values:", ""));
|
|
140
|
-
} else {
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
console.log("Time taken to run rust DE pipeline:", time2 - time1, "ms");
|
|
131
|
+
result = JSON.parse(await run_rust("DEanalysis", JSON.stringify(expression_input)));
|
|
132
|
+
mayLog("Time taken to run rust DE pipeline:", Date.now() - time1, "ms");
|
|
144
133
|
param.method = "wilcoxon";
|
|
145
134
|
}
|
|
146
135
|
return { data: result, sample_size1, sample_size2, method: param.method };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import { read_file } from "#src/utils.js";
|
|
4
|
-
import run_R from "#src/run_R.js";
|
|
3
|
+
import { read_file, file_is_readable } from "#src/utils.js";
|
|
5
4
|
import { joinUrl, mayLog } from "#src/helpers.ts";
|
|
6
5
|
import { run_rust } from "@sjcrh/proteinpaint-rust";
|
|
7
6
|
import serverconfig from "#src/serverconfig.js";
|
|
@@ -138,16 +137,7 @@ function validateDataNative(D, ds) {
|
|
|
138
137
|
(q.sample.eID || q.sample.sID) + plot.fileSuffix
|
|
139
138
|
);
|
|
140
139
|
if (!file2Lines[tsvfile]) {
|
|
141
|
-
|
|
142
|
-
await fs.promises.stat(tsvfile);
|
|
143
|
-
} catch (e) {
|
|
144
|
-
if (e.code == "ENOENT") {
|
|
145
|
-
continue;
|
|
146
|
-
}
|
|
147
|
-
if (e.code == "EACCES")
|
|
148
|
-
throw "cannot read file, permission denied";
|
|
149
|
-
throw "failed to load sc data file";
|
|
150
|
-
}
|
|
140
|
+
await file_is_readable(tsvfile);
|
|
151
141
|
file2Lines[tsvfile] = (await read_file(tsvfile)).trim().split("\n");
|
|
152
142
|
}
|
|
153
143
|
const colorColumn = plot.colorColumns.find((c) => c.name == q.colorBy?.[plot.name]) || plot.colorColumns[0];
|
|
@@ -195,52 +185,28 @@ function validateDataNative(D, ds) {
|
|
|
195
185
|
}
|
|
196
186
|
function validateGeneExpressionNative(G) {
|
|
197
187
|
G.sample2gene2expressionBins = {};
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
return {};
|
|
213
|
-
}
|
|
214
|
-
return out;
|
|
215
|
-
};
|
|
216
|
-
} else if (G.storage_type == "HDF5") {
|
|
217
|
-
G.get = async (q) => {
|
|
218
|
-
const rdsfile = path.join(serverconfig.tpmasterdir, G.folder, (q.sample.eID || q.sample.sID) + ".h5");
|
|
219
|
-
try {
|
|
220
|
-
await fs.promises.stat(rdsfile);
|
|
221
|
-
} catch (_) {
|
|
222
|
-
return {};
|
|
223
|
-
}
|
|
224
|
-
const read_hdf5_input_type = { gene: q.gene, hdf5_file: rdsfile };
|
|
225
|
-
let out;
|
|
226
|
-
try {
|
|
227
|
-
const time1 = (/* @__PURE__ */ new Date()).valueOf();
|
|
228
|
-
const rust_output = await run_rust("readHDF5", JSON.stringify(read_hdf5_input_type));
|
|
229
|
-
const time2 = (/* @__PURE__ */ new Date()).valueOf();
|
|
230
|
-
console.log("Time taken to query HDF5 file:", time2 - time1, "ms");
|
|
231
|
-
for (const line of rust_output.split("\n")) {
|
|
232
|
-
if (line.startsWith("output_string:")) {
|
|
233
|
-
out = JSON.parse(line.replace("output_string:", ""));
|
|
234
|
-
} else {
|
|
235
|
-
console.log(line);
|
|
236
|
-
}
|
|
188
|
+
G.get = async (q) => {
|
|
189
|
+
const h5file = path.join(serverconfig.tpmasterdir, G.folder, (q.sample.eID || q.sample.sID) + ".h5");
|
|
190
|
+
await file_is_readable(h5file);
|
|
191
|
+
const read_hdf5_input_type = { gene: q.gene, hdf5_file: h5file };
|
|
192
|
+
let out;
|
|
193
|
+
try {
|
|
194
|
+
const time1 = Date.now();
|
|
195
|
+
const rust_output = await run_rust("readHDF5", JSON.stringify(read_hdf5_input_type));
|
|
196
|
+
mayLog("Time taken to query HDF5 file:", Date.now() - time1, "ms");
|
|
197
|
+
for (const line of rust_output.split("\n")) {
|
|
198
|
+
if (line.startsWith("output_string:")) {
|
|
199
|
+
out = JSON.parse(line.replace("output_string:", ""));
|
|
200
|
+
} else {
|
|
201
|
+
console.log(line);
|
|
237
202
|
}
|
|
238
|
-
} catch (_) {
|
|
239
|
-
return {};
|
|
240
203
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
204
|
+
} catch (e) {
|
|
205
|
+
console.log(e);
|
|
206
|
+
throw "error reading h5 file: " + e;
|
|
207
|
+
}
|
|
208
|
+
return out;
|
|
209
|
+
};
|
|
244
210
|
}
|
|
245
211
|
function gdc_validateGeneExpression(G, ds, genome) {
|
|
246
212
|
G.sample2gene2expressionBins = {};
|