@sjcrh/proteinpaint-server 2.137.1 → 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/dataset/termdb.test.js +31 -2
- package/package.json +5 -5
- package/routes/filterTermValues.js +7 -6
- package/routes/profileFormScores.js +4 -2
- package/routes/profileScores.js +3 -4
- package/routes/termdb.singlecellSamples.js +19 -20
- package/src/app.js +57 -48
package/dataset/termdb.test.js
CHANGED
|
@@ -264,14 +264,43 @@ function termdb_test_default() {
|
|
|
264
264
|
},
|
|
265
265
|
geneExpression: {
|
|
266
266
|
src: "native",
|
|
267
|
-
file: "files/hg38/TermdbTest/TermdbTest.fpkm.matrix.h5"
|
|
267
|
+
file: "files/hg38/TermdbTest/rnaseq/TermdbTest.fpkm.matrix.h5"
|
|
268
268
|
},
|
|
269
269
|
topVariablyExpressedGenes: {
|
|
270
270
|
src: "native"
|
|
271
271
|
},
|
|
272
272
|
rnaseqGeneCount: {
|
|
273
273
|
storage_type: "HDF5",
|
|
274
|
-
file: "files/hg38/TermdbTest/TermdbTest.geneCounts.h5"
|
|
274
|
+
file: "files/hg38/TermdbTest/rnaseq/TermdbTest.geneCounts.h5"
|
|
275
|
+
},
|
|
276
|
+
singleCell: {
|
|
277
|
+
samples: {
|
|
278
|
+
sampleColumns: [{ termid: "sex" }],
|
|
279
|
+
extraSampleTabLabel: "sex"
|
|
280
|
+
},
|
|
281
|
+
data: {
|
|
282
|
+
sameLegend: true,
|
|
283
|
+
src: "native",
|
|
284
|
+
plots: [
|
|
285
|
+
{
|
|
286
|
+
name: "scRNA",
|
|
287
|
+
folder: "files/hg38/TermdbTest/scrna/umap",
|
|
288
|
+
fileSuffix: "_umap.txt",
|
|
289
|
+
colorColumns: [
|
|
290
|
+
{
|
|
291
|
+
index: 3,
|
|
292
|
+
name: "CellType"
|
|
293
|
+
}
|
|
294
|
+
],
|
|
295
|
+
coordsColumns: { x: 1, y: 2 },
|
|
296
|
+
selected: true
|
|
297
|
+
}
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
geneExpression: {
|
|
301
|
+
src: "native",
|
|
302
|
+
folder: "files/hg38/TermdbTest/scrna/geneExpHdf5"
|
|
303
|
+
}
|
|
275
304
|
},
|
|
276
305
|
WSImages: {
|
|
277
306
|
type: "H&E",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sjcrh/proteinpaint-server",
|
|
3
|
-
"version": "2.137.1",
|
|
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",
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@sjcrh/augen": "2.136.0",
|
|
63
63
|
"@sjcrh/proteinpaint-python": "2.135.2-0",
|
|
64
|
-
"@sjcrh/proteinpaint-r": "2.
|
|
65
|
-
"@sjcrh/proteinpaint-rust": "2.
|
|
66
|
-
"@sjcrh/proteinpaint-shared": "2.137.1",
|
|
67
|
-
"@sjcrh/proteinpaint-types": "2.137.1",
|
|
64
|
+
"@sjcrh/proteinpaint-r": "2.137.2-0",
|
|
65
|
+
"@sjcrh/proteinpaint-rust": "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",
|
|
@@ -37,14 +37,15 @@ function getList(samplesPerFilter, filtersData, tw) {
|
|
|
37
37
|
}
|
|
38
38
|
const annotations = data.filter((s) => s != void 0).map((sample) => sample[tw.$id]?.value);
|
|
39
39
|
const sampleValues = Array.from(new Set(annotations));
|
|
40
|
+
const filteredValues = [];
|
|
40
41
|
for (const value of values) {
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
value.
|
|
42
|
+
const label = value.label.replace(/["']/g, "");
|
|
43
|
+
const disabled = !sampleValues.includes(value.key || value.label);
|
|
44
|
+
filteredValues.push({ value: value.key || value.label, label, disabled });
|
|
44
45
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return
|
|
46
|
+
filteredValues.unshift({ label: "", value: "" });
|
|
47
|
+
filteredValues.sort((a, b) => a.label.localeCompare(b.label));
|
|
48
|
+
return filteredValues;
|
|
48
49
|
}
|
|
49
50
|
async function getFilters(query, ds, genome, res) {
|
|
50
51
|
try {
|
|
@@ -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
|
|
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) {
|
package/routes/profileScores.js
CHANGED
|
@@ -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
|
|
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) {
|
|
@@ -55,7 +55,7 @@ async function validate_query_singleCell(ds, genome) {
|
|
|
55
55
|
throw "singleCell.samples{} not object";
|
|
56
56
|
if (typeof q.samples.get == "function") {
|
|
57
57
|
} else {
|
|
58
|
-
validateSamplesNative(q.samples, q.data, ds);
|
|
58
|
+
await validateSamplesNative(q.samples, q.data, ds);
|
|
59
59
|
}
|
|
60
60
|
if (typeof q.data != "object")
|
|
61
61
|
throw "singleCell.data{} not object";
|
|
@@ -99,32 +99,31 @@ function validateImages(images) {
|
|
|
99
99
|
async function validateSamplesNative(S, D, ds) {
|
|
100
100
|
const samples = /* @__PURE__ */ new Map();
|
|
101
101
|
for (const plot of D.plots) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (plot.fileSuffix)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
sampleName = fn.split(plot.fileSuffix)[0];
|
|
109
|
-
}
|
|
110
|
-
if (!sampleName)
|
|
111
|
-
continue;
|
|
112
|
-
const sid = ds.cohort.termdb.q.sampleName2id(sampleName);
|
|
113
|
-
if (sid == void 0)
|
|
114
|
-
continue;
|
|
115
|
-
samples.set(sid, { sample: sampleName });
|
|
102
|
+
for (const fn of await fs.promises.readdir(path.join(serverconfig.tpmasterdir, plot.folder))) {
|
|
103
|
+
let sampleName = fn;
|
|
104
|
+
if (plot.fileSuffix) {
|
|
105
|
+
if (!fn.endsWith(plot.fileSuffix))
|
|
106
|
+
throw `singlecell.sample file name ${fn} does not end with required suffix ${plot.fileSuffix}`;
|
|
107
|
+
sampleName = fn.split(plot.fileSuffix)[0];
|
|
116
108
|
}
|
|
117
|
-
|
|
118
|
-
|
|
109
|
+
if (!sampleName)
|
|
110
|
+
throw `singlecell.sample: cannot derive sample name from file name ${fn}`;
|
|
111
|
+
const sid = ds.cohort.termdb.q.sampleName2id(sampleName);
|
|
112
|
+
if (sid == void 0)
|
|
113
|
+
throw `singlecell.sample: unknown sample name ${sampleName}`;
|
|
114
|
+
samples.set(sid, { sample: sampleName });
|
|
119
115
|
}
|
|
120
116
|
}
|
|
121
117
|
if (S.sampleColumns) {
|
|
122
|
-
for (const
|
|
123
|
-
const
|
|
118
|
+
for (const { termid } of S.sampleColumns) {
|
|
119
|
+
const term = ds.cohort.termdb.q.termjsonByOneid(termid);
|
|
120
|
+
if (!term)
|
|
121
|
+
throw "unknown termid from singlecell.samples.sampleColumns[]";
|
|
122
|
+
const s2v = ds.cohort.termdb.q.getAllValues4term(termid);
|
|
124
123
|
for (const [sid, v] of s2v.entries()) {
|
|
125
124
|
if (!samples.has(sid))
|
|
126
125
|
continue;
|
|
127
|
-
samples.get(sid)[
|
|
126
|
+
samples.get(sid)[termid] = term.values?.[v]?.label || v;
|
|
128
127
|
}
|
|
129
128
|
}
|
|
130
129
|
}
|