@sjcrh/proteinpaint-shared 2.180.0 → 2.180.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.
package/src/common.js CHANGED
@@ -8,40 +8,40 @@ exported functions
8
8
 
9
9
 
10
10
  */
11
- import { rgb } from 'd3-color'
12
- import * as d3scale from 'd3-scale'
13
- import * as d3 from 'd3'
14
- import { getWrappedTvslst } from './filter.js'
11
+ import { rgb } from "d3-color"
12
+ import * as d3scale from "d3-scale"
13
+ import * as d3 from "d3"
14
+ import { getWrappedTvslst } from "./filter.js"
15
15
 
16
16
  // moved from `#shared/terms` to here, so that this can be passed as
17
17
  // part of 'common' argument to exported dataset js function, at server runtime
18
18
  export const TermTypeGroups = {
19
- DICTIONARY_VARIABLES: 'Dictionary Variables',
20
- DNA_METHYLATION: 'DNA Methylation',
21
- GENE_DEPENDENCY: 'Gene Dependency',
22
- GENE_EXPRESSION: 'Gene Expression',
23
- GSEA: 'GSEA',
24
- METABOLITE_INTENSITY: 'Metabolite Intensity',
25
- WHOLE_PROTEOME_ABUNDANCE: 'Whole Proteome Abundance',
26
- MUTATION_CNV_FUSION: 'Mutation/CNV/Fusion',
27
- MUTATION_SIGNATURE: 'Mutation Signature',
28
- PROTEIN_EXPRESSION: 'Protein Expression',
29
- SINGLECELL_CELLTYPE: 'Single-cell Cell Type',
30
- SINGLECELL_GENE_EXPRESSION: 'Single-cell Gene Expression',
31
- SNP: 'SNP Genotype',
32
- SNP_LIST: 'SNP List',
33
- SNP_LOCUS: 'SNP Locus',
34
- SPLICE_JUNCTION: 'Splice Junction',
35
- SSGSEA: 'Geneset Expression',
36
- TERM_COLLECTION: 'Term Collection',
37
- VARIANT_GENOTYPE: 'Variant Genotype'
38
- }
39
-
40
- export const defaultcolor = rgb('#8AB1D4').darker()
41
- export const default_text_color = rgb('#aaa').darker().darker()
42
-
43
- export const exoncolor = '#4F8053'
44
- export const plotColor = '#ce768e'
19
+ DICTIONARY_VARIABLES: "Dictionary Variables",
20
+ DNA_METHYLATION: "DNA Methylation",
21
+ GENE_DEPENDENCY: "Gene Dependency",
22
+ GENE_EXPRESSION: "Gene Expression",
23
+ GSEA: "GSEA",
24
+ METABOLITE_INTENSITY: "Metabolite Intensity",
25
+ PROTEOME_ABUNDANCE: "Whole Proteome Abundance",
26
+ MUTATION_CNV_FUSION: "Mutation/CNV/Fusion",
27
+ MUTATION_SIGNATURE: "Mutation Signature",
28
+ PROTEIN_EXPRESSION: "Protein Expression",
29
+ SINGLECELL_CELLTYPE: "Single-cell Cell Type",
30
+ SINGLECELL_GENE_EXPRESSION: "Single-cell Gene Expression",
31
+ SNP: "SNP Genotype",
32
+ SNP_LIST: "SNP List",
33
+ SNP_LOCUS: "SNP Locus",
34
+ SPLICE_JUNCTION: "Splice Junction",
35
+ SSGSEA: "Geneset Expression",
36
+ TERM_COLLECTION: "Term Collection",
37
+ VARIANT_GENOTYPE: "Variant Genotype",
38
+ }
39
+
40
+ export const defaultcolor = rgb("#8AB1D4").darker()
41
+ export const default_text_color = rgb("#aaa").darker().darker()
42
+
43
+ export const exoncolor = "#4F8053"
44
+ export const plotColor = "#ce768e"
45
45
 
46
46
  // something that has something to do with coding gene reading frame
47
47
  export const IN_frame = true
@@ -68,46 +68,48 @@ export const dtloh = 10
68
68
  export const dtmetaboliteintensity = 11
69
69
  export const dtssgsea = 12
70
70
  export const dtdnamethylation = 13
71
- export const dtwholeproteomeabundance = 14
71
+ export const dtproteomeabundance = 14
72
72
  // add new dt value here. !!!DO NOT change value of existing dt!!!
73
73
 
74
74
  export const dt2label = {
75
- [dtsnvindel]: 'SNV/indel',
76
- [dtfusionrna]: 'Fusion RNA',
77
- [dtcnv]: 'CNV',
78
- [dtsv]: 'SV',
79
- [dtitd]: 'ITD',
80
- [dtdel]: 'Deletion',
81
- [dtnloss]: 'N-loss',
82
- [dtcloss]: 'C-loss',
83
- [dtloh]: 'LOH',
84
- [dtgeneexpression]: 'Gene Expression',
85
- [dtmetaboliteintensity]: 'Metabolite Intensity',
86
- [dtwholeproteomeabundance]: 'Whole Proteome Abundance'
75
+ [dtsnvindel]: "SNV/indel",
76
+ [dtfusionrna]: "Fusion RNA",
77
+ [dtcnv]: "CNV",
78
+ [dtsv]: "SV",
79
+ [dtitd]: "ITD",
80
+ [dtdel]: "Deletion",
81
+ [dtnloss]: "N-loss",
82
+ [dtcloss]: "C-loss",
83
+ [dtloh]: "LOH",
84
+ [dtgeneexpression]: "Gene Expression",
85
+ [dtmetaboliteintensity]: "Metabolite Intensity",
86
+ [dtproteomeabundance]: "Whole Proteome Abundance",
87
87
  }
88
88
 
89
89
  // Maps dt types to UI labels and lesion types for GRIN2
90
90
  // All dt types use lesionTypes array for consistency
91
91
  export const dt2lesion = {
92
92
  [dtsnvindel]: {
93
- uilabel: 'SNV/INDEL (Mutation)',
94
- lesionTypes: [{ name: 'Mutation', lesionType: 'mutation', color: '#44AA44' }]
93
+ uilabel: "SNV/INDEL (Mutation)",
94
+ lesionTypes: [
95
+ { name: "Mutation", lesionType: "mutation", color: "#44AA44" },
96
+ ],
95
97
  },
96
98
  [dtcnv]: {
97
- uilabel: 'CNV (Copy Number Variation)',
99
+ uilabel: "CNV (Copy Number Variation)",
98
100
  lesionTypes: [
99
- { name: 'Loss', lesionType: 'loss', color: '#4444FF' },
100
- { name: 'Gain', lesionType: 'gain', color: '#FF4444' }
101
- ]
101
+ { name: "Loss", lesionType: "loss", color: "#4444FF" },
102
+ { name: "Gain", lesionType: "gain", color: "#FF4444" },
103
+ ],
102
104
  },
103
105
  [dtsv]: {
104
- uilabel: 'SV (Structural Variation)',
105
- lesionTypes: [{ name: 'SV', lesionType: 'sv', color: '#9932CC' }]
106
+ uilabel: "SV (Structural Variation)",
107
+ lesionTypes: [{ name: "SV", lesionType: "sv", color: "#9932CC" }],
106
108
  },
107
109
  [dtfusionrna]: {
108
- uilabel: 'Fusion (RNA Fusion)',
109
- lesionTypes: [{ name: 'Fusion', lesionType: 'fusion', color: '#FFA500' }]
110
- }
110
+ uilabel: "Fusion (RNA Fusion)",
111
+ lesionTypes: [{ name: "Fusion", lesionType: "fusion", color: "#FFA500" }],
112
+ },
111
113
  }
112
114
 
113
115
  // Maps GRIN2 option types to their corresponding dt values
@@ -115,166 +117,190 @@ export const optionToDt = {
115
117
  snvindelOptions: dtsnvindel,
116
118
  cnvOptions: dtcnv,
117
119
  fusionOptions: dtfusionrna,
118
- svOptions: dtsv
120
+ svOptions: dtsv,
119
121
  }
120
122
 
121
123
  export const mclass = {
122
124
  M: {
123
- label: 'MISSENSE',
124
- color: '#3987CC',
125
+ label: "MISSENSE",
126
+ color: "#3987CC",
125
127
  dt: dtsnvindel,
126
- desc: 'A sequence variant, that changes one or more bases, resulting in a different amino acid sequence but where the length is preserved',
127
- key: 'M'
128
+ desc: "A sequence variant, that changes one or more bases, resulting in a different amino acid sequence but where the length is preserved",
129
+ key: "M",
130
+ },
131
+ E: {
132
+ label: "EXON",
133
+ color: "#bcbd22",
134
+ dt: dtsnvindel,
135
+ desc: "A variant in the exon of a non-coding RNA.",
136
+ key: "E",
128
137
  },
129
- E: { label: 'EXON', color: '#bcbd22', dt: dtsnvindel, desc: 'A variant in the exon of a non-coding RNA.', key: 'E' },
130
138
  F: {
131
- label: 'FRAMESHIFT',
132
- color: 'rgb(200, 61, 61)',
139
+ label: "FRAMESHIFT",
140
+ color: "rgb(200, 61, 61)",
133
141
  dt: dtsnvindel,
134
- desc: 'A sequence variant which causes a disruption of the translational reading frame, because the number of nucleotides inserted or deleted is not a multiple of three',
135
- key: 'F'
142
+ desc: "A sequence variant which causes a disruption of the translational reading frame, because the number of nucleotides inserted or deleted is not a multiple of three",
143
+ key: "F",
136
144
  },
137
145
  N: {
138
- label: 'NONSENSE',
139
- color: '#ff7f0e',
146
+ label: "NONSENSE",
147
+ color: "#ff7f0e",
140
148
  dt: dtsnvindel,
141
- desc: 'A sequence variant whereby at least one base of a codon is changed, resulting in a premature stop codon, leading to a shortened transcript',
142
- key: 'N'
149
+ desc: "A sequence variant whereby at least one base of a codon is changed, resulting in a premature stop codon, leading to a shortened transcript",
150
+ key: "N",
143
151
  },
144
152
  S: {
145
- label: 'SILENT',
146
- color: '#2ca02c',
153
+ label: "SILENT",
154
+ color: "#2ca02c",
147
155
  dt: dtsnvindel,
148
- desc: 'A sequence variant where there is no resulting change to the encoded amino acid',
149
- key: 'S'
156
+ desc: "A sequence variant where there is no resulting change to the encoded amino acid",
157
+ key: "S",
150
158
  },
151
159
  D: {
152
- label: 'PROTEINDEL',
153
- color: 'rgb(100, 100, 100)',
160
+ label: "PROTEINDEL",
161
+ color: "rgb(100, 100, 100)",
154
162
  dt: dtsnvindel,
155
- desc: 'An inframe non synonymous variant that deletes bases from the coding sequence',
156
- key: 'D'
163
+ desc: "An inframe non synonymous variant that deletes bases from the coding sequence",
164
+ key: "D",
157
165
  },
158
166
  I: {
159
- label: 'PROTEININS',
160
- color: '#8c564b',
167
+ label: "PROTEININS",
168
+ color: "#8c564b",
161
169
  dt: dtsnvindel,
162
- desc: 'An inframe non synonymous variant that inserts bases into in the coding sequence',
163
- key: 'I'
170
+ desc: "An inframe non synonymous variant that inserts bases into in the coding sequence",
171
+ key: "I",
164
172
  },
165
173
  ProteinAltering: {
166
- label: 'PROTEINALTERING',
167
- color: '#5a0034',
174
+ label: "PROTEINALTERING",
175
+ color: "#5a0034",
168
176
  dt: dtsnvindel,
169
- desc: 'An inframe complex change to the coding sequence',
170
- key: 'ProteinAltering'
177
+ desc: "An inframe complex change to the coding sequence",
178
+ key: "ProteinAltering",
171
179
  },
172
180
  P: {
173
- label: 'SPLICE_REGION',
174
- color: '#9467bd',
181
+ label: "SPLICE_REGION",
182
+ color: "#9467bd",
175
183
  dt: dtsnvindel,
176
- desc: 'A sequence variant in which a change has occurred within the region of the splice site, either within 1-3 bases of the exon or 3-8 bases of the intron',
177
- key: 'P'
184
+ desc: "A sequence variant in which a change has occurred within the region of the splice site, either within 1-3 bases of the exon or 3-8 bases of the intron",
185
+ key: "P",
178
186
  },
179
187
  L: {
180
- label: 'SPLICE',
181
- color: '#6633FF',
188
+ label: "SPLICE",
189
+ color: "#6633FF",
190
+ dt: dtsnvindel,
191
+ desc: "A variant near an exon edge that may affect splicing functionality",
192
+ key: "L",
193
+ },
194
+ Intron: {
195
+ label: "INTRON",
196
+ color: "#656565",
182
197
  dt: dtsnvindel,
183
- desc: 'A variant near an exon edge that may affect splicing functionality',
184
- key: 'L'
198
+ desc: "An intronic variant.",
199
+ key: "Intron",
185
200
  },
186
- Intron: { label: 'INTRON', color: '#656565', dt: dtsnvindel, desc: 'An intronic variant.', key: 'Intron' },
187
201
 
188
202
  StopLost: {
189
- label: 'Stop lost',
190
- color: '#ff7f0e',
203
+ label: "Stop lost",
204
+ color: "#ff7f0e",
191
205
  dt: dtsnvindel,
192
- desc: 'A sequence variant where at least one base of the terminator codon (stop) is changed, resulting in an elongated transcript',
193
- key: 'StopLost'
206
+ desc: "A sequence variant where at least one base of the terminator codon (stop) is changed, resulting in an elongated transcript",
207
+ key: "StopLost",
194
208
  },
195
209
  StartLost: {
196
- label: 'Start lost',
197
- color: '#ff7f0e',
210
+ label: "Start lost",
211
+ color: "#ff7f0e",
198
212
  dt: dtsnvindel,
199
- desc: 'A codon variant that changes at least one base of the canonical start codon',
200
- key: 'StartLost'
213
+ desc: "A codon variant that changes at least one base of the canonical start codon",
214
+ key: "StartLost",
201
215
  },
202
216
 
203
217
  // quick fix!! for showing genes that are not tested in samples (e.g. gene panels) in the heatmap
204
- Blank: { label: 'Not tested', color: '#fff', dt: dtsnvindel, desc: 'This gene is not tested.', key: 'Blank' },
218
+ Blank: {
219
+ label: "Not tested",
220
+ color: "#fff",
221
+ dt: dtsnvindel,
222
+ desc: "This gene is not tested.",
223
+ key: "Blank",
224
+ },
205
225
 
206
- WT: { label: 'Wildtype', color: '#D3D3D3', dt: dtsnvindel, desc: 'Wildtype', key: 'WT' }
226
+ WT: {
227
+ label: "Wildtype",
228
+ color: "#D3D3D3",
229
+ dt: dtsnvindel,
230
+ desc: "Wildtype",
231
+ key: "WT",
232
+ },
207
233
  }
208
- export const mclassitd = 'ITD'
234
+ export const mclassitd = "ITD"
209
235
  mclass[mclassitd] = {
210
- label: 'ITD',
211
- color: '#ff70ff',
236
+ label: "ITD",
237
+ color: "#ff70ff",
212
238
  dt: dtitd,
213
- desc: 'In-frame internal tandem duplication.',
214
- key: mclassitd
239
+ desc: "In-frame internal tandem duplication.",
240
+ key: mclassitd,
215
241
  }
216
242
 
217
- export const mclassdel = 'DEL'
243
+ export const mclassdel = "DEL"
218
244
  mclass[mclassdel] = {
219
- label: 'DELETION, intragenic',
220
- color: '#858585',
245
+ label: "DELETION, intragenic",
246
+ color: "#858585",
221
247
  dt: dtdel,
222
- desc: 'Intragenic deletion.',
223
- key: mclassdel
248
+ desc: "Intragenic deletion.",
249
+ key: mclassdel,
224
250
  }
225
251
 
226
- export const mclassnloss = 'NLOSS'
252
+ export const mclassnloss = "NLOSS"
227
253
  mclass[mclassnloss] = {
228
- label: 'N-terminus loss',
229
- color: '#545454',
254
+ label: "N-terminus loss",
255
+ color: "#545454",
230
256
  dt: dtnloss,
231
- desc: 'N-terminus loss due to translocation',
232
- key: mclassnloss
257
+ desc: "N-terminus loss due to translocation",
258
+ key: mclassnloss,
233
259
  }
234
260
 
235
- export const mclasscloss = 'CLOSS'
261
+ export const mclasscloss = "CLOSS"
236
262
  mclass[mclasscloss] = {
237
- label: 'C-terminus loss',
238
- color: '#545454',
263
+ label: "C-terminus loss",
264
+ color: "#545454",
239
265
  dt: dtcloss,
240
- desc: 'C-terminus loss due to translocation',
241
- key: mclasscloss
266
+ desc: "C-terminus loss due to translocation",
267
+ key: mclasscloss,
242
268
  }
243
269
 
244
- export const mclassutr3 = 'Utr3'
270
+ export const mclassutr3 = "Utr3"
245
271
  mclass[mclassutr3] = {
246
- label: 'UTR_3',
247
- color: '#998199',
272
+ label: "UTR_3",
273
+ color: "#998199",
248
274
  dt: dtsnvindel,
249
275
  desc: "A variant in the 3' untranslated region.",
250
- key: mclassutr3
276
+ key: mclassutr3,
251
277
  }
252
278
 
253
- export const mclassutr5 = 'Utr5'
279
+ export const mclassutr5 = "Utr5"
254
280
  mclass[mclassutr5] = {
255
- label: 'UTR_5',
256
- color: '#819981',
281
+ label: "UTR_5",
282
+ color: "#819981",
257
283
  dt: dtsnvindel,
258
284
  desc: "A variant in the 5' untranslated region.",
259
- key: mclassutr5
285
+ key: mclassutr5,
260
286
  }
261
287
 
262
- export const mclassnonstandard = 'X'
288
+ export const mclassnonstandard = "X"
263
289
  mclass[mclassnonstandard] = {
264
- label: 'NONSTANDARD',
265
- color: 'black',
290
+ label: "NONSTANDARD",
291
+ color: "black",
266
292
  dt: dtsnvindel,
267
- desc: 'A mutation class that either does not match our notation, or is unspecified.',
268
- key: mclassnonstandard
293
+ desc: "A mutation class that either does not match our notation, or is unspecified.",
294
+ key: mclassnonstandard,
269
295
  }
270
296
 
271
- export const mclassnoncoding = 'noncoding'
297
+ export const mclassnoncoding = "noncoding"
272
298
  mclass[mclassnoncoding] = {
273
- label: 'NONCODING',
274
- color: 'black',
299
+ label: "NONCODING",
300
+ color: "black",
275
301
  dt: dtsnvindel,
276
- desc: 'Noncoding mutation.',
277
- key: mclassnoncoding
302
+ desc: "Noncoding mutation.",
303
+ key: mclassnoncoding,
278
304
  }
279
305
 
280
306
  /*
@@ -289,46 +315,46 @@ from this array derives multiple types of lookup tables to perform mapping on bo
289
315
  */
290
316
  const SOterms = [
291
317
  //transcript_ablation // not supported: 1) do not expect this in maf/vcf 2) should be represented as cnv deletion but not the legacy unused value "dtdel"; if needed can reenable
292
- ['splice_acceptor_variant', 'L'],
293
- ['splice_donor_variant', 'L'],
294
- ['stop_gained', 'N'],
295
- ['frameshift_variant', 'F'],
296
- ['stop_lost', 'StopLost'],
297
- ['start_lost', 'StartLost'],
318
+ ["splice_acceptor_variant", "L"],
319
+ ["splice_donor_variant", "L"],
320
+ ["stop_gained", "N"],
321
+ ["frameshift_variant", "F"],
322
+ ["stop_lost", "StopLost"],
323
+ ["start_lost", "StartLost"],
298
324
  //transcript_amplification // not supported, should be represented by cnv instead
299
- ['feature_elongation', mclassnoncoding],
300
- ['feature_truncation', mclassnoncoding],
301
- ['inframe_insertion', 'I'],
302
- ['inframe_deletion', 'D'],
303
- ['missense_variant', 'M'],
304
- ['protein_altering_variant', 'ProteinAltering'],
305
- ['splice_donor_5th_base_variant', 'P'],
306
- ['splice_region_variant', 'P'],
307
- ['splice_donor_region_variant', 'P'],
308
- ['splice_polypyrimidine_tract_variant', 'P'],
309
- ['incomplete_terminal_codon_variant', 'N'],
310
- ['start_retained_variant', 'S'],
311
- ['stop_retained_variant', 'S'],
312
- ['synonymous_variant', 'S'],
313
- ['coding_sequence_variant', 'E'],
314
- ['mature_miRNA_variant', 'E'],
315
- ['5_prime_UTR_variant', mclassutr5],
316
- ['3_prime_UTR_variant', mclassutr3],
317
- ['non_coding_transcript_exon_variant', 'E'],
318
- ['intron_variant', 'Intron'],
319
- ['NMD_transcript_variant', 'F'],
320
- ['non_coding_transcript_variant', 'E'],
321
- ['coding_transcript_variant', 'E'],
322
- ['upstream_gene_variant', mclassnoncoding],
323
- ['downstream_gene_variant', mclassnoncoding],
324
- ['TFBS_ablation', mclassnoncoding],
325
- ['TFBS_amplification', mclassnoncoding],
326
- ['TF_binding_site_variant', mclassnoncoding],
327
- ['regulatory_region_ablation', mclassnoncoding],
328
- ['regulatory_region_amplification', mclassnoncoding],
329
- ['regulatory_region_variant', mclassnoncoding],
330
- ['intergenic_variant', mclassnoncoding],
331
- ['sequence_variant', mclassnonstandard]
325
+ ["feature_elongation", mclassnoncoding],
326
+ ["feature_truncation", mclassnoncoding],
327
+ ["inframe_insertion", "I"],
328
+ ["inframe_deletion", "D"],
329
+ ["missense_variant", "M"],
330
+ ["protein_altering_variant", "ProteinAltering"],
331
+ ["splice_donor_5th_base_variant", "P"],
332
+ ["splice_region_variant", "P"],
333
+ ["splice_donor_region_variant", "P"],
334
+ ["splice_polypyrimidine_tract_variant", "P"],
335
+ ["incomplete_terminal_codon_variant", "N"],
336
+ ["start_retained_variant", "S"],
337
+ ["stop_retained_variant", "S"],
338
+ ["synonymous_variant", "S"],
339
+ ["coding_sequence_variant", "E"],
340
+ ["mature_miRNA_variant", "E"],
341
+ ["5_prime_UTR_variant", mclassutr5],
342
+ ["3_prime_UTR_variant", mclassutr3],
343
+ ["non_coding_transcript_exon_variant", "E"],
344
+ ["intron_variant", "Intron"],
345
+ ["NMD_transcript_variant", "F"],
346
+ ["non_coding_transcript_variant", "E"],
347
+ ["coding_transcript_variant", "E"],
348
+ ["upstream_gene_variant", mclassnoncoding],
349
+ ["downstream_gene_variant", mclassnoncoding],
350
+ ["TFBS_ablation", mclassnoncoding],
351
+ ["TFBS_amplification", mclassnoncoding],
352
+ ["TF_binding_site_variant", mclassnoncoding],
353
+ ["regulatory_region_ablation", mclassnoncoding],
354
+ ["regulatory_region_amplification", mclassnoncoding],
355
+ ["regulatory_region_variant", mclassnoncoding],
356
+ ["intergenic_variant", mclassnoncoding],
357
+ ["sequence_variant", mclassnonstandard],
332
358
  ]
333
359
 
334
360
  // maps a pp class to an array of consequences
@@ -350,30 +376,30 @@ for (const [csq, cls] of SOterms) {
350
376
  // DO NOT USE to map vep consequences
351
377
  export function mclasstester(s) {
352
378
  switch (s.toLowerCase()) {
353
- case 'missense_mutation':
354
- return 'M'
355
- case 'nonsense_mutation':
356
- return 'N'
357
- case 'splice_site':
358
- return 'L'
359
- case 'splice_region':
360
- return 'P'
361
- case 'rna':
379
+ case "missense_mutation":
380
+ return "M"
381
+ case "nonsense_mutation":
382
+ return "N"
383
+ case "splice_site":
384
+ return "L"
385
+ case "splice_region":
386
+ return "P"
387
+ case "rna":
362
388
  return mclassnoncoding
363
- case 'frame_shift_del':
364
- return 'F'
365
- case 'frame_shift_ins':
366
- return 'F'
367
- case 'in_frame_del':
368
- return 'D'
369
- case 'in_frame_ins':
370
- return 'I'
371
- case 'protein_altering_variant':
372
- return 'ProteinAltering'
373
- case 'translation_start_site':
389
+ case "frame_shift_del":
390
+ return "F"
391
+ case "frame_shift_ins":
392
+ return "F"
393
+ case "in_frame_del":
394
+ return "D"
395
+ case "in_frame_ins":
396
+ return "I"
397
+ case "protein_altering_variant":
398
+ return "ProteinAltering"
399
+ case "translation_start_site":
374
400
  return mclassnonstandard
375
- case 'nonstop_mutation':
376
- return 'N'
401
+ case "nonstop_mutation":
402
+ return "N"
377
403
  case "3'utr":
378
404
  return mclassutr3
379
405
  case "3'flank":
@@ -382,115 +408,121 @@ export function mclasstester(s) {
382
408
  return mclassutr5
383
409
  case "5'flank":
384
410
  return mclassnoncoding
385
- case 'silent':
386
- return 'S'
387
- case 'blank':
388
- return 'Blank'
411
+ case "silent":
412
+ return "S"
413
+ case "blank":
414
+ return "Blank"
389
415
  default:
390
416
  return null
391
417
  }
392
418
  }
393
419
 
394
- export const mclassfusionrna = 'Fuserna'
420
+ export const mclassfusionrna = "Fuserna"
395
421
  mclass[mclassfusionrna] = {
396
- label: 'Fusion transcript',
397
- color: '#545454',
422
+ label: "Fusion transcript",
423
+ color: "#545454",
398
424
  dt: dtfusionrna,
399
425
  desc:
400
- 'Marks the break points leading to fusion transcripts.<br>' +
401
- '<span style="font-size:150%">&#9680;</span> - 3\' end of the break point is fused to the 5\' end of another break point in a different gene.<br>' +
402
- '<span style="font-size:150%">&#9681;</span> - 5\' end of the break point is fused to the 3\' end of another break point in a different gene.',
403
- key: mclassfusionrna
426
+ "Marks the break points leading to fusion transcripts.<br>" +
427
+ "<span style=\"font-size:150%\">&#9680;</span> - 3' end of the break point is fused to the 5' end of another break point in a different gene.<br>" +
428
+ "<span style=\"font-size:150%\">&#9681;</span> - 5' end of the break point is fused to the 3' end of another break point in a different gene.",
429
+ key: mclassfusionrna,
404
430
  }
405
- export const mclasssv = 'SV'
431
+ export const mclasssv = "SV"
406
432
  mclass[mclasssv] = {
407
- label: 'Structural variation',
408
- color: '#858585',
433
+ label: "Structural variation",
434
+ color: "#858585",
409
435
  dt: dtsv,
410
436
  desc:
411
- '<span style="font-size:150%">&#9680;</span> - 3\' end of the break point is fused to the 5\' end of another break point in a different gene.<br>' +
412
- '<span style="font-size:150%">&#9681;</span> - 5\' end of the break point is fused to the 3\' end of another break point in a different gene.',
413
- key: mclasssv
437
+ "<span style=\"font-size:150%\">&#9680;</span> - 3' end of the break point is fused to the 5' end of another break point in a different gene.<br>" +
438
+ "<span style=\"font-size:150%\">&#9681;</span> - 5' end of the break point is fused to the 3' end of another break point in a different gene.",
439
+ key: mclasssv,
414
440
  }
415
441
 
416
442
  // "CNV_amp" represents "CNV Gain" and is used in both 2-category and 5-category CNV data representation
417
443
  // "CNV_amplification" represents CNV amplification and is used in 5-category CNV
418
444
  // "CNV_amp" have to stay as-is since it may be hardcoded in lots of data beyond portal code.
419
- export const mclasscnvgain = 'CNV_amp'
445
+ export const mclasscnvgain = "CNV_amp"
420
446
  mclass[mclasscnvgain] = {
421
- label: 'Copy number gain', // TODO change to 'Gain'
422
- color: '#e9a3c9',
447
+ label: "Copy number gain", // TODO change to 'Gain'
448
+ color: "#e9a3c9",
423
449
  dt: dtcnv,
424
- desc: 'Copy number gain',
425
- key: mclasscnvgain
450
+ desc: "Copy number gain",
451
+ key: mclasscnvgain,
426
452
  }
427
453
 
428
- export const mclasscnvloss = 'CNV_loss'
454
+ export const mclasscnvloss = "CNV_loss"
429
455
  mclass[mclasscnvloss] = {
430
- label: 'Copy number loss',
431
- color: '#a1d76a',
456
+ label: "Copy number loss",
457
+ color: "#a1d76a",
432
458
  dt: dtcnv,
433
- desc: 'Copy number loss',
434
- key: mclasscnvloss
459
+ desc: "Copy number loss",
460
+ key: mclasscnvloss,
435
461
  }
436
462
 
437
463
  // mclasscnvAmp is next level above mclasscnvgain and is used in 5-category CNV data
438
- export const mclasscnvAmp = 'CNV_amplification'
464
+ export const mclasscnvAmp = "CNV_amplification"
439
465
  mclass[mclasscnvAmp] = {
440
- label: 'Copy number amplification',
441
- color: '#ff0000',
466
+ label: "Copy number amplification",
467
+ color: "#ff0000",
442
468
  dt: dtcnv,
443
- desc: 'Copy number amplification',
444
- key: mclasscnvAmp
469
+ desc: "Copy number amplification",
470
+ key: mclasscnvAmp,
445
471
  }
446
472
 
447
- export const mclasscnvHomozygousDel = 'CNV_homozygous_deletion'
473
+ export const mclasscnvHomozygousDel = "CNV_homozygous_deletion"
448
474
  mclass[mclasscnvHomozygousDel] = {
449
- label: 'Copy number homozygous deletion',
450
- color: '#0000ff',
475
+ label: "Copy number homozygous deletion",
476
+ color: "#0000ff",
451
477
  dt: dtcnv,
452
- desc: 'Copy number homozygous deletion',
453
- key: mclasscnvHomozygousDel
478
+ desc: "Copy number homozygous deletion",
479
+ key: mclasscnvHomozygousDel,
454
480
  }
455
481
 
456
- export const mclasscnvloh = 'CNV_loh'
457
- mclass[mclasscnvloh] = { label: 'LOH', color: '#12EDFC', dt: dtcnv, desc: 'Loss of heterozygosity', key: mclasscnvloh }
482
+ export const mclasscnvloh = "CNV_loh"
483
+ mclass[mclasscnvloh] = {
484
+ label: "LOH",
485
+ color: "#12EDFC",
486
+ dt: dtcnv,
487
+ desc: "Loss of heterozygosity",
488
+ key: mclasscnvloh,
489
+ }
458
490
 
459
491
  // for VCF
460
- export const mclasssnv = 'snv'
492
+ export const mclasssnv = "snv"
461
493
  mclass[mclasssnv] = {
462
- label: 'SNV',
463
- color: '#92a2d4',
494
+ label: "SNV",
495
+ color: "#92a2d4",
464
496
  dt: dtsnvindel,
465
- desc: 'Single nucleotide variation',
466
- key: mclasssnv
497
+ desc: "Single nucleotide variation",
498
+ key: mclasssnv,
467
499
  }
468
500
 
469
- export const mclassmnv = 'mnv'
501
+ export const mclassmnv = "mnv"
470
502
  mclass[mclassmnv] = {
471
- label: 'MNV',
472
- color: '#92a2d4',
503
+ label: "MNV",
504
+ color: "#92a2d4",
473
505
  dt: dtsnvindel,
474
- desc: 'Multiple nucleotide variation',
475
- key: mclassmnv
506
+ desc: "Multiple nucleotide variation",
507
+ key: mclassmnv,
476
508
  }
477
509
 
478
- export const mclassinsertion = 'insertion'
510
+ export const mclassinsertion = "insertion"
479
511
  mclass[mclassinsertion] = {
480
- label: 'Sequence insertion',
481
- color: '#bd8e91',
512
+ label: "Sequence insertion",
513
+ color: "#bd8e91",
482
514
  dt: dtsnvindel,
483
- desc: 'Sequence insertion',
484
- key: mclassinsertion
515
+ desc: "Sequence insertion",
516
+ key: mclassinsertion,
485
517
  }
486
518
 
487
- export const mclassdeletion = 'deletion'
519
+ export const mclassdeletion = "deletion"
488
520
  mclass[mclassdeletion] = {
489
- label: 'Sequence deletion',
490
- color: '#b5a174',
521
+ label: "Sequence deletion",
522
+ color: "#b5a174",
491
523
  dt: dtsnvindel,
492
- desc: 'Sequence deletion',
493
- key: mclassdeletion
524
+ desc: "Sequence deletion",
525
+ key: mclassdeletion,
494
526
  }
495
527
  // TODO complex indel
496
528
 
@@ -502,16 +534,16 @@ the tricky case doesn't apply to other plots
502
534
  export function mds3tkMclass(k) {
503
535
  if (k == dtcnv) {
504
536
  return {
505
- color: '#858585',
506
- label: 'CNV',
507
- desc: 'Copy number variation'
537
+ color: "#858585",
538
+ label: "CNV",
539
+ desc: "Copy number variation",
508
540
  }
509
541
  }
510
542
  return mclass[k]
511
543
  }
512
544
 
513
545
  export const dt2color = {
514
- [dtsnvindel]: mclass.M.color // general color for snvindel irrespective of class (when class is not available)
546
+ [dtsnvindel]: mclass.M.color, // general color for snvindel irrespective of class (when class is not available)
515
547
  // add new dt as needed
516
548
  }
517
549
 
@@ -535,93 +567,111 @@ performs case insensitive match and returns severity rank
535
567
  TODO share data with SOterms
536
568
  */
537
569
  export const vepinfo = function (s) {
538
- const l = s.toLowerCase().split(',')
570
+ const l = s.toLowerCase().split(",")
539
571
  let rank = 1
540
- if (l.indexOf('transcript_ablation') != -1) {
572
+ if (l.indexOf("transcript_ablation") != -1) {
541
573
  // FIXME no class for whole gene deletion
542
574
  return [dtdel, mclassdel, rank]
543
575
  }
544
576
  rank++
545
- if (l.indexOf('splice_acceptor_variant') != -1) return [dtsnvindel, 'L', rank]
577
+ if (l.indexOf("splice_acceptor_variant") != -1) return [dtsnvindel, "L", rank]
546
578
  rank++
547
- if (l.indexOf('splice_donor_variant') != -1) return [dtsnvindel, 'L', rank]
579
+ if (l.indexOf("splice_donor_variant") != -1) return [dtsnvindel, "L", rank]
548
580
  rank++
549
- if (l.indexOf('stop_gained') != -1) return [dtsnvindel, 'N', rank]
581
+ if (l.indexOf("stop_gained") != -1) return [dtsnvindel, "N", rank]
550
582
  rank++
551
- if (l.indexOf('frameshift_variant') != -1) return [dtsnvindel, 'F', rank]
583
+ if (l.indexOf("frameshift_variant") != -1) return [dtsnvindel, "F", rank]
552
584
  rank++
553
- if (l.indexOf('stop_lost') != -1) return [dtsnvindel, 'N', rank]
585
+ if (l.indexOf("stop_lost") != -1) return [dtsnvindel, "N", rank]
554
586
  rank++
555
- if (l.indexOf('start_lost') != -1) return [dtsnvindel, 'N', rank]
587
+ if (l.indexOf("start_lost") != -1) return [dtsnvindel, "N", rank]
556
588
  rank++
557
- if (l.indexOf('transcript_amplification') != -1) {
589
+ if (l.indexOf("transcript_amplification") != -1) {
558
590
  // FIXME no class for whole gene amp
559
591
  return [dtsnvindel, mclassnonstandard, rank]
560
592
  }
561
593
  rank++
562
594
  if (
563
- l.indexOf('inframe_insertion') != -1 ||
564
- l.indexOf('conservative_inframe_insertion') != -1 ||
565
- l.indexOf('disruptive_inframe_insertion') != -1
595
+ l.indexOf("inframe_insertion") != -1 ||
596
+ l.indexOf("conservative_inframe_insertion") != -1 ||
597
+ l.indexOf("disruptive_inframe_insertion") != -1
566
598
  )
567
- return [dtsnvindel, 'I', rank]
599
+ return [dtsnvindel, "I", rank]
568
600
  rank++
569
601
  if (
570
- l.indexOf('inframe_deletion') != -1 ||
571
- l.indexOf('conservative_inframe_deletion') != -1 ||
572
- l.indexOf('disruptive_inframe_deletion') != -1
602
+ l.indexOf("inframe_deletion") != -1 ||
603
+ l.indexOf("conservative_inframe_deletion") != -1 ||
604
+ l.indexOf("disruptive_inframe_deletion") != -1
573
605
  )
574
- return [dtsnvindel, 'D', rank]
606
+ return [dtsnvindel, "D", rank]
575
607
  rank++
576
- if (l.indexOf('missense_variant') != -1) return [dtsnvindel, 'M', rank]
608
+ if (l.indexOf("missense_variant") != -1) return [dtsnvindel, "M", rank]
577
609
  rank++
578
- if (l.indexOf('protein_altering_variant') != -1) return [dtsnvindel, 'ProteinAltering', rank]
610
+ if (l.indexOf("protein_altering_variant") != -1)
611
+ return [dtsnvindel, "ProteinAltering", rank]
579
612
  rank++
580
- if (l.indexOf('splice_region_variant') != -1) return [dtsnvindel, 'P', rank]
613
+ if (l.indexOf("splice_region_variant") != -1) return [dtsnvindel, "P", rank]
581
614
  rank++
582
- if (l.indexOf('incomplete_terminal_codon_variant') != -1) return [dtsnvindel, 'N', rank]
615
+ if (l.indexOf("incomplete_terminal_codon_variant") != -1)
616
+ return [dtsnvindel, "N", rank]
583
617
  rank++
584
- if (l.indexOf('stop_retained_variant') != -1) return [dtsnvindel, 'S', rank]
618
+ if (l.indexOf("stop_retained_variant") != -1) return [dtsnvindel, "S", rank]
585
619
  rank++
586
- if (l.indexOf('synonymous_variant') != -1) return [dtsnvindel, 'S', rank]
620
+ if (l.indexOf("synonymous_variant") != -1) return [dtsnvindel, "S", rank]
587
621
  rank++
588
- if (l.indexOf('coding_sequence_variant') != -1) return [dtsnvindel, mclassnonstandard, rank]
622
+ if (l.indexOf("coding_sequence_variant") != -1)
623
+ return [dtsnvindel, mclassnonstandard, rank]
589
624
  rank++
590
- if (l.indexOf('mature_mirna_variant') != -1) return [dtsnvindel, 'E', rank]
625
+ if (l.indexOf("mature_mirna_variant") != -1) return [dtsnvindel, "E", rank]
591
626
  rank++
592
- if (l.indexOf('5_prime_utr_variant') != -1) return [dtsnvindel, mclassutr5, rank]
627
+ if (l.indexOf("5_prime_utr_variant") != -1)
628
+ return [dtsnvindel, mclassutr5, rank]
593
629
  rank++
594
- if (l.indexOf('3_prime_utr_variant') != -1) return [dtsnvindel, mclassutr3, rank]
630
+ if (l.indexOf("3_prime_utr_variant") != -1)
631
+ return [dtsnvindel, mclassutr3, rank]
595
632
  rank++
596
- if (l.indexOf('non_coding_transcript_exon_variant') != -1) return [dtsnvindel, 'E', rank]
633
+ if (l.indexOf("non_coding_transcript_exon_variant") != -1)
634
+ return [dtsnvindel, "E", rank]
597
635
  rank++
598
- if (l.indexOf('intron_variant') != -1) return [dtsnvindel, 'Intron', rank]
636
+ if (l.indexOf("intron_variant") != -1) return [dtsnvindel, "Intron", rank]
599
637
  rank++
600
- if (l.indexOf('nmd_transcript_variant') != -1) return [dtsnvindel, 'S', rank]
638
+ if (l.indexOf("nmd_transcript_variant") != -1) return [dtsnvindel, "S", rank]
601
639
  rank++
602
- if (l.indexOf('non_coding_transcript_variant') != -1) return [dtsnvindel, 'E', rank]
640
+ if (l.indexOf("non_coding_transcript_variant") != -1)
641
+ return [dtsnvindel, "E", rank]
603
642
  rank++
604
- if (l.indexOf('upstream_gene_variant') != -1) return [dtsnvindel, mclassnoncoding, rank]
643
+ if (l.indexOf("upstream_gene_variant") != -1)
644
+ return [dtsnvindel, mclassnoncoding, rank]
605
645
  rank++
606
- if (l.indexOf('downstream_gene_variant') != -1) return [dtsnvindel, mclassnoncoding, rank]
646
+ if (l.indexOf("downstream_gene_variant") != -1)
647
+ return [dtsnvindel, mclassnoncoding, rank]
607
648
  rank++
608
- if (l.indexOf('tfbs_ablation') != -1) return [dtsnvindel, mclassnoncoding, rank]
649
+ if (l.indexOf("tfbs_ablation") != -1)
650
+ return [dtsnvindel, mclassnoncoding, rank]
609
651
  rank++
610
- if (l.indexOf('tfbs_amplification') != -1) return [dtsnvindel, mclassnoncoding, rank]
652
+ if (l.indexOf("tfbs_amplification") != -1)
653
+ return [dtsnvindel, mclassnoncoding, rank]
611
654
  rank++
612
- if (l.indexOf('tf_binding_site_variant') != -1) return [dtsnvindel, mclassnoncoding, rank]
655
+ if (l.indexOf("tf_binding_site_variant") != -1)
656
+ return [dtsnvindel, mclassnoncoding, rank]
613
657
  rank++
614
- if (l.indexOf('regulatory_region_ablation') != -1) return [dtsnvindel, mclassnoncoding, rank]
658
+ if (l.indexOf("regulatory_region_ablation") != -1)
659
+ return [dtsnvindel, mclassnoncoding, rank]
615
660
  rank++
616
- if (l.indexOf('regulatory_region_amplification') != -1) return [dtsnvindel, mclassnoncoding, rank]
661
+ if (l.indexOf("regulatory_region_amplification") != -1)
662
+ return [dtsnvindel, mclassnoncoding, rank]
617
663
  rank++
618
- if (l.indexOf('feature_elongation') != -1) return [dtsnvindel, mclassnoncoding, rank]
664
+ if (l.indexOf("feature_elongation") != -1)
665
+ return [dtsnvindel, mclassnoncoding, rank]
619
666
  rank++
620
- if (l.indexOf('regulatory_region_variant') != -1) return [dtsnvindel, mclassnoncoding, rank]
667
+ if (l.indexOf("regulatory_region_variant") != -1)
668
+ return [dtsnvindel, mclassnoncoding, rank]
621
669
  rank++
622
- if (l.indexOf('feature_truncation') != -1) return [dtsnvindel, mclassnoncoding, rank]
670
+ if (l.indexOf("feature_truncation") != -1)
671
+ return [dtsnvindel, mclassnoncoding, rank]
623
672
  rank++
624
- if (l.indexOf('intergenic_variant') != -1) return [dtsnvindel, mclassnoncoding, rank]
673
+ if (l.indexOf("intergenic_variant") != -1)
674
+ return [dtsnvindel, mclassnoncoding, rank]
625
675
  rank++
626
676
  return [dtsnvindel, mclassnonstandard, rank]
627
677
  }
@@ -632,65 +682,65 @@ export const germlinelegend =
632
682
 
633
683
  export const morigin = {}
634
684
 
635
- export const moriginsomatic = 'S'
685
+ export const moriginsomatic = "S"
636
686
  morigin[moriginsomatic] = {
637
- label: 'Somatic',
638
- desc: 'A variant found only in a tumor sample. The proportion is indicated by lack of any arc.',
639
- legend: '<circle cx="7" cy="12" r="7" fill="#b1b1b1"></circle>'
687
+ label: "Somatic",
688
+ desc: "A variant found only in a tumor sample. The proportion is indicated by lack of any arc.",
689
+ legend: '<circle cx="7" cy="12" r="7" fill="#b1b1b1"></circle>',
640
690
  }
641
- export const morigingermline = 'G'
691
+ export const morigingermline = "G"
642
692
  morigin[morigingermline] = {
643
- label: 'Germline',
644
- desc: 'A constitutional variant found in a normal sample. The proportion is indicated by the span of the solid arc within the whole circle.',
645
- legend: germlinelegend
693
+ label: "Germline",
694
+ desc: "A constitutional variant found in a normal sample. The proportion is indicated by the span of the solid arc within the whole circle.",
695
+ legend: germlinelegend,
646
696
  }
647
697
 
648
698
  morigin.germline = morigin[morigingermline]
649
699
  morigin.somatic = morigin[moriginsomatic]
650
700
 
651
- export const moriginrelapse = 'R'
701
+ export const moriginrelapse = "R"
652
702
  morigin[moriginrelapse] = {
653
- label: 'Relapse',
654
- desc: 'A somatic variant found only in a relapse sample. The proportion is indicated by the span of the hollow arc within the whole circle.',
703
+ label: "Relapse",
704
+ desc: "A somatic variant found only in a relapse sample. The proportion is indicated by the span of the hollow arc within the whole circle.",
655
705
  legend:
656
- '<circle cx="7" cy="12" r="7" fill="#b1b1b1"></circle><path d="M6.735557395310443e-16,-11A11,11 0 0,1 11,0L9,0A9,9 0 0,0 5.51091059616309e-16,-9Z" transform="translate(7,12)" fill="none" stroke="#858585"></path>'
706
+ '<circle cx="7" cy="12" r="7" fill="#b1b1b1"></circle><path d="M6.735557395310443e-16,-11A11,11 0 0,1 11,0L9,0A9,9 0 0,0 5.51091059616309e-16,-9Z" transform="translate(7,12)" fill="none" stroke="#858585"></path>',
657
707
  }
658
- export const morigingermlinepathogenic = 'GP'
708
+ export const morigingermlinepathogenic = "GP"
659
709
  morigin[morigingermlinepathogenic] = {
660
- label: 'Germline pathogenic',
661
- desc: 'A constitutional variant with pathogenic allele.',
662
- legend: germlinelegend
710
+ label: "Germline pathogenic",
711
+ desc: "A constitutional variant with pathogenic allele.",
712
+ legend: germlinelegend,
663
713
  }
664
- export const morigingermlinenonpathogenic = 'GNP'
714
+ export const morigingermlinenonpathogenic = "GNP"
665
715
  morigin[morigingermlinenonpathogenic] = {
666
- label: 'Germline non-pathogenic',
667
- desc: 'A constitutional variant with non-pathogenic allele.',
716
+ label: "Germline non-pathogenic",
717
+ desc: "A constitutional variant with non-pathogenic allele.",
668
718
  legend: germlinelegend,
669
- hidden: true
719
+ hidden: true,
670
720
  }
671
721
 
672
722
  export const tkt = {
673
- usegm: 'usegm',
674
- ds: 'dataset',
675
- bigwig: 'bigwig',
676
- bigwigstranded: 'bigwigstranded',
677
- junction: 'junction',
678
- mdsjunction: 'mdsjunction',
679
- mdssvcnv: 'mdssvcnv', // replaced by mds3
680
- mdsexpressionrank: 'mdsexpressionrank',
681
- mdsvcf: 'mdsvcf', // for snv/indels, currently vcf, may include MAF
723
+ usegm: "usegm",
724
+ ds: "dataset",
725
+ bigwig: "bigwig",
726
+ bigwigstranded: "bigwigstranded",
727
+ junction: "junction",
728
+ mdsjunction: "mdsjunction",
729
+ mdssvcnv: "mdssvcnv", // replaced by mds3
730
+ mdsexpressionrank: "mdsexpressionrank",
731
+ mdsvcf: "mdsvcf", // for snv/indels, currently vcf, may include MAF
682
732
  //mdsgeneral:'mdsgeneral', // replaces mdssvcnv ****** not ready yet
683
- bedj: 'bedj',
684
- pgv: 'profilegenevalue',
685
- bampile: 'bampile',
686
- hicstraw: 'hicstraw',
687
- expressionrank: 'expressionrank',
688
- aicheck: 'aicheck',
689
- ase: 'ase',
690
- mds3: 'mds3', //
691
- bedgraphdot: 'bedgraphdot',
692
- bam: 'bam',
693
- ld: 'ld'
733
+ bedj: "bedj",
734
+ pgv: "profilegenevalue",
735
+ bampile: "bampile",
736
+ hicstraw: "hicstraw",
737
+ expressionrank: "expressionrank",
738
+ aicheck: "aicheck",
739
+ ase: "ase",
740
+ mds3: "mds3", //
741
+ bedgraphdot: "bedgraphdot",
742
+ bam: "bam",
743
+ ld: "ld",
694
744
  }
695
745
 
696
746
  export function validtkt(what) {
@@ -708,7 +758,7 @@ to get rid of hardcoded strings
708
758
  in future may include MAF format files
709
759
  */
710
760
  export const mdsvcftype = {
711
- vcf: 'vcf'
761
+ vcf: "vcf",
712
762
  }
713
763
 
714
764
  /*
@@ -717,77 +767,77 @@ or general track
717
767
  to avoid using hard-coded string
718
768
  */
719
769
  export const custommdstktype = {
720
- vcf: 'vcf',
721
- svcnvitd: 'svcnvitd',
722
- geneexpression: 'geneexpression'
770
+ vcf: "vcf",
771
+ svcnvitd: "svcnvitd",
772
+ geneexpression: "geneexpression",
723
773
  }
724
774
 
725
775
  // codons that are not here are stop codon!!
726
776
  export const codon = {
727
- GCT: 'A',
728
- GCC: 'A',
729
- GCA: 'A',
730
- GCG: 'A',
731
- CGT: 'R',
732
- CGC: 'R',
733
- CGA: 'R',
734
- CGG: 'R',
735
- AGA: 'R',
736
- AGG: 'R',
737
- AAT: 'N',
738
- AAC: 'N',
739
- GAT: 'D',
740
- GAC: 'D',
741
- TGT: 'C',
742
- TGC: 'C',
743
- CAA: 'Q',
744
- CAG: 'Q',
745
- GAA: 'E',
746
- GAG: 'E',
747
- GGT: 'G',
748
- GGC: 'G',
749
- GGA: 'G',
750
- GGG: 'G',
751
- CAT: 'H',
752
- CAC: 'H',
753
- ATT: 'I',
754
- ATC: 'I',
755
- ATA: 'I',
756
- TTA: 'L',
757
- TTG: 'L',
758
- CTT: 'L',
759
- CTC: 'L',
760
- CTA: 'L',
761
- CTG: 'L',
762
- AAA: 'K',
763
- AAG: 'K',
764
- ATG: 'M',
765
- TTT: 'F',
766
- TTC: 'F',
767
- CCT: 'P',
768
- CCC: 'P',
769
- CCA: 'P',
770
- CCG: 'P',
771
- TCT: 'S',
772
- TCC: 'S',
773
- TCA: 'S',
774
- TCG: 'S',
775
- AGT: 'S',
776
- AGC: 'S',
777
- ACT: 'T',
778
- ACC: 'T',
779
- ACA: 'T',
780
- ACG: 'T',
781
- TGG: 'W',
782
- TAT: 'Y',
783
- TAC: 'Y',
784
- GTT: 'V',
785
- GTC: 'V',
786
- GTA: 'V',
787
- GTG: 'V'
788
- }
789
-
790
- export const codon_stop = '*'
777
+ GCT: "A",
778
+ GCC: "A",
779
+ GCA: "A",
780
+ GCG: "A",
781
+ CGT: "R",
782
+ CGC: "R",
783
+ CGA: "R",
784
+ CGG: "R",
785
+ AGA: "R",
786
+ AGG: "R",
787
+ AAT: "N",
788
+ AAC: "N",
789
+ GAT: "D",
790
+ GAC: "D",
791
+ TGT: "C",
792
+ TGC: "C",
793
+ CAA: "Q",
794
+ CAG: "Q",
795
+ GAA: "E",
796
+ GAG: "E",
797
+ GGT: "G",
798
+ GGC: "G",
799
+ GGA: "G",
800
+ GGG: "G",
801
+ CAT: "H",
802
+ CAC: "H",
803
+ ATT: "I",
804
+ ATC: "I",
805
+ ATA: "I",
806
+ TTA: "L",
807
+ TTG: "L",
808
+ CTT: "L",
809
+ CTC: "L",
810
+ CTA: "L",
811
+ CTG: "L",
812
+ AAA: "K",
813
+ AAG: "K",
814
+ ATG: "M",
815
+ TTT: "F",
816
+ TTC: "F",
817
+ CCT: "P",
818
+ CCC: "P",
819
+ CCA: "P",
820
+ CCG: "P",
821
+ TCT: "S",
822
+ TCC: "S",
823
+ TCA: "S",
824
+ TCG: "S",
825
+ AGT: "S",
826
+ AGC: "S",
827
+ ACT: "T",
828
+ ACC: "T",
829
+ ACA: "T",
830
+ ACG: "T",
831
+ TGG: "W",
832
+ TAT: "Y",
833
+ TAC: "Y",
834
+ GTT: "V",
835
+ GTC: "V",
836
+ GTA: "V",
837
+ GTG: "V",
838
+ }
839
+
840
+ export const codon_stop = "*"
791
841
 
792
842
  export function nt2aa(gm) {
793
843
  // must convert genome seq to upper case!!!
@@ -796,14 +846,14 @@ export function nt2aa(gm) {
796
846
  if (gm.coding) {
797
847
  for (const [i, e] of gm.coding.entries()) {
798
848
  const s = gm.genomicseq.substr(e[0] - gm.start, e[1] - e[0])
799
- if (gm.strand == '-') {
849
+ if (gm.strand == "-") {
800
850
  enlst.push(reversecompliment(s))
801
851
  } else {
802
852
  enlst.push(s)
803
853
  }
804
854
  }
805
855
  }
806
- const nt = enlst.join('')
856
+ const nt = enlst.join("")
807
857
  const pep = []
808
858
 
809
859
  /*
@@ -817,44 +867,44 @@ export function nt2aa(gm) {
817
867
  pep.push(a || codon_stop)
818
868
  }
819
869
  gm.cdseq = nt
820
- return pep.join('')
870
+ return pep.join("")
821
871
  }
822
872
 
823
873
  export function bplen(len, isfile) {
824
874
  // if "isfile" is true, to measure file size instead of basepair len
825
- if (len >= 1000000000) return (len / 1000000000).toFixed(1) + ' Gb'
826
- if (len >= 10000000) return Math.ceil(len / 1000000) + ' Mb'
827
- if (len >= 1000000) return (len / 1000000).toFixed(1) + ' Mb'
828
- if (len >= 10000) return Math.ceil(len / 1000) + ' Kb'
829
- if (len >= 1000) return (len / 1000).toFixed(1) + ' Kb'
830
- return len + (isfile ? 'bytes' : ' bp')
875
+ if (len >= 1000000000) return (len / 1000000000).toFixed(1) + " Gb"
876
+ if (len >= 10000000) return Math.ceil(len / 1000000) + " Mb"
877
+ if (len >= 1000000) return (len / 1000000).toFixed(1) + " Mb"
878
+ if (len >= 10000) return Math.ceil(len / 1000) + " Kb"
879
+ if (len >= 1000) return (len / 1000).toFixed(1) + " Kb"
880
+ return len + (isfile ? "bytes" : " bp")
831
881
  }
832
882
 
833
883
  export const basecolor = {
834
- A: '#ca0020',
835
- T: '#f4a582',
836
- C: '#92c5de',
837
- G: '#0571b0'
884
+ A: "#ca0020",
885
+ T: "#f4a582",
886
+ C: "#92c5de",
887
+ G: "#0571b0",
838
888
  }
839
889
 
840
890
  export function basecompliment(nt) {
841
891
  switch (nt) {
842
- case 'A':
843
- return 'T'
844
- case 'T':
845
- return 'A'
846
- case 'C':
847
- return 'G'
848
- case 'G':
849
- return 'C'
850
- case 'a':
851
- return 't'
852
- case 't':
853
- return 'a'
854
- case 'c':
855
- return 'g'
856
- case 'g':
857
- return 'c'
892
+ case "A":
893
+ return "T"
894
+ case "T":
895
+ return "A"
896
+ case "C":
897
+ return "G"
898
+ case "G":
899
+ return "C"
900
+ case "a":
901
+ return "t"
902
+ case "t":
903
+ return "a"
904
+ case "c":
905
+ return "g"
906
+ case "g":
907
+ return "c"
858
908
  default:
859
909
  return nt
860
910
  }
@@ -865,7 +915,7 @@ export function reversecompliment(s) {
865
915
  for (let i = s.length - 1; i >= 0; i--) {
866
916
  tmp.push(basecompliment(s[i]))
867
917
  }
868
- return tmp.join('')
918
+ return tmp.join("")
869
919
  }
870
920
 
871
921
  export function spliceeventchangegmexon(gm, evt) {
@@ -879,7 +929,7 @@ export function spliceeventchangegmexon(gm, evt) {
879
929
  start: gm.start,
880
930
  stop: gm.stop,
881
931
  strand: gm.strand,
882
- coding: []
932
+ coding: [],
883
933
  }
884
934
  if (evt.isskipexon || evt.isaltexon) {
885
935
  for (let i = 0; i < gm.exon.length; i++) {
@@ -899,8 +949,8 @@ export function spliceeventchangegmexon(gm, evt) {
899
949
  } else if (evt.a5ss || evt.a3ss) {
900
950
  // still equal number of exons
901
951
  // adjust the affected exon first, then figure out coding[]
902
- const exons = gm.exon.map(e => [e[0], e[1]])
903
- const forward = gm.strand == '+'
952
+ const exons = gm.exon.map((e) => [e[0], e[1]])
953
+ const forward = gm.strand == "+"
904
954
  if (evt.a5ss) {
905
955
  if (forward) {
906
956
  exons[evt.exon5idx][1] = evt.junctionB.start
@@ -940,10 +990,10 @@ export function fasta2gmframecheck(gm, str) {
940
990
  str
941
991
  samtools faidx output
942
992
  */
943
- const lines = str.split('\n')
993
+ const lines = str.split("\n")
944
994
  // remove fasta header
945
995
  lines.shift()
946
- gm.genomicseq = lines.join('').toUpperCase()
996
+ gm.genomicseq = lines.join("").toUpperCase()
947
997
 
948
998
  const aaseq = nt2aa(gm)
949
999
 
@@ -961,12 +1011,12 @@ export function validate_vcfinfofilter(obj) {
961
1011
  validate vcfinfofilter as from embedding api or dataset
962
1012
  */
963
1013
 
964
- if (!obj.lst) return '.lst missing'
1014
+ if (!obj.lst) return ".lst missing"
965
1015
 
966
- if (!Array.isArray(obj.lst)) return 'input is not an array'
1016
+ if (!Array.isArray(obj.lst)) return "input is not an array"
967
1017
 
968
1018
  for (const set of obj.lst) {
969
- if (!set.name) return 'name missing from a set of .vcfinfofilter.lst'
1019
+ if (!set.name) return "name missing from a set of .vcfinfofilter.lst"
970
1020
 
971
1021
  if (set.autocategory || set.categories) {
972
1022
  // categorical info, auto or defined
@@ -975,7 +1025,12 @@ export function validate_vcfinfofilter(obj) {
975
1025
  for (const k in set.categories) {
976
1026
  const v = set.categories[k]
977
1027
  if (!set.autocolor && !v.color)
978
- return '.color missing for class ' + k + ' from .categories of set ' + set.name
1028
+ return (
1029
+ ".color missing for class " +
1030
+ k +
1031
+ " from .categories of set " +
1032
+ set.name
1033
+ )
979
1034
  if (!v.label) {
980
1035
  v.label = k
981
1036
  }
@@ -984,7 +1039,13 @@ export function validate_vcfinfofilter(obj) {
984
1039
 
985
1040
  if (set.categoryhidden) {
986
1041
  for (const k in set.categoryhidden) {
987
- if (!set.categories[k]) return 'unknown hidden-by-default category ' + k + ' from set ' + set.name
1042
+ if (!set.categories[k])
1043
+ return (
1044
+ "unknown hidden-by-default category " +
1045
+ k +
1046
+ " from set " +
1047
+ set.name
1048
+ )
988
1049
  }
989
1050
  } else {
990
1051
  set.categoryhidden = {}
@@ -993,15 +1054,15 @@ export function validate_vcfinfofilter(obj) {
993
1054
  // otherwise, numerical value, the style of population frequency filter
994
1055
  const lst = []
995
1056
  for (const v of set.numericfilter) {
996
- if (typeof v == 'number') {
1057
+ if (typeof v == "number") {
997
1058
  /*
998
1059
  just a number, defaults to 'lower-than'
999
1060
  */
1000
- lst.push({ side: '<', value: v })
1061
+ lst.push({ side: "<", value: v })
1001
1062
  } else {
1002
1063
  lst.push({
1003
- side: v.side || '<',
1004
- value: v.value
1064
+ side: v.side || "<",
1065
+ value: v.value,
1005
1066
  })
1006
1067
  }
1007
1068
  }
@@ -1012,14 +1073,16 @@ export function validate_vcfinfofilter(obj) {
1012
1073
 
1013
1074
  if (set.altalleleinfo) {
1014
1075
  if (!set.altalleleinfo.key) {
1015
- return '.key missing from .altalleleinfo from set ' + set.name
1076
+ return ".key missing from .altalleleinfo from set " + set.name
1016
1077
  }
1017
1078
  } else if (set.locusinfo) {
1018
1079
  if (!set.locusinfo.key) {
1019
- return '.key missing from .locusinfo from set ' + set.name
1080
+ return ".key missing from .locusinfo from set " + set.name
1020
1081
  }
1021
1082
  } else {
1022
- return 'neither .altalleleinfo or .locusinfo is available from set ' + set.name
1083
+ return (
1084
+ "neither .altalleleinfo or .locusinfo is available from set " + set.name
1085
+ )
1023
1086
  }
1024
1087
  }
1025
1088
  }
@@ -1029,13 +1092,13 @@ export function contigNameNoChr(genome, chrlst) {
1029
1092
  FIXME hard-coded for human genome styled chromosome names
1030
1093
  */
1031
1094
  for (const n in genome.majorchr) {
1032
- if (chrlst.indexOf(n.replace('chr', '')) != -1) {
1095
+ if (chrlst.indexOf(n.replace("chr", "")) != -1) {
1033
1096
  return true
1034
1097
  }
1035
1098
  }
1036
1099
  if (genome.minorchr) {
1037
1100
  for (const n in genome.minorchr) {
1038
- if (chrlst.indexOf(n.replace('chr', '')) != -1) {
1101
+ if (chrlst.indexOf(n.replace("chr", "")) != -1) {
1039
1102
  return true
1040
1103
  }
1041
1104
  }
@@ -1051,7 +1114,7 @@ export function contigNameNoChr2(genome, chrlst) {
1051
1114
  for (const n in genome.majorchr) {
1052
1115
  if (chrlst.includes(n)) {
1053
1116
  haschrcount++
1054
- } else if (chrlst.includes(n.replace('chr', ''))) {
1117
+ } else if (chrlst.includes(n.replace("chr", ""))) {
1055
1118
  nochrcount++
1056
1119
  }
1057
1120
  }
@@ -1059,7 +1122,7 @@ export function contigNameNoChr2(genome, chrlst) {
1059
1122
  for (const n in genome.minorchr) {
1060
1123
  if (chrlst.includes(n)) {
1061
1124
  haschrcount++
1062
- } else if (chrlst.includes(n.replace('chr', ''))) {
1125
+ } else if (chrlst.includes(n.replace("chr", ""))) {
1063
1126
  nochrcount++
1064
1127
  }
1065
1128
  }
@@ -1084,18 +1147,18 @@ export function getMax_byiqr(lst, novaluemax) {
1084
1147
 
1085
1148
  export function alleleInGenotypeStr(genotype, allele) {
1086
1149
  if (!genotype) return false
1087
- if (genotype.indexOf('/') != -1) {
1088
- return genotype.split('/').indexOf(allele) != -1
1150
+ if (genotype.indexOf("/") != -1) {
1151
+ return genotype.split("/").indexOf(allele) != -1
1089
1152
  }
1090
- return genotype.split('|').indexOf(allele) != -1
1153
+ return genotype.split("|").indexOf(allele) != -1
1091
1154
  }
1092
1155
 
1093
1156
  export const gmmode = {
1094
- genomic: 'genomic',
1095
- splicingrna: 'splicing RNA', // if just 1 exon, use "RNA" as label
1096
- exononly: 'exon only',
1097
- protein: 'protein',
1098
- gmsum: 'aggregated exons'
1157
+ genomic: "genomic",
1158
+ splicingrna: "splicing RNA", // if just 1 exon, use "RNA" as label
1159
+ exononly: "exon only",
1160
+ protein: "protein",
1161
+ gmsum: "aggregated exons",
1099
1162
  }
1100
1163
 
1101
1164
  /*
@@ -1134,13 +1197,13 @@ export function vcfcopymclass(m, block) {
1134
1197
 
1135
1198
  if (block.usegm) {
1136
1199
  // block is in gm mode, find a csq matching with the genemodel isoform
1137
- useone = m.csq.find(i => i._isoform == block.usegm.isoform)
1200
+ useone = m.csq.find((i) => i._isoform == block.usegm.isoform)
1138
1201
  }
1139
1202
 
1140
1203
  if (!useone) {
1141
1204
  // no match to usegm isoform; can be due to in genomic mode and zoomed out, where this variant is from a neighboring gene near block.usegm
1142
1205
  // find one using canonical isoform
1143
- useone = m.csq.find(i => i.CANONICAL)
1206
+ useone = m.csq.find((i) => i.CANONICAL)
1144
1207
 
1145
1208
  if (!useone) {
1146
1209
  // none of the elements in m.csq[] is using a canonical isoform, as that's a vep optional output
@@ -1211,7 +1274,7 @@ export function vcfcopymclass(m, block) {
1211
1274
  if (mclass[m.type]) {
1212
1275
  m.class = m.type
1213
1276
  m.dt = mclass[m.type].dt
1214
- m.mname = m.id && m.id != '.' ? m.id : m.ref + '>' + m.alt
1277
+ m.mname = m.id && m.id != "." ? m.id : m.ref + ">" + m.alt
1215
1278
  if (m.mname.length > 15) {
1216
1279
  // avoid long indel
1217
1280
  m.mname = m.type
@@ -1230,14 +1293,17 @@ export function vcfcopymclass(m, block) {
1230
1293
  used in:
1231
1294
  mdssvcnv track, mutation attributes, items that are not annotated by an attribute for showing in legend, and server-side filtering
1232
1295
  */
1233
- export const not_annotated = 'Unannotated'
1296
+ export const not_annotated = "Unannotated"
1234
1297
 
1235
1298
  // kernal density estimator as from https://www.d3-graph-gallery.com/graph/density_basic.html
1236
1299
 
1237
1300
  export function kernelDensityEstimator(kernel, X) {
1238
1301
  return function (V) {
1239
- return X.map(x => {
1240
- return [x, V.map(v => kernel(x - v)).reduce((i, j) => i + j, 0) / V.length]
1302
+ return X.map((x) => {
1303
+ return [
1304
+ x,
1305
+ V.map((v) => kernel(x - v)).reduce((i, j) => i + j, 0) / V.length,
1306
+ ]
1241
1307
  })
1242
1308
  }
1243
1309
  }
@@ -1251,33 +1317,34 @@ export function kernelEpanechnikov(k) {
1251
1317
  /////////////////////// color sets /////////////////////////
1252
1318
 
1253
1319
  export const schemeCategory20 = [
1254
- '#1f77b4',
1255
- '#aec7e8',
1256
- '#ff7f0e',
1257
- '#ffbb78',
1258
- '#2ca02c',
1259
- '#98df8a',
1260
- '#d62728',
1261
- '#ff9896',
1262
- '#9467bd',
1263
- '#c5b0d5',
1264
- '#8c564b',
1265
- '#c49c94',
1266
- '#e377c2',
1267
- '#f7b6d2',
1268
- '#7f7f7f',
1269
- '#c7c7c7',
1270
- '#bcbd22',
1271
- '#dbdb8d',
1272
- '#17becf',
1273
- '#9edae5'
1320
+ "#1f77b4",
1321
+ "#aec7e8",
1322
+ "#ff7f0e",
1323
+ "#ffbb78",
1324
+ "#2ca02c",
1325
+ "#98df8a",
1326
+ "#d62728",
1327
+ "#ff9896",
1328
+ "#9467bd",
1329
+ "#c5b0d5",
1330
+ "#8c564b",
1331
+ "#c49c94",
1332
+ "#e377c2",
1333
+ "#f7b6d2",
1334
+ "#7f7f7f",
1335
+ "#c7c7c7",
1336
+ "#bcbd22",
1337
+ "#dbdb8d",
1338
+ "#17becf",
1339
+ "#9edae5",
1274
1340
  ]
1275
- export const schemeCategory2 = ['#e75480', 'blue']
1341
+ export const schemeCategory2 = ["#e75480", "blue"]
1276
1342
 
1277
1343
  export function getColorScheme(number) {
1278
1344
  if (number > 20) {
1279
1345
  const scheme = []
1280
- for (let i = 0; i < number; i++) scheme.push(d3.interpolateRainbow(i / number))
1346
+ for (let i = 0; i < number; i++)
1347
+ scheme.push(d3.interpolateRainbow(i / number))
1281
1348
  return scheme
1282
1349
  }
1283
1350
  if (number > 12) return schemeCategory20
@@ -1292,16 +1359,16 @@ export function getColors(number) {
1292
1359
 
1293
1360
  // for now not using getColorScheme() for protein domains, because this color list have been in use since 2015...
1294
1361
  const proteinDomainColors = [
1295
- '#8dd3c7',
1296
- '#bebada',
1297
- '#fb8072',
1298
- '#80b1d3',
1299
- '#E8E89E',
1300
- '#a6d854',
1301
- '#fdb462',
1302
- '#ffd92f',
1303
- '#e5c494',
1304
- '#b3b3b3'
1362
+ "#8dd3c7",
1363
+ "#bebada",
1364
+ "#fb8072",
1365
+ "#80b1d3",
1366
+ "#E8E89E",
1367
+ "#a6d854",
1368
+ "#fdb462",
1369
+ "#ffd92f",
1370
+ "#e5c494",
1371
+ "#b3b3b3",
1305
1372
  ]
1306
1373
  export function proteinDomainColorScale() {
1307
1374
  return d3scale.scaleOrdinal().range(proteinDomainColors)
@@ -1309,70 +1376,86 @@ export function proteinDomainColorScale() {
1309
1376
 
1310
1377
  /////////////////////// end of color sets /////////////////////////
1311
1378
 
1312
- export const truncatingMutations = ['F', 'N', 'L', 'P']
1313
- export const proteinChangingMutations = ['F', 'N', 'L', 'P', 'D', 'I', 'ProteinAltering', 'M']
1314
- export const synonymousMutations = ['S', 'Intron', 'Utr3', 'Utr5', 'noncoding', 'E']
1379
+ export const truncatingMutations = ["F", "N", "L", "P"]
1380
+ export const proteinChangingMutations = [
1381
+ "F",
1382
+ "N",
1383
+ "L",
1384
+ "P",
1385
+ "D",
1386
+ "I",
1387
+ "ProteinAltering",
1388
+ "M",
1389
+ ]
1390
+ export const synonymousMutations = [
1391
+ "S",
1392
+ "Intron",
1393
+ "Utr3",
1394
+ "Utr5",
1395
+ "noncoding",
1396
+ "E",
1397
+ ]
1315
1398
  export const mutationClasses = Object.values(mclass)
1316
- .filter(m => m.dt == dtsnvindel)
1317
- .map(m => m.key)
1399
+ .filter((m) => m.dt == dtsnvindel)
1400
+ .map((m) => m.key)
1318
1401
  export const CNVClasses = Object.values(mclass)
1319
- .filter(m => m.dt == dtcnv)
1320
- .map(m => m.key)
1402
+ .filter((m) => m.dt == dtcnv)
1403
+ .map((m) => m.key)
1321
1404
 
1322
1405
  // dt terms used for filtering variants for geneVariant term
1323
1406
  const dtTerms_temp = [
1324
1407
  {
1325
- id: 'snvindel',
1326
- query: 'snvindel',
1408
+ id: "snvindel",
1409
+ query: "snvindel",
1327
1410
  name: dt2label[dtsnvindel],
1328
1411
  parent_id: null,
1329
1412
  isleaf: true,
1330
- type: 'dtsnvindel',
1413
+ type: "dtsnvindel",
1331
1414
  dt: dtsnvindel,
1332
- values: {}
1415
+ values: {},
1333
1416
  },
1334
1417
  {
1335
- id: 'cnv',
1336
- query: 'cnv',
1418
+ id: "cnv",
1419
+ query: "cnv",
1337
1420
  name: dt2label[dtcnv],
1338
1421
  parent_id: null,
1339
1422
  isleaf: true,
1340
- type: 'dtcnv',
1423
+ type: "dtcnv",
1341
1424
  dt: dtcnv,
1342
- values: {}
1425
+ values: {},
1343
1426
  },
1344
1427
  {
1345
- id: 'fusion',
1346
- query: 'svfusion',
1428
+ id: "fusion",
1429
+ query: "svfusion",
1347
1430
  name: dt2label[dtfusionrna],
1348
1431
  parent_id: null,
1349
1432
  isleaf: true,
1350
- type: 'dtfusion',
1433
+ type: "dtfusion",
1351
1434
  dt: dtfusionrna,
1352
- values: {}
1435
+ values: {},
1353
1436
  },
1354
1437
  {
1355
- id: 'sv',
1356
- query: 'svfusion',
1438
+ id: "sv",
1439
+ query: "svfusion",
1357
1440
  name: dt2label[dtsv],
1358
1441
  parent_id: null,
1359
1442
  isleaf: true,
1360
- type: 'dtsv',
1443
+ type: "dtsv",
1361
1444
  dt: dtsv,
1362
- values: {}
1363
- }
1445
+ values: {},
1446
+ },
1364
1447
  ]
1365
1448
  // add origin annotations to dt terms
1366
1449
  const dtTerms_temp2 = []
1367
1450
  for (const dtTerm of dtTerms_temp) {
1368
1451
  dtTerm.name_noOrigin = dtTerm.name // for labeling groups in groupsetting
1369
1452
  dtTerms_temp2.push(dtTerm) // no origin
1370
- for (const origin of ['somatic', 'germline']) {
1453
+ for (const origin of ["somatic", "germline"]) {
1371
1454
  // add origins
1372
1455
  const addOrigin = {
1373
1456
  id: `${dtTerm.id}_${origin}`,
1374
1457
  name: `${dtTerm.name} (${origin})`,
1375
- origin
1458
+ origin,
1376
1459
  }
1377
1460
  dtTerms_temp2.push(Object.assign({}, dtTerm, addOrigin))
1378
1461
  }
@@ -1380,39 +1463,63 @@ for (const dtTerm of dtTerms_temp) {
1380
1463
  export const dtTerms = dtTerms_temp2
1381
1464
 
1382
1465
  export const colorScaleMap = {
1383
- blueWhiteRed: { domain: [0, 0.5, 1], range: ['blue', 'white', 'red'] },
1384
- greenWhiteRed: { domain: [0, 0.5, 1], range: ['green', 'white', 'red'] },
1466
+ blueWhiteRed: { domain: [0, 0.5, 1], range: ["blue", "white", "red"] },
1467
+ greenWhiteRed: { domain: [0, 0.5, 1], range: ["green", "white", "red"] },
1385
1468
  blueYellowRed: {
1386
1469
  domain: [0, 0.17, 0.33, 0.5, 0.67, 0.83, 1],
1387
- range: ['#313695', '#649AC7', '#BCE1ED', '#FFFFBF', '#FDBE70', '#EA5839', '#A50026']
1470
+ range: [
1471
+ "#313695",
1472
+ "#649AC7",
1473
+ "#BCE1ED",
1474
+ "#FFFFBF",
1475
+ "#FDBE70",
1476
+ "#EA5839",
1477
+ "#A50026",
1478
+ ],
1388
1479
  },
1389
1480
  greenBlackRed: {
1390
1481
  domain: [0, 0.17, 0.33, 0.5, 0.67, 0.83, 1],
1391
- range: ['#00FF00', '#14E10C', '#1AAF10', '#000000', '#B01205', '#E20E03', '#FF0000']
1482
+ range: [
1483
+ "#00FF00",
1484
+ "#14E10C",
1485
+ "#1AAF10",
1486
+ "#000000",
1487
+ "#B01205",
1488
+ "#E20E03",
1489
+ "#FF0000",
1490
+ ],
1392
1491
  },
1393
1492
  blueBlackYellow: {
1394
1493
  domain: [0, 0.17, 0.33, 0.5, 0.67, 0.83, 1],
1395
- range: ['#0000FF', '#0000CC', '#000099', '#202020', '#999900', '#CCCC00', '#FFFF00']
1494
+ range: [
1495
+ "#0000FF",
1496
+ "#0000CC",
1497
+ "#000099",
1498
+ "#202020",
1499
+ "#999900",
1500
+ "#CCCC00",
1501
+ "#FFFF00",
1502
+ ],
1396
1503
  },
1397
1504
  // when hierCluster z-score transformation is not performed, should use two-color scale
1398
- whiteRed: { domain: [0, 1], range: ['white', 'red'] }
1505
+ whiteRed: { domain: [0, 1], range: ["white", "red"] },
1399
1506
  }
1400
1507
 
1401
1508
  export function invalidcoord(thisgenome, chrom, start, stop) {
1402
- if (!thisgenome) return 'no genome'
1403
- if (!chrom) return 'no chr name'
1509
+ if (!thisgenome) return "no genome"
1510
+ if (!chrom) return "no chr name"
1404
1511
  const chr = thisgenome.chrlookup[chrom.toUpperCase()]
1405
- if (!chr) return 'Invalid chromosome name: ' + chr
1406
- if (!Number.isInteger(start)) return 'Non-numerical position: ' + start
1407
- if (start < 0 || start >= chr.len) return 'Position out of range: ' + start
1408
- if (!Number.isInteger(stop)) return 'Non-numerical position: ' + stop
1409
- if (stop < 0 || stop > chr.len) return 'Position out of range: ' + stop
1410
- if (start > stop) return 'Start position is greater than stop'
1512
+ if (!chr) return "Invalid chromosome name: " + chr
1513
+ if (!Number.isInteger(start)) return "Non-numerical position: " + start
1514
+ if (start < 0 || start >= chr.len) return "Position out of range: " + start
1515
+ if (!Number.isInteger(stop)) return "Non-numerical position: " + stop
1516
+ if (stop < 0 || stop > chr.len) return "Position out of range: " + stop
1517
+ if (start > stop) return "Start position is greater than stop"
1411
1518
  return false
1412
1519
  }
1413
1520
 
1414
1521
  export function string2pos(s, genome, donotextend) {
1415
- s = s.replace(/,/g, '')
1522
+ s = s.replace(/,/g, "")
1416
1523
  const chr = genome.chrlookup[s.toUpperCase()]
1417
1524
  if (chr) {
1418
1525
  // chr name only, to middle
@@ -1420,12 +1527,12 @@ export function string2pos(s, genome, donotextend) {
1420
1527
  chr: chr.name,
1421
1528
  chrlen: chr.len,
1422
1529
  start: Math.max(0, Math.ceil(chr.len / 2) - 10000),
1423
- stop: Math.min(chr.len, Math.ceil(chr.len / 2) + 10000)
1530
+ stop: Math.min(chr.len, Math.ceil(chr.len / 2) + 10000),
1424
1531
  }
1425
1532
  }
1426
1533
  {
1427
1534
  // special handling for snv4
1428
- const tmp = s.split('.')
1535
+ const tmp = s.split(".")
1429
1536
  if (tmp.length >= 2) {
1430
1537
  const chr = genome.chrlookup[tmp[0].toUpperCase()]
1431
1538
  const pos = Number.parseInt(tmp[1])
@@ -1438,7 +1545,7 @@ export function string2pos(s, genome, donotextend) {
1438
1545
  chrlen: chr.len,
1439
1546
  start: Math.max(0, pos - Math.ceil(bpspan / 2)),
1440
1547
  stop: Math.min(chr.len, pos + Math.ceil(bpspan / 2)),
1441
- actualposition: { position: pos, len: 1 }
1548
+ actualposition: { position: pos, len: 1 },
1442
1549
  }
1443
1550
  }
1444
1551
  }
@@ -1458,7 +1565,7 @@ export function string2pos(s, genome, donotextend) {
1458
1565
  chrlen: chr.len,
1459
1566
  start: Math.max(0, pos - Math.ceil(bpspan / 2)),
1460
1567
  stop: Math.min(chr.len, pos + Math.ceil(bpspan / 2)),
1461
- actualposition: { position: pos, len: 1 }
1568
+ actualposition: { position: pos, len: 1 },
1462
1569
  }
1463
1570
  }
1464
1571
  if (tmp.length == 3) {
@@ -1489,7 +1596,7 @@ export function string2pos(s, genome, donotextend) {
1489
1596
  chrlen: chr.len,
1490
1597
  start,
1491
1598
  stop,
1492
- actualposition
1599
+ actualposition,
1493
1600
  }
1494
1601
  }
1495
1602
  return null