@sjcrh/proteinpaint-types 2.180.1 → 2.182.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 (50) hide show
  1. package/dist/brainImaging.js +1 -1
  2. package/dist/{chunk-XCSFBW4V.js → chunk-2QTCQFYE.js} +1101 -649
  3. package/dist/{chunk-DIKDKRFN.js → chunk-3DA4MJ2U.js} +691 -467
  4. package/dist/{chunk-Y6F7ZVSV.js → chunk-45VA4Y6L.js} +691 -467
  5. package/dist/chunk-7OA6G77M.js +113 -0
  6. package/dist/{chunk-XAGXFLSH.js → chunk-C5ECCXOT.js} +1402 -756
  7. package/dist/{chunk-PZUKZRSI.js → chunk-DDMUMMOL.js} +438 -214
  8. package/dist/{chunk-4DCPDZW4.js → chunk-G6ZTAMGK.js} +13 -1
  9. package/dist/{chunk-DPWX7ORN.js → chunk-J55IQXT7.js} +515 -291
  10. package/dist/{chunk-P75GBHFO.js → chunk-K6W2WEPW.js} +857 -395
  11. package/dist/{chunk-LLBTODL6.js → chunk-KNDCWQJD.js} +691 -467
  12. package/dist/{chunk-NOT62STS.js → chunk-UBAJYDGK.js} +453 -229
  13. package/dist/{chunk-WSKMTIOO.js → chunk-URYAC364.js} +677 -453
  14. package/dist/{chunk-6PTYP7X4.js → chunk-UYKWZWCU.js} +2180 -1062
  15. package/dist/{chunk-OT6W3FNI.js → chunk-VUNM6QTX.js} +438 -214
  16. package/dist/{chunk-ICACMXK2.js → chunk-ZKO7LMCC.js} +438 -214
  17. package/dist/{chunk-KFNXZOED.js → chunk-ZRTB7SRA.js} +653 -425
  18. package/dist/correlationVolcano.js +1 -1
  19. package/dist/grin2.js +1 -1
  20. package/dist/index.js +34 -34
  21. package/dist/termdb.categories.js +1 -1
  22. package/dist/termdb.chat.js +438 -214
  23. package/dist/termdb.chat2.js +1 -1
  24. package/dist/termdb.cluster.js +1 -1
  25. package/dist/termdb.descrstats.js +1 -1
  26. package/dist/termdb.diffMeth.js +1 -1
  27. package/dist/termdb.dmr.js +1 -1
  28. package/dist/termdb.isoformAvailability.js +11 -0
  29. package/dist/termdb.numericcategories.js +1 -1
  30. package/dist/termdb.percentile.js +1 -1
  31. package/dist/termdb.termsbyids.js +1 -1
  32. package/dist/termdb.topTermsByType.js +1 -1
  33. package/dist/termdb.topVariablyExpressedGenes.js +1 -1
  34. package/dist/termdb.violinBox.js +11 -0
  35. package/package.json +1 -1
  36. package/src/dataset.ts +92 -58
  37. package/src/index.ts +3 -2
  38. package/src/routes/termdb.cluster.ts +11 -0
  39. package/src/routes/termdb.diffMeth.ts +6 -0
  40. package/src/routes/termdb.dmr.ts +73 -14
  41. package/src/routes/termdb.isoformAvailability.ts +22 -0
  42. package/src/routes/termdb.violinBox.ts +230 -0
  43. package/src/terms/isoformExpression.ts +36 -0
  44. package/src/terms/numeric.ts +2 -0
  45. package/src/vocab.ts +0 -1
  46. package/dist/chunk-R7BNDCKV.js +0 -3722
  47. package/dist/termdb.boxplot.js +0 -11
  48. package/dist/termdb.violin.js +0 -11
  49. package/src/routes/termdb.boxplot.ts +0 -164
  50. package/src/routes/termdb.violin.ts +0 -163
@@ -0,0 +1,230 @@
1
+ import type { RoutePayload } from './routeApi.js'
2
+ import type { TermWrapper } from '../terms/tw.ts'
3
+ import type { Filter } from '../filter.ts'
4
+ import type { ErrorResponse } from './errorResponse.ts'
5
+ import type { DescrStats } from './termdb.descrstats.ts'
6
+
7
+ /** Common properties shared by both violin and box plots */
8
+ type CommonProps = {
9
+ /** numeric tw to fetch numeric data. tw.q.mode must be continuous */
10
+ tw: TermWrapper
11
+ dslabel: string
12
+ genome: string
13
+ /** overlay tw for multiple violins/boxplots */
14
+ overlayTw?: TermWrapper
15
+ /** tw to divide to multiple charts */
16
+ divideTw?: TermWrapper
17
+ /** mass filter */
18
+ filter?: Filter
19
+ /** read-only invisible filter */
20
+ filter0?: any
21
+ /** TODO: Needs description FIXME delete */
22
+ currentGeneNames?: string[]
23
+ /** if true, use log scale; if false or undefined, use linear scale */
24
+ isLogScale?: boolean
25
+ }
26
+
27
+ /** Request type for violin plots with required violin-specific parameters */
28
+ export type ViolinRequest = CommonProps & {
29
+ /** Indicates the type of chart to render */
30
+ plotType: 'violin'
31
+ /** A number representing the dimension perpendicular to the violin spread */
32
+ axisHeight?: number
33
+ /** A string representing the type of symbol used on the plot */
34
+ datasymbol?: string
35
+ /** A number representing the device's pixel ratio */
36
+ devicePixelRatio: number
37
+ /** If true, uses KDE method to build plot */
38
+ isKDE?: boolean
39
+ /** A string with two possible values: 'horizontal' or 'vertical' */
40
+ orientation: string
41
+ /** A number representing the radius of the data symbols */
42
+ radius: number
43
+ /** A number representing the right margin */
44
+ rightMargin?: number
45
+ /** Term may be scaled from regression analysis */
46
+ scale?: any
47
+ /** A number representing the width of the stroke */
48
+ strokeWidth?: number
49
+ /** A number representing the width of the SVG box */
50
+ svgw: number
51
+ /** Number of bins to build the plot. Default is 20. */
52
+ ticks?: number
53
+ }
54
+
55
+ /** Request type for box plots with required box-specific parameters */
56
+ export type BoxRequest = CommonProps & {
57
+ /** Indicates the type of chart to render */
58
+ plotType: 'box'
59
+ /** sort plots by median value */
60
+ orderByMedian?: boolean
61
+ /** Remove outliers from the plot */
62
+ removeOutliers?: boolean
63
+ /** If true, show association tests table */
64
+ showAssocTests?: boolean
65
+ }
66
+
67
+ /**Unified request type for violin and boxplot - union of ViolinRequest and BoxRequest */
68
+ export type ViolinBoxRequest = ViolinRequest | BoxRequest
69
+
70
+ export type ViolinBoxResponse = ViolinResponse | BoxPlotResponse | ErrorResponse
71
+
72
+ /** Type guard to check if response is an ErrorResponse */
73
+ export function isErrorResponse(response: ViolinBoxResponse): response is ErrorResponse {
74
+ return 'error' in response && 'status' in response
75
+ }
76
+
77
+ /** Type guard to check if response is a BoxPlotResponse */
78
+ export function isBoxPlotResponse(response: ViolinBoxResponse): response is BoxPlotResponse {
79
+ return !isErrorResponse(response) && 'charts' in response && 'descrStats' in response
80
+ }
81
+
82
+ /** Type guard to check if response is a ViolinResponse */
83
+ export function isViolinResponse(response: ViolinBoxResponse): response is ViolinResponse {
84
+ return !isErrorResponse(response) && 'min' in response && 'max' in response
85
+ }
86
+
87
+ /** Violin response types */
88
+ interface BinsEntries {
89
+ x0: number
90
+ x1: number
91
+ density: number
92
+ }
93
+
94
+ interface ValuesEntries {
95
+ id: string
96
+ label: string
97
+ value: number
98
+ }
99
+
100
+ interface PValueEntries {
101
+ value?: string
102
+ html?: string
103
+ }
104
+
105
+ type ViolinDensity = {
106
+ bins: BinsEntries[]
107
+ densityMax: number
108
+ densityMin: number
109
+ }
110
+
111
+ export type ViolinPlotEntry = {
112
+ color: string
113
+ chartId: string
114
+ density: ViolinDensity
115
+ label: string
116
+ plotValueCount: number
117
+ seriesId: string
118
+ src: string
119
+ summaryStats: ValuesEntries[]
120
+ }
121
+
122
+ export type ViolinResponse = {
123
+ bins: { [index: string]: any }
124
+ charts: {
125
+ [index: string]: {
126
+ chartId: string
127
+ plots: ViolinPlotEntry[]
128
+ pvalues?: PValueEntries[][]
129
+ }
130
+ }
131
+ min: number
132
+ max: number
133
+ uncomputableValues: { [index: string]: number }[] | null
134
+ descrStats?: DescrStats
135
+ }
136
+
137
+ /** Boxplot response types */
138
+ export type BoxPlotData = {
139
+ w1: number | undefined
140
+ w2: number | undefined
141
+ p05: number
142
+ p25: number
143
+ p50: number
144
+ p75: number
145
+ p95: number
146
+ iqr: number
147
+ out: { value: number }[]
148
+ }
149
+
150
+ export type BoxPlotEntry = {
151
+ boxplot: BoxPlotData & { label: string }
152
+ color?: string
153
+ descrStats: DescrStats
154
+ isHidden?: boolean
155
+ key: string
156
+ seriesId?: string
157
+ }
158
+
159
+ export type BoxPlotChartEntry = {
160
+ chartId: string
161
+ plots: BoxPlotEntry[]
162
+ sampleCount: number
163
+ wilcoxon?: [{ value: string }, { value: string }, { html: string }][]
164
+ }
165
+
166
+ export type BoxPlotResponse = {
167
+ absMin?: number
168
+ absMax?: number
169
+ bins?: {
170
+ [index: string]: any
171
+ }
172
+ charts: {
173
+ [chartId: string]: BoxPlotChartEntry
174
+ }
175
+ descrStats: DescrStats
176
+ uncomputableValues: { label: string; value: number }[] | null
177
+ }
178
+
179
+ export const violinBoxPayload: RoutePayload = {
180
+ request: {
181
+ typeId: 'ViolinBoxRequest'
182
+ },
183
+ response: {
184
+ typeId: 'ViolinBoxResponse'
185
+ },
186
+ examples: [
187
+ {
188
+ request: {
189
+ body: {
190
+ plotType: 'violin',
191
+ genome: 'hg38-test',
192
+ dslabel: 'TermdbTest',
193
+ tw: {
194
+ term: { id: 'aaclassic_5', type: 'float' },
195
+ q: { mode: 'continuous' }
196
+ },
197
+ devicePixelRatio: 2,
198
+ svgw: 200,
199
+ orientation: 'horizontal',
200
+ datasymbol: 'rug',
201
+ radius: 5,
202
+ isLogScale: false
203
+ }
204
+ },
205
+ response: {
206
+ header: { status: 200 }
207
+ }
208
+ },
209
+ {
210
+ request: {
211
+ body: {
212
+ plotType: 'box',
213
+ genome: 'hg38-test',
214
+ dslabel: 'TermdbTest',
215
+ tw: {
216
+ term: { id: 'agedx', type: 'float' },
217
+ q: { mode: 'continuous' }
218
+ },
219
+ overlayTw: {
220
+ term: { id: 'sex', type: 'categorical' }
221
+ },
222
+ orderByMedian: true
223
+ }
224
+ },
225
+ response: {
226
+ header: { status: 200 }
227
+ }
228
+ }
229
+ ]
230
+ }
@@ -0,0 +1,36 @@
1
+ import type { PresetNumericBins, NumericBaseTerm, NumTW, RawNumTW } from '../index.ts'
2
+
3
+ /*
4
+ --------EXPORTED--------
5
+ IsoformExpressionTerm
6
+ IsoformExpressionTermWrapper
7
+ */
8
+
9
+ type Isoform = {
10
+ kind?: 'isoform'
11
+ isoform: string
12
+ gene?: string
13
+ chr?: string
14
+ start?: number
15
+ stop?: number
16
+ }
17
+
18
+ type Coord = {
19
+ kind?: 'coord'
20
+ isoform?: string
21
+ gene?: string
22
+ chr: string
23
+ start: number
24
+ stop: number
25
+ }
26
+
27
+ export type IsoformExpressionTerm = NumericBaseTerm & {
28
+ type: 'isoformExpression'
29
+ bins?: PresetNumericBins
30
+ } & (Isoform | Coord)
31
+
32
+ export type IsoformExpressionTW = NumTW & { term: IsoformExpressionTerm }
33
+
34
+ export type RawIsoformExpTerm = IsoformExpressionTerm & { name?: string }
35
+
36
+ export type RawIsoformExpTW = RawNumTW & { term: RawIsoformExpTerm }
@@ -4,6 +4,7 @@ import type {
4
4
  TermValues,
5
5
  BaseTerm,
6
6
  GeneExpressionTerm,
7
+ IsoformExpressionTerm,
7
8
  MetaboliteIntensityTerm,
8
9
  ProteomeAbundanceTerm,
9
10
  DateTerm,
@@ -62,6 +63,7 @@ export type RawNumericDictTerm = NumericDictTerm & {
62
63
  export type NumericTerm =
63
64
  | NumericDictTerm
64
65
  | GeneExpressionTerm
66
+ | IsoformExpressionTerm
65
67
  | MetaboliteIntensityTerm
66
68
  | ProteomeAbundanceTerm
67
69
  | DateTerm
package/src/vocab.ts CHANGED
@@ -23,7 +23,6 @@ export type VocabApi = {
23
23
  getterm: (f: any) => Term
24
24
  getTerms: (f: any) => any
25
25
  getTermdbConfig: () => any
26
- getViolinPlotData: (args: any, _body?: any) => any
27
26
  getAnnotatedSampleData: (args: any) => any
28
27
  getDefaultBins: (args: any) => any
29
28
  setTermBins(tw: TermWrapper): any