@sjcrh/proteinpaint-shared 2.137.2-2 → 2.137.3
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 +1 -1
- package/src/common.js +0 -2
- package/src/filter.js +0 -52
package/package.json
CHANGED
package/src/common.js
CHANGED
|
@@ -1240,8 +1240,6 @@ export const mutationClasses = Object.values(mclass)
|
|
|
1240
1240
|
export const CNVClasses = Object.values(mclass)
|
|
1241
1241
|
.filter(m => m.dt == dtcnv)
|
|
1242
1242
|
.map(m => m.key)
|
|
1243
|
-
export const cnvGainClasses = [mclasscnvgain, mclasscnvAmp]
|
|
1244
|
-
export const cnvLossClasses = [mclasscnvloss, mclasscnvHomozygousDel]
|
|
1245
1243
|
|
|
1246
1244
|
// dt terms used for filtering variants for geneVariant term
|
|
1247
1245
|
const dtTerms_temp = [
|
package/src/filter.js
CHANGED
|
@@ -253,55 +253,3 @@ export function getWrappedTvslst(lst = [], join = '', $id = null) {
|
|
|
253
253
|
if ($id !== null && filter.$id !== undefined) filter.$id = $id
|
|
254
254
|
return filter
|
|
255
255
|
}
|
|
256
|
-
/*
|
|
257
|
-
This function is used where ever you need to build a group of categorical filters related.
|
|
258
|
-
It builds the filter needed to retrieve a term values after filtering out samples according to the other filters provided.
|
|
259
|
-
The profile filters, for example, use this function to get the filters needed to call filterTermValues, that populate the dropdowns in the controls.
|
|
260
|
-
If no tw is provided it returns a filter that is the combination of all the categorical filters provided in the filterTWs array.
|
|
261
|
-
Input:
|
|
262
|
-
- filterTWs: list of term wrappers (tw) that are used to filter the samples
|
|
263
|
-
- values: an object with term ids as keys and the values to filter by
|
|
264
|
-
- tw: The term wrapper for which the filter is being built. If provided, it will be excluded from the filter.
|
|
265
|
-
- globalFilter: an optional filter that will be joined with the generated filter
|
|
266
|
-
Output:
|
|
267
|
-
- a filter object that can be used to filter term values based on the provided term wrappers and values.
|
|
268
|
-
*/
|
|
269
|
-
export function getCategoricalTermFilter(filterTWs, values, tw, globalFilter) {
|
|
270
|
-
const excluded = []
|
|
271
|
-
if (tw) excluded.push(tw.term.id)
|
|
272
|
-
const lst = []
|
|
273
|
-
for (const tw of filterTWs) processTW(tw, values, excluded, lst)
|
|
274
|
-
|
|
275
|
-
let filter = {
|
|
276
|
-
type: 'tvslst',
|
|
277
|
-
in: true,
|
|
278
|
-
join: lst.length > 1 ? 'and' : '',
|
|
279
|
-
lst
|
|
280
|
-
}
|
|
281
|
-
if (globalFilter?.lst.length > 0) filter = filterJoin([globalFilter, filter])
|
|
282
|
-
return filter
|
|
283
|
-
|
|
284
|
-
function processTW(tw, values, excluded, lst) {
|
|
285
|
-
const value = values[tw.term.id]
|
|
286
|
-
if (value && !excluded.includes(tw.term.id)) {
|
|
287
|
-
if (Array.isArray(value)) {
|
|
288
|
-
const tvs = {
|
|
289
|
-
type: 'tvs',
|
|
290
|
-
tvs: {
|
|
291
|
-
term: tw.term,
|
|
292
|
-
values: []
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
for (const item of value) tvs.tvs.values.push({ key: item })
|
|
296
|
-
lst.push(tvs)
|
|
297
|
-
} else
|
|
298
|
-
lst.push({
|
|
299
|
-
type: 'tvs',
|
|
300
|
-
tvs: {
|
|
301
|
-
term: tw.term,
|
|
302
|
-
values: [{ key: value }]
|
|
303
|
-
}
|
|
304
|
-
})
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|