@sjcrh/proteinpaint-server 2.39.5 → 2.39.6

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.39.5",
3
+ "version": "2.39.6",
4
4
  "description": "a genomics visualization tool for exploring a cohort's genotype and phenotype data",
5
5
  "main": "server.js",
6
6
  "bin": "start.js",
@@ -1,5 +1,5 @@
1
- import { GdcTopMutatedGeneRequest, GdcTopMutatedGeneResponse } from '#shared/types/routes/gdc.topMutatedGenes.ts'
2
- import path from 'path'
1
+ import { GdcTopMutatedGeneRequest, GdcTopMutatedGeneResponse, Gene } from '#shared/types/routes/gdc.topMutatedGenes.ts'
2
+ import { mclasscnvgain, mclasscnvloss, dtsnvindel } from '#shared/common.js'
3
3
  import got from 'got'
4
4
 
5
5
  // TODO change to /termdb/topMutatedGenes
@@ -240,26 +240,37 @@ async function getGenesGraphql(q: GdcTopMutatedGeneRequest) {
240
240
  })
241
241
 
242
242
  const re: any = JSON.parse(response.body)
243
- const genes: string[] = []
243
+ const genes: Gene[] = []
244
244
  for (const g of re.data.genesTableViewer.explore.genes.hits.edges) {
245
- /*
245
+ /* g.node is:
246
246
  {
247
- node: {
248
- biotype: 'protein_coding',
249
- case_cnv_gain: { hits: [Object] },
250
- case_cnv_loss: { hits: [Object] },
251
- cnv_case: { hits: [Object] },
252
- cytoband: [ '17q11.2' ],
253
- gene_id: 'ENSG00000196712',
254
- is_cancer_gene_census: true,
255
- name: 'neurofibromin 1',
256
- numCases: 93,
257
- ssm_case: { hits: [Object] },
258
- symbol: 'NF1'
259
- }
247
+ "biotype": "protein_coding",
248
+ "case_cnv_gain": { "hits": { "total": 65 } },
249
+ "case_cnv_loss": { "hits": { "total": 93 } },
250
+ "cnv_case": { "hits": { "total": 173 } },
251
+ "cytoband": [
252
+ "12q15"
253
+ ],
254
+ "gene_id": "ENSG00000127329",
255
+ "is_cancer_gene_census": true,
256
+ "name": "protein tyrosine phosphatase receptor type B",
257
+ "numCases": 18,
258
+ "ssm_case": { "hits": { "total": 630 } },
259
+ "symbol": "PTPRB"
260
260
  }
261
261
  */
262
- genes.push(g.node.symbol)
262
+ if (typeof g.node != 'object') throw 'node missing from re.data.genesTableViewer.explore.genes.hits.edges[]'
263
+ const mutationStat: any = []
264
+ if (Number.isInteger(g.node.case_cnv_gain?.hits?.total) && g.node.case_cnv_gain.hits.total > 0)
265
+ mutationStat.push({ class: mclasscnvgain, count: g.node.case_cnv_gain.hits.total })
266
+ if (Number.isInteger(g.node.case_cnv_loss?.hits?.total) && g.node.case_cnv_loss.hits.total > 0)
267
+ mutationStat.push({ class: mclasscnvloss, count: g.node.case_cnv_loss.hits.total })
268
+ if (Number.isInteger(g.node.ssm_case?.hits?.total) && g.node.ssm_case.hits.total > 0)
269
+ mutationStat.push({ dt: dtsnvindel, count: g.node.ssm_case.hits.total })
270
+ genes.push({
271
+ gene: g.node.symbol,
272
+ mutationStat
273
+ })
263
274
  }
264
275
  return genes
265
276
  }
@@ -276,11 +287,11 @@ function geneCGC() {
276
287
  }
277
288
 
278
289
  /*************************************
290
+ below are old code
279
291
  old method to use rest api
280
292
  **************************************
281
293
  this api only gets ssm-cases and does not account for cnv cases, will not return any gene for ssm-less cohort e.g. APOLLO-LUAD
282
294
  thus is replaced by getGenesGraphql
283
- */
284
295
  async function getGenes(q: GdcTopMutatedGeneRequest) {
285
296
  const _f = q.filter0 || { op: 'and', content: [] } // allow blank filter to test geneset edit ui (without filter)
286
297
  const response = await got.post(path.join(apihost, '/analysis/top_mutated_genes_by_project'), {
@@ -299,6 +310,7 @@ async function getGenes(q: GdcTopMutatedGeneRequest) {
299
310
  }
300
311
  return genes
301
312
  }
313
+ */
302
314
 
303
315
  /*
304
316
  str:
@@ -315,7 +327,6 @@ geneFilter: str
315
327
  }
316
328
  ]
317
329
  }
318
- */
319
330
  function mayAddCGC2filter(f: any, geneFilter?: string) {
320
331
  // reformulate f into f2
321
332
  // f may be "in" or "and". f2 is always "and", in order to join in additional filters
@@ -354,3 +365,4 @@ function mayAddCGC2filter(f: any, geneFilter?: string) {
354
365
 
355
366
  return f2
356
367
  }
368
+ */