@sjcrh/proteinpaint-server 2.49.0 → 2.50.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.49.0",
3
+ "version": "2.50.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",
package/routes/gdc.maf.js CHANGED
@@ -67,7 +67,6 @@ async function listMafFiles(q, ds) {
67
67
  const { host, headers } = ds.getHostHeaders(q);
68
68
  const data = {
69
69
  filters,
70
- case_filters,
71
70
  size: maxFileNumber,
72
71
  fields: [
73
72
  "id",
@@ -80,6 +79,8 @@ async function listMafFiles(q, ds) {
80
79
  // may add diagnosis and primary site
81
80
  ].join(",")
82
81
  };
82
+ if (case_filters.content.length)
83
+ data.case_filters = case_filters;
83
84
  const response = await got.post(path.join(host.rest, "files"), { headers, body: JSON.stringify(data) });
84
85
  let re;
85
86
  try {
@@ -1,6 +1,5 @@
1
1
  import { mclasscnvgain, mclasscnvloss, dtsnvindel } from "#shared/common.js";
2
2
  import got from "got";
3
- import serverconfig from "#src/serverconfig.js";
4
3
  const api = {
5
4
  endpoint: "gdc/topMutatedGenes",
6
5
  methods: {
@@ -33,195 +32,6 @@ function init({ genomes }) {
33
32
  }
34
33
  };
35
34
  }
36
- const queryV1 = {
37
- query: `
38
- query GenesTable_relayQuery(
39
- $genesTable_filters: FiltersArgument
40
- $genesTable_size: Int
41
- $genesTable_offset: Int
42
- $score: String
43
- $ssmCase: FiltersArgument
44
- $geneCaseFilter: FiltersArgument
45
- $ssmTested: FiltersArgument
46
- $cnvTested: FiltersArgument
47
- $cnvGainFilters: FiltersArgument
48
- $cnvLossFilters: FiltersArgument
49
- ) {
50
- genesTableViewer: viewer {
51
- explore {
52
- cases {
53
- hits(first: 0, filters: $ssmTested) {
54
- total
55
- }
56
- }
57
- filteredCases: cases {
58
- hits(first: 0, filters: $geneCaseFilter) {
59
- total
60
- }
61
- }
62
- cnvCases: cases {
63
- hits(first: 0, filters: $cnvTested) {
64
- total
65
- }
66
- }
67
- genes {
68
- hits(first: $genesTable_size, offset: $genesTable_offset, filters: $genesTable_filters, score: $score) {
69
- total
70
- edges {
71
- node {
72
- id
73
- numCases: score
74
- symbol
75
- name
76
- cytoband
77
- biotype
78
- gene_id
79
- is_cancer_gene_census
80
- ssm_case: case {
81
- hits(first: 0, filters: $ssmCase) {
82
- total
83
- }
84
- }
85
- cnv_case: case {
86
- hits(first: 0, filters: $cnvTested) {
87
- total
88
- }
89
- }
90
- case_cnv_gain: case {
91
- hits(first: 0, filters: $cnvGainFilters) {
92
- total
93
- }
94
- }
95
- case_cnv_loss: case {
96
- hits(first: 0, filters: $cnvLossFilters) {
97
- total
98
- }
99
- }
100
- }
101
- }
102
- }
103
- }
104
- }
105
- }
106
- }
107
- `,
108
- getVariables: (q) => {
109
- const variables = {
110
- genesTable_filters: { op: "and", content: [] },
111
- genesTable_size: q.maxGenes || 50,
112
- genesTable_offset: 0,
113
- score: "case.project.project_id",
114
- ssmCase: {
115
- op: "and",
116
- content: [
117
- {
118
- op: "in",
119
- content: {
120
- field: "cases.available_variation_data",
121
- value: ["ssm"]
122
- }
123
- },
124
- {
125
- op: "NOT",
126
- content: {
127
- field: "genes.case.ssm.observation.observation_id",
128
- value: "MISSING"
129
- }
130
- }
131
- ]
132
- },
133
- geneCaseFilter: {
134
- content: [
135
- {
136
- content: {
137
- field: "cases.available_variation_data",
138
- value: ["ssm"]
139
- },
140
- op: "in"
141
- }
142
- ],
143
- op: "and"
144
- },
145
- ssmTested: {
146
- content: [
147
- {
148
- content: {
149
- field: "cases.available_variation_data",
150
- value: ["ssm"]
151
- },
152
- op: "in"
153
- }
154
- ],
155
- op: "and"
156
- },
157
- cnvTested: {
158
- op: "and",
159
- content: [
160
- {
161
- content: {
162
- field: "cases.available_variation_data",
163
- value: ["cnv"]
164
- },
165
- op: "in"
166
- }
167
- ]
168
- },
169
- cnvGainFilters: {
170
- op: "and",
171
- content: [
172
- {
173
- content: {
174
- field: "cases.available_variation_data",
175
- value: ["cnv"]
176
- },
177
- op: "in"
178
- },
179
- {
180
- content: {
181
- field: "cnvs.cnv_change",
182
- value: ["Gain"]
183
- },
184
- op: "in"
185
- }
186
- ]
187
- },
188
- cnvLossFilters: {
189
- op: "and",
190
- content: [
191
- {
192
- content: {
193
- field: "cases.available_variation_data",
194
- value: ["cnv"]
195
- },
196
- op: "in"
197
- },
198
- {
199
- content: {
200
- field: "cnvs.cnv_change",
201
- value: ["Loss"]
202
- },
203
- op: "in"
204
- }
205
- ]
206
- }
207
- };
208
- if (q.filter0) {
209
- variables.genesTable_filters.content.push(JSON.parse(JSON.stringify(q.filter0)));
210
- variables.geneCaseFilter.content.push(JSON.parse(JSON.stringify(q.filter0)));
211
- variables.cnvTested.content.push(JSON.parse(JSON.stringify(q.filter0)));
212
- variables.cnvGainFilters.content.push(JSON.parse(JSON.stringify(q.filter0)));
213
- variables.cnvLossFilters.content.push(JSON.parse(JSON.stringify(q.filter0)));
214
- }
215
- if (q.geneFilter == "CGC") {
216
- variables.genesTable_filters.content.push(geneCGC());
217
- variables.geneCaseFilter.content.push(geneCGC());
218
- variables.cnvTested.content.push(geneCGC());
219
- variables.cnvGainFilters.content.push(geneCGC());
220
- variables.cnvLossFilters.content.push(geneCGC());
221
- }
222
- return variables;
223
- }
224
- };
225
35
  const queryV2 = {
226
36
  query: `
227
37
  query GenesTable(
@@ -419,15 +229,9 @@ const queryV2 = {
419
229
  }
420
230
  };
421
231
  async function getGenesGraphql(q, ds) {
422
- let query, variables;
423
232
  const { host, headers } = ds.getHostHeaders(q);
424
- if (serverconfig.features?.geneExpHost) {
425
- query = queryV1.query;
426
- variables = queryV1.getVariables(q);
427
- } else {
428
- query = queryV2.query;
429
- variables = queryV2.getVariables(q);
430
- }
233
+ const query = queryV2.query;
234
+ const variables = queryV2.getVariables(q);
431
235
  const response = await got.post(host.graphql, {
432
236
  headers,
433
237
  body: JSON.stringify({ query, variables })
@@ -103,6 +103,8 @@ function addScatterplots(c, ds) {
103
103
  colorTW: p.colorTW,
104
104
  shapeTW: p.shapeTW,
105
105
  colorColumn: p.colorColumn,
106
+ sampleType: p.sampleType,
107
+ coordsColumns: p.coordsColumns,
106
108
  settings: p.settings
107
109
  };
108
110
  });
@@ -66,32 +66,19 @@ async function validate_query_singleCell(ds, genome) {
66
66
  }
67
67
  }
68
68
  async function getSamplesNative(S, ds) {
69
- const isSamples = ds.cohort.termdb.q.getAllValues4term(S.isSampleTerm);
70
- if (isSamples.size == 0)
71
- throw "no samples found that are identified by isSampleTerm";
72
- const samples = [];
73
- for (const sampleid of isSamples.keys()) {
74
- if (isSamples.get(sampleid) == "1")
75
- samples.push({
76
- sample: ds.cohort.termdb.q.id2sampleName(sampleid),
77
- // string name for display
78
- sampleid
79
- // temporarily kept to assign term value to each sample
80
- });
81
- }
69
+ const samples = {};
82
70
  if (S.sampleColumns) {
83
71
  for (const term of S.sampleColumns) {
84
72
  const s2v = ds.cohort.termdb.q.getAllValues4term(term.termid);
85
- for (const s of samples) {
86
- if (s2v.has(s.sampleid))
87
- s[term.termid] = s2v.get(s.sampleid);
73
+ for (const [s, v] of s2v.entries()) {
74
+ if (!samples[s])
75
+ samples[s] = { sample: ds.cohort.termdb.q.id2sampleName(s) };
76
+ samples[s][term.termid] = v;
88
77
  }
89
78
  }
90
79
  }
91
- for (const s of samples)
92
- delete s.sampleid;
93
80
  S.get = () => {
94
- return { samples };
81
+ return { samples: Object.values(samples) };
95
82
  };
96
83
  }
97
84
  function getDataNative(D, ds) {
@@ -1,4 +1,4 @@
1
- import { gdcGetCasesWithExressionDataFromCohort } from "../src/mds3.gdc.js";
1
+ import { gdcGetCasesWithExpressionDataFromCohort } from "../src/mds3.gdc.js";
2
2
  import path from "path";
3
3
  import { run_rust } from "@sjcrh/proteinpaint-rust";
4
4
  import got from "got";
@@ -47,12 +47,12 @@ function validate_query_TopVariablyExpressedGenes(ds, genome) {
47
47
  if (q.src == "gdcapi") {
48
48
  gdcValidateQuery(ds, genome);
49
49
  } else if (q.src == "native") {
50
- nativeValidateQuery(ds, genome);
50
+ nativeValidateQuery(ds);
51
51
  } else {
52
52
  throw "unknown topVariablyExpressedGenes.src";
53
53
  }
54
54
  }
55
- function nativeValidateQuery(ds, genome) {
55
+ function nativeValidateQuery(ds) {
56
56
  const gE = ds.queries.geneExpression;
57
57
  if (!gE)
58
58
  throw "topVariablyExpressedGenes query given but geneExpression missing";
@@ -111,7 +111,7 @@ function gdcValidateQuery(ds, genome) {
111
111
  }
112
112
  if (!ds.__gdc.doneCaching)
113
113
  throw "The server has not finished caching the case IDs: try again in ~2 minutes";
114
- const caseLst = await gdcGetCasesWithExressionDataFromCohort(q, ds);
114
+ const caseLst = await gdcGetCasesWithExpressionDataFromCohort(q, ds);
115
115
  if (caseLst.length == 0) {
116
116
  return [];
117
117
  }