@sjcrh/proteinpaint-server 2.131.0 → 2.132.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 +4 -4
- package/routes/gdc.grin2.list.js +30 -18
- package/routes/gdc.grin2.run.js +11 -2
- package/src/app.js +82 -31
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sjcrh/proteinpaint-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.132.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",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"@sjcrh/augen": "2.121.0",
|
|
64
64
|
"@sjcrh/proteinpaint-python": "2.118.0",
|
|
65
65
|
"@sjcrh/proteinpaint-r": "2.130.0",
|
|
66
|
-
"@sjcrh/proteinpaint-rust": "2.
|
|
67
|
-
"@sjcrh/proteinpaint-shared": "2.
|
|
68
|
-
"@sjcrh/proteinpaint-types": "2.
|
|
66
|
+
"@sjcrh/proteinpaint-rust": "2.132.0",
|
|
67
|
+
"@sjcrh/proteinpaint-shared": "2.132.0",
|
|
68
|
+
"@sjcrh/proteinpaint-types": "2.132.0",
|
|
69
69
|
"@types/express": "^5.0.0",
|
|
70
70
|
"@types/express-session": "^1.18.1",
|
|
71
71
|
"better-sqlite3": "^9.4.1",
|
package/routes/gdc.grin2.list.js
CHANGED
|
@@ -29,14 +29,24 @@ function init({ genomes }) {
|
|
|
29
29
|
const ds = g.datasets?.GDC;
|
|
30
30
|
if (!ds)
|
|
31
31
|
throw "hg38 GDC missing";
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
console.log("GRIN2 List Route Received:", JSON.stringify(req.query, null, 2));
|
|
33
|
+
const result = {};
|
|
34
|
+
if (req.query.mafOptions) {
|
|
35
|
+
result.mafFiles = {
|
|
36
|
+
files: [],
|
|
37
|
+
filesTotal: 0,
|
|
38
|
+
maxTotalSizeCompressed: 0,
|
|
39
|
+
fileCounts: { maf: 0 }
|
|
40
|
+
};
|
|
41
|
+
await listMafFiles(req.query, result, ds);
|
|
42
|
+
}
|
|
43
|
+
if (req.query.cnvOptions) {
|
|
44
|
+
result.cnvFiles = {
|
|
45
|
+
files: [],
|
|
46
|
+
maxTotalSizeCompressed
|
|
47
|
+
};
|
|
48
|
+
await listCnvFiles(req.query, result, ds);
|
|
49
|
+
}
|
|
40
50
|
res.send(result);
|
|
41
51
|
} catch (e) {
|
|
42
52
|
if (e.stack)
|
|
@@ -45,9 +55,12 @@ function init({ genomes }) {
|
|
|
45
55
|
}
|
|
46
56
|
};
|
|
47
57
|
}
|
|
48
|
-
async function
|
|
58
|
+
async function listMafFiles(q, result, ds) {
|
|
49
59
|
if (!q.mafOptions)
|
|
50
60
|
return;
|
|
61
|
+
if (!result.mafFiles) {
|
|
62
|
+
throw new Error("result.mafFiles must be initialized before calling listMafFiles");
|
|
63
|
+
}
|
|
51
64
|
const filters = {
|
|
52
65
|
op: "and",
|
|
53
66
|
content: [
|
|
@@ -158,12 +171,12 @@ If you want to include it, please increase the maxFileSizeAllowed in the code.`
|
|
|
158
171
|
);
|
|
159
172
|
}
|
|
160
173
|
deduplicatedFiles.sort((a, b) => b.file_size - a.file_size);
|
|
161
|
-
result.files.push(...deduplicatedFiles);
|
|
162
|
-
result.filesTotal = re.data.pagination.total;
|
|
163
|
-
if (result.fileCounts) {
|
|
164
|
-
result.fileCounts.maf = files.length;
|
|
174
|
+
result.mafFiles.files.push(...deduplicatedFiles);
|
|
175
|
+
result.mafFiles.filesTotal = re.data.pagination.total;
|
|
176
|
+
if (result.mafFiles.fileCounts) {
|
|
177
|
+
result.mafFiles.fileCounts.maf = files.length;
|
|
165
178
|
}
|
|
166
|
-
result.deduplicationStats = {
|
|
179
|
+
result.mafFiles.deduplicationStats = {
|
|
167
180
|
originalFileCount: files.length,
|
|
168
181
|
deduplicatedFileCount: deduplicatedFiles.length,
|
|
169
182
|
duplicatesRemoved,
|
|
@@ -171,8 +184,7 @@ If you want to include it, please increase the maxFileSizeAllowed in the code.`
|
|
|
171
184
|
filteredFiles
|
|
172
185
|
};
|
|
173
186
|
}
|
|
174
|
-
async function
|
|
175
|
-
result.cnvFiles = { files: [] };
|
|
187
|
+
async function listCnvFiles(q, result, ds) {
|
|
176
188
|
if (!q.cnvOptions) {
|
|
177
189
|
console.log("No cnvOptions provided, returning empty cnvFiles");
|
|
178
190
|
return;
|
|
@@ -240,11 +252,11 @@ async function mayListCnvFiles(q, result, ds) {
|
|
|
240
252
|
cnvFiles.push(file);
|
|
241
253
|
}
|
|
242
254
|
}
|
|
243
|
-
result.cnvFiles = { files: cnvFiles };
|
|
255
|
+
result.cnvFiles = { files: cnvFiles, maxTotalSizeCompressed };
|
|
244
256
|
console.log(`Successfully processed ${cnvFiles.length} CNV files`);
|
|
245
257
|
} catch (error) {
|
|
246
258
|
console.error("Error fetching CNV files:", error);
|
|
247
|
-
result.cnvFiles = { files: [] };
|
|
259
|
+
result.cnvFiles = { files: [], maxTotalSizeCompressed };
|
|
248
260
|
}
|
|
249
261
|
}
|
|
250
262
|
export {
|
package/routes/gdc.grin2.run.js
CHANGED
|
@@ -21,13 +21,18 @@ function parseJsonlOutput(rustOutput) {
|
|
|
21
21
|
const lines = rustOutput.trim().split("\n");
|
|
22
22
|
const allSuccessfulData = [];
|
|
23
23
|
let finalSummary = null;
|
|
24
|
+
let processedFiles = 0;
|
|
24
25
|
for (const line of lines) {
|
|
25
26
|
const trimmedLine = line.trim();
|
|
26
27
|
if (trimmedLine) {
|
|
27
28
|
try {
|
|
28
29
|
const data = JSON.parse(trimmedLine);
|
|
29
30
|
if (data.type === "data") {
|
|
31
|
+
processedFiles++;
|
|
30
32
|
allSuccessfulData.push(data.data);
|
|
33
|
+
console.log(
|
|
34
|
+
`[GRIN2] Processed file ${processedFiles}: ${data.case_id} (${data.data_type}) - ${data.data.length} records`
|
|
35
|
+
);
|
|
31
36
|
} else if (data.type === "summary") {
|
|
32
37
|
finalSummary = data;
|
|
33
38
|
console.log(`[GRIN2] Download complete: ${data.successful_files}/${data.total_files} files successful`);
|
|
@@ -55,7 +60,9 @@ function parseJsonlOutput(rustOutput) {
|
|
|
55
60
|
filtered_records: finalSummary.filtered_records || 0,
|
|
56
61
|
filtered_maf_records: finalSummary.filtered_maf_records || 0,
|
|
57
62
|
filtered_cnv_records: finalSummary.filtered_cnv_records || 0,
|
|
58
|
-
filtered_records_by_case: finalSummary.filtered_records_by_case || {}
|
|
63
|
+
filtered_records_by_case: finalSummary.filtered_records_by_case || {},
|
|
64
|
+
included_maf_records: finalSummary.included_maf_records || 0,
|
|
65
|
+
included_cnv_records: finalSummary.included_cnv_records || 0
|
|
59
66
|
}
|
|
60
67
|
};
|
|
61
68
|
}
|
|
@@ -74,8 +81,10 @@ function init({ genomes }) {
|
|
|
74
81
|
console.log(`[GRIN2] Parsed request: ${JSON.stringify(parsedRequest)}`);
|
|
75
82
|
const rustInput = JSON.stringify({
|
|
76
83
|
caseFiles: parsedRequest.caseFiles,
|
|
77
|
-
mafOptions: parsedRequest.mafOptions
|
|
84
|
+
mafOptions: parsedRequest.mafOptions,
|
|
85
|
+
cnvOptions: parsedRequest.cnvOptions
|
|
78
86
|
});
|
|
87
|
+
console.log(`[GRIN2] Rust input: ${rustInput}`);
|
|
79
88
|
console.log("[GRIN2] Executing Rust function with streaming...");
|
|
80
89
|
let rustOutput = "";
|
|
81
90
|
let buffer = "";
|