@sjcrh/proteinpaint-types 2.78.0-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.
Files changed (62) hide show
  1. package/package.json +29 -0
  2. package/src/Mclass.ts +8 -0
  3. package/src/dataset.ts +1416 -0
  4. package/src/docs.json +16417 -0
  5. package/src/fileOrUrl.ts +15 -0
  6. package/src/filter.ts +125 -0
  7. package/src/genome.ts +123 -0
  8. package/src/index.ts +56 -0
  9. package/src/routes/brainImaging.ts +21 -0
  10. package/src/routes/burden.ts +67 -0
  11. package/src/routes/dzimages.ts +9 -0
  12. package/src/routes/errorResponse.ts +6 -0
  13. package/src/routes/filter.gdc.ts +15 -0
  14. package/src/routes/gdc.maf.ts +41 -0
  15. package/src/routes/gdc.mafBuild.ts +13 -0
  16. package/src/routes/gdc.topMutatedGenes.ts +25 -0
  17. package/src/routes/genelookup.ts +10 -0
  18. package/src/routes/genesetEnrichment.ts +46 -0
  19. package/src/routes/genesetOverrepresentation.ts +32 -0
  20. package/src/routes/healthcheck.ts +57 -0
  21. package/src/routes/hicdata.ts +37 -0
  22. package/src/routes/hicgenome.ts +22 -0
  23. package/src/routes/hicstat.ts +45 -0
  24. package/src/routes/sampledzimages.ts +1 -0
  25. package/src/routes/samplewsimages.ts +15 -0
  26. package/src/routes/termdb.DE.ts +25 -0
  27. package/src/routes/termdb.categories.ts +26 -0
  28. package/src/routes/termdb.cluster.ts +75 -0
  29. package/src/routes/termdb.getSampleImages.ts +14 -0
  30. package/src/routes/termdb.getTopTermsByType.ts +21 -0
  31. package/src/routes/termdb.getdescrstats.ts +31 -0
  32. package/src/routes/termdb.getnumericcategories.ts +21 -0
  33. package/src/routes/termdb.getpercentile.ts +17 -0
  34. package/src/routes/termdb.getrootterm.ts +22 -0
  35. package/src/routes/termdb.gettermchildren.ts +21 -0
  36. package/src/routes/termdb.singleSampleMutation.ts +18 -0
  37. package/src/routes/termdb.singlecellDEgenes.ts +30 -0
  38. package/src/routes/termdb.singlecellData.ts +55 -0
  39. package/src/routes/termdb.singlecellSamples.ts +35 -0
  40. package/src/routes/termdb.termsbyids.ts +15 -0
  41. package/src/routes/termdb.topVariablyExpressedGenes.ts +45 -0
  42. package/src/routes/termdb.violin.ts +74 -0
  43. package/src/routes/wsimages.ts +12 -0
  44. package/src/terms/categorical.ts +106 -0
  45. package/src/terms/condition.ts +55 -0
  46. package/src/terms/geneExpression.ts +32 -0
  47. package/src/terms/geneVariant.ts +51 -0
  48. package/src/terms/metaboliteIntensity.ts +31 -0
  49. package/src/terms/numeric.ts +245 -0
  50. package/src/terms/q.ts +38 -0
  51. package/src/terms/samplelst.ts +41 -0
  52. package/src/terms/singleCellCellType.ts +22 -0
  53. package/src/terms/singleCellGeneExpression.ts +28 -0
  54. package/src/terms/snp.ts +28 -0
  55. package/src/terms/snps.ts +110 -0
  56. package/src/terms/term.ts +184 -0
  57. package/src/terms/tw.ts +38 -0
  58. package/src/terms/updated-types.ts +9 -0
  59. package/src/termsetting.ts +193 -0
  60. package/src/test/numeric.type.spec.ts +275 -0
  61. package/src/typedoc.js +30 -0
  62. package/src/vocab.ts +37 -0
@@ -0,0 +1,74 @@
1
+ import type { Filter } from '../filter.ts'
2
+ import type { ErrorResponse } from './errorResponse.ts'
3
+
4
+ export type getViolinRequest = {
5
+ genome: string
6
+ dslabel: string
7
+ embedder: string
8
+ /** main tw to fetch numeric data to show in violin */
9
+ tw: any
10
+ /** optional tw to divide tw data into multiple violins and show under one axis */
11
+ divideTw?: any
12
+ /** A number representing the device's pixel ratio, which may be used for rendering quality adjustments */
13
+ devicePixelRatio: number
14
+ /** optional mass filter */
15
+ filter?: Filter
16
+ /** optional read-only invisible filter TODO GdcFilter0 */
17
+ filter0?: any
18
+ /** A number representing the width of the SVG (Scalable Vector Graphics) box, used for rendering the chart */
19
+ svgw: number
20
+ /** A string with two possible values: 'horizontal' or 'vertical', indicating the orientation of the chart, either horizontal or vertical */
21
+ orientation: 'horizontal' | 'vertical'
22
+ /** A string representing the type of symbol used on the plot, which can be either 'circles' or 'rugs' */
23
+ datasymbol: string
24
+ /** A number representing the radius of the data symbols rendered on the plot */
25
+ radius: number
26
+ /** A number representing the width of the stroke used to generate the data symbols (data symbols are rendered on the server side) */
27
+ strokeWidth: number
28
+ /** A number representing the dimension perpendicular to the violin spread (the height of the axis) */
29
+ axisHeight: number
30
+ /** A number representing the right margin of the chart or plot */
31
+ rightMargin: number
32
+ /** A string representing a unit of measurement (e.g., 'log' for log scale) */
33
+ unit: string
34
+ /** ?? */
35
+ isKDE: boolean
36
+ }
37
+
38
+ interface binsEntries {
39
+ x0: number
40
+ x1: number
41
+ density: number
42
+ }
43
+ interface valuesEntries {
44
+ id: string
45
+ label: string
46
+ value: number
47
+ }
48
+
49
+ interface pvalueEntries {
50
+ value?: string
51
+ html?: string
52
+ }
53
+
54
+ type plot = {
55
+ label: string
56
+ plotValueCount: number
57
+ src: string
58
+ bins: binsEntries[]
59
+ densityMax: number
60
+ biggestBin: number
61
+ summaryStats: {
62
+ values: valuesEntries[]
63
+ }
64
+ }
65
+
66
+ export type getViolinResponse = ValidResponse | ErrorResponse
67
+
68
+ type ValidResponse = {
69
+ min: number
70
+ max: number
71
+ plots: plot[]
72
+ pvalues?: pvalueEntries[][]
73
+ uncomputableValueObj: any
74
+ }
@@ -0,0 +1,12 @@
1
+ export type GetWSImagesRequest = {
2
+ genome: string
3
+ dslabel: string
4
+ sampleId: string
5
+ wsimage: string
6
+ }
7
+
8
+ export type GetWSImagesResponse = {
9
+ sessionId: string
10
+ slide_dimensions: number[]
11
+ status: string
12
+ }
@@ -0,0 +1,106 @@
1
+ import {
2
+ BaseTerm,
3
+ TermValues,
4
+ GroupSettingQ,
5
+ ValuesQ,
6
+ TermGroupSetting,
7
+ BaseTW,
8
+ PredefinedGroupSettingQ,
9
+ CustomGroupSettingQ
10
+ } from './term.ts'
11
+ import { RawValuesQ, RawPredefinedGroupsetQ, RawCustomGroupsetQ, MinBaseQ } from './q.ts'
12
+ import { TermSettingInstance } from '../termsetting.ts'
13
+
14
+ /**
15
+ * A raw categorical term q object, before filling-in
16
+ *
17
+ * test:CategoricalQ:
18
+ *
19
+ * @category TW
20
+ */
21
+
22
+ export type RawCatTWValues = BaseTW & {
23
+ type?: 'CatTWValues'
24
+ /** must already exist, for dictionary terms, TwRouter.fill() will use mayHydrateDictTwLst() */
25
+ term: CategoricalTerm
26
+ q: RawValuesQ
27
+ }
28
+
29
+ export type RawCatTWPredefinedGS = BaseTW & {
30
+ type?: 'CatTWPredefinedGS'
31
+ term: CategoricalTerm
32
+ q: RawPredefinedGroupsetQ
33
+ }
34
+
35
+ export type RawCatTWCustomGS = BaseTW & {
36
+ type?: 'CatTWCustomGS'
37
+ term: CategoricalTerm
38
+ q: RawCustomGroupsetQ
39
+ }
40
+
41
+ export type RawCatTW = RawCatTWValues | RawCatTWPredefinedGS | RawCatTWCustomGS
42
+
43
+ export type CategoricalBaseQ = MinBaseQ & {
44
+ mode?: 'discrete' | 'binary'
45
+ }
46
+
47
+ export type CategoricalQ = GroupSettingQ | ValuesQ
48
+
49
+ export type CategoricalTerm = BaseTerm & {
50
+ type: 'categorical'
51
+ values: TermValues
52
+ groupsetting: TermGroupSetting
53
+ }
54
+
55
+ /**
56
+ * A categorical term wrapper object
57
+ *
58
+ * @group Termdb
59
+ * @category TW
60
+ */
61
+
62
+ export type CategoricalTW = BaseTW & {
63
+ //id: string
64
+ type: 'CatTWValues' | 'CatTWPredefinedGS' | 'CatTWCustomGS'
65
+ q: CategoricalQ
66
+ term: CategoricalTerm
67
+ }
68
+
69
+ export type CatTWValues = BaseTW & {
70
+ //id: string
71
+ term: CategoricalTerm
72
+ q: ValuesQ
73
+ type: 'CatTWValues'
74
+ // do not use this boolean flag, defined here only to help illustrate
75
+ // in tw/test/fake/app.js why this is type check error prone and
76
+ // less preferred than a discriminant prop that also works at runtime
77
+ isCatTWValues?: true
78
+ }
79
+
80
+ export type CatTWPredefinedGS = BaseTW & {
81
+ //id: string
82
+ term: CategoricalTerm
83
+ q: PredefinedGroupSettingQ
84
+ type: 'CatTWPredefinedGS'
85
+ // do not use this boolean flag, defined here only to help illustrate
86
+ // in tw/test/fake/app.js why this is type check error prone and
87
+ // less preferred than a discriminant prop that also works at runtime
88
+ isCatTWPredefiendGS?: true
89
+ }
90
+
91
+ export type CatTWCustomGS = BaseTW & {
92
+ //id: string
93
+ term: CategoricalTerm
94
+ q: CustomGroupSettingQ
95
+ type: 'CatTWCustomGS'
96
+ }
97
+
98
+ export type CatTWTypes = CatTWValues | CatTWPredefinedGS | CatTWCustomGS
99
+
100
+ export type CategoricalTermSettingInstance = TermSettingInstance & {
101
+ q: CategoricalQ
102
+ term: CategoricalTerm
103
+ category2samplecount: any
104
+ validateGroupsetting: () => { text: string; bgcolor?: string }
105
+ error?: string
106
+ }
@@ -0,0 +1,55 @@
1
+ import { BaseTerm, BaseQ, TermValues } from './term.ts'
2
+ import { TermWrapper } from './tw.ts'
3
+
4
+ /**
5
+ * @category TW
6
+ */
7
+
8
+ export type ConditionQ = BaseQ & {
9
+ mode: 'discrete' | 'binary' | 'cuminc' | 'cox'
10
+ type?: 'values'
11
+ bar_by_children?: boolean // 'true' if term is not a leaf and has subconditions
12
+ bar_by_grade?: boolean /* 'true' for barchart. Always 'true' for cuminc and logistic/cox outcome (children terms are not allowed for those cases)
13
+ when 'true', 'value_by_*' flags are effective.*/
14
+ breaks?: number[] /*
15
+ Breaks grades into groups
16
+ Array length=1, will break grades to 2 groups.
17
+ E.g. [3] divides to [-1,0,1,2,], [3,4,5]
18
+ Allowed for both conditionModes "discrete/binary"
19
+ Array length=2, break to 3 groups.
20
+ E.g. [1,2] divides to [-1,0], [1], [2,3,4,5]
21
+ E.g. [1,3] divides to [-1,0], [1,2], [3,4,5]
22
+ Only allowed for conditionMode="discrete" but not "binary"
23
+ */
24
+ timeScale: 'age' | 'time'
25
+ value_by_max_grade?: boolean //'false' if bar_by_children is 'true'
26
+ value_by_most_recent?: boolean //'false' if bar_by_children is 'true'
27
+ value_by_computable_grade?: boolean //'true' if bar_by_children is 'true'
28
+ groups?: any // TODO: should use a defined type
29
+ }
30
+
31
+ export type ConditionTerm = BaseTerm & {
32
+ type: 'condition'
33
+ values: TermValues
34
+ }
35
+
36
+ /**
37
+ * @group Termdb
38
+ * @category TW
39
+ */
40
+ export type ConditionTW = TermWrapper & {
41
+ term: ConditionTerm
42
+ q: ConditionQ //replace the generic Q with specific condition Q
43
+ }
44
+
45
+ /**
46
+ * @group Termdb
47
+ * @category TW
48
+ */
49
+ /*
50
+ export type ConditionTermSettingInstance = TermSettingInstance & {
51
+ q: ConditionQ
52
+ category2samplecount: { key: string; label: string; count: number }[]
53
+ refGrp: any
54
+ }
55
+ */
@@ -0,0 +1,32 @@
1
+ import { TermWrapper } from './tw.ts'
2
+ import { NumericTerm, NumericQ } from './numeric.ts'
3
+ import { TermSettingInstance } from '../termsetting.ts'
4
+
5
+ /*
6
+ --------EXPORTED--------
7
+ GeneExpressionQ
8
+ GeneExpressionTermWrapper
9
+ GeneExpressionTermSettingInstance
10
+
11
+ */
12
+
13
+ export type GeneExpressionQ = NumericQ & { dt?: number }
14
+
15
+ export type GeneExpressionTW = TermWrapper & {
16
+ q: GeneExpressionQ
17
+ term: GeneExpressionTerm
18
+ }
19
+
20
+ export type GeneExpressionTerm = NumericTerm & {
21
+ gene: string
22
+ // temporarily allowing chr/start/stop to support
23
+ // legacy fpkm files
24
+ chr?: string
25
+ start?: number
26
+ stop?: number
27
+ }
28
+
29
+ export type GeneExpressionTermSettingInstance = TermSettingInstance & {
30
+ q: GeneExpressionQ
31
+ term: GeneExpressionTerm
32
+ }
@@ -0,0 +1,51 @@
1
+ import { MinBaseQ, BaseTerm, EnabledTermGroupSetting, BaseTW, GroupSettingQ, ValuesQ } from '../index.ts'
2
+ import { TermSettingInstance } from '../termsetting.ts'
3
+
4
+ export type GeneVariantBaseQ = MinBaseQ & {
5
+ cnvGainCutoff?: number
6
+ cnvMaxLength?: number
7
+ cnvMinAbsValue?: number
8
+ cnvLossCutoff?: number
9
+ exclude: string[]
10
+ dt?: number
11
+ origin?: string
12
+ }
13
+
14
+ export type GeneVariantQ = GeneVariantBaseQ & (ValuesQ | GroupSettingQ)
15
+
16
+ type GeneVariantBaseTerm = BaseTerm & {
17
+ type: 'geneVariant'
18
+ groupsetting: EnabledTermGroupSetting
19
+ }
20
+
21
+ export type GeneVariantGeneTerm = GeneVariantBaseTerm & {
22
+ kind: 'gene'
23
+ gene: string
24
+ // chr,start,stop should exist together as a separate type called
25
+ // 'Coord', but hard to code as atomic `& Coord` because it may
26
+ // need to be filled in
27
+ chr?: string
28
+ start?: number
29
+ stop?: number
30
+ }
31
+
32
+ export type GeneVariantCoordTerm = GeneVariantBaseTerm & {
33
+ kind: 'coord'
34
+ chr: string
35
+ start: number
36
+ stop: number
37
+ }
38
+
39
+ export type GeneVariantTerm = GeneVariantGeneTerm | GeneVariantCoordTerm
40
+
41
+ export type GeneVariantTW = BaseTW & {
42
+ term: GeneVariantTerm
43
+ q: GeneVariantQ
44
+ }
45
+
46
+ export type GeneVariantTermSettingInstance = TermSettingInstance & {
47
+ q: GeneVariantQ
48
+ term: GeneVariantTerm
49
+ category2samplecount: any
50
+ groupSettingInstance?: any
51
+ }
@@ -0,0 +1,31 @@
1
+ import { TermWrapper } from './tw.ts'
2
+ import { BaseQ } from './term.ts'
3
+ import { NumericTerm } from './numeric.ts'
4
+ import { TermSettingInstance } from '../termsetting.ts'
5
+
6
+ /*
7
+ --------EXPORTED--------
8
+ MetaboliteIntensityQ
9
+ MetaboliteIntensityTermWrapper
10
+ MetaboliteIntensityTermSettingInstance
11
+
12
+ */
13
+
14
+ export type MetaboliteIntensityQ = BaseQ & {
15
+ mode: 'continuous'
16
+ }
17
+
18
+ export type MetaboliteIntensityTW = TermWrapper & {
19
+ q: MetaboliteIntensityQ
20
+ term: MetaboliteIntensityTerm
21
+ }
22
+
23
+ export type MetaboliteIntensityTerm = NumericTerm & {
24
+ metabolite: string
25
+ bins: any
26
+ }
27
+
28
+ export type MetaboliteIntensityTermSettingInstance = TermSettingInstance & {
29
+ q: MetaboliteIntensityQ
30
+ term: MetaboliteIntensityTerm
31
+ }
@@ -0,0 +1,245 @@
1
+ import { MinBaseQ, BaseTW, TermValues, BaseTerm } from '../index.ts'
2
+
3
+ export type RawRegularBin = Partial<RegularNumericBinConfig> & { preferredBins?: string }
4
+
5
+ export type RawNumTWRegularBin = BaseTW & {
6
+ type?: 'NumTWRegularBin'
7
+ term: NumericTerm
8
+ q: RawRegularBin
9
+ }
10
+
11
+ export type RawCustomBin = Partial<CustomNumericBinConfig> & { preferredBins?: string }
12
+
13
+ export type RawNumTWCustomBin = BaseTW & {
14
+ type?: 'NumTWCustomBin'
15
+ term: NumericTerm
16
+ q: RawCustomBin
17
+ }
18
+
19
+ export type RawNumTWCont = BaseTW & {
20
+ type?: 'NumTWCont'
21
+ term: NumericTerm
22
+ q: ContinuousNumericQ
23
+ }
24
+
25
+ export type RawNumTWSpline = BaseTW & {
26
+ type?: 'NumTWSpline'
27
+ term: NumericTerm
28
+ q: SplineNumericQ
29
+ }
30
+
31
+ export type RawNumTW = RawNumTWCustomBin | RawNumTWRegularBin | RawNumTWCont | RawNumTWSpline
32
+
33
+ export type NumericTerm = BaseTerm & {
34
+ id?: string
35
+ // these concrete term.type values make it clear that only these are numeric,
36
+ // "categorical", "condition", and other term.types are not included in this union
37
+ type: 'integer' | 'float' | 'geneExpression' | 'metaboliteIntensity'
38
+ bins: PresetNumericBins
39
+ values?: TermValues
40
+ unit?: string
41
+ /*densityNotAvailable?: boolean //Not used?
42
+ logScale?: string | number
43
+ max?: number
44
+ min?: number
45
+ name?: string
46
+ skip0forPercentile?: boolean
47
+ tvs?: Tvs
48
+ values?: TermValues
49
+ unit?: string
50
+ valueConversion?: ValueConversion*/
51
+ }
52
+
53
+ export type StartUnboundedBin = {
54
+ // where possible, assign a concrete value (true) when it is known in advance,
55
+ // in which case, do not use an abstract type (boolean) to startunbounded
56
+ startunbounded: true
57
+ startinclusive?: false // cannot include an infinite bound
58
+ stop: number
59
+ stopinclusive?: boolean
60
+ stopunbounded?: false
61
+ label?: string
62
+ }
63
+
64
+ export type StopUnboundedBin = {
65
+ start: number
66
+ stopunbounded: true
67
+ startinclusive?: boolean
68
+ startunbounded?: false
69
+ stopinclusive?: false // cannot include an infinite bound
70
+ label?: string
71
+ }
72
+
73
+ // TODO??? should separate a fully bounded bin by startinclusive, stopinclusive
74
+ // since neighboring bins must not contain the same boundary value
75
+ export type FullyBoundedBin = {
76
+ startunbounded?: false
77
+ startinclusive?: boolean
78
+ start: number
79
+ stop: number
80
+ stopinclusive?: boolean
81
+ stopunbounded?: false
82
+ label?: string
83
+ }
84
+
85
+ export type NumericBin = StartUnboundedBin | FullyBoundedBin | StopUnboundedBin
86
+
87
+ export type RegularNumericBinConfig = MinBaseQ & {
88
+ type: 'regular-bin' // another concrete value being assigned, instead of `string`
89
+ //regular-sized bins
90
+ mode?: 'discrete'
91
+ bin_size: number
92
+ // first_bin.stop is always required
93
+ first_bin: StartUnboundedBin | FullyBoundedBin
94
+
95
+ // if last_bin?.start is set, then a fixed last bin is used; otherwise it's not fixed and computed from data
96
+ last_bin?: StopUnboundedBin | FullyBoundedBin
97
+ label_offset?: number
98
+ }
99
+
100
+ export type CustomNumericBinConfig = MinBaseQ & {
101
+ type: 'custom-bin'
102
+ mode?: 'discrete' | 'binary'
103
+ // since ts will allow NumericBin[] to be empty,
104
+ // use this workaround to define a non-empty array
105
+ lst: [NumericBin, ...NumericBin[]]
106
+ preferredBins?: 'median'
107
+ }
108
+
109
+ // |
110
+ // {
111
+ // type?: 'custom-bin'
112
+ // mode?: 'discrete' | 'binary'
113
+ // // since ts will allow NumericBin[] to be empty,
114
+ // // use this workaround to define a non-empty array
115
+ // lst?: [NumericBin, ...NumericBin[]]
116
+ // }
117
+
118
+ /*export type NumericQ = BaseQ & {
119
+ // termType: 'float' | 'integer' -- converts to 'numeric'
120
+ preferredBins?: 'median' | 'less' | 'default'
121
+ modeBinaryCutoffType: 'normal' | 'percentile'
122
+ modeBinaryCutoffPercentile?: number
123
+ knots?: any //[]?
124
+ scale?: number //0.1 | 0.01 | 0.001
125
+ rounding: string
126
+ }*/
127
+
128
+ export type PresetNumericBins = {
129
+ default: RegularNumericBinConfig | CustomNumericBinConfig
130
+ less: RegularNumericBinConfig | CustomNumericBinConfig
131
+ label_offset?: number
132
+ label_offset_ignored?: boolean
133
+ rounding?: string
134
+ min?: number
135
+ max?: number
136
+ }
137
+
138
+ export type BinnedNumericQ = RegularNumericBinConfig | CustomNumericBinConfig
139
+
140
+ export type DiscreteNumericQ = BinnedNumericQ //&
141
+ // MinBaseQ & {
142
+ // mode: 'discrete' | 'binary'
143
+ // }
144
+
145
+ // TODO: test with live code that defines an actual binary q object
146
+ export type BinaryNumericQ = MinBaseQ & {
147
+ mode: 'binary'
148
+ type: 'custom-bin'
149
+ // tuple type with 2 members
150
+ lst: [StartUnboundedBin | FullyBoundedBin, StopUnboundedBin | FullyBoundedBin]
151
+ }
152
+
153
+ export type ContinuousNumericQ = MinBaseQ & {
154
+ mode: 'continuous'
155
+ // TODO: do not use a boolean, convert to a `transform: 'zscore' | ...` option
156
+ convert2ZScore?: boolean
157
+ //scale?: string
158
+ // todo below: q.type is expected to be undefined for now,
159
+ // but may be used later like in other q.modes,
160
+ // making type optional here makes NumericQ operations/conditions
161
+ // work consistently within the TermWrapper union type
162
+ type?: undefined
163
+ }
164
+
165
+ export type SplineNumericQ = MinBaseQ & {
166
+ mode: 'spline'
167
+ knots: {
168
+ value: number
169
+ }[]
170
+ // todo below: q.type is expected to be undefined for now,
171
+ // but may be used later like in other q.modes,
172
+ // making type optional here makes NumericQ operations/conditions
173
+ // work consistently within the TermWrapper union type
174
+ type?: undefined
175
+ }
176
+
177
+ export type NumericQ = DiscreteNumericQ | BinaryNumericQ | ContinuousNumericQ | SplineNumericQ
178
+
179
+ export type NumericTW = BaseTW & {
180
+ //id: string
181
+ term: NumericTerm
182
+ q: NumericQ
183
+ }
184
+
185
+ export type NumTWDiscrete = BaseTW & {
186
+ type: 'NumTWDiscrete'
187
+ term: NumericTerm
188
+ q: DiscreteNumericQ
189
+ }
190
+
191
+ export type NumTWRegularBin = BaseTW & {
192
+ type: 'NumTWRegularBin'
193
+ term: NumericTerm
194
+ q: RegularNumericBinConfig
195
+ }
196
+
197
+ export type NumTWCustomBin = BaseTW & {
198
+ type: 'NumTWCustomBin'
199
+ term: NumericTerm
200
+ q: CustomNumericBinConfig
201
+ }
202
+
203
+ export type NumTWBinaryBin = BaseTW & {
204
+ type: 'NumTWBinaryBin'
205
+ term: NumericTerm
206
+ q: BinaryNumericQ
207
+ }
208
+
209
+ export type NumTWBinary = BaseTW & {
210
+ type: 'NumTWBinary'
211
+ term: NumericTerm
212
+ q: BinaryNumericQ
213
+ }
214
+
215
+ export type NumTWCont = BaseTW & {
216
+ type: 'NumTWCont'
217
+ term: NumericTerm
218
+ q: ContinuousNumericQ
219
+ }
220
+
221
+ export type NumTWSpline = BaseTW & {
222
+ type: 'NumTWSpline'
223
+ term: NumericTerm
224
+ q: SplineNumericQ
225
+ }
226
+
227
+ export type NumTWTypes = NumTWRegularBin | NumTWCustomBin | NumTWBinary | NumTWCont | NumTWSpline
228
+ export type NumTWDiscreteTypes = NumTWRegularBin | NumTWCustomBin //| NumTWBinary
229
+
230
+ export type DefaultMedianQ = {
231
+ isAtomic?: true
232
+ mode: 'discrete'
233
+ type: 'custom-bin'
234
+ preferredBins: 'median'
235
+ lst: []
236
+ }
237
+
238
+ export type DefaultBinnedQ = {
239
+ isAtomic: true
240
+ mode: 'discrete'
241
+ type: 'regular-bin' | 'custom-bin'
242
+ preferredBins: 'default' | 'less'
243
+ }
244
+
245
+ export type DefaultNumericQ = NumericQ | DefaultBinnedQ | DefaultMedianQ
package/src/terms/q.ts ADDED
@@ -0,0 +1,38 @@
1
+ import { HiddenValues, GroupSettingQ, GroupEntry } from './term.ts'
2
+
3
+ // MinBaseQ is BaseQ without .mode and .type
4
+ // MinBaseQ should eventually replace BaseQ because .mode and .type
5
+ // should be specified in a term-type-specific manner
6
+ export type MinBaseQ = {
7
+ /**Automatically set by fillTermWrapper()
8
+ Applies to barchart, survival plot, and cuminc plot.
9
+ Contains categories of a term to be hidden in its chart. This should only apply to client-side rendering, and should not be part of “dataName” when requesting data from server. Server will always provide a summary for all categories. It’s up to the client to show/hide categories.
10
+ This allows the key visibility to be stored in state, while toggling visibility will not trigger data re-request.
11
+ Currently termsetting menu does not manage this attribute. It’s managed by barchart legend.
12
+ */
13
+ hiddenValues?: HiddenValues
14
+ /**indicates this object should not be extended by a copy-merge tool */
15
+ isAtomic?: true
16
+ name?: string
17
+ reuseId?: string
18
+ }
19
+
20
+ export type RawValuesQ = MinBaseQ & { type?: 'values'; mode?: 'binary' }
21
+
22
+ export type RawPredefinedGroupsetQ = MinBaseQ & {
23
+ type: 'predefined-groupset'
24
+ mode?: 'binary' | 'discrete'
25
+ predefined_groupset_idx: number
26
+ /** deprecated nested object, will be handled by reshapeLegacyTW() in TwRouter */
27
+ groupsetting?: { inuse?: boolean } & GroupSettingQ
28
+ }
29
+
30
+ export type RawCustomGroupsetQ = MinBaseQ & {
31
+ type: 'custom-groupset'
32
+ mode?: 'binary' | 'discrete'
33
+ customset: {
34
+ groups: GroupEntry[]
35
+ }
36
+ /** deprecated nested object, will be handled by reshapeLegacyTW() in TwRouter */
37
+ groupsetting?: { inuse?: boolean } & GroupSettingQ
38
+ }
@@ -0,0 +1,41 @@
1
+ import { BaseTerm, BaseQ } from './term.ts'
2
+ import { TermWrapper } from './tw.ts'
3
+ import { TermSettingInstance } from '../termsetting.ts'
4
+
5
+ /*
6
+ --------EXPORTED--------
7
+ SampleLstTermValues
8
+ SampleLstQ
9
+ SampleLstTerm
10
+ SampleLstTW
11
+ SampleLstSettingInstance
12
+
13
+ */
14
+
15
+ export type SampleLstTermValues = {
16
+ [index: string | number]: {
17
+ name: string
18
+ inuse: boolean
19
+ list: { sampleId: string; sample: string }[]
20
+ values: any
21
+ }
22
+ }
23
+
24
+ export type SampleLstQ = BaseQ & {
25
+ groups: SampleLstTermValues
26
+ }
27
+
28
+ export type SampleLstTerm = BaseTerm & {
29
+ values: SampleLstTermValues
30
+ }
31
+
32
+ export type SampleLstTW = TermWrapper & {
33
+ q: SampleLstQ
34
+ term: SampleLstTerm
35
+ }
36
+
37
+ //temporary, will eventually change to SampleLstHandler
38
+ export type SampleLstTermSettingInstance = TermSettingInstance & {
39
+ q: SampleLstQ
40
+ term: SampleLstTerm
41
+ }