@sjcrh/proteinpaint-server 2.108.1-0 → 2.109.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/genome/hg38.js +2 -2
- package/package.json +3 -3
- package/routes/termdb.DE.js +75 -7
- package/routes/termdb.cluster.js +1 -1
- package/routes/termdb.config.js +2 -1
- package/src/app.js +100 -18
- package/src/bedj.parseBed.js +1 -1
- package/src/run_R.js +1 -1
- package/utils/edge.R +29 -14
- package/utils/hwe.R +0 -11
package/genome/hg38.js
CHANGED
|
@@ -42,8 +42,8 @@ var hg38_default = {
|
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
__isgene: true,
|
|
45
|
-
name: "GENCODE
|
|
46
|
-
file: "anno/gencode.
|
|
45
|
+
name: "GENCODE v47",
|
|
46
|
+
file: "anno/gencode.v47.hg38.gz",
|
|
47
47
|
translatecoding: true,
|
|
48
48
|
categories: {
|
|
49
49
|
coding: { color: "#004D99", label: "Coding gene" },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sjcrh/proteinpaint-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.109.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",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@sjcrh/augen": "2.87.0",
|
|
62
62
|
"@sjcrh/proteinpaint-rust": "2.99.0",
|
|
63
|
-
"@sjcrh/proteinpaint-shared": "2.
|
|
64
|
-
"@sjcrh/proteinpaint-types": "2.
|
|
63
|
+
"@sjcrh/proteinpaint-shared": "2.109.0",
|
|
64
|
+
"@sjcrh/proteinpaint-types": "2.109.0",
|
|
65
65
|
"@types/express": "^5.0.0",
|
|
66
66
|
"@types/express-session": "^1.18.1",
|
|
67
67
|
"better-sqlite3": "^9.4.1",
|
package/routes/termdb.DE.js
CHANGED
|
@@ -42,7 +42,22 @@ function init({ genomes }) {
|
|
|
42
42
|
if (term_results.error)
|
|
43
43
|
throw term_results.error;
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
let term_results2 = [];
|
|
46
|
+
if (q.tw2) {
|
|
47
|
+
const terms2 = [q.tw2];
|
|
48
|
+
term_results2 = await getData(
|
|
49
|
+
{
|
|
50
|
+
filter: q.filter,
|
|
51
|
+
filter0: q.filter0,
|
|
52
|
+
terms: terms2
|
|
53
|
+
},
|
|
54
|
+
ds,
|
|
55
|
+
genome
|
|
56
|
+
);
|
|
57
|
+
if (term_results2.error)
|
|
58
|
+
throw term_results2.error;
|
|
59
|
+
}
|
|
60
|
+
const results = await run_DE(req.query, ds, term_results, term_results2);
|
|
46
61
|
res.send(results);
|
|
47
62
|
} catch (e) {
|
|
48
63
|
res.send({ status: "error", error: e.message || e });
|
|
@@ -51,7 +66,7 @@ function init({ genomes }) {
|
|
|
51
66
|
}
|
|
52
67
|
};
|
|
53
68
|
}
|
|
54
|
-
async function run_DE(param, ds, term_results) {
|
|
69
|
+
async function run_DE(param, ds, term_results, term_results2) {
|
|
55
70
|
if (param.samplelst?.groups?.length != 2)
|
|
56
71
|
throw ".samplelst.groups.length!=2";
|
|
57
72
|
if (param.samplelst.groups[0].values?.length < 1)
|
|
@@ -68,6 +83,7 @@ async function run_DE(param, ds, term_results) {
|
|
|
68
83
|
param.storage_type = q.storage_type;
|
|
69
84
|
const group1names = [];
|
|
70
85
|
const conf1_group1 = [];
|
|
86
|
+
const conf2_group1 = [];
|
|
71
87
|
for (const s of param.samplelst.groups[0].values) {
|
|
72
88
|
if (!Number.isInteger(s.sampleId))
|
|
73
89
|
continue;
|
|
@@ -75,7 +91,7 @@ async function run_DE(param, ds, term_results) {
|
|
|
75
91
|
if (!n)
|
|
76
92
|
continue;
|
|
77
93
|
if (q.allSampleSet.has(n)) {
|
|
78
|
-
if (param.tw) {
|
|
94
|
+
if (param.tw && !param.tw2) {
|
|
79
95
|
if (term_results.samples[s.sampleId]) {
|
|
80
96
|
if (param.tw.q.mode == "continuous") {
|
|
81
97
|
conf1_group1.push(term_results.samples[s.sampleId][param.tw.$id]["value"]);
|
|
@@ -84,14 +100,37 @@ async function run_DE(param, ds, term_results) {
|
|
|
84
100
|
}
|
|
85
101
|
group1names.push(n);
|
|
86
102
|
}
|
|
103
|
+
} else if (!param.tw && param.tw2) {
|
|
104
|
+
if (term_results2.samples[s.sampleId]) {
|
|
105
|
+
if (param.tw2.q.mode == "continuous") {
|
|
106
|
+
conf2_group1.push(term_results2.samples[s.sampleId][param.tw2.$id]["value"]);
|
|
107
|
+
} else {
|
|
108
|
+
conf2_group1.push(term_results2.samples[s.sampleId][param.tw2.$id]["key"]);
|
|
109
|
+
}
|
|
110
|
+
group1names.push(n);
|
|
111
|
+
}
|
|
112
|
+
} else if (param.tw && param.tw2) {
|
|
113
|
+
if (term_results.samples[s.sampleId] && term_results2.samples[s.sampleId]) {
|
|
114
|
+
if (param.tw.q.mode == "continuous") {
|
|
115
|
+
conf1_group1.push(term_results.samples[s.sampleId][param.tw.$id]["value"]);
|
|
116
|
+
} else {
|
|
117
|
+
conf1_group1.push(term_results.samples[s.sampleId][param.tw.$id]["key"]);
|
|
118
|
+
}
|
|
119
|
+
if (param.tw2.q.mode == "continuous") {
|
|
120
|
+
conf2_group1.push(term_results2.samples[s.sampleId][param.tw2.$id]["value"]);
|
|
121
|
+
} else {
|
|
122
|
+
conf2_group1.push(term_results2.samples[s.sampleId][param.tw2.$id]["key"]);
|
|
123
|
+
}
|
|
124
|
+
group1names.push(n);
|
|
125
|
+
}
|
|
87
126
|
} else {
|
|
88
127
|
group1names.push(n);
|
|
89
128
|
}
|
|
90
|
-
} else {
|
|
91
129
|
}
|
|
92
130
|
}
|
|
93
131
|
const group2names = [];
|
|
94
132
|
const conf1_group2 = [];
|
|
133
|
+
const conf2_group2 = [];
|
|
95
134
|
for (const s of param.samplelst.groups[1].values) {
|
|
96
135
|
if (!Number.isInteger(s.sampleId))
|
|
97
136
|
continue;
|
|
@@ -99,7 +138,7 @@ async function run_DE(param, ds, term_results) {
|
|
|
99
138
|
if (!n)
|
|
100
139
|
continue;
|
|
101
140
|
if (q.allSampleSet.has(n)) {
|
|
102
|
-
if (param.tw) {
|
|
141
|
+
if (param.tw && !param.tw2) {
|
|
103
142
|
if (term_results.samples[s.sampleId]) {
|
|
104
143
|
if (param.tw.q.mode == "continuous") {
|
|
105
144
|
conf1_group2.push(term_results.samples[s.sampleId][param.tw.$id]["value"]);
|
|
@@ -108,10 +147,32 @@ async function run_DE(param, ds, term_results) {
|
|
|
108
147
|
}
|
|
109
148
|
group2names.push(n);
|
|
110
149
|
}
|
|
150
|
+
} else if (!param.tw && param.tw2) {
|
|
151
|
+
if (term_results2.samples[s.sampleId]) {
|
|
152
|
+
if (param.tw2.q.mode == "continuous") {
|
|
153
|
+
conf2_group2.push(term_results2.samples[s.sampleId][param.tw2.$id]["value"]);
|
|
154
|
+
} else {
|
|
155
|
+
conf2_group2.push(term_results2.samples[s.sampleId][param.tw2.$id]["key"]);
|
|
156
|
+
}
|
|
157
|
+
group2names.push(n);
|
|
158
|
+
}
|
|
159
|
+
} else if (param.tw && param.tw2) {
|
|
160
|
+
if (term_results.samples[s.sampleId] && term_results2.samples[s.sampleId]) {
|
|
161
|
+
if (param.tw.q.mode == "continuous") {
|
|
162
|
+
conf1_group2.push(term_results.samples[s.sampleId][param.tw.$id]["value"]);
|
|
163
|
+
} else {
|
|
164
|
+
conf1_group2.push(term_results.samples[s.sampleId][param.tw.$id]["key"]);
|
|
165
|
+
}
|
|
166
|
+
if (param.tw2.q.mode == "continuous") {
|
|
167
|
+
conf2_group2.push(term_results2.samples[s.sampleId][param.tw2.$id]["value"]);
|
|
168
|
+
} else {
|
|
169
|
+
conf2_group2.push(term_results2.samples[s.sampleId][param.tw2.$id]["key"]);
|
|
170
|
+
}
|
|
171
|
+
group2names.push(n);
|
|
172
|
+
}
|
|
111
173
|
} else {
|
|
112
174
|
group2names.push(n);
|
|
113
175
|
}
|
|
114
|
-
} else {
|
|
115
176
|
}
|
|
116
177
|
}
|
|
117
178
|
const sample_size1 = group1names.length;
|
|
@@ -135,7 +196,14 @@ async function run_DE(param, ds, term_results) {
|
|
|
135
196
|
expression_input.conf1 = [...conf1_group2, ...conf1_group1];
|
|
136
197
|
expression_input.conf1_mode = param.tw.q.mode;
|
|
137
198
|
if (new Set(expression_input.conf1).size === 1) {
|
|
138
|
-
throw "Confounding variable has only one value";
|
|
199
|
+
throw "Confounding variable 1 has only one value";
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (param.tw2) {
|
|
203
|
+
expression_input.conf2 = [...conf2_group2, ...conf2_group1];
|
|
204
|
+
expression_input.conf2_mode = param.tw2.q.mode;
|
|
205
|
+
if (new Set(expression_input.conf2).size === 1) {
|
|
206
|
+
throw "Confounding variable 2 has only one value";
|
|
139
207
|
}
|
|
140
208
|
}
|
|
141
209
|
const sample_size_limit = 8;
|
package/routes/termdb.cluster.js
CHANGED
|
@@ -233,7 +233,7 @@ async function validateNative(q, ds, genome) {
|
|
|
233
233
|
q.get = async (param) => {
|
|
234
234
|
const limitSamples = await mayLimitSamples(param, q.samples, ds);
|
|
235
235
|
if (limitSamples?.size == 0) {
|
|
236
|
-
return { term2sample2value: /* @__PURE__ */ new
|
|
236
|
+
return { term2sample2value: /* @__PURE__ */ new Map(), byTermId: {}, bySampleId: {} };
|
|
237
237
|
}
|
|
238
238
|
const bySampleId = {};
|
|
239
239
|
const samples = q.samples || [];
|
package/routes/termdb.config.js
CHANGED
|
@@ -123,7 +123,8 @@ function addScatterplots(c, ds) {
|
|
|
123
123
|
colorColumn: p.colorColumn,
|
|
124
124
|
sampleType: p.sampleType,
|
|
125
125
|
coordsColumns: p.coordsColumns,
|
|
126
|
-
settings: p.settings,
|
|
126
|
+
settings: { sampleScatter: p.settings },
|
|
127
|
+
//the client settings are under sampleScatter so we add it here to avoid adding it in the dataset
|
|
127
128
|
sampleCategory: p.sampleCategory
|
|
128
129
|
};
|
|
129
130
|
});
|