@sjcrh/proteinpaint-server 2.129.6 → 2.130.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.129.6",
3
+ "version": "2.130.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",
@@ -62,10 +62,10 @@
62
62
  "dependencies": {
63
63
  "@sjcrh/augen": "2.121.0",
64
64
  "@sjcrh/proteinpaint-python": "2.118.0",
65
- "@sjcrh/proteinpaint-r": "2.129.6",
66
- "@sjcrh/proteinpaint-rust": "2.129.6",
65
+ "@sjcrh/proteinpaint-r": "2.130.0",
66
+ "@sjcrh/proteinpaint-rust": "2.130.0",
67
67
  "@sjcrh/proteinpaint-shared": "2.129.6",
68
- "@sjcrh/proteinpaint-types": "2.129.6",
68
+ "@sjcrh/proteinpaint-types": "2.130.0",
69
69
  "@types/express": "^5.0.0",
70
70
  "@types/express-session": "^1.18.1",
71
71
  "better-sqlite3": "^9.4.1",
@@ -177,35 +177,37 @@ async function mayListCnvFiles(q, result, ds) {
177
177
  console.log("No cnvOptions provided, returning empty cnvFiles");
178
178
  return;
179
179
  }
180
- const fields = [
181
- "cases.samples.tissue_type",
182
- "cases.project.project_id",
183
- "cases.submitter_id",
184
- "cases.case_id",
185
- "data_type",
186
- "file_id",
187
- "file_size",
188
- "data_format",
189
- "experimental_strategy",
190
- "analysis.workflow_type"
191
- ];
180
+ const case_filters = { op: "and", content: [] };
181
+ if (q.filter0) {
182
+ case_filters.content.push(q.filter0);
183
+ }
184
+ const body = {
185
+ size: cnvMaxFileNumber,
186
+ fields: [
187
+ "cases.samples.tissue_type",
188
+ "cases.project.project_id",
189
+ "cases.submitter_id",
190
+ "cases.case_id",
191
+ "data_type",
192
+ "file_id",
193
+ "file_size",
194
+ "data_format",
195
+ "experimental_strategy",
196
+ "analysis.workflow_type"
197
+ ].join(","),
198
+ filters: {
199
+ op: "in",
200
+ content: {
201
+ field: "data_type",
202
+ value: ["Copy Number Segment", "Masked Copy Number Segment", "Allele-specific Copy Number Segment"]
203
+ }
204
+ }
205
+ };
206
+ if (case_filters.content.length)
207
+ body.case_filters = case_filters;
192
208
  const { host, headers } = ds.getHostHeaders(q);
193
209
  try {
194
- const re = await ky.post(joinUrl(host.rest, "files"), {
195
- timeout: false,
196
- headers,
197
- json: {
198
- size: cnvMaxFileNumber,
199
- fields: fields.join(","),
200
- filters: {
201
- op: "in",
202
- content: {
203
- field: "data_type",
204
- value: ["Masked Copy Number Segment", "Allele-specific Copy Number Segment"]
205
- }
206
- }
207
- }
208
- }).json();
210
+ const re = await ky.post(joinUrl(host.rest, "files"), { timeout: false, headers, json: body }).json();
209
211
  console.log("API Response:", {
210
212
  hits: re.data?.hits?.length || 0,
211
213
  firstHit: re.data?.hits?.[0]
@@ -215,37 +217,27 @@ async function mayListCnvFiles(q, result, ds) {
215
217
  }
216
218
  const cnvFiles = [];
217
219
  for (const h of re.data.hits) {
218
- console.log("Processing file:", {
219
- file_id: h.file_id,
220
- data_format: h.data_format,
221
- data_type: h.data_type,
222
- cases_length: h.cases?.length
223
- });
224
- if (h.data_format === "TXT") {
225
- if (h.data_type === "Masked Copy Number Segment" || h.data_type === "Allele-specific Copy Number Segment") {
226
- const c = h.cases?.[0];
227
- if (!c) {
228
- console.warn(`Skipping file ${h.file_id} - missing case data`);
229
- continue;
230
- }
231
- console.log("Case structure:", {
232
- case_id: c.case_id,
233
- submitter_id: c.submitter_id,
234
- project: c.project,
235
- samples: c.samples?.length
236
- });
237
- const file = {
238
- id: h.file_id || h.id,
239
- // Handle both field names
240
- project_id: c.project?.project_id || "unknown",
241
- // Safe access with fallback
242
- file_size: h.file_size,
243
- case_submitter_id: c.submitter_id,
244
- case_uuid: c.case_id,
245
- sample_types: c.samples?.map((s) => s.tissue_type).filter(Boolean) || []
246
- };
247
- cnvFiles.push(file);
248
- }
220
+ if (h.data_format != "TXT") {
221
+ continue;
222
+ }
223
+ if (!h.analysis?.workflow_type)
224
+ throw "h.analysis.workflow_type missing";
225
+ const c = h.cases?.[0];
226
+ if (!c)
227
+ throw "h.cases[0] missing";
228
+ if (h.data_type == "Allele-specific Copy Number Segment") {
229
+ } else if (h.data_type == "Masked Copy Number Segment" || h.data_type == "Copy Number Segment" && h.analysis.workflow_type != "DNACopy") {
230
+ const file = {
231
+ id: h.file_id || h.id,
232
+ // Handle both field names
233
+ project_id: c.project?.project_id || "unknown",
234
+ // Safe access with fallback
235
+ file_size: h.file_size,
236
+ case_submitter_id: c.submitter_id,
237
+ case_uuid: c.case_id,
238
+ sample_types: c.samples?.map((s) => s.tissue_type).filter(Boolean) || []
239
+ };
240
+ cnvFiles.push(file);
249
241
  }
250
242
  }
251
243
  result.cnvFiles = { files: cnvFiles };
@@ -50,7 +50,12 @@ function parseJsonlOutput(rustOutput) {
50
50
  summary: {
51
51
  total_files: finalSummary.total_files,
52
52
  successful_files: finalSummary.successful_files,
53
- failed_files: finalSummary.failed_files
53
+ failed_files: finalSummary.failed_files,
54
+ errors: finalSummary.errors || [],
55
+ filtered_records: finalSummary.filtered_records || 0,
56
+ filtered_maf_records: finalSummary.filtered_maf_records || 0,
57
+ filtered_cnv_records: finalSummary.filtered_cnv_records || 0,
58
+ filtered_records_by_case: finalSummary.filtered_records_by_case || {}
54
59
  }
55
60
  };
56
61
  }
@@ -149,8 +154,15 @@ function init({ genomes }) {
149
154
  console.log("[GRIN2] Finished R analysis");
150
155
  const pngImg = resultData.png[0];
151
156
  const topGeneTable = resultData.topGeneTable || null;
157
+ const analysisStats = parsedRustResult.summary || {};
152
158
  console.log("[GRIN2] Total GRIN2 processing time:", formatElapsedTime(Date.now() - downloadStartTime));
153
- return res.json({ pngImg, topGeneTable, rustResult: parsedRustResult, status: "success" });
159
+ return res.json({
160
+ pngImg,
161
+ topGeneTable,
162
+ rustResult: parsedRustResult,
163
+ analysisStats,
164
+ status: "success"
165
+ });
154
166
  } catch (parseError) {
155
167
  console.error("[GRIN2] Error parsing R result:", parseError);
156
168
  }