@sjcrh/proteinpaint-server 2.191.4 → 2.192.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.
@@ -112,6 +112,14 @@ function getHg38() {
112
112
  file: "anno/hicFragment/hic.NcoI.hg38.gz"
113
113
  }
114
114
  ],
115
+ // sources of blacklisted genomic regions (artifact-prone / germline-CNV loci),
116
+ // consumed e.g. by GRIN2 to drop genes lying in these regions before recurrence testing
117
+ blacklists: [
118
+ { name: "ENCODE blacklist", file: "anno/encodeBlacklist.hg38.bed.gz" },
119
+ { name: "Segmental duplications", file: "anno/genomicSuperDups.hg38.bed.gz" },
120
+ { name: "Assembly gaps", file: "anno/gaps.hg38.bed.gz" },
121
+ { name: "Common germline CNVs (DGV)", file: "anno/dgvCommon.hg38.bed.gz" }
122
+ ],
115
123
  geneset: [
116
124
  {
117
125
  name: "Cancer Gene Census",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjcrh/proteinpaint-server",
3
- "version": "2.191.4",
3
+ "version": "2.192.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.191.0",
62
+ "@sjcrh/proteinpaint-python": "2.192.0",
63
63
  "@sjcrh/proteinpaint-r": "2.190.0",
64
- "@sjcrh/proteinpaint-rust": "2.191.4",
65
- "@sjcrh/proteinpaint-shared": "2.191.4",
66
- "@sjcrh/proteinpaint-types": "2.191.4",
64
+ "@sjcrh/proteinpaint-rust": "2.192.0",
65
+ "@sjcrh/proteinpaint-shared": "2.192.0",
66
+ "@sjcrh/proteinpaint-types": "2.192.0",
67
67
  "@types/express": "^5.0.0",
68
68
  "@types/express-session": "^1.18.1",
69
69
  "better-sqlite3": "^12.4.1",
@@ -12,6 +12,9 @@ function init({ genomes }) {
12
12
  const term = q.term?.term || q.term;
13
13
  if (!term?.name) throw "term.name missing";
14
14
  const cohorts = [];
15
+ const brConfig = ds.queries.proteome.brainRegions;
16
+ const regionRemap = brConfig?.regionValueRemap || {};
17
+ const sampleRegions = {};
15
18
  for (const organismName in ds.queries.proteome.organisms) {
16
19
  const organism = ds.queries.proteome.organisms[organismName];
17
20
  for (const assayName in organism.assays) {
@@ -43,20 +46,31 @@ function init({ genomes }) {
43
46
  const prior = assay.cohorts[cohortName].prior;
44
47
  for (const entry of cohortData.allEntries || []) {
45
48
  const s2v = entry.s2v;
49
+ const sampleRegionsRaw = entry.sampleRegionsRaw || {};
46
50
  const stats = getCohortStats(s2v, controlSampleIds, prior);
47
51
  delete entry.s2v;
52
+ delete entry.sampleRegionsRaw;
48
53
  entry.foldChange = stats.foldChange;
49
54
  entry.pValue = stats.pValue;
50
55
  entry.testedN = stats.testedN;
51
56
  entry.controlN = stats.controlN;
52
57
  if (assay.mclassOverride) entry.mclassOverride = assay.mclassOverride;
53
58
  if (organism.genomeName) entry.genomeName = organism.genomeName;
59
+ if (brConfig) {
60
+ entry.sampleIds = Object.keys(s2v);
61
+ for (const sid in sampleRegionsRaw) {
62
+ const raw = sampleRegionsRaw[sid];
63
+ if (raw == null) continue;
64
+ const code = regionRemap[String(raw)] ?? String(raw);
65
+ if (brConfig.regions[code] !== void 0) sampleRegions[sid] = code;
66
+ }
67
+ }
54
68
  cohorts.push(entry);
55
69
  }
56
70
  }
57
71
  }
58
72
  }
59
- res.send({ protein: term.name, cohorts });
73
+ res.send({ protein: term.name, cohorts, sampleRegions: brConfig ? sampleRegions : void 0 });
60
74
  } catch (e) {
61
75
  if (e?.stack) console.log(e.stack);
62
76
  res.send({ error: e.message || e });
@@ -324,13 +338,14 @@ function countDistinctSamples(db, filters) {
324
338
  function queryDbRows(db, matchColumn, matchValue, filters) {
325
339
  const { conditions, params } = buildFilterClause(filters);
326
340
  const allConditions = [`${matchColumn} = ? COLLATE NOCASE`, ...conditions];
327
- const sql = `SELECT organism, disease, identifier, protein_accession, isoform, modsite, gene, sample, value
341
+ const sql = `SELECT organism, disease, identifier, protein_accession, isoform, modsite, gene, sample, value, brain_region
328
342
  FROM proteome_abundance
329
343
  WHERE ${allConditions.join(" AND ")}`;
330
344
  return db.prepare(sql).all(matchValue, ...params);
331
345
  }
332
346
  async function getProteomeValuesFromCohort(ds, param, q) {
333
347
  const db = ds.queries.proteome.db;
348
+ const hasBrainRegions = !!q.brainRegions;
334
349
  const { assay, cohort, organism } = param.dataTypeDetails;
335
350
  const organismConfig = q.organisms?.[organism];
336
351
  if (!organismConfig) throw `queries.proteome invalid organism: ${organism}`;
@@ -403,10 +418,14 @@ async function getProteomeValuesFromCohort(ds, param, q) {
403
418
  isoform: row.isoform,
404
419
  // refSeq transcript ID mapped from protein_accession
405
420
  geneName: row.gene,
406
- s2v: {}
421
+ s2v: {},
422
+ // raw brain_region per sample id (only when brainRegions is configured);
423
+ // remapped + finalized into entry.sampleRegions in the route's init().
424
+ sampleRegionsRaw: hasBrainRegions ? {} : void 0
407
425
  });
408
426
  }
409
427
  entryMap.get(row.identifier).s2v[sid] = row.value;
428
+ if (hasBrainRegions) entryMap.get(row.identifier).sampleRegionsRaw[sid] = row.brain_region;
410
429
  }
411
430
  for (const entry of entryMap.values()) allEntries.push(entry);
412
431
  } else {
@@ -445,6 +464,8 @@ async function getProteomeValuesFromCohort(ds, param, q) {
445
464
  }
446
465
  export {
447
466
  countDistinctSamples,
467
+ getCohortStats,
448
468
  init,
469
+ queryDbRows,
449
470
  validate_query_proteome
450
471
  };
@@ -4,7 +4,7 @@ import { run_R } from "@sjcrh/proteinpaint-r";
4
4
  import { getData } from "../src/termdb.matrix.js";
5
5
  import { createCanvas } from "canvas";
6
6
  import { getOrderedLabels } from "../src/termdb.barchart.js";
7
- import { getDescrStats, getStdDev, getMean } from "./termdb.descrstats.ts";
7
+ import { getDescrStats, getStdDev, getMean } from "#routes/termdb.descrstats.ts";
8
8
  import { isNumericTerm } from "#shared/terms.js";
9
9
  import { boxplot_getvalue } from "../src/utils.js";
10
10
  import { roundValueAuto } from "#shared/roundValue.js";