@sjcrh/proteinpaint-server 2.193.0 → 2.195.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 -0
- package/package.json +5 -5
- package/routes/termdb.diffMeth.js +21 -5
- package/routes/termdb.proteome.js +27 -0
- package/src/app.js +1786 -1133
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.195.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,11 +59,11 @@
|
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@sjcrh/augen": "2.190.0",
|
|
62
|
-
"@sjcrh/proteinpaint-python": "2.
|
|
62
|
+
"@sjcrh/proteinpaint-python": "2.194.0",
|
|
63
63
|
"@sjcrh/proteinpaint-r": "2.190.0",
|
|
64
|
-
"@sjcrh/proteinpaint-rust": "2.
|
|
65
|
-
"@sjcrh/proteinpaint-shared": "2.
|
|
66
|
-
"@sjcrh/proteinpaint-types": "2.
|
|
64
|
+
"@sjcrh/proteinpaint-rust": "2.195.0",
|
|
65
|
+
"@sjcrh/proteinpaint-shared": "2.195.0",
|
|
66
|
+
"@sjcrh/proteinpaint-types": "2.195.0",
|
|
67
67
|
"@types/express": "^5.0.0",
|
|
68
68
|
"@types/express-session": "^1.18.1",
|
|
69
69
|
"better-sqlite3": "^12.4.1",
|
|
@@ -14,7 +14,7 @@ function init({ genomes }) {
|
|
|
14
14
|
const q = req.query;
|
|
15
15
|
if (q.preAnalysis) {
|
|
16
16
|
const { ds, term_results, term_results2 } = await resolveDaContext(q, genomes);
|
|
17
|
-
const groups = resolveDmSampleGroups(q, ds, term_results, term_results2);
|
|
17
|
+
const groups = await resolveDmSampleGroups(q, ds, term_results, term_results2);
|
|
18
18
|
const group1Name = q.samplelst.groups[0].name;
|
|
19
19
|
const group2Name = q.samplelst.groups[1].name;
|
|
20
20
|
res.send({
|
|
@@ -67,7 +67,7 @@ async function getDmCacheResult(req, genomes) {
|
|
|
67
67
|
return { result, cacheId };
|
|
68
68
|
}
|
|
69
69
|
async function runDmFresh(param, ds, term_results, term_results2) {
|
|
70
|
-
const groups = resolveDmSampleGroups(param, ds, term_results, term_results2);
|
|
70
|
+
const groups = await resolveDmSampleGroups(param, ds, term_results, term_results2);
|
|
71
71
|
if (groups.alerts.length) throw new Error(groups.alerts.join(" | "));
|
|
72
72
|
const q = ds.queries.dnaMethylation.promoter;
|
|
73
73
|
const diffMethInput = {
|
|
@@ -97,7 +97,7 @@ async function runDmFresh(param, ds, term_results, term_results2) {
|
|
|
97
97
|
};
|
|
98
98
|
return cacheResult;
|
|
99
99
|
}
|
|
100
|
-
function resolveDmSampleGroups(param, ds, term_results, term_results2) {
|
|
100
|
+
async function resolveDmSampleGroups(param, ds, term_results, term_results2) {
|
|
101
101
|
if (param.samplelst?.groups?.length != 2)
|
|
102
102
|
throw new Error("Exactly 2 sample groups are required for differential methylation analysis.");
|
|
103
103
|
if (param.samplelst.groups[0].values?.length < 1)
|
|
@@ -107,8 +107,24 @@ function resolveDmSampleGroups(param, ds, term_results, term_results2) {
|
|
|
107
107
|
const q = ds.queries.dnaMethylation?.promoter;
|
|
108
108
|
if (!q) throw new Error("This dataset does not have promoter-level methylation data configured.");
|
|
109
109
|
if (!q.file) throw new Error("Promoter methylation data file is not configured for this dataset.");
|
|
110
|
-
const g1 = buildGroupValues(
|
|
111
|
-
|
|
110
|
+
const g1 = await buildGroupValues(
|
|
111
|
+
param.samplelst.groups[0].values,
|
|
112
|
+
q,
|
|
113
|
+
ds,
|
|
114
|
+
param.tw,
|
|
115
|
+
param.tw2,
|
|
116
|
+
term_results,
|
|
117
|
+
term_results2
|
|
118
|
+
);
|
|
119
|
+
const g2 = await buildGroupValues(
|
|
120
|
+
param.samplelst.groups[1].values,
|
|
121
|
+
q,
|
|
122
|
+
ds,
|
|
123
|
+
param.tw,
|
|
124
|
+
param.tw2,
|
|
125
|
+
term_results,
|
|
126
|
+
term_results2
|
|
127
|
+
);
|
|
112
128
|
const alerts = [];
|
|
113
129
|
if (g1.names.length < 1) alerts.push("No samples in group 1 have methylation data available.");
|
|
114
130
|
if (g2.names.length < 1) alerts.push("No samples in group 2 have methylation data available.");
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { get_ds_tdb } from "#src/termdb.js";
|
|
2
2
|
import * as utils from "#src/utils.js";
|
|
3
3
|
import { mayLimitSamples } from "#src/mds3.filter.js";
|
|
4
|
+
function baseUniProtAcc(acc) {
|
|
5
|
+
if (!acc) return "";
|
|
6
|
+
const parts = acc.split("|");
|
|
7
|
+
const id = parts.length >= 2 ? parts[1] : acc;
|
|
8
|
+
const dash = id.indexOf("-");
|
|
9
|
+
return dash > 0 ? id.slice(0, dash) : id;
|
|
10
|
+
}
|
|
4
11
|
function init({ genomes }) {
|
|
5
12
|
return async (req, res) => {
|
|
6
13
|
const q = req.query;
|
|
@@ -70,6 +77,26 @@ function init({ genomes }) {
|
|
|
70
77
|
}
|
|
71
78
|
}
|
|
72
79
|
}
|
|
80
|
+
const refAssay = ds.queries.proteome.proteinReferenceAssay;
|
|
81
|
+
if (refAssay) {
|
|
82
|
+
const refFcByKey = /* @__PURE__ */ new Map();
|
|
83
|
+
for (const e of cohorts) {
|
|
84
|
+
if (e.assayName !== refAssay || !Number.isFinite(e.foldChange)) continue;
|
|
85
|
+
const baseAcc = baseUniProtAcc(e.proteinAccession);
|
|
86
|
+
if (!baseAcc) continue;
|
|
87
|
+
const key = `${e.organism}|${e.cohortName}|${baseAcc}`;
|
|
88
|
+
const p = Number.isFinite(e.pValue) ? e.pValue : Infinity;
|
|
89
|
+
const cur = refFcByKey.get(key);
|
|
90
|
+
if (!cur || p < cur.p) refFcByKey.set(key, { fc: e.foldChange, p });
|
|
91
|
+
}
|
|
92
|
+
for (const e of cohorts) {
|
|
93
|
+
if (!e.PTMType) continue;
|
|
94
|
+
const baseAcc = baseUniProtAcc(e.proteinAccession);
|
|
95
|
+
if (!baseAcc) continue;
|
|
96
|
+
const ref = refFcByKey.get(`${e.organism}|${e.cohortName}|${baseAcc}`);
|
|
97
|
+
if (ref) e.proteinFoldChange = ref.fc;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
73
100
|
res.send({ protein: term.name, cohorts, sampleRegions: brConfig ? sampleRegions : void 0 });
|
|
74
101
|
} catch (e) {
|
|
75
102
|
if (e?.stack) console.log(e.stack);
|