@sjcrh/proteinpaint-server 2.81.2-2 → 2.81.2
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 +1 -1
- package/routes/termdb.topVariablyExpressedGenes.js +21 -10
- package/src/app.js +433 -398
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import path from "path";
|
|
2
1
|
import { run_rust } from "@sjcrh/proteinpaint-rust";
|
|
3
2
|
import serverconfig from "#src/serverconfig.js";
|
|
4
3
|
import { get_samples } from "#src/termdb.sql.js";
|
|
5
4
|
import { makeFilter } from "#src/mds3.gdc.js";
|
|
6
5
|
import { cachedFetch } from "#src/utils.js";
|
|
6
|
+
import { resolve } from "url";
|
|
7
7
|
const api = {
|
|
8
8
|
endpoint: "termdb/topVariablyExpressedGenes",
|
|
9
9
|
methods: {
|
|
@@ -178,21 +178,32 @@ function gdcValidateQuery(ds, genome) {
|
|
|
178
178
|
);
|
|
179
179
|
return serverconfig.features.gdcGenes;
|
|
180
180
|
}
|
|
181
|
-
if (!ds.__gdc
|
|
181
|
+
if (!ds.__gdc?.doneCaching) {
|
|
182
182
|
throw "The server has not finished caching the case IDs: try again in about 2 minutes.";
|
|
183
183
|
}
|
|
184
184
|
const { host, headers } = ds.getHostHeaders(q);
|
|
185
|
-
const url =
|
|
185
|
+
const url = resolve(host.geneExp, "/gene_expression/gene_selection");
|
|
186
186
|
try {
|
|
187
|
-
const response = await cachedFetch(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
187
|
+
const response = await cachedFetch(
|
|
188
|
+
url,
|
|
189
|
+
{
|
|
190
|
+
method: "POST",
|
|
191
|
+
headers,
|
|
192
|
+
body: getGeneSelectionArg(q)
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
// noCache: true, // !!! for testing only !!!
|
|
196
|
+
getErrMessage: (response2) => {
|
|
197
|
+
const body = response2?.body || response2;
|
|
198
|
+
return Array.isArray(body?.gene_selection) ? "" : body?.message || body?.error || JSON.stringify(body);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
);
|
|
192
202
|
const re = response.body;
|
|
193
203
|
const genes = [];
|
|
194
|
-
if (!Array.isArray(re.gene_selection))
|
|
195
|
-
throw "re.gene_selection[] is not array";
|
|
204
|
+
if (!Array.isArray(re.gene_selection)) {
|
|
205
|
+
throw "re.gene_selection[] is not array: " + JSON.stringify(re);
|
|
206
|
+
}
|
|
196
207
|
for (const i of re.gene_selection) {
|
|
197
208
|
if (i.gene_id && typeof i.gene_id == "string") {
|
|
198
209
|
const t = genome.genedb.getNameByAlias.get(i.gene_id);
|