@sjcrh/proteinpaint-server 2.128.0 → 2.128.2-c8a27e966.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 +3 -3
- package/routes/gdcGRIN2list.js +27 -13
- package/routes/genesetEnrichment.js +37 -22
- package/src/app.js +108 -58
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sjcrh/proteinpaint-server",
|
|
3
|
-
"version": "2.128.0",
|
|
3
|
+
"version": "2.128.2-c8a27e966.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",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"@sjcrh/augen": "2.121.0",
|
|
64
64
|
"@sjcrh/proteinpaint-python": "2.118.0",
|
|
65
65
|
"@sjcrh/proteinpaint-r": "2.126.2",
|
|
66
|
-
"@sjcrh/proteinpaint-rust": "2.
|
|
66
|
+
"@sjcrh/proteinpaint-rust": "2.128.1",
|
|
67
67
|
"@sjcrh/proteinpaint-shared": "2.126.0",
|
|
68
|
-
"@sjcrh/proteinpaint-types": "2.128.
|
|
68
|
+
"@sjcrh/proteinpaint-types": "2.128.1",
|
|
69
69
|
"@types/express": "^5.0.0",
|
|
70
70
|
"@types/express-session": "^1.18.1",
|
|
71
71
|
"better-sqlite3": "^9.4.1",
|
package/routes/gdcGRIN2list.js
CHANGED
|
@@ -36,19 +36,29 @@ function init({ genomes }) {
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
async function listMafFiles(q, ds) {
|
|
39
|
+
const shouldRetrieveMaf = !!q.mafOptions;
|
|
40
|
+
const experimentalStrategy = q.mafOptions?.experimentalStrategy;
|
|
41
|
+
if (shouldRetrieveMaf && !experimentalStrategy) {
|
|
42
|
+
throw "Missing experimentalStrategy parameter for MAF file retrieval";
|
|
43
|
+
}
|
|
39
44
|
const dataFormatFilter = {
|
|
40
45
|
op: "and",
|
|
41
46
|
content: [{ op: "=", content: { field: "data_format", value: "MAF" } }]
|
|
42
47
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
let filters;
|
|
49
|
+
if (shouldRetrieveMaf) {
|
|
50
|
+
filters = {
|
|
51
|
+
op: "and",
|
|
52
|
+
content: [
|
|
53
|
+
dataFormatFilter,
|
|
54
|
+
{ op: "=", content: { field: "experimental_strategy", value: experimentalStrategy } },
|
|
55
|
+
{ op: "=", content: { field: "analysis.workflow_type", value: allowedWorkflowType } },
|
|
56
|
+
{ op: "=", content: { field: "access", value: "open" } }
|
|
57
|
+
]
|
|
58
|
+
};
|
|
59
|
+
} else {
|
|
60
|
+
throw "At least one file type option must be specified (mafOptions, cnvOptions, or fusionOptions)";
|
|
61
|
+
}
|
|
52
62
|
const case_filters = { op: "and", content: [] };
|
|
53
63
|
if (q.filter0) {
|
|
54
64
|
case_filters.content.push(q.filter0);
|
|
@@ -61,11 +71,8 @@ async function listMafFiles(q, ds) {
|
|
|
61
71
|
"id",
|
|
62
72
|
"file_size",
|
|
63
73
|
"cases.project.project_id",
|
|
64
|
-
// for display only
|
|
65
74
|
"cases.case_id",
|
|
66
|
-
// case uuid for making case url link to portal
|
|
67
75
|
"cases.submitter_id",
|
|
68
|
-
// used when listing all cases & files
|
|
69
76
|
"cases.samples.tissue_type",
|
|
70
77
|
"cases.samples.tumor_descriptor"
|
|
71
78
|
].join(",")
|
|
@@ -114,7 +121,14 @@ async function listMafFiles(q, ds) {
|
|
|
114
121
|
const result = {
|
|
115
122
|
files,
|
|
116
123
|
filesTotal: re.data.pagination.total,
|
|
117
|
-
maxTotalSizeCompressed
|
|
124
|
+
maxTotalSizeCompressed,
|
|
125
|
+
fileCounts: {
|
|
126
|
+
maf: files.length
|
|
127
|
+
},
|
|
128
|
+
appliedFilters: {
|
|
129
|
+
fileTypes: shouldRetrieveMaf ? ["MAF"] : [],
|
|
130
|
+
experimentalStrategy
|
|
131
|
+
}
|
|
118
132
|
};
|
|
119
133
|
return result;
|
|
120
134
|
}
|
|
@@ -3,7 +3,9 @@ import fs from "fs";
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import serverconfig from "#src/serverconfig.js";
|
|
5
5
|
import { run_python } from "@sjcrh/proteinpaint-python";
|
|
6
|
+
import { run_rust } from "@sjcrh/proteinpaint-rust";
|
|
6
7
|
import { mayLog } from "#src/helpers.ts";
|
|
8
|
+
import { formatElapsedTime } from "@sjcrh/proteinpaint-shared/time.js";
|
|
7
9
|
const api = {
|
|
8
10
|
endpoint: "genesetEnrichment",
|
|
9
11
|
methods: {
|
|
@@ -54,33 +56,46 @@ async function run_genesetEnrichment_analysis(q, genomes) {
|
|
|
54
56
|
db: genomes[q.genome].termdbs.msigdb.cohort.db.connection.name,
|
|
55
57
|
// For now msigdb has been added, but later databases other than msigdb may be used
|
|
56
58
|
geneset_group: q.geneSetGroup,
|
|
57
|
-
cachedir: cachedir_gsea,
|
|
58
|
-
geneset_name: q.geneset_name,
|
|
59
|
-
pickle_file: q.pickle_file,
|
|
60
|
-
num_permutations: q.num_permutations,
|
|
61
59
|
genedb: path.join(serverconfig.tpmasterdir, genomes[q.genome].genedb.dbfile),
|
|
62
60
|
filter_non_coding_genes: q.filter_non_coding_genes
|
|
63
61
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
62
|
+
let gsea_output;
|
|
63
|
+
if (q.method == "blitzgsea") {
|
|
64
|
+
genesetenrichment_input.cachedir = cachedir_gsea;
|
|
65
|
+
genesetenrichment_input.pickle_file = q.pickle_file;
|
|
66
|
+
genesetenrichment_input.geneset_name = q.geneset_name;
|
|
67
|
+
genesetenrichment_input.num_permutations = q.num_permutations;
|
|
68
|
+
const time1 = (/* @__PURE__ */ new Date()).valueOf();
|
|
69
|
+
gsea_output = await run_python("gsea.py", "/" + JSON.stringify(genesetenrichment_input));
|
|
70
|
+
mayLog("Time taken to run blitzgsea:", formatElapsedTime(Date.now() - time1));
|
|
71
|
+
let result;
|
|
72
|
+
let data_found = false;
|
|
73
|
+
let image_found = false;
|
|
74
|
+
for (const line of gsea_output.split("\n")) {
|
|
75
|
+
if (line.startsWith("result: ")) {
|
|
76
|
+
result = JSON.parse(line.replace("result: ", ""));
|
|
77
|
+
data_found = true;
|
|
78
|
+
} else if (line.startsWith("image: ")) {
|
|
79
|
+
result = JSON.parse(line.replace("image: ", ""));
|
|
80
|
+
image_found = true;
|
|
81
|
+
} else {
|
|
82
|
+
mayLog(line);
|
|
83
|
+
}
|
|
77
84
|
}
|
|
85
|
+
if (data_found)
|
|
86
|
+
return result;
|
|
87
|
+
const image_file_name = path.join(cachedir_gsea, result.image_file);
|
|
88
|
+
if (image_found)
|
|
89
|
+
return image_file_name;
|
|
90
|
+
throw "data or image not found in gsea output; this should not happen";
|
|
91
|
+
} else if (q.method == "cerno") {
|
|
92
|
+
const time1 = (/* @__PURE__ */ new Date()).valueOf();
|
|
93
|
+
gsea_output = JSON.parse(await run_rust("cerno", JSON.stringify(genesetenrichment_input)));
|
|
94
|
+
mayLog("Time taken to run CERNO:", formatElapsedTime(Date.now() - time1));
|
|
95
|
+
return gsea_output;
|
|
96
|
+
} else {
|
|
97
|
+
throw "Unknown method:" + q.method;
|
|
78
98
|
}
|
|
79
|
-
if (data_found)
|
|
80
|
-
return result;
|
|
81
|
-
if (image_found)
|
|
82
|
-
return path.join(cachedir_gsea, result.image_file);
|
|
83
|
-
throw "data or image not found in gsea output; this should not happen";
|
|
84
99
|
}
|
|
85
100
|
export {
|
|
86
101
|
api
|