@sjcrh/proteinpaint-server 2.108.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 CHANGED
@@ -42,8 +42,8 @@ var hg38_default = {
42
42
  },
43
43
  {
44
44
  __isgene: true,
45
- name: "GENCODE v43",
46
- file: "anno/gencode.v43.hg38.gz",
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.108.0",
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.108.0",
64
- "@sjcrh/proteinpaint-types": "2.108.0",
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/gdc.maf.js CHANGED
@@ -101,8 +101,10 @@ async function listMafFiles(q, ds) {
101
101
  if (normalTypeName)
102
102
  file.sample_types.push(normalTypeName);
103
103
  }
104
+ file.sample_types = [...new Set(file.sample_types)];
104
105
  files.push(file);
105
106
  }
107
+ files.sort((a, b) => b.file_size - a.file_size);
106
108
  const result = {
107
109
  files,
108
110
  filesTotal: re.data.pagination.total,
@@ -42,7 +42,22 @@ function init({ genomes }) {
42
42
  if (term_results.error)
43
43
  throw term_results.error;
44
44
  }
45
- const results = await run_DE(req.query, ds, term_results);
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;
@@ -74,6 +74,12 @@ async function getResult(q, ds, genome) {
74
74
  ;
75
75
  ({ term2sample2value, byTermId, bySampleId } = await ds.queries[q.dataType].get(_q));
76
76
  }
77
+ for (const [term, obj] of term2sample2value) {
78
+ if (Object.keys(obj).length === 0) {
79
+ term2sample2value.delete(term);
80
+ delete byTermId[term];
81
+ }
82
+ }
77
83
  if (term2sample2value.size == 0)
78
84
  throw "no data";
79
85
  if (term2sample2value.size == 1) {
@@ -227,7 +233,7 @@ async function validateNative(q, ds, genome) {
227
233
  q.get = async (param) => {
228
234
  const limitSamples = await mayLimitSamples(param, q.samples, ds);
229
235
  if (limitSamples?.size == 0) {
230
- return { term2sample2value: /* @__PURE__ */ new Set(), byTermId: {}, bySampleId: {} };
236
+ return { term2sample2value: /* @__PURE__ */ new Map(), byTermId: {}, bySampleId: {} };
231
237
  }
232
238
  const bySampleId = {};
233
239
  const samples = q.samples || [];
@@ -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
  });