@sjcrh/proteinpaint-types 2.86.0 → 2.87.1

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 (233) hide show
  1. package/README.md +22 -0
  2. package/dist/brainImaging.js +11 -0
  3. package/dist/brainImagingSamples.js +11 -0
  4. package/dist/burden.js +11 -0
  5. package/dist/chunk-37ZPCVP5.js +111 -0
  6. package/dist/chunk-5GG2FNAY.js +62 -0
  7. package/dist/chunk-5JWTIWVB.js +222 -0
  8. package/dist/chunk-5RZYB4M4.js +171 -0
  9. package/dist/chunk-6EFB6ZMB.js +62 -0
  10. package/dist/chunk-6LFMFM2C.js +122 -0
  11. package/dist/chunk-7PMGKVWQ.js +62 -0
  12. package/dist/chunk-7Z3IHB43.js +152 -0
  13. package/dist/chunk-B3D26X6X.js +337 -0
  14. package/dist/chunk-BY2JABTF.js +256 -0
  15. package/dist/chunk-CETMA2FU.js +144 -0
  16. package/dist/chunk-DCN75URO.js +1740 -0
  17. package/dist/chunk-DIDZMC3G.js +96 -0
  18. package/dist/chunk-DKSPASWZ.js +4058 -0
  19. package/dist/chunk-EWRK4PKZ.js +62 -0
  20. package/dist/chunk-FDTUTGQG.js +288 -0
  21. package/dist/chunk-FZ6QOTGM.js +205 -0
  22. package/dist/chunk-GU7LIGHN.js +174 -0
  23. package/dist/chunk-IL33L6MY.js +126 -0
  24. package/dist/chunk-INDBFC54.js +1538 -0
  25. package/dist/chunk-IT7IGDC4.js +1697 -0
  26. package/dist/chunk-IWG5IPXG.js +3409 -0
  27. package/dist/chunk-JEQ3TBVQ.js +1472 -0
  28. package/dist/chunk-JPW6LFDQ.js +1507 -0
  29. package/dist/chunk-K2KQTFQI.js +113 -0
  30. package/dist/chunk-M33KP65Z.js +3347 -0
  31. package/dist/chunk-MUJUKENL.js +62 -0
  32. package/dist/chunk-N45Z3JCY.js +62 -0
  33. package/dist/chunk-OMHEDUNA.js +62 -0
  34. package/dist/chunk-OY3EKV7F.js +130 -0
  35. package/dist/chunk-Q56YNQFK.js +3417 -0
  36. package/dist/chunk-QDIIM52V.js +165 -0
  37. package/dist/chunk-QX7QLUKY.js +228 -0
  38. package/dist/chunk-RLFGMVJZ.js +234 -0
  39. package/dist/chunk-SDOWCOGK.js +96 -0
  40. package/dist/chunk-UCG25D2C.js +109 -0
  41. package/dist/chunk-UIU3IQH4.js +62 -0
  42. package/dist/chunk-W3F2RMPU.js +3494 -0
  43. package/dist/chunk-W3QYIXXF.js +273 -0
  44. package/dist/chunk-XGAOGA3F.js +159 -0
  45. package/dist/chunk-XJCQEOPB.js +61 -0
  46. package/dist/chunk-XLBSZOMF.js +117 -0
  47. package/dist/chunk-XQQ5G6N6.js +109 -0
  48. package/dist/chunk-Z6B6IQIY.js +1785 -0
  49. package/dist/dataset.js +11 -0
  50. package/dist/dsdata.js +11 -0
  51. package/dist/dzimages.js +11 -0
  52. package/dist/gdc.maf.js +11 -0
  53. package/dist/gdc.mafBuild.js +11 -0
  54. package/dist/gdc.topMutatedGenes.js +11 -0
  55. package/dist/genelookup.js +11 -0
  56. package/dist/genesetEnrichment.js +11 -0
  57. package/dist/genesetOverrepresentation.js +11 -0
  58. package/dist/healthcheck.js +11 -0
  59. package/dist/hicdata.js +11 -0
  60. package/dist/hicgenome.js +11 -0
  61. package/dist/hicstat.js +11 -0
  62. package/dist/index.js +347 -0
  63. package/dist/isoformlst.js +11 -0
  64. package/dist/ntseq.js +11 -0
  65. package/dist/pdomain.js +11 -0
  66. package/dist/samplewsimages.js +11 -0
  67. package/dist/snp.js +11 -0
  68. package/dist/termdb.DE.js +11 -0
  69. package/dist/termdb.boxplot.js +11 -0
  70. package/dist/termdb.categories.js +11 -0
  71. package/dist/termdb.cluster.js +11 -0
  72. package/dist/termdb.cohort.summary.js +11 -0
  73. package/dist/termdb.cohorts.js +11 -0
  74. package/dist/termdb.descrstats.js +11 -0
  75. package/dist/termdb.numericcategories.js +11 -0
  76. package/dist/termdb.percentile.js +11 -0
  77. package/dist/termdb.rootterm.js +11 -0
  78. package/dist/termdb.sampleImages.js +11 -0
  79. package/dist/termdb.singleSampleMutation.js +11 -0
  80. package/dist/termdb.singlecellDEgenes.js +11 -0
  81. package/dist/termdb.singlecellData.js +11 -0
  82. package/dist/termdb.singlecellSamples.js +11 -0
  83. package/dist/termdb.termchildren.js +11 -0
  84. package/dist/termdb.termsbyids.js +11 -0
  85. package/dist/termdb.topTermsByType.js +11 -0
  86. package/dist/termdb.topVariablyExpressedGenes.js +11 -0
  87. package/dist/termdb.violin.js +11 -0
  88. package/dist/tileserver.js +11 -0
  89. package/dist/wsimages.js +11 -0
  90. package/package.json +17 -15
  91. package/src/Mclass.ts +8 -0
  92. package/src/dataset.ts +1588 -0
  93. package/src/docs.json +16417 -0
  94. package/src/fileOrUrl.ts +15 -0
  95. package/src/filter.ts +125 -0
  96. package/src/genome.ts +123 -0
  97. package/src/index.ts +67 -0
  98. package/src/routes/brainImaging.ts +47 -0
  99. package/src/routes/brainImagingSamples.ts +25 -0
  100. package/src/routes/burden.ts +111 -0
  101. package/src/routes/dataset.ts +14 -0
  102. package/src/routes/dsdata.ts +14 -0
  103. package/src/routes/dzimages.ts +25 -0
  104. package/src/routes/errorResponse.ts +6 -0
  105. package/src/routes/filter.gdc.ts +15 -0
  106. package/src/routes/gdc.maf.ts +52 -0
  107. package/src/routes/gdc.mafBuild.ts +20 -0
  108. package/src/routes/gdc.topMutatedGenes.ts +37 -0
  109. package/src/routes/genelookup.ts +22 -0
  110. package/src/routes/genesetEnrichment.ts +60 -0
  111. package/src/routes/genesetOverrepresentation.ts +48 -0
  112. package/src/routes/healthcheck.ts +79 -0
  113. package/src/routes/hicdata.ts +48 -0
  114. package/src/routes/hicgenome.ts +50 -0
  115. package/src/routes/hicstat.ts +57 -0
  116. package/src/routes/isoformlst.ts +14 -0
  117. package/src/routes/ntseq.ts +14 -0
  118. package/src/routes/pdomain.ts +14 -0
  119. package/src/routes/routeApi.ts +41 -0
  120. package/src/routes/samplewsimages.ts +27 -0
  121. package/src/routes/snp.ts +13 -0
  122. package/src/routes/termdb.DE.ts +57 -0
  123. package/src/routes/termdb.boxplot.ts +78 -0
  124. package/src/routes/termdb.categories.ts +73 -0
  125. package/src/routes/termdb.cluster.ts +103 -0
  126. package/src/routes/termdb.cohort.summary.ts +14 -0
  127. package/src/routes/termdb.cohorts.ts +14 -0
  128. package/src/routes/termdb.descrstats.ts +78 -0
  129. package/src/routes/termdb.numericcategories.ts +32 -0
  130. package/src/routes/termdb.percentile.ts +65 -0
  131. package/src/routes/termdb.rootterm.ts +49 -0
  132. package/src/routes/termdb.sampleImages.ts +26 -0
  133. package/src/routes/termdb.singleSampleMutation.ts +29 -0
  134. package/src/routes/termdb.singlecellDEgenes.ts +41 -0
  135. package/src/routes/termdb.singlecellData.ts +69 -0
  136. package/src/routes/termdb.singlecellSamples.ts +46 -0
  137. package/src/routes/termdb.termchildren.ts +49 -0
  138. package/src/routes/termdb.termsbyids.ts +26 -0
  139. package/src/routes/termdb.topTermsByType.ts +32 -0
  140. package/src/routes/termdb.topVariablyExpressedGenes.ts +56 -0
  141. package/src/routes/termdb.violin.ts +122 -0
  142. package/src/routes/tileserver.ts +14 -0
  143. package/src/routes/wsimages.ts +24 -0
  144. package/src/terms/categorical.ts +106 -0
  145. package/src/terms/condition.ts +55 -0
  146. package/src/terms/geneExpression.ts +32 -0
  147. package/src/terms/geneVariant.ts +51 -0
  148. package/src/terms/metaboliteIntensity.ts +31 -0
  149. package/src/terms/numeric.ts +253 -0
  150. package/src/terms/q.ts +38 -0
  151. package/src/terms/samplelst.ts +41 -0
  152. package/src/terms/singleCellCellType.ts +22 -0
  153. package/src/terms/singleCellGeneExpression.ts +28 -0
  154. package/src/terms/snp.ts +28 -0
  155. package/src/terms/snps.ts +110 -0
  156. package/src/terms/term.ts +184 -0
  157. package/src/terms/tw.ts +38 -0
  158. package/src/terms/updated-types.ts +9 -0
  159. package/src/termsetting.ts +197 -0
  160. package/src/test/numeric.type.spec.ts +275 -0
  161. package/src/vocab.ts +37 -0
  162. package/dist/routes.ts +0 -28911
  163. package/src/Mclass.js +0 -0
  164. package/src/checkers/routes.js +0 -167
  165. package/src/dataset.js +0 -0
  166. package/src/fileOrUrl.js +0 -0
  167. package/src/filter.js +0 -0
  168. package/src/genome.js +0 -0
  169. package/src/index.js +0 -66
  170. package/src/routes/brainImaging.js +0 -11
  171. package/src/routes/brainImagingSamples.js +0 -11
  172. package/src/routes/burden.js +0 -44
  173. package/src/routes/dataset.js +0 -12
  174. package/src/routes/dsdata.js +0 -12
  175. package/src/routes/dzimages.js +0 -12
  176. package/src/routes/errorResponse.js +0 -0
  177. package/src/routes/filter.gdc.js +0 -0
  178. package/src/routes/gdc.maf.js +0 -17
  179. package/src/routes/gdc.mafBuild.js +0 -12
  180. package/src/routes/gdc.topMutatedGenes.js +0 -12
  181. package/src/routes/genelookup.js +0 -12
  182. package/src/routes/genesetEnrichment.js +0 -12
  183. package/src/routes/genesetOverrepresentation.js +0 -12
  184. package/src/routes/healthcheck.js +0 -23
  185. package/src/routes/hicdata.js +0 -12
  186. package/src/routes/hicgenome.js +0 -29
  187. package/src/routes/hicstat.js +0 -12
  188. package/src/routes/isoformlst.js +0 -12
  189. package/src/routes/ntseq.js +0 -12
  190. package/src/routes/pdomain.js +0 -12
  191. package/src/routes/routeApi.js +0 -0
  192. package/src/routes/samplewsimages.js +0 -12
  193. package/src/routes/snp.js +0 -11
  194. package/src/routes/termdb.DE.js +0 -13
  195. package/src/routes/termdb.boxplot.js +0 -12
  196. package/src/routes/termdb.categories.js +0 -48
  197. package/src/routes/termdb.cluster.js +0 -12
  198. package/src/routes/termdb.cohort.summary.js +0 -12
  199. package/src/routes/termdb.cohorts.js +0 -12
  200. package/src/routes/termdb.descrstats.js +0 -48
  201. package/src/routes/termdb.numericcategories.js +0 -12
  202. package/src/routes/termdb.percentile.js +0 -49
  203. package/src/routes/termdb.rootterm.js +0 -27
  204. package/src/routes/termdb.sampleImages.js +0 -12
  205. package/src/routes/termdb.singleSampleMutation.js +0 -12
  206. package/src/routes/termdb.singlecellDEgenes.js +0 -12
  207. package/src/routes/termdb.singlecellData.js +0 -12
  208. package/src/routes/termdb.singlecellSamples.js +0 -12
  209. package/src/routes/termdb.termchildren.js +0 -28
  210. package/src/routes/termdb.termsbyids.js +0 -12
  211. package/src/routes/termdb.topTermsByType.js +0 -12
  212. package/src/routes/termdb.topVariablyExpressedGenes.js +0 -12
  213. package/src/routes/termdb.violin.js +0 -49
  214. package/src/routes/tileserver.js +0 -12
  215. package/src/routes/wsimages.js +0 -12
  216. package/src/terms/categorical.js +0 -0
  217. package/src/terms/condition.js +0 -0
  218. package/src/terms/geneExpression.js +0 -0
  219. package/src/terms/geneVariant.js +0 -0
  220. package/src/terms/metaboliteIntensity.js +0 -0
  221. package/src/terms/numeric.js +0 -0
  222. package/src/terms/q.js +0 -0
  223. package/src/terms/samplelst.js +0 -0
  224. package/src/terms/singleCellCellType.js +0 -0
  225. package/src/terms/singleCellGeneExpression.js +0 -0
  226. package/src/terms/snp.js +0 -0
  227. package/src/terms/snps.js +0 -0
  228. package/src/terms/term.js +0 -0
  229. package/src/terms/tw.js +0 -0
  230. package/src/terms/updated-types.js +0 -0
  231. package/src/termsetting.js +0 -0
  232. package/src/test/numeric.type.spec.js +0 -117
  233. package/src/vocab.js +0 -0
package/src/dataset.ts ADDED
@@ -0,0 +1,1588 @@
1
+ import type { Mclass } from './Mclass.ts'
2
+
3
+ /*** General usage types ***/
4
+ type FileObj = {
5
+ file: string
6
+ }
7
+
8
+ type KeyVal = {
9
+ k: string
10
+ v?: string
11
+ }
12
+
13
+ type KeyLabel = {
14
+ key: string
15
+ label: string
16
+ }
17
+
18
+ /** a set of categories about a vcf INFO field */
19
+ export type InfoFieldCategories = {
20
+ /** category key from an INFO field of a vcf file */
21
+ [index: string]: {
22
+ /** Color used for rendering labels and backgrounds in the legend, tables, etc. */
23
+ color: string
24
+ /** Human readable label */
25
+ label?: string
26
+ /** Shown in the legend on label click */
27
+ desc: string
28
+ /** When .color is used as the background, denoted whether
29
+ * to use 'white', 'black', or other color for the text */
30
+ textcolor?: string
31
+ }
32
+ }
33
+
34
+ type NumericFilterEntry = {
35
+ /** '<' or '>' for filtering */
36
+ side: string
37
+ /** value for filtering */
38
+ value: number
39
+ }
40
+
41
+ type AFEntry = {
42
+ /** human readable label */
43
+ name: string
44
+ /** */
45
+ locusinfo: {
46
+ /** usually the data dictionary value (e.g. AF_EXAC for ExAC frequency) */
47
+ key: string
48
+ }
49
+ /** key/values for filtering */
50
+ numericfilter: NumericFilterEntry[]
51
+ }
52
+
53
+ /** Specific allele freq info for ClinVar */
54
+ export type ClinvarAF = {
55
+ [index: string]: AFEntry
56
+ }
57
+
58
+ /*** types supporting Queries type ***/
59
+
60
+ type InfoFieldEntry = {
61
+ /** Human readable name to display */
62
+ name: string
63
+ /** vcf INFO field */
64
+ key: string
65
+ /** a set of categories about a vcf INFO field */
66
+ categories?: InfoFieldCategories
67
+ /** seperator (e.g. '&', '|' ) between join values */
68
+ separator?: string
69
+ }
70
+
71
+ /*
72
+ type GenomicPositionEntry = {
73
+ chr: string
74
+ start: number
75
+ stop: number
76
+ }
77
+ */
78
+
79
+ type Chr2bcffile = {
80
+ /** index is the chr (e.g. 'chr1', 'chr2', etc.)
81
+ * value is the bcf file path */
82
+ [index: string]: string
83
+ }
84
+
85
+ type bcfMafFile = {
86
+ /** bcf file for only variants, no samples and FORMAT */
87
+ bcffile: string
88
+ /** maf file for sample mutations. bcf header contents with FORMAT and list of samples are
89
+ * copied into this maf as headers followed by the maf header starting with #chr, pos, ref,
90
+ * alt and sample. Each column after sample corresponds to the information in FORMAT. file
91
+ * is bgzipped and tabix indexed (tabix -c"#" -s 1 -b 2 -e 2 <maf.gz>) */
92
+ maffile: string
93
+ }
94
+
95
+ type SnvindelByRange = {
96
+ /** if true, served from gdc. no other parameters TODO change to src='gdc/native' */
97
+ gdcapi?: boolean
98
+
99
+ //local ds can have following different setup
100
+
101
+ /** one single bcf file */
102
+ bcffile?: string
103
+ /** one bcf file per chr */
104
+ chr2bcffile?: Chr2bcffile
105
+ /** bcf+maf combined */
106
+ bcfMafFile?: bcfMafFile
107
+ /** allow to apply special configurations to certain INFO fields of the bcf file */
108
+ infoFields?: InfoFieldEntry[]
109
+ /** if true, bcf or chr2bcf uses string sample name in header. to be used during this migrating so the code can deal with old files with integer sample ids and new ones; TODO once all datasets are migrated, delete the flag */
110
+ tempflag_sampleNameInVcfHeader?: boolean
111
+ }
112
+
113
+ type URLEntry = {
114
+ /** base URL, including the host and possibly other queries */
115
+ base?: string
116
+ key?: string
117
+ namekey?: string
118
+ label?: string
119
+ url?: string
120
+ }
121
+
122
+ type SkewerRim = {
123
+ /** only enabled for 'format' */
124
+ type: string
125
+ /** 'origin' */
126
+ formatKey: string
127
+ /** 'somatic' or 'germline', generally germline */
128
+ rim1value: string
129
+ /** 'somatic' or 'germline', generally somatic */
130
+ noRimValue: string
131
+ }
132
+
133
+ type GdcApi = {
134
+ /** Represents the configuration for accessing the GDC API. */
135
+ gdcapi?: boolean
136
+ }
137
+
138
+ type SnvIndelFormat = {
139
+ [index: string]: {
140
+ /* has value for a non-GT field indicating the variant
141
+ is annotated to this sample*/
142
+ ID: string
143
+ Description: string
144
+ /** 'R' or 1. do not parse values here based on Number="R"
145
+ as we don't need to compute on the format values on backend
146
+ client will parse the values for display */
147
+ Number: string | number
148
+ Type: string
149
+ }
150
+ }
151
+
152
+ type FilterValues = {
153
+ [index: string | number]: {
154
+ key?: string | number
155
+ label: string
156
+ }
157
+ }
158
+
159
+ type RangesEntry = {
160
+ start: number
161
+ startinclusive: boolean
162
+ stopunbounded: boolean
163
+ }
164
+
165
+ type BaseTvsFilter = {
166
+ isnot?: boolean
167
+ ranges?: RangesEntry[]
168
+ }
169
+
170
+ type TvsFilter = BaseTvsFilter & {
171
+ values?: (string | number | { label: string })[]
172
+ }
173
+
174
+ export type FilterTermEntry = BaseTvsFilter & {
175
+ id: string
176
+ name: string
177
+ type: string
178
+ parent_id: string | null
179
+ isleaf: boolean
180
+ values?: FilterValues
181
+ tvs?: TvsFilter
182
+ min?: number
183
+ max?: number
184
+ }
185
+
186
+ type FilterLstTvs = BaseTvsFilter & {
187
+ term: FilterTermEntry
188
+ values: (string | number | FilterValues)[]
189
+ }
190
+
191
+ type FilterLstEntry = {
192
+ type: string
193
+ tvs: FilterLstTvs
194
+ }
195
+
196
+ type Filter = {
197
+ type: string
198
+ join: string
199
+ in: boolean
200
+ lst?: FilterLstEntry[]
201
+ }
202
+
203
+ type VariantFilter = {
204
+ opts: { joinWith: string[] }
205
+ filter: Filter
206
+ terms: FilterTermEntry[]
207
+ }
208
+
209
+ /** one set of AC and AN info fields to retrieve data for this population */
210
+ type PopulationINFOset = {
211
+ /** optional name for identifying this set, when the population is ancestry-stratified and a population has multiple sets */
212
+ key?: string
213
+ /** required info field */
214
+ infokey_AC: string
215
+ /** required info field */
216
+ infokey_AN: string
217
+ /** Optional */
218
+ termfilter_value?: string
219
+ }
220
+
221
+ /* define method to retrieve allele AC/AN in a population, by using bcf INFO fields; population could be ancestry-stratified
222
+ two types of population are supported:
223
+ - ancestry-stratified
224
+ allowto_adjust_race can be set to true
225
+ sets[] has >1 elements
226
+ - not stratified
227
+ allowto_adjust_race cannot be set to true
228
+ sets[] has only 1 element
229
+ */
230
+ type Population = {
231
+ /** for identifying this element */
232
+ key: string
233
+ /** display, in fact it can replace key since label should also be unique*/
234
+ label: string
235
+ /** allow to set to true for race-stratified population, will adjust population AC/AN values based on admix coefficient for the dataset's cohort variants
236
+ * supposed to be "read-only" attribute and not modifiable in runtime */
237
+ allowto_adjust_race?: boolean
238
+ /** when above is true, this flag is flip switch for this adjustion */
239
+ adjust_race?: boolean
240
+ /** optional term id used for race adjusting, must correspond to a term in dataset db */
241
+ termfilter?: string
242
+ /** if AC/AN of the population is ancestry-stratified, will be multiple elements of this array; otherwise just one */
243
+ sets: PopulationINFOset[]
244
+ }
245
+
246
+ /** a data type under ds.queries{} */
247
+ type SnvIndelQuery = {
248
+ forTrack?: boolean
249
+ /** allow to query data by either isoform or range
250
+ * isoform query is only used for gdc api
251
+ */
252
+ byisoform?: GdcApi
253
+ /** query data by range */
254
+ byrange: SnvindelByRange
255
+
256
+ infoUrl?: URLEntry[]
257
+ skewerRim?: SkewerRim
258
+ format4filters?: string[]
259
+ format?: SnvIndelFormat
260
+ variant_filter?: VariantFilter
261
+ populations?: Population[]
262
+ /** NOTE **
263
+ this definition can appear either in queries.snvindel{} or termdb{}
264
+ so that it can work for a termdb-less ds, e.g. clinvar, where termdbConfig cannot be made */
265
+ ssmUrl?: UrlTemplateSsm
266
+ m2csq?: {
267
+ gdcapi?: boolean
268
+ by: string
269
+ }
270
+ allowSNPs?: boolean
271
+ vcfid4skewerName?: boolean
272
+ details?: any
273
+ }
274
+
275
+ type SvFusion = {
276
+ byrange: {
277
+ /** file paths for sv fusion data */
278
+ file?: string
279
+ }
280
+ }
281
+
282
+ type SingleSampleMutationQuery = {
283
+ src: 'native' | 'gdcapi' | string
284
+ /** which property of client mutation object to retrieve sample identifier for
285
+ * querying single sample data with */
286
+ sample_id_key: string
287
+ /** only required for src=native */
288
+ folder?: string
289
+ /** quick fix to hide chrM from disco, due to reason e.g. this dataset doesn't
290
+ * have data on chrM */
291
+ discoSkipChrM?: true
292
+ }
293
+
294
+ type NIdataQuery = {
295
+ /** Reference obj for NI data query. */
296
+ Ref1: NIdataQueryRef
297
+ }
298
+
299
+ type NIdataQueryRef = {
300
+ /** file path for the reference file */
301
+ referenceFile: string
302
+ /** file path for the sample file */
303
+ samples: string
304
+ /** Parameters for slice indices in the mass brain imaging plot */
305
+ parameters?: NIdataQueryRefParams
306
+ /** optional terms to show as table columns and annotate samples */
307
+ sampleColumns?: { termid: string }[]
308
+ }
309
+
310
+ type NIdataQueryRefParams = {
311
+ /** index of slice for default sagittal plane */
312
+ l: number
313
+ /** index of slice for default coronal plane */
314
+ f: number
315
+ /** index of slice for default axial plane */
316
+ t: number
317
+ }
318
+
319
+ /** used for the gene set edit ui */
320
+ export type GeneArgumentEntry = {
321
+ /** Dom element id
322
+ * Use the cooresponding parameter name as the id
323
+ */
324
+ id: string
325
+ /** label/prompt for the checkbox, input, etc. */
326
+ label: string
327
+ /** Optional: Creates subtext below the main label */
328
+ sublabel?: string
329
+ /** boolean and string creates a checkbox
330
+ * number creates a text input
331
+ */
332
+ type: 'boolean' | 'string' | 'number' | 'radio'
333
+ /** value of the input or checkbox
334
+ * required if type is string. Otherwise, optional
335
+ */
336
+ value?:
337
+ | string
338
+ | boolean
339
+ | number
340
+ | {
341
+ type: string
342
+ value: string[] | null
343
+ }
344
+ options?: {
345
+ /** Type of dom element to render underneath the radio
346
+ * 'text': creates a text area input
347
+ * 'tree': launches termdb app and the tree
348
+ * 'boolean': No element is created
349
+ */
350
+ type: 'text' | 'tree' | 'boolean' | string
351
+ /** value used to construct the server argument
352
+ * also the element id in the gene set edit ui
353
+ */
354
+ value: number | string
355
+ /** radio label */
356
+ label: string
357
+ /** Optional: smaller text that appears underneath the label */
358
+ sublabel?: string
359
+ }[]
360
+ }
361
+
362
+ type TopVariablyExpressedGenesQuery = {
363
+ /** Denotes either gdc specific data requests or common
364
+ * data request processing */
365
+ src: 'gdcapi' | 'native' | string
366
+ /** Specifies the dom element rendered in the menu */
367
+ arguments?: GeneArgumentEntry[]
368
+ }
369
+
370
+ type TopMutatedGenes = {
371
+ /** Specifies the dom element rendered in the menu */
372
+ arguments?: GeneArgumentEntry[]
373
+ }
374
+
375
+ type TklstEntry = {
376
+ /** Determines the column to add the track via the assay names
377
+ * shown at the top of the facet table.*/
378
+ assay?: string
379
+ /** track type (e.g. bigwig, bedj, etc.) */
380
+ type: string
381
+ /** Human readable name */
382
+ name: string
383
+ /** Corresponding sample id in the data file */
384
+ sampleID?: string
385
+ /** data file path */
386
+ file: string
387
+ /** The key for the second tier of the facet table*/
388
+ level1?: string
389
+ /** The key for the third tier of the facet table*/
390
+ level2?: string
391
+ /** Whether the track is shown by default */
392
+ defaultShown?: boolean
393
+ /** Track height */
394
+ stackheight?: number
395
+ /** Space added to the height of the track */
396
+ stackspace?: number
397
+ /** padding-top for the track */
398
+ toppad?: number
399
+ /** padding-bottom for the track */
400
+ bottompad?: number
401
+ /** Specifically for bedj tracks. if true, will render all items in a
402
+ * single row and do not stack them */
403
+ onerow?: number | boolean
404
+ }
405
+
406
+ type TrackLstEntry = {
407
+ /** creates a facet table if true. */
408
+ isfacet: boolean
409
+ /** name shown for the facet table button from Tracks button*/
410
+ name: string
411
+ /** tk objs to show on click of the facet table */
412
+ tklst: TklstEntry[]
413
+ }
414
+
415
+ type CnvSegment = {
416
+ byrange: CnvSegmentByRange
417
+ /****** rendering parameters ****
418
+ not used as query parameter to filter segments
419
+ value range for color scaling. default to 5. cnv segment value>this will use solid color
420
+ */
421
+ absoluteValueRenderMax?: number
422
+ gainColor?: string
423
+ lossColor?: string
424
+
425
+ /*** filtering parameters ***
426
+ default max length setting to restrict to focal events; if missing show all */
427
+ cnvMaxLength?: number
428
+
429
+ /** TODO define value type, if logratio, or copy number */
430
+
431
+ /** following two cutoffs only apply to log ratio, cnv gain value is positive, cnv loss value is negative
432
+ if cnv is gain, skip if value<this cutoff */
433
+ cnvGainCutoff?: number
434
+ /** if cnv is loss, skip if value>this cutoff */
435
+ cnvLossCutoff?: number
436
+ }
437
+
438
+ type CnvSegmentByRange = {
439
+ src: 'native' | 'gdcapi' | string
440
+ /** only for src=native */
441
+ file?: string
442
+ }
443
+
444
+ /*
445
+ no longer used!!
446
+ file content is a probe-by-sample matrix, values are signals
447
+ for a given region, the median signal from probes in the region is used to make a gain/loss call for each sample
448
+ this is alternative to CnvSegment
449
+
450
+ type Probe2Cnv = {
451
+ file: string
452
+ }
453
+ */
454
+
455
+ type RnaseqGeneCount = {
456
+ /** Name of the HDF5 or text file */
457
+ file: string
458
+ samplesFile?: string
459
+ /** Storage_type for storing data (HDF5 or text). Will deprecate text files in the future */
460
+ storage_type: 'text' | 'HDF5'
461
+ }
462
+
463
+ /** the metabolite query */
464
+ export type MetaboliteIntensityQueryNative = {
465
+ src: 'native' | string
466
+ file: string
467
+ samples?: number[]
468
+ /** _metabolites,used to dynamically built cache of metabolite names to speed up search */
469
+ _metabolites?: string[]
470
+ get?: (param: any) => void
471
+ find?: (param: string[]) => void
472
+ metaboliteIntensity2bins?: { [index: string]: any }
473
+ }
474
+
475
+ export type MetaboliteIntensityQuery = MetaboliteIntensityQueryNative
476
+
477
+ /** the geneExpression query */
478
+ export type GeneExpressionQueryGdc = {
479
+ src: 'gdcapi' | string
480
+ geneExpression2bins?: { [index: string]: any }
481
+ }
482
+
483
+ export type GeneExpressionQueryNative = {
484
+ src: 'native' | string
485
+ file: string
486
+ /** dynamically added during server launch, list of sample integer IDs from file */
487
+ samples?: number[]
488
+ nochr?: boolean
489
+ get?: (param: any) => void
490
+ /** This dictionary is used to store/cache the default bins calculated for a geneExpression term when initialized in the fillTermWrapper */
491
+ geneExpression2bins?: { [index: string]: any }
492
+ /** Type of data format HDF5 or bed */
493
+ storage_type?: 'HDF5' | 'bed'
494
+ }
495
+
496
+ export type GeneExpressionQuery = GeneExpressionQueryGdc | GeneExpressionQueryNative
497
+
498
+ export type SingleCellGeneExpressionNative = {
499
+ src: 'native'
500
+ /** path to R rds or HDF5 files, each is a gene-by-cell matrix for a sample, with ".rdx" suffix. missing files are detected and handled */
501
+ folder: string
502
+ /** HDF5 or RDS file, will deprecate RDS file later */
503
+ storage_type: 'HDF5' | 'RDS'
504
+ /** dynamically added getter */
505
+ get?: (q: any) => any
506
+ /** cached gene exp bins */
507
+ sample2gene2expressionBins?: { [sample: string]: { [gene: string]: any } }
508
+ }
509
+
510
+ export type SingleCellGeneExpressionGdc = {
511
+ src: 'gdcapi'
512
+ }
513
+
514
+ export type SingleCellSamplesNative = {
515
+ src: 'native'
516
+
517
+ /** logic to decide sample table columns (the one shown on singlecell app ui, displaying a table of samples with sc data)
518
+ a sample table will always have a sample column, to show sample.sample value
519
+ firstColumnName allow to change name of 1st column from "Sample" to different, e.g. "Case" for gdc
520
+ the other two properties allow to declare additional columns to be shown in table, that are for display only
521
+ when sample.experiments[] are used, a last column of experiment id will be auto added
522
+ */
523
+ firstColumnName?: string
524
+
525
+ /** do not use for native ds! gdc-only property. kept as optional to avoid tsc err */
526
+ experimentColumns?: string
527
+
528
+ /** any other columns to be added to sample table. each is a term id */
529
+ sampleColumns?: { termid: string }[]
530
+
531
+ /** dynamically added getter */
532
+ get?: (q: any) => any
533
+ }
534
+
535
+ export type SingleCellSamplesGdc = {
536
+ src: 'gdcapi'
537
+ get?: (q: any) => any
538
+ /** if missing refer to the samples as 'sample', this provides override e.g. 'case' */
539
+ firstColumnName?: string
540
+ sampleColumns?: { termid: string }[]
541
+ experimentColumns?: { label: string }[]
542
+ }
543
+
544
+ export type SingleCellDataGdc = {
545
+ src: 'gdcapi'
546
+ sameLegend: boolean
547
+ get?: (q: any) => any
548
+ refName?: string
549
+ plots: GDCSingleCellPlot[]
550
+ width?: number
551
+ height?: number
552
+ }
553
+
554
+ export type SingleCellDEgeneGdc = {
555
+ src: 'gdcapi'
556
+ /** Column name.
557
+ this must be the colorColumn from one of the plots. so that at the client app, as soon as the plot data have been loaded and maps rendered, client will find out the cell groups based on this columnName value, and show a drop down of these groups on UI. user selects a group, and pass it as request body to backend to get DE genes for this group
558
+ */
559
+ columnName: string
560
+ }
561
+
562
+ type GDCSingleCellPlot = {
563
+ name: string
564
+ colorColumns: ColorColumn[]
565
+ coordsColumns: { x: number; y: number }
566
+ /** if true the plot is shown by default. otherwise hidden */
567
+ selected?: boolean
568
+ }
569
+
570
+ type ColorColumn = {
571
+ /** 0-based column number in the tabular file */
572
+ index?: number
573
+ /** name of the column */
574
+ name: string
575
+ /** column values (categories) to color mapping */
576
+ colorMap?: { [index: string]: string }
577
+ }
578
+
579
+ /** defines a tsne type of plot for cells from one sample */
580
+ type SingleCellPlot = {
581
+ /** type of the plot, e.g. tsne or umap, also display as plot name on ui */
582
+ name: string
583
+ /** folder in which per-sample files are stored.
584
+ each file is a tabular text file with all cells (rows) from that sample.
585
+ all files must have same set of columns
586
+ file columns include cell types and x/y coords, as described by other parameters
587
+ */
588
+ folder: string
589
+ /** optional suffix to locate the file for a sample, via ${folder}/${sampleName}${fileSuffix}
590
+ assumes that file name always start with sample name.
591
+ if not introduce filePrefix
592
+ */
593
+ fileSuffix?: string
594
+ /** list of columns in tabular text file that define cell categories and can be used to color the cells in the plot. must have categorical values
595
+ */
596
+ colorColumns: ColorColumn[]
597
+ /** 0-based column number for x/y coordinate for this plot */
598
+ coordsColumns: { x: number; y: number }
599
+ /** if true the plot is shown by default. otherwise hidden */
600
+ selected?: boolean
601
+ }
602
+ export type SingleCellDataNative = {
603
+ src: 'native'
604
+ /** when a sample has multiple tsne plots, this flag allows allows all plots to share one cell type legend */
605
+ sameLegend: boolean
606
+ /** available tsne type of plots for each sample */
607
+ plots: SingleCellPlot[]
608
+ /** name of ref cells? */
609
+ refName?: string
610
+ /** dynamically added getter */
611
+ get?: (q: any) => any
612
+ /** width and height of the plots */
613
+
614
+ width?: number
615
+ height?: number
616
+ }
617
+
618
+ export type SingleCellQuery = {
619
+ /** methods to identify samples with singlecell data,
620
+ this data allows client-side to display a table with these samples for user to choose from
621
+ also, sampleView uses this to determine if to invoke the sc plot for a sample
622
+ */
623
+ samples: SingleCellSamplesGdc | SingleCellSamplesNative
624
+ /** defines tsne/umap type of clustering maps for each sample
625
+ */
626
+ data: SingleCellDataGdc | SingleCellDataNative
627
+ /** defines available gene-level expression values for each cell of each sample */
628
+ geneExpression?: SingleCellGeneExpressionGdc | SingleCellGeneExpressionNative
629
+ /** Precomputed top differentialy expressed genes for a cell cluster, against rest of cells */
630
+ DEgenes?: SingleCellDEgeneGdc
631
+ }
632
+
633
+ type LdQuery = {
634
+ /** each track obj defines a ld track */
635
+ tracks: {
636
+ /** for displaying and identifying a track. must not duplicate */
637
+ name: string
638
+ /** relative path of ld .gz file */
639
+ file: string
640
+ /** dynamically added full path */
641
+ file0?: string
642
+ /** dynamically added */
643
+ nochr?: boolean
644
+ /** if to show by default */
645
+ shown: boolean
646
+ /** max range allowed to show data */
647
+ viewrangelimit: number
648
+ }[]
649
+ /** color scale when LD is used to overlay on variants of a locus */
650
+ overlay: {
651
+ /** color for r2 value 1 */
652
+ color_1: string
653
+ /** Color for r2 value 0 */
654
+ color_0: string
655
+ }
656
+ }
657
+
658
+ /** one more multiple sets of genome-wide plots per sample, e.g. dna meth probe beta values. the plot has a Y axis and shows all chromosomes. each key is one set of such plot. there could be multiple sets */
659
+ type SingleSampleGenomeQuantification = {
660
+ [index: string]: {
661
+ /** description of this data */
662
+ description: string
663
+ /** min value of Y axis */
664
+ min: number
665
+ /** max value of Y axis */
666
+ max: number
667
+ sample_id_key: string
668
+ /** folder path of data files per sample */
669
+ folder: string
670
+ /** plot color for positive values */
671
+ positiveColor: string
672
+ /** plot color for negative values */
673
+ negativeColor: string
674
+ /** optionally, link the plot to singleSampleGbtk, in that clicking on the plot will luanch a detailed block view defined by singleSampleGbtk */
675
+ singleSampleGbtk?: string
676
+ }
677
+ }
678
+
679
+ /** single sample genome browser track. each key corresponds to one track. currently hardcoded to "<sampleId>.gz" bedgraph files in the folder */
680
+ type SingleSampleGbtk = {
681
+ [index: string]: {
682
+ /** description of this data */
683
+ description: string
684
+ /** min value of Y axis */
685
+ min: number
686
+ /** max value of Y axis */
687
+ max: number
688
+ /** */
689
+ sample_id_key: string
690
+ /** folder path of data files per sample */
691
+ folder: string
692
+ }
693
+ }
694
+
695
+ type Mds3Queries = {
696
+ defaultBlock2GeneMode?: boolean
697
+ snvindel?: SnvIndelQuery
698
+ svfusion?: SvFusion
699
+ cnv?: CnvSegment
700
+ singleSampleMutation?: SingleSampleMutationQuery
701
+ NIdata?: NIdataQuery
702
+ geneExpression?: GeneExpressionQuery
703
+ rnaseqGeneCount?: RnaseqGeneCount
704
+ /** Used to create the top mutated genes UI in the gene
705
+ * set edit ui and data requests. */
706
+ topMutatedGenes?: TopMutatedGenes
707
+ /** Used to create the top variably expressed UI in the gene
708
+ * set edit ui. Also used for data requests */
709
+ topVariablyExpressedGenes?: TopVariablyExpressedGenesQuery
710
+ metaboliteIntensity?: {
711
+ src: 'native' | 'gdc'
712
+ file: string
713
+ }
714
+ trackLst?: TrackLstEntry[]
715
+ singleCell?: SingleCellQuery
716
+ geneCnv?: {
717
+ bygene?: {
718
+ gdcapi: true
719
+ }
720
+ }
721
+ defaultCoord?: string
722
+ ld?: LdQuery
723
+ singleSampleGenomeQuantification?: SingleSampleGenomeQuantification
724
+ singleSampleGbtk?: SingleSampleGbtk
725
+ /** depreciated. replaced by WSImages */
726
+ DZImages?: DZImages
727
+ WSImages?: WSImages
728
+ images?: Images
729
+ }
730
+
731
+ /** non-zoom small images
732
+ iamge file to sample mapping is stored in images table
733
+ */
734
+ type Images = {
735
+ /** folder where the per-sample image files are stored */
736
+ folder: string
737
+ }
738
+
739
+ /** Depreciated. deep zoom image shown via openseadragon, with precomputed tiles.
740
+ * this is replaced by WSImages and should not be used anymore */
741
+ export type DZImages = {
742
+ // type of the image, e.g. H&E
743
+ type: string
744
+ // path to the folder where sample images are stored
745
+ imageBySampleFolder: string
746
+ }
747
+
748
+ /** deep zoom image shown via tiatoolbox, covers any big image files including whole-slide image.
749
+ image file to sample mapping is stored in wsimages table
750
+ */
751
+ export type WSImages = {
752
+ // type of the image, e.g. H&E
753
+ type: string
754
+ // path to the folder where sample images are stored
755
+ imageBySampleFolder: string
756
+ // TODO extend to support multiple sources
757
+ //sources?: []
758
+ }
759
+
760
+ /*** types supporting Termdb ***/
761
+
762
+ type TermIds = {
763
+ [index: string]: string
764
+ }
765
+
766
+ type SelectCohortValuesEntry = {
767
+ keys: string[]
768
+ label: string
769
+ shortLabel: string
770
+ isdefault?: boolean
771
+ note?: string
772
+ }
773
+
774
+ export type SelectCohortEntry = {
775
+ term: { id: string; type: string }
776
+ /** Title above the cohort introduction/content in the about tab */
777
+ title?: string
778
+ /** Text above radio cohort options in the about tab. */
779
+ prompt: string
780
+ values: SelectCohortValuesEntry[]
781
+ description?: string
782
+ /* If the description is dependent on the user pass a descriptionByUser dict instead */
783
+ descriptionByUser?: { [index: string]: string }
784
+ /** subtext shown at the very bottom of the cohort/about tab subheader */
785
+ asterisk?: string
786
+ //The profile has clearOnChange. The terms used in the plots are not always the same for the profile.
787
+ //Therefore when switching cohorts, it is necessary to delete the plots opened and the global filter
788
+ clearOnChange?: { [index: string]: boolean }
789
+ }
790
+
791
+ type MissingAccess = {
792
+ message: string
793
+ links: { [index: string]: string }
794
+ }
795
+
796
+ type DataDownloadCatch = {
797
+ helpLink: string
798
+ missingAccess: MissingAccess
799
+ jwt: { [index: string]: string }
800
+ }
801
+
802
+ //Plots
803
+
804
+ type ScatterPlotsEntry = {
805
+ name: string
806
+ dimension: number
807
+ file: string
808
+ coordsColumns?: { x: number; y: number; z?: number }
809
+ settings?: { [index: string]: any }
810
+ /** by default the dots are called "samples" on the plot, use this to call it by diff name e.g. "cells" */
811
+ sampleType?: string
812
+ /** a plot can be colored by either a dict term termsetting (colorTW) or file column values (colorColumn) */
813
+ colorTW?: { id: string }
814
+ colorColumn?: ColorColumn
815
+ /** provide a sampletype term to filter for specific type of samples for subjects with multiple samples and show in the plot.
816
+ e.g. to only show D samples from all patients
817
+ this is limited to only one term and doesn't allow switching between multiple terms
818
+ */
819
+ sampleCategory?: {
820
+ /** categorical term like "sampleType" which describes types of multiple samples from the same subject */
821
+ tw: { id: string }
822
+ /** default category */
823
+ defaultValue: string
824
+ /** order of categories */
825
+ order: string[]
826
+ }
827
+ }
828
+
829
+ type Scatterplots = {
830
+ plots: ScatterPlotsEntry[]
831
+ }
832
+
833
+ type MatrixSettingsControlLabels = {
834
+ samples?: string
835
+ sample?: string
836
+ Samples?: string
837
+ Sample?: string
838
+ Mutations?: string
839
+ Mutation?: string
840
+ }
841
+
842
+ type SurvPlotsEntry = {
843
+ name: string
844
+ serialtimekey: string
845
+ iscensoredkey: string
846
+ timelabel: string
847
+ }
848
+
849
+ type SurvPlots = {
850
+ [index: string]: SurvPlotsEntry
851
+ }
852
+
853
+ type sampleGroupAttrLstEntry = { key: string }
854
+
855
+ type SurvivalPlot = {
856
+ plots: SurvPlots
857
+ samplegroupattrlst: sampleGroupAttrLstEntry[]
858
+ }
859
+
860
+ type TieBreakerFilterValuesEntry = {
861
+ dt: number
862
+ }
863
+
864
+ type TieBreakerFilter = {
865
+ values: TieBreakerFilterValuesEntry[]
866
+ }
867
+
868
+ type TieBreakersEntry = {
869
+ by: string
870
+ order?: (string | number)[]
871
+ filter?: TieBreakerFilter
872
+ }
873
+
874
+ type SortPriorityEntry = {
875
+ types: string[]
876
+ tiebreakers: TieBreakersEntry[]
877
+ }
878
+
879
+ type SurvivalSettings = {
880
+ /** The max time-to-event to be displayed in plot, hide all the samples with Time-to-Event longer than this maxTimeToEvent */
881
+ maxTimeToEvent?: number
882
+ }
883
+
884
+ type MatrixSettings = {
885
+ maxSample?: number
886
+ svgCanvasSwitch?: number
887
+ cellEncoding?: string
888
+ cellbg?: string
889
+ controlLabels?: MatrixSettingsControlLabels
890
+ sortSamplesBy?: string
891
+ sortPriority?: SortPriorityEntry[]
892
+ ignoreCnvValues?: boolean
893
+ geneVariantCountSamplesSkipMclass?: string[]
894
+ /** all the truncating mutations exist in the dataset */
895
+ truncatingMutations?: string[]
896
+ /** all the protein-changing mutations mutations exist in the dataset */
897
+ proteinChangingMutations?: string[]
898
+ /** all the mutation classes exist in the dataset */
899
+ mutationClasses?: string[]
900
+ /** all the CNV classes exist in the dataset */
901
+ CNVClasses?: string[]
902
+ /** all the synonymous mutations exist in the dataset */
903
+ synonymousMutations?: string[]
904
+ showHints?: string[]
905
+ displayDictRowWithNoValues?: boolean
906
+ /** allow to add two buttons (CNV and mutation) to control panel for selecting
907
+ * mclasses displayed on oncoMatrix */
908
+ addMutationCNVButtons?: boolean
909
+ /** this is now computed from sortPriority[x].tiebreakers.find(tb =>
910
+ * tb.filter?.values[0]?.dt === 1) ... */
911
+ sortByMutation?: string
912
+ /** this is now computed from sortPriority[x].tiebreakers.find(tb =>
913
+ * tb.filter?.values[0]?.dt === 4).isOrdered */
914
+ sortByCNV?: boolean
915
+ cnvUnit?: 'log2ratio' | 'segmedian'
916
+ }
917
+
918
+ type NumericDictTermClusterSettings = {
919
+ /** default hiercluster group name */
920
+ termGroupName?: string
921
+ zScoreTransformation?: boolean
922
+ colorScale?: string
923
+ }
924
+
925
+ type Matrix = {
926
+ /** alternative name, e.g. the plot is called "oncomatrix" in gdc; by default it's called "matrix" */
927
+ appName?: string
928
+ /** default settings for matrix plot */
929
+ settings?: MatrixSettings
930
+ /** matrix-specific mclass override? */
931
+ mclass?: Mclass
932
+ // TODO: improve definitions below
933
+ legendGrpFilter?: any
934
+ legendValueFilter?: any
935
+ }
936
+
937
+ // specific hierCluster type settings, should be named as "dataTYpe + Cluster"
938
+ type NumericDictTermCluster = {
939
+ /** alternative name, e.g. the plot is called "drug sensitivity" in ALL-pharmacotyping; by default it's called "Numeric Dictionary Term cluster" */
940
+ appName?: string
941
+ /** default settings for numericDictTermCluster plot */
942
+ settings?: NumericDictTermClusterSettings
943
+ /** list of numeric term ids that will be excluded from the numeric dictionary term cluster, add to usecase.detail to exclude terms*/
944
+ exclude?: string[]
945
+ }
946
+
947
+ type Survival = {
948
+ /** default settings for survival plot */
949
+ settings?: SurvivalSettings
950
+ }
951
+
952
+ type MatrixPlotsEntry = {
953
+ name: string
954
+ file: string
955
+ settings?: {
956
+ [key: string]: any
957
+ }
958
+ getConfig?: (f: any) => void
959
+ }
960
+
961
+ type MatrixPlots = {
962
+ plots: MatrixPlotsEntry[]
963
+ }
964
+
965
+ type AllowCaseDetails = {
966
+ sample_id_key: string
967
+ terms: string[]
968
+ }
969
+
970
+ type MultipleTestingCorrection = {
971
+ method: string
972
+ skipLowSampleSize: boolean
973
+ }
974
+
975
+ type TvsTerm = {
976
+ id: string
977
+ type: string
978
+ name: string
979
+ }
980
+
981
+ type TvsValues = {
982
+ key?: string
983
+ label: string
984
+ }
985
+
986
+ type Tvs = {
987
+ term: TvsTerm
988
+ values: TvsValues[]
989
+ }
990
+
991
+ type RestrictAncestriesEntry = {
992
+ name: string
993
+ tvs: Tvs
994
+ PCcount: number
995
+
996
+ // TODO declare that either PCTermId or PCBySubcohort is required
997
+ PCTermId?: string
998
+ PCBySubcohort?: {
999
+ [subcohortId: string]: any
1000
+ }
1001
+ }
1002
+
1003
+ /*
1004
+ base type for deriving new types with new attributes
1005
+
1006
+ */
1007
+ type UrlTemplateBase = {
1008
+ /** must end with '/' */
1009
+ base: string
1010
+ namekey: string
1011
+ defaultText?: string
1012
+ }
1013
+ export type UrlTemplateSsm = UrlTemplateBase & {
1014
+ /** to create separate link, but not directly on chr.pos.ref.alt string.
1015
+ name of link is determined by either namekey or linkText. former allows to retrieve a name per m that's different from chr.pos.xx */
1016
+ shownSeparately?: boolean
1017
+ /** optional name of link, if set, same name will be used for all links. e.g. "ClinVar".
1018
+ if missing, name is value of m[url.namekey], as used in url itself (e.g. snp rsid) */
1019
+ linkText?: string
1020
+ }
1021
+
1022
+ /*** type of ds.cohort.termdb{} ***/
1023
+ type Termdb = {
1024
+ /** Terms */
1025
+ termIds?: TermIds
1026
+ /** if true, backend is allowed to send sample names to client in charts */
1027
+ displaySampleIds?: boolean
1028
+ converSampleIds?: boolean
1029
+ allowedTermTypes?: string[]
1030
+ alwaysShowBranchTerms?: boolean
1031
+ minimumSampleAllowed4filter?: number
1032
+ minTimeSinceDx?: number
1033
+ timeUnit?: string
1034
+ ageEndOffset?: number
1035
+ cohortStartTimeMsg?: string
1036
+ alwaysRefillCategoricalTermValues?: boolean
1037
+ restrictAncestries?: RestrictAncestriesEntry[]
1038
+ /** Cohort specific */
1039
+ selectCohort?: SelectCohortEntry
1040
+
1041
+ /** quick fix to convert category values from a term to lower cases for comparison (case insensitive comparison)
1042
+ for gdc, graphql and rest apis return case-mismatching strings for the same category e.g. "Breast/breast"
1043
+ keep this setting here for reason of:
1044
+ - in mds3.gdc.js, when received all-lowercase values from graphql, it's hard to convert them to Title case for comparison
1045
+ - mds3.variant2samples consider this setting, allows to handle other datasets of same issue
1046
+ */
1047
+ useLower?: boolean
1048
+
1049
+ scatterplots?: Scatterplots
1050
+ matrix?: Matrix
1051
+ numericDictTermCluster?: NumericDictTermCluster
1052
+ survival?: Survival
1053
+ logscaleBase2?: boolean
1054
+ plotConfigByCohort?: PlotConfigByCohort
1055
+ /** Functionality */
1056
+ dataDownloadCatch?: DataDownloadCatch
1057
+ helpPages?: URLEntry[]
1058
+ multipleTestingCorrection?: MultipleTestingCorrection
1059
+ /** regression settings for neuro-oncology portals:
1060
+ - no interaction terms
1061
+ - report event counts of cox coefficients
1062
+ - hide type III stats and miscellaneous statistical tests */
1063
+ neuroOncRegression?: boolean
1064
+ urlTemplates?: {
1065
+ /** gene link definition */
1066
+ gene?: UrlTemplateBase
1067
+ /** sample link definition */
1068
+ sample?: UrlTemplateBase
1069
+ /** ssm link definition */
1070
+ ssm?: UrlTemplateSsm | UrlTemplateSsm[]
1071
+ }
1072
+
1073
+ q?: {
1074
+ getSupportedChartTypes: (a: any) => any
1075
+ }
1076
+ termMatch2geneSet?: any
1077
+ mclass?: Mclass
1078
+ lollipop?: any
1079
+ hasAncestry?: boolean
1080
+
1081
+ //GDC
1082
+ termid2totalsize2?: GdcApi
1083
+ dictionary?: GdcApi
1084
+ allowCaseDetails?: AllowCaseDetails
1085
+ isGeneSetTermdb?: boolean
1086
+ /** Searches the genedb alias list to return the genecode ID */
1087
+ getGeneAlias?: (q: any, tw: any) => { gencodeId: any }
1088
+ convertSampleId?: GdcApi
1089
+ hierCluster?: any
1090
+
1091
+ /** ds customization of rules in TermTypeSelect on what term type to exclude for a usecase.
1092
+ used by gdc in that gene exp cannot be used for filtering
1093
+ note this applies to left-side term type tabs, but not terms in dict tree. latter is controlled by excludeTermtypeByTarget
1094
+ */
1095
+ useCasesExcluded?: {
1096
+ /** key is target name (todo restrict values), value is array of 1 or more term
1097
+ * types (todo restrict values) */
1098
+ [useCaseTarget: string]: string[]
1099
+ }
1100
+ /** ds customization to rules in isUsableTerm(). this applies to what's showing in dict tree
1101
+ */
1102
+ excludedTermtypeByTarget?: {
1103
+ /** key is usecase target (todo restrict). value is array of term type (todo restrict) */
1104
+ [useCaseTarget: string]: string[]
1105
+ }
1106
+ /** in development!
1107
+ * Supports the About tab in mass UI
1108
+ */
1109
+ hasSampleAncestry?: boolean
1110
+ sampleTypes?: SampleType[]
1111
+
1112
+ tracks?: {
1113
+ /** allow color or shape changes in the lollipop */
1114
+ allowSkewerChanges: boolean
1115
+ }
1116
+ }
1117
+
1118
+ type SampleType = {
1119
+ name: string
1120
+ plural_name: string
1121
+ parent_id: string
1122
+ }
1123
+
1124
+ /** predefined configuration objects per subcohort per plot type */
1125
+ type PlotConfigByCohort = {
1126
+ /** key is subcohort string */
1127
+ [index: string]: {
1128
+ /** key is plot type as in mass/charts.js */
1129
+ [key: string]: object
1130
+ }
1131
+ }
1132
+
1133
+ /** modified version of termwrapper*/
1134
+ type Tw = {
1135
+ id: string
1136
+ q: unknown
1137
+ baseURL?: string //Only appears as a quick fix in SAMD9-SAMD9L.hg19?
1138
+ }
1139
+
1140
+ type Variant2Samples = GdcApi & {
1141
+ variantkey: string
1142
+ twLst?: Tw[]
1143
+ sunburst_twLst?: Tw[]
1144
+ }
1145
+
1146
+ type MutationSet = {
1147
+ snvindel: string
1148
+ cnv: string
1149
+ fusion: string
1150
+ }
1151
+
1152
+ type BaseDtEntry = {
1153
+ term_id: string
1154
+ yes: { value: string[] }
1155
+ no: { value: string[] }
1156
+ label?: string
1157
+ }
1158
+
1159
+ type SNVByOrigin = {
1160
+ [index: string]: BaseDtEntry
1161
+ }
1162
+
1163
+ type DtEntrySNV = {
1164
+ byOrigin: SNVByOrigin
1165
+ }
1166
+
1167
+ type ByDt = {
1168
+ /** SNVs differentiate by sample origin. Non-SNV, no differentiation*/
1169
+ [index: number]: DtEntrySNV | BaseDtEntry
1170
+ }
1171
+
1172
+ type AssayValuesEntry = {
1173
+ [index: string]: { label: string; color: string }
1174
+ }
1175
+
1176
+ type AssaysEntry = {
1177
+ id: string
1178
+ name: string
1179
+ type: string
1180
+ values?: AssayValuesEntry
1181
+ }
1182
+
1183
+ type AssayAvailability = {
1184
+ byDt?: ByDt
1185
+ file?: string
1186
+ assays?: AssaysEntry[]
1187
+ }
1188
+
1189
+ //Shared with genome.ts
1190
+ export type Cohort = {
1191
+ cumburden?: {
1192
+ files: {
1193
+ fit: string
1194
+ surv: string
1195
+ sample: string
1196
+ }
1197
+ }
1198
+ db: FileObj
1199
+ /** customize the default chart to open on mass ui when there's no charts. if
1200
+ * missing it opens dictionary ui */
1201
+ defaultChartType?: string
1202
+ hiddenChartTypes?: string[]
1203
+ massNav?: MassNav
1204
+ matrixplots?: MatrixPlots
1205
+ mutationset?: MutationSet[]
1206
+ renamedChartTypes?: { singleCellPlot?: string; sampleScatter?: string }
1207
+ scatterplots?: Scatterplots
1208
+ termdb: Termdb
1209
+ }
1210
+
1211
+ /** Customizations specific to the mass nav component */
1212
+ type MassNav = {
1213
+ /** optional title of this ds, if missing use ds.label. shown on mass nav header.
1214
+ * use blank string to not to show a label*/
1215
+ title?: Title
1216
+ /** Customization for the tabs*/
1217
+ tabs?: {
1218
+ /** about, charts, groups, and fitler */
1219
+ [index: string]: {
1220
+ /** show in a specific order of tabs */
1221
+ order?: number
1222
+ /** label appearing in the top row in upper case */
1223
+ top?: string
1224
+ /** biggest label appearing in the middle row in upper case */
1225
+ mid?: string
1226
+ /** label appearing in the bottom row*/
1227
+ btm?: string
1228
+ /** if true, does not show the tab */
1229
+ hide?: boolean
1230
+ /** html code, specifically for the about tab
1231
+ * maybe used for other tabs as well.
1232
+ */
1233
+ html?: string
1234
+ }
1235
+ }
1236
+ }
1237
+
1238
+ type Title = {
1239
+ text: string
1240
+ link?: string
1241
+ }
1242
+ /*** types supporting MdsCohort type ***/
1243
+ type SampleAttribute = {
1244
+ attributes: Attributes
1245
+ }
1246
+
1247
+ type HierarchiesLstEntry = {
1248
+ name: string
1249
+ levels: KeyLabelFull[]
1250
+ }
1251
+
1252
+ type Hierarchies = {
1253
+ lst: HierarchiesLstEntry[]
1254
+ }
1255
+
1256
+ type SetSamples = {
1257
+ file: string
1258
+ valuename: string
1259
+ skipzero: boolean
1260
+ }
1261
+
1262
+ type SetSignatures = {
1263
+ [index: number]: { name: string; color: string }
1264
+ }
1265
+
1266
+ type MutSigSets = {
1267
+ [index: string]: {
1268
+ name: string
1269
+ samples: SetSamples
1270
+ signatures: SetSignatures
1271
+ }
1272
+ }
1273
+
1274
+ type MutationSignature = {
1275
+ sets: MutSigSets
1276
+ }
1277
+
1278
+ type MdsCohort = {
1279
+ //Does not apply to Mds3 or genomes!
1280
+ files: FileObj[]
1281
+ samplenamekey: string
1282
+ tohash: (item: any, ds: any) => void //Fix later
1283
+ sampleAttribute?: SampleAttribute
1284
+ hierarchies?: Hierarchies
1285
+ survivalplot?: SurvivalPlot
1286
+ mutation_signature?: MutationSignature
1287
+ //scatterplot - skipping b/c codes to the old scatterplot, not mass
1288
+ }
1289
+
1290
+ /*** types supporting MdsQueries type ***/
1291
+ type BaseTrack = {
1292
+ name?: string
1293
+ istrack?: boolean
1294
+ type?: string
1295
+ file?: string
1296
+ hideforthemoment?: number
1297
+ viewrangeupperlimit?: number
1298
+ }
1299
+
1300
+ type LegendVOrigin = {
1301
+ key: string
1302
+ somatic: string
1303
+ germline: string
1304
+ }
1305
+
1306
+ type GroupSampleByAttr = {
1307
+ attrlst: KeyLabelFull[]
1308
+ sortgroupby?: {
1309
+ key: string
1310
+ order: string[]
1311
+ }
1312
+ attrnamespacer?: string
1313
+ }
1314
+
1315
+ type Svcnv = BaseTrack & {
1316
+ valueCutoff: number
1317
+ bplengthUpperLimit: number
1318
+ segmeanValueCutoff?: number
1319
+ no_loh?: number
1320
+ lohLengthUpperLimit?: number
1321
+ hideLOHwithCNVoverlap?: boolean
1322
+ vcf_querykey?: string
1323
+ expressionrank_querykey?: string
1324
+ multihidelabel_vcf: boolean
1325
+ multihidelabel_fusion?: boolean
1326
+ multihidelabel_sv: boolean
1327
+ legend_vorigin?: LegendVOrigin
1328
+ groupsamplebyattr?: GroupSampleByAttr
1329
+ }
1330
+
1331
+ type KeyLabelFull = {
1332
+ /* Used in:
1333
+ queries.genefpkm.boxplotbysamplegroup.attributes
1334
+ cohort.hierarchies.lst[i].levels
1335
+ */
1336
+ k: string
1337
+ label: string
1338
+ full?: string
1339
+ }
1340
+
1341
+ type ASE = {
1342
+ qvalue: number
1343
+ meandelta_monoallelic: number
1344
+ asemarkernumber_biallelic: number
1345
+ color_noinfo: string
1346
+ color_notsure: string
1347
+ color_biallelic: string
1348
+ color_monoallelic: string
1349
+ }
1350
+
1351
+ type GeneFpkmOutlier = {
1352
+ pvalue: number
1353
+ color: string
1354
+ }
1355
+
1356
+ type BoxPlotAdditionalsEntry = {
1357
+ label: string
1358
+ attributes: KeyVal[]
1359
+ }
1360
+
1361
+ type BoxPlotBySampleGroup = {
1362
+ attributes: KeyLabelFull[]
1363
+ additionals?: BoxPlotAdditionalsEntry[]
1364
+ }
1365
+
1366
+ type Fpkm = BaseTrack & {
1367
+ datatype: string
1368
+ itemcolor: string
1369
+ }
1370
+
1371
+ type GeneFpkm = Fpkm & {
1372
+ isgenenumeric: boolean
1373
+ boxplotbysamplegroup?: BoxPlotBySampleGroup
1374
+ ase?: ASE
1375
+ outlier?: GeneFpkmOutlier
1376
+ }
1377
+
1378
+ type CutoffValueLstEntry = {
1379
+ /** '<' or '>' to add to the label */
1380
+ side: string
1381
+ value: number
1382
+ label: string
1383
+ }
1384
+
1385
+ type ValuePerSample = KeyLabel & {
1386
+ cutoffValueLst: CutoffValueLstEntry[]
1387
+ }
1388
+
1389
+ type InfoFilterCatEntry = {
1390
+ label: string
1391
+ color: string
1392
+ valuePerSample?: ValuePerSample
1393
+ }
1394
+
1395
+ type InfoFilterCat = {
1396
+ [index: string]: InfoFilterCatEntry
1397
+ }
1398
+
1399
+ type InfoFilterLstEntry = KeyLabel & {
1400
+ categories: InfoFilterCat
1401
+ hiddenCategories: { Unannotated: number }
1402
+ }
1403
+
1404
+ type InfoFilter = {
1405
+ lst: InfoFilterLstEntry[]
1406
+ }
1407
+
1408
+ type ReadCountBoxPlotPerCohort = {
1409
+ groups: KeyLabel[]
1410
+ }
1411
+
1412
+ type SingleJunctionSummary = {
1413
+ readcountboxplotpercohort: ReadCountBoxPlotPerCohort
1414
+ }
1415
+
1416
+ type Junction = BaseTrack & {
1417
+ readcountCutoff: number
1418
+ infoFilter: InfoFilter
1419
+ singlejunctionsummary: SingleJunctionSummary
1420
+ }
1421
+
1422
+ type MdsSnvindel = BaseTrack & {
1423
+ tracks: BaseTrack[]
1424
+ singlesamples?: {
1425
+ tablefile: string
1426
+ }
1427
+ }
1428
+
1429
+ type SomaticCnv = BaseTrack & {
1430
+ valueLabel: string
1431
+ valueCutoff: number
1432
+ bplengthUpperLimit: number
1433
+ }
1434
+
1435
+ type Vcf = BaseTrack & {
1436
+ tracks: BaseTrack[]
1437
+ }
1438
+
1439
+ type MdsQueries = {
1440
+ svcnv?: Svcnv
1441
+ genefpkm?: GeneFpkm
1442
+ junction?: Junction
1443
+ snvindel?: MdsSnvindel
1444
+ somaticcnv?: SomaticCnv
1445
+ vcf?: Vcf
1446
+ fpkm?: Fpkm
1447
+ }
1448
+
1449
+ type AttrValues = {
1450
+ [index: string]: {
1451
+ name?: string
1452
+ label?: string
1453
+ color?: string
1454
+ }
1455
+ }
1456
+
1457
+ type AttributesEntry = {
1458
+ label: string
1459
+ values?: AttrValues
1460
+ hidden?: number
1461
+ filter?: number
1462
+ appendto_link?: string
1463
+ isfloat?: number | boolean
1464
+ isinteger?: number | boolean
1465
+ clientnoshow?: number
1466
+ showintrack?: boolean
1467
+ }
1468
+
1469
+ type Attributes = {
1470
+ [index: string]: AttributesEntry
1471
+ }
1472
+
1473
+ type MutationAttribute = {
1474
+ attributes: Attributes
1475
+ }
1476
+
1477
+ type MutationTypesEntry = {
1478
+ db_col: string
1479
+ label?: string
1480
+ default: number
1481
+ sizecutoff?: string
1482
+ log2cutoff?: number
1483
+ }
1484
+
1485
+ type Gene2MutCount = {
1486
+ dbfile: string
1487
+ mutationTypes: MutationTypesEntry[]
1488
+ }
1489
+
1490
+ type LocusAttribute = {
1491
+ attributes: Attributes
1492
+ }
1493
+
1494
+ type ViewMode = {
1495
+ byAttribute?: string
1496
+ byInfo?: string
1497
+ inuse?: boolean
1498
+ }
1499
+
1500
+ /*** types supporting Mds Dataset types ***/
1501
+ type BaseMds = {
1502
+ genome?: string //Not declared in TermdbTest
1503
+ assayAvailability?: AssayAvailability
1504
+ }
1505
+
1506
+ export type Mds = BaseMds & {
1507
+ isMds: boolean
1508
+ about?: KeyVal[]
1509
+ sampleAssayTrack?: FileObj
1510
+ singlesamplemutationjson?: FileObj
1511
+ cohort?: MdsCohort
1512
+ queries?: MdsQueries
1513
+ mutationAttribute?: MutationAttribute
1514
+ dbFile?: string
1515
+ version?: { label: string; link: string }
1516
+ gene2mutcount?: Gene2MutCount
1517
+ locusAttribute?: LocusAttribute
1518
+ alleleAttribute?: {
1519
+ attributes: {
1520
+ [attrName: string]: {
1521
+ label: string
1522
+ isnumeric: number
1523
+ filter: number
1524
+ }
1525
+ }
1526
+ }
1527
+ }
1528
+
1529
+ type PreInitStatus = {
1530
+ status: string
1531
+ message?: string
1532
+ [props: string]: any
1533
+ }
1534
+
1535
+ export type PreInit = {
1536
+ getStatus: () => Promise<PreInitStatus>
1537
+ retryDelay?: number
1538
+ retryMax?: number
1539
+ errorCallback?: (response: PreInitStatus) => void
1540
+ test?: {
1541
+ numCalls: number
1542
+ minor: number
1543
+ mayEditResponse: (response: any) => any
1544
+ }
1545
+ }
1546
+
1547
+ /** supply "isSupported()" kind of callback per chart type,
1548
+ that will overwrite default logic in getSupportedChartTypes()
1549
+ - the callback can have arbitrary logic based on requirements from this ds
1550
+ - can supply ()=>false to hide charts that will otherwise shown
1551
+ - can define arbitrary chart type names for purpose-specific charts
1552
+ */
1553
+ export type isSupportedChartCallbacks = {
1554
+ [chartType: string]: (f: any, auth: any) => boolean | undefined
1555
+ }
1556
+
1557
+ export type Mds3 = BaseMds & {
1558
+ label?: Title
1559
+ isMds3: boolean
1560
+ loadWithoutBlocking?: boolean
1561
+ preInit?: PreInit
1562
+ initErrorCallback?: (a: any) => void
1563
+ viewModes?: ViewMode[]
1564
+ dsinfo?: KeyVal[]
1565
+ queries?: Mds3Queries
1566
+ cohort?: Cohort
1567
+ isSupportedChartOverride?: isSupportedChartCallbacks
1568
+ // TODO: termdb should be nested under cohort
1569
+ termdb?: Termdb
1570
+ validate_filter0?: (f: any) => void
1571
+ ssm2canonicalisoform?: GdcApi
1572
+ variant2samples?: Variant2Samples
1573
+ // !!! TODO: improve these type definitions below !!!
1574
+ getHostHeaders?: (q?: any) => any
1575
+ serverconfigFeatures?: any
1576
+ customTwQByType?: {
1577
+ [termType: string]: {
1578
+ [key: string]: any
1579
+ }
1580
+ }
1581
+ getHealth?: (ds: any) => {
1582
+ [key: string]: any
1583
+ }
1584
+ }
1585
+
1586
+ export type Mds3WithCohort = Mds3 & {
1587
+ cohort: Cohort
1588
+ }