@sjcrh/proteinpaint-server 2.130.0 → 2.131.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 +2 -2
- package/routes/termdb.singleSampleMutation.js +26 -12
- package/src/app.js +220 -150
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sjcrh/proteinpaint-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.131.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",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@sjcrh/proteinpaint-r": "2.130.0",
|
|
66
66
|
"@sjcrh/proteinpaint-rust": "2.130.0",
|
|
67
67
|
"@sjcrh/proteinpaint-shared": "2.129.6",
|
|
68
|
-
"@sjcrh/proteinpaint-types": "2.
|
|
68
|
+
"@sjcrh/proteinpaint-types": "2.131.0",
|
|
69
69
|
"@types/express": "^5.0.0",
|
|
70
70
|
"@types/express-session": "^1.18.1",
|
|
71
71
|
"better-sqlite3": "^9.4.1",
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
1
|
import path from "path";
|
|
3
|
-
import { read_file } from "#src/utils.js";
|
|
4
|
-
import serverconfig from "#src/serverconfig.js";
|
|
2
|
+
import { read_file, file_is_readable, fileurl, illegalpath } from "#src/utils.js";
|
|
5
3
|
import { termdbSingleSampleMutationPayload } from "#types/checkers";
|
|
6
4
|
import { gdcValidate_query_singleSampleMutation } from "#src/mds3.gdc.js";
|
|
7
5
|
const api = {
|
|
@@ -46,16 +44,32 @@ async function validate_query_singleSampleMutation(ds, genome) {
|
|
|
46
44
|
gdcValidate_query_singleSampleMutation(ds, genome);
|
|
47
45
|
} else if (_q.src == "native") {
|
|
48
46
|
_q.get = async (q) => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
let sample;
|
|
48
|
+
{
|
|
49
|
+
const vt = typeof q.sample;
|
|
50
|
+
if (vt == "string") {
|
|
51
|
+
if (q.sample == "")
|
|
52
|
+
throw "sample is blank string";
|
|
53
|
+
sample = q.sample;
|
|
54
|
+
} else if (vt == "number") {
|
|
55
|
+
sample = q.sample.toString();
|
|
56
|
+
} else {
|
|
57
|
+
throw "sample value is not string or number";
|
|
58
|
+
}
|
|
58
59
|
}
|
|
60
|
+
if (illegalpath(sample))
|
|
61
|
+
throw "invalid sample name";
|
|
62
|
+
const tmp = fileurl({
|
|
63
|
+
query: {
|
|
64
|
+
file: path.join(_q.folder, sample)
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
if (tmp[0])
|
|
68
|
+
throw tmp[0];
|
|
69
|
+
const file = tmp[1];
|
|
70
|
+
if (!file)
|
|
71
|
+
throw "no file returned";
|
|
72
|
+
await file_is_readable(file);
|
|
59
73
|
const data = await read_file(file);
|
|
60
74
|
return { mlst: JSON.parse(data) };
|
|
61
75
|
};
|