@sjcrh/proteinpaint-server 2.137.2-0 → 2.137.2-1

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.137.2-0",
3
+ "version": "2.137.2-1",
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",
@@ -63,8 +63,8 @@
63
63
  "@sjcrh/proteinpaint-python": "2.135.2-0",
64
64
  "@sjcrh/proteinpaint-r": "2.137.2-0",
65
65
  "@sjcrh/proteinpaint-rust": "2.137.2-0",
66
- "@sjcrh/proteinpaint-shared": "2.137.1",
67
- "@sjcrh/proteinpaint-types": "2.137.2-0",
66
+ "@sjcrh/proteinpaint-shared": "2.137.2-1",
67
+ "@sjcrh/proteinpaint-types": "2.137.2-1",
68
68
  "@types/express": "^5.0.0",
69
69
  "@types/express-session": "^1.18.1",
70
70
  "better-sqlite3": "^9.4.1",
@@ -29,7 +29,7 @@ function init({ genomes }) {
29
29
  };
30
30
  }
31
31
  async function getScoresDict(query, ds, genome) {
32
- const terms = [...query.scoreTerms];
32
+ const terms = [...query.scoreTerms, query.facilityTW];
33
33
  if (query.scScoreTerms)
34
34
  terms.push(...query.scScoreTerms);
35
35
  const data = await getData(
@@ -70,7 +70,9 @@ async function getScoresDict(query, ds, genome) {
70
70
  const percents = getSCPercentsDict(d, samples2);
71
71
  term2Score[d.term.id] = percents;
72
72
  }
73
- const hospital = sampleData?.[query.facilityTW.$id]?.value;
73
+ const facilityValue = sampleData?.[query.facilityTW.$id];
74
+ const termValue = query.facilityTW.term.values[facilityValue?.value];
75
+ const hospital = termValue?.label || termValue?.key;
74
76
  return { term2Score, sites, hospital, n: sampleData ? 1 : samples.length };
75
77
  }
76
78
  function getDict(key, sample) {
@@ -49,9 +49,6 @@ async function getScores(query, ds, genome) {
49
49
  let sites = lst.map((s) => {
50
50
  return { label: data.refs.bySampleId[s.sample].label, value: s.sample };
51
51
  });
52
- sites = lst.map((s) => {
53
- return { label: data.refs.bySampleId[s.sample].label, value: s.sample };
54
- });
55
52
  if (query.userSites) {
56
53
  sites = sites.filter((s) => query.userSites.includes(s.label));
57
54
  }
@@ -70,7 +67,9 @@ async function getScores(query, ds, genome) {
70
67
  for (const d of query.scoreTerms) {
71
68
  term2Score[d.score.term.id] = getPercentage(d, samples, sampleData);
72
69
  }
73
- const hospital = sampleData?.[query.facilityTW.$id]?.value;
70
+ const facilityValue = sampleData?.[query.facilityTW.$id];
71
+ const termValue = query.facilityTW.term.values[facilityValue?.value];
72
+ const hospital = termValue?.label || termValue?.key;
74
73
  return { term2Score, sites, hospital, n: sampleData ? 1 : samples.length };
75
74
  }
76
75
  function getPercentage(d, samples, sampleData) {