@sjcrh/proteinpaint-server 2.170.26 → 2.170.27

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjcrh/proteinpaint-server",
3
- "version": "2.170.26",
3
+ "version": "2.170.27",
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",
@@ -64,9 +64,9 @@
64
64
  "@sjcrh/augen": "2.143.0",
65
65
  "@sjcrh/proteinpaint-python": "2.169.0",
66
66
  "@sjcrh/proteinpaint-r": "2.152.1-0",
67
- "@sjcrh/proteinpaint-rust": "2.170.0",
67
+ "@sjcrh/proteinpaint-rust": "2.170.27-1ac4377f6.0",
68
68
  "@sjcrh/proteinpaint-shared": "2.170.21",
69
- "@sjcrh/proteinpaint-types": "2.170.26",
69
+ "@sjcrh/proteinpaint-types": "2.170.27",
70
70
  "@types/express": "^5.0.0",
71
71
  "@types/express-session": "^1.18.1",
72
72
  "better-sqlite3": "^12.4.1",
package/routes/gdc.maf.js CHANGED
@@ -26,7 +26,8 @@ function init({ genomes }) {
26
26
  if (!g) throw "hg38 missing";
27
27
  const ds = g.datasets.GDC;
28
28
  if (!ds) throw "hg38 GDC missing";
29
- const payload = await listMafFiles(req.query, ds);
29
+ const q = req.query;
30
+ const payload = await listMafFiles(q, ds);
30
31
  res.send(payload);
31
32
  } catch (e) {
32
33
  res.send({ status: "error", error: e.message || e });
@@ -48,7 +49,7 @@ async function listMafFiles(q, ds) {
48
49
  if (q.filter0) {
49
50
  case_filters.content.push(q.filter0);
50
51
  }
51
- const { host } = ds.getHostHeaders(q);
52
+ const { host, headers } = ds.getHostHeaders(q);
52
53
  const body = {
53
54
  filters,
54
55
  size: maxFileNumber,
@@ -66,7 +67,7 @@ async function listMafFiles(q, ds) {
66
67
  ].join(",")
67
68
  };
68
69
  if (case_filters.content.length) body.case_filters = case_filters;
69
- const response = await ky.post(joinUrl(host.rest, "files"), { timeout: false, json: body });
70
+ const response = await ky.post(joinUrl(host.rest, "files"), { headers, timeout: false, json: body });
70
71
  if (!response.ok) throw `HTTP Error: ${response.status} ${response.statusText}`;
71
72
  const re = await response.json();
72
73
  if (!Number.isInteger(re.data?.pagination?.total)) throw "re.data.pagination.total is not int";
@@ -20,11 +20,11 @@ const api = {
20
20
  function init({ genomes }) {
21
21
  return async (req, res) => {
22
22
  try {
23
- const q = req.query;
24
23
  const g = genomes.hg38;
25
24
  if (!g) throw "hg38 missing";
26
25
  const ds = g.datasets.GDC;
27
26
  if (!ds) throw "hg38 GDC missing";
27
+ const q = req.query;
28
28
  await buildMaf(q, res, ds);
29
29
  } catch (e) {
30
30
  if (e.stack) console.log(e.stack);
@@ -34,14 +34,15 @@ function init({ genomes }) {
34
34
  }
35
35
  async function buildMaf(q, res, ds) {
36
36
  const t0 = Date.now();
37
- const { host } = ds.getHostHeaders(q);
38
- const fileLst2 = await getFileLstUnderSizeLimit(q.fileIdLst, host);
37
+ const { host, headers } = ds.getHostHeaders(q);
38
+ const fileLst2 = await getFileLstUnderSizeLimit(q.fileIdLst, host, headers);
39
39
  mayLog(`${fileLst2.length} out of ${q.fileIdLst.length} input MAF files accepted by size limit`, Date.now() - t0);
40
40
  const arg = {
41
41
  fileIdLst: fileLst2,
42
42
  columns: q.columns,
43
- host: joinUrl(host.rest, "data")
43
+ host: joinUrl(host.rest, "data"),
44
44
  // must use the /data/ endpoint from current host
45
+ headers
45
46
  };
46
47
  const boundary = "------------------------GDC-MAF-BUILD";
47
48
  res.setHeader("Content-Type", `multipart/form-data; boundary=${boundary}`);
@@ -97,7 +98,7 @@ async function buildMaf(q, res, ds) {
97
98
  if (end) res.end();
98
99
  }
99
100
  }
100
- async function getFileLstUnderSizeLimit(lst, host) {
101
+ async function getFileLstUnderSizeLimit(lst, host, headers) {
101
102
  if (lst.length == 0) throw "fileIdLst[] not array or blank";
102
103
  const body = {
103
104
  filters: {
@@ -107,7 +108,7 @@ async function getFileLstUnderSizeLimit(lst, host) {
107
108
  size: 1e4,
108
109
  fields: "file_size"
109
110
  };
110
- const response = await ky.post(joinUrl(host.rest, "files"), { timeout: false, json: body });
111
+ const response = await ky.post(joinUrl(host.rest, "files"), { headers, timeout: false, json: body });
111
112
  if (!response.ok) throw `HTTP Error: ${response.status} ${response.statusText}`;
112
113
  const re = await response.json();
113
114
  if (!Array.isArray(re.data?.hits)) throw "re.data.hits[] not array";
@@ -215,9 +215,13 @@ function gdc_validateGeneExpression(G, ds, genome) {
215
215
  gene_ids: [gencodeId],
216
216
  file_id: hdf5id
217
217
  };
218
- const { host } = ds.getHostHeaders(q);
218
+ const { host, headers } = ds.getHostHeaders(q);
219
219
  const t = Date.now();
220
- const response = await ky.post(joinUrl(host.rest, "scrna_seq/gene_expression"), { timeout: false, json: body });
220
+ const response = await ky.post(joinUrl(host.rest, "scrna_seq/gene_expression"), {
221
+ timeout: false,
222
+ headers,
223
+ json: body
224
+ });
221
225
  if (!response.ok) throw new Error(`HTTP Error: ${response.status} ${response.statusText}`);
222
226
  const out = await response.json();
223
227
  mayLog("gdc scrna gene exp", q.gene, Date.now() - t);