@sjcrh/proteinpaint-shared 2.85.0 → 2.87.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.85.0",
3
+ "version": "2.87.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",
@@ -108,20 +108,19 @@ export function isUsableTerm(term, _usecase, termdbConfig, ds) {
108
108
  }
109
109
  return uses
110
110
 
111
- case 'profile':
111
+ case 'profileForms':
112
112
  if (!term.isleaf) {
113
- uses.add('branch')
114
113
  const ancestors = term.id.split('__').length //depends on using the __ naming convension!
115
- if (ancestors > 2) {
114
+ if (ancestors == 2) {
116
115
  uses.add('plot')
117
- }
116
+ } else if (ancestors < 2) uses.add('branch')
118
117
  }
119
118
  return uses
120
119
 
121
- case 'boxplot':
122
- if (term.type == 'float' || term.type == 'integer') uses.add('plot')
123
- if (usecase.detail === 'term2' && hasNumericChild(child_types)) uses.add('branch')
124
- return uses
120
+ // case 'boxplot':
121
+ // if (term.type == 'float' || term.type == 'integer') uses.add('plot')
122
+ // if (usecase.detail === 'term2' && hasNumericChild(child_types)) uses.add('branch')
123
+ // return uses
125
124
 
126
125
  case 'cuminc':
127
126
  if (usecase.detail == 'term') {
package/src/terms.js CHANGED
@@ -36,7 +36,8 @@ export const TermTypes = {
36
36
  SAMPLELST: 'samplelst',
37
37
  METABOLITE_INTENSITY: 'metaboliteIntensity',
38
38
  SINGLECELL_GENE_EXPRESSION: 'singleCellGeneExpression',
39
- SINGLECELL_CELLTYPE: 'singleCellCellType'
39
+ SINGLECELL_CELLTYPE: 'singleCellCellType',
40
+ MULTIVALUE: 'multivalue'
40
41
  }
41
42
 
42
43
  export const NUMERIC_DICTIONARY_TERM = 'numericDictTerm'
@@ -150,9 +151,15 @@ export function getBin(lst, value) {
150
151
  )
151
152
  return bin
152
153
  }
153
-
154
+ //Terms may have a sample type associated to them, in datasets with multiple types of samples.
155
+ //For example the gender is associated to the patient while the age is associated to the type sample. This function is used
156
+ //for example when calling getData or getFilter, to return either the parent or the child samples, depending on the use case.
154
157
  export function getSampleType(term, ds) {
155
158
  if (!term) return null
159
+ //non dict terms annotate only samples, eg: gene expression, metabolite intensity, gene variant.
160
+ //Their sample type is the default sample type that may or may not have a parent type, depending on the dataset
161
+ if (term.type && isNonDictionaryType(term.type)) return DEFAULT_SAMPLE_TYPE
162
+ //dictionary terms may annotate different types of samples, eg: patient and sample or mouse and crop.
156
163
  if (term.id) return ds.cohort.termdb.term2SampleType.get(term.id)
157
164
  if (term.type == 'samplelst') {
158
165
  const key = Object.keys(term.values)[0]