@sjcrh/proteinpaint-server 2.126.2 → 2.127.1-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjcrh/proteinpaint-server",
3
- "version": "2.126.2",
3
+ "version": "2.127.1-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",
@@ -1,19 +1,20 @@
1
- import { gdcMafPayload } from "#types/checkers";
1
+ import { gdcGRIN2listPayload } from "#types/checkers";
2
2
  import ky from "ky";
3
3
  import { joinUrl } from "#shared/joinUrl.js";
4
4
  import serverconfig from "#src/serverconfig.js";
5
5
  const maxFileNumber = 1e3;
6
6
  const allowedWorkflowType = "Aliquot Ensemble Somatic Variant Merging and Masking";
7
+ const maxFileSizeAllowed = 1e6;
7
8
  const maxTotalSizeCompressed = serverconfig.features.gdcMafMaxFileSize || 4e8;
8
9
  const api = {
9
10
  endpoint: "gdc/GRIN2list",
10
11
  methods: {
11
12
  get: {
12
- ...gdcMafPayload,
13
+ ...gdcGRIN2listPayload,
13
14
  init
14
15
  },
15
16
  post: {
16
- ...gdcMafPayload,
17
+ ...gdcGRIN2listPayload,
17
18
  init
18
19
  }
19
20
  }
@@ -84,6 +85,8 @@ async function listMafFiles(q, ds) {
84
85
  const c = h.cases?.[0];
85
86
  if (!c)
86
87
  throw "h.cases[0] missing";
88
+ if (h.file_size >= maxFileSizeAllowed)
89
+ continue;
87
90
  const file = {
88
91
  id: h.id,
89
92
  project_id: c.project.project_id,
@@ -31,53 +31,43 @@ function init({ genomes }) {
31
31
  if (!caseFiles) {
32
32
  throw "Missing or invalid cases data";
33
33
  }
34
+ console.log("[GRIN2] Calling Rust for file processing...");
35
+ const rustInput = JSON.stringify(caseFiles);
36
+ console.log("[GRIN2] Executing Rust function...");
37
+ const rustResult = await run_rust("gdcGRIN2", rustInput);
38
+ console.log("[GRIN2] Rust execution completed");
39
+ if (!rustResult) {
40
+ throw new Error("Failed to process MAF files: No result from Rust");
41
+ }
42
+ let parsedRustResult;
43
+ try {
44
+ parsedRustResult = typeof rustResult === "string" ? JSON.parse(rustResult) : rustResult;
45
+ console.log(`[GRIN2] Parsed Rust result: ${JSON.stringify(parsedRustResult).substring(0, 200)}...`);
46
+ } catch (parseError) {
47
+ console.error("[GRIN2] Error parsing Rust result:", parseError);
48
+ }
49
+ const genedbfile = path.join(serverconfig.tpmasterdir, g.genedb.dbfile);
50
+ const imagefile = path.join(serverconfig.cachedir, `grin2_${Date.now()}_${Math.floor(Math.random() * 1e9)}.png`);
51
+ const rInput = JSON.stringify({
52
+ genedb: genedbfile,
53
+ chromosomelist: g.majorchr,
54
+ imagefile,
55
+ lesion: rustResult
56
+ // The mutation string from Rust
57
+ });
58
+ console.log(`R input: ${rInput}`);
59
+ console.log("[GRIN2] Executing R script...");
60
+ const rResult = await run_R("gdcGRIN2.R", rInput, []);
61
+ console.log(`[GRIN2] R execution completed, result: ${rResult}`);
62
+ let resultData;
34
63
  try {
35
- console.log("[GRIN2] Calling Rust for file processing...");
36
- const rustInput = JSON.stringify(caseFiles);
37
- console.log("[GRIN2] Executing Rust function...");
38
- const rustResult = await run_rust("gdcGRIN2", rustInput);
39
- console.log("[GRIN2] Rust execution completed");
40
- console.log(`[GRIN2] Rust result type: ${typeof rustResult}`);
41
- if (!rustResult) {
42
- throw new Error("Failed to process MAF files: No result from Rust");
43
- }
44
- let parsedRustResult;
45
- try {
46
- parsedRustResult = typeof rustResult === "string" ? JSON.parse(rustResult) : rustResult;
47
- console.log(`[GRIN2] Parsed Rust result: ${JSON.stringify(parsedRustResult).substring(0, 200)}...`);
48
- } catch (parseError) {
49
- console.error("[GRIN2] Error parsing Rust result:", parseError);
50
- }
51
- const genedbfile = path.join(serverconfig.tpmasterdir, g.genedb.dbfile);
52
- const imagefile = path.join(serverconfig.cachedir, `grin2_${Date.now()}_${Math.floor(Math.random() * 1e9)}.png`);
53
- const rInput = JSON.stringify({
54
- genedb: genedbfile,
55
- chromosomelist: g.majorchr,
56
- imagefile,
57
- lesion: rustResult
58
- // The mutation string from Rust
59
- });
60
- console.log(`R input: ${rInput}`);
61
- const parsedInput = JSON.parse(rInput);
62
- console.log("Parsed lesion data type:", typeof parsedInput.lesion);
63
- console.log(
64
- "Parsed lesion data length:",
65
- typeof parsedInput.lesion === "string" ? parsedInput.lesion.length : "not a string"
66
- );
67
- console.log("[GRIN2] Executing R script...");
68
- const rResult = await run_R("gdcGRIN2.R", rInput, []);
69
- console.log(`[GRIN2] R execution completed, result: ${rResult}`);
70
- let resultData;
71
- try {
72
- resultData = JSON.parse(rResult);
73
- console.log("[GRIN2] Finished R analysis");
74
- const pngImg = resultData.png[0];
75
- return res.json({ pngImg });
76
- } catch (parseError) {
77
- console.error("[GRIN2] Error parsing R result:", parseError);
78
- console.log("[GRIN2] Raw R result:", rResult);
79
- }
80
- } finally {
64
+ resultData = JSON.parse(rResult);
65
+ console.log("[GRIN2] Finished R analysis");
66
+ const pngImg = resultData.png[0];
67
+ return res.json({ pngImg });
68
+ } catch (parseError) {
69
+ console.error("[GRIN2] Error parsing R result:", parseError);
70
+ console.log("[GRIN2] Raw R result:", rResult);
81
71
  }
82
72
  } catch (e) {
83
73
  console.error("[GRIN2] Error running analysis:", e);