@sjcrh/proteinpaint-shared 2.135.1 → 2.135.2-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-shared",
3
- "version": "2.135.1",
3
+ "version": "2.135.2-0",
4
4
  "description": "ProteinPaint code that is shared between server and client-side workspaces",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/common.js CHANGED
@@ -1242,7 +1242,7 @@ export const CNVClasses = Object.values(mclass)
1242
1242
  .map(m => m.key)
1243
1243
 
1244
1244
  // dt terms used for filtering variants for geneVariant term
1245
- const _dtTerms = [
1245
+ const dtTerms_temp = [
1246
1246
  {
1247
1247
  id: 'snvindel',
1248
1248
  query: 'snvindel',
@@ -1287,11 +1287,10 @@ const _dtTerms = [
1287
1287
  }
1288
1288
  ]
1289
1289
  // add origin annotations to dt terms
1290
- export const dtTerms = []
1291
- for (const _dtTerm of _dtTerms) {
1292
- const dtTerm = structuredClone(_dtTerm)
1290
+ const dtTerms_temp2 = []
1291
+ for (const dtTerm of dtTerms_temp) {
1293
1292
  dtTerm.name_noOrigin = dtTerm.name // for labeling groups in groupsetting
1294
- dtTerms.push(dtTerm) // no origin
1293
+ dtTerms_temp2.push(dtTerm) // no origin
1295
1294
  for (const origin of ['somatic', 'germline']) {
1296
1295
  // add origins
1297
1296
  const addOrigin = {
@@ -1299,9 +1298,10 @@ for (const _dtTerm of _dtTerms) {
1299
1298
  name: `${dtTerm.name} (${origin})`,
1300
1299
  origin
1301
1300
  }
1302
- dtTerms.push(Object.assign({}, dtTerm, addOrigin))
1301
+ dtTerms_temp2.push(Object.assign({}, dtTerm, addOrigin))
1303
1302
  }
1304
1303
  }
1304
+ export const dtTerms = dtTerms_temp2
1305
1305
 
1306
1306
  export const colorScaleMap = {
1307
1307
  blueWhiteRed: { domain: [0, 0.5, 1], range: ['blue', 'white', 'red'] },
package/src/index.js CHANGED
@@ -10,7 +10,6 @@ export * from './filter.js'
10
10
  export * from './hash.js'
11
11
  export * from './helpers.js'
12
12
  export * from './joinUrl.js'
13
- export * from './mds.termdb.termvaluesetting.js' // deprecated?
14
13
  export * from './mds3tk.js'
15
14
  export * from './roundValue.js'
16
15
  export * from './termdb.bins.js'
package/src/terms.js CHANGED
@@ -41,7 +41,7 @@ export const TermTypes = {
41
41
  MULTIVALUE: 'multivalue',
42
42
  DATE: 'date'
43
43
  }
44
- const dtTermTypes = new Set(dtTerms.map(t => t.type))
44
+ export const dtTermTypes = new Set(dtTerms.map(t => t.type))
45
45
  for (const dtTermType of dtTermTypes) {
46
46
  TermTypes[dtTermType.toUpperCase()] = dtTermType
47
47
  }
@@ -1,81 +0,0 @@
1
- export function validate_termvaluesetting ( lst, from ) {
2
- /*
3
- shared between client and server
4
- for validating a list of term-value setting
5
- TODO also work for termdb filter
6
- */
7
- if(!lst) throw '.terms[] list missing from '+from
8
- if(!Array.isArray(lst)) throw '.terms[] is not an array from '+from
9
-
10
- // allow the array to be blank!!!
11
-
12
- for(const t of lst) {
13
- if(!t.term) throw '.term{} missing from a '+from+' term'
14
- if(!t.term.id) throw '.term.term.id missing from a '+from+' term'
15
- if( t.term.iscategorical ) {
16
- if(!t.values) throw '.values[] missing from a '+from+' term'
17
- if(!Array.isArray(t.values)) throw '.values[] is not an array from a '+from+' term'
18
- for(const i of t.values) {
19
- if(typeof i != 'object') throw 'an element is not object from values of '+t.term.id+' from '+from
20
- if(!i.key) throw '.key missing from a value of '+t.term.id+' from '+from
21
- if(!i.label) i.label = i.key
22
- }
23
- continue
24
- }
25
- if(t.term.isinteger || t.term.isfloat) {
26
- if(!t.ranges) throw '.ranges[] missing from a numerical term of '+from
27
- for(const range of t.ranges) {
28
- if( range.value != undefined ) {
29
- // is a special category, not a value from numerical range
30
- if(!range.label) throw '.label missing for is_unannotated category'
31
- } else {
32
- validate_single_numericrange( range, from )
33
- }
34
- }
35
- continue
36
- }
37
- if(t.term.iscondition) {
38
- if( t.grade_and_child ) {
39
- if(!Array.isArray(t.grade_and_child)) throw 'grade_and_child[] is not array from '+from
40
- for(const i of t.grade_and_child) {
41
- if(!Number.isInteger(i.grade)) throw '.grade is not an integer from one of grade_and_child[] from '+from
42
- if(i.child_id==undefined) throw 'child_id is missing from one of grade_and_child[] from '+from
43
- }
44
- if(!t.value_by_max_grade && !t.value_by_most_recent && !t.value_by_computable_grade) throw 'unknown value_type for a bar_by_grade condition term from '+from
45
- } else {
46
- if(!t.values) throw '.values[] missing from a condition term of '+from
47
- if(!Array.isArray(t.values)) throw '.values[] is not an array from a '+from+' term'
48
- for(const i of t.values) {
49
- if(typeof i != 'object') throw 'an element is not object from values of '+t.term.id+' from '+from
50
- // i.key == 0 should be valid, check for presence of the object["key"] property instead
51
- if(!('key' in i)) throw '.key missing from a value of '+t.term.id+' from '+from
52
- if(!i.label) i.label = i.key
53
- }
54
- if( t.bar_by_grade ) {
55
- if(!t.value_by_max_grade && !t.value_by_most_recent && !t.value_by_computable_grade) throw 'unknown value_type for a bar_by_grade condition term from '+from
56
- } else if(t.bar_by_children) {
57
- } else {
58
- throw 'neither bar_by_grade or bar_by_children is set for a condition term from '+from
59
- }
60
- }
61
- continue
62
- }
63
- throw 'unknown term type from a '+from+' term'
64
- }
65
- }
66
-
67
-
68
-
69
- export function validate_single_numericrange ( r, from ) {
70
- // a regular range
71
- if(r.startunbounded) {
72
- if(r.stopunbounded) throw 'both start & stop are unbounded from '+from
73
- if(!Number.isFinite(r.stop)) throw '.stop undefined when start is unbounded from '+from
74
- } else if(r.stopunbounded) {
75
- if(!Number.isFinite(r.start)) throw '.start undefined when stop is unbounded from '+from
76
- } else {
77
- if(!Number.isFinite(r.start)) throw '.start undefined when start is not unbounded from '+from
78
- if(!Number.isFinite(r.stop)) throw '.stop undefined when stop is not unbounded from '+from
79
- if(r.start >= r.stop ) throw '.start is not lower than stop from '+from
80
- }
81
- }