samplevis.json 21.2 KB
Newer Older
jhoogenboom's avatar
jhoogenboom committed
1
2
3
{
  "width": 600,
  "height": 10,
4
5
6
7
8
9
10
11
12
  "signals": [
    {
      "name": "amplitude_threshold",
      "init": 5
    },
    {
      "name": "amplitude_pct_threshold",
      "init": 0.5
    },
13
14
15
16
    {
      "name": "amplitude_markerpct_threshold",
      "init": 0
    },
17
18
19
20
    {
      "name": "orientation_threshold",
      "init": 0
    },
21
22
23
24
    {
      "name": "show_negative",
      "init": true
    },
25
26
27
28
    {
      "name": "show_other",
      "init": true
    },
29
30
31
32
33
34
    {
      "name": "bias_threshold",
      "init": 25
    },
    {
      "name": "filter_marker",
35
36
37
38
39
40
      "init": ""
    },
    {
      "name": "marker_regex",
      "init": {"expr": "regexp('(?:' + replace(replace(replace(filter_marker, /^ *(.*?) *$/, '$1'), /(^| )=(.*?)(?= |$)/g, '$1^$2$$'), / +/g, ')|(?:') + ')')"},
      "expr": "regexp('(?:' + replace(replace(replace(filter_marker, /^ *(.*?) *$/, '$1'), /(^| )=(.*?)(?= |$)/g, '$1^$2$$'), / +/g, ')|(?:') + ')')"
41
42
43
44
45
46
47
48
49
50
51
52
53
    },
    {
      "name": "barwidth",
      "init": 15
    },
    {
      "name": "subgraphoffset",
      "init": 70
    },
    {
      "name": "clickedAllele",
      "verbose": true,
      "streams": [
54
        {"type": "@alleleSelector:click[datum.thedatum]", "expr": "datum.thedatum"}
55
56
57
      ]
    }
  ],
jhoogenboom's avatar
jhoogenboom committed
58
59
  "data": [
    {
jhoogenboom's avatar
jhoogenboom committed
60
      "name": "raw",
jhoogenboom's avatar
jhoogenboom committed
61
62
63
64
65
      "values": "sample_data_file_contents_here",
      "format": {
        "type": "tsv",
        "parse": {
          "forward": "number",
66
67
          "forward_noise": "number",
          "forward_add": "number",
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
68
          "reverse": "number",
69
70
          "reverse_noise": "number",
          "reverse_add": "number",
jhoogenboom's avatar
jhoogenboom committed
71
72
73
74
75
76
          "total": "number",
          "total_noise": "number",
          "total_add": "number"
        }
      },
      "transform": [
77
78
79
80
        {
          "type": "filter",
          "test": "test(marker_regex, datum.marker)"
        },
81
82
83
84
85
86
87
88
89
90
        {
          "type": "formula",
          "field": "forward_corr",
          "expr": "datum.forward_noise? datum.forward-datum.forward_noise : datum.forward"
        },
        {
          "type": "formula",
          "field": "reverse_corr",
          "expr": "datum.reverse_noise? datum.reverse-datum.reverse_noise : datum.reverse"
        },
jhoogenboom's avatar
jhoogenboom committed
91
92
93
94
95
96
97
        {
          "type": "formula",
          "field": "total_corr",
          "expr": "datum.total_noise? datum.total-datum.total_noise : datum.total"
        },
        {
          "type": "formula",
98
99
          "field": "forward_added",
          "expr": "datum.forward_add? datum.forward_corr+datum.forward_add : datum.forward_corr"
jhoogenboom's avatar
jhoogenboom committed
100
        },
jhoogenboom's avatar
jhoogenboom committed
101
102
        {
          "type": "formula",
103
104
105
106
107
108
109
          "field": "reverse_added",
          "expr": "datum.reverse_add? datum.reverse_corr+datum.reverse_add : datum.reverse_corr"
        },
        {
          "type": "formula",
          "field": "total_added",
          "expr": "datum.total_add? datum.total_corr+datum.total_add : datum.total_corr"
jhoogenboom's avatar
jhoogenboom committed
110
111
112
113
        }
      ]
    },
    {
114
      "name": "aggr",
jhoogenboom's avatar
jhoogenboom committed
115
116
117
118
      "source": "raw",
      "transform": [
        {
          "type": "aggregate",
119
          "groupby": ["marker"],
120
          "summarize": {"total_added": ["sum", "max"]}
jhoogenboom's avatar
jhoogenboom committed
121
122
123
124
        }
      ]
    },
    {
125
      "name": "preannotated",
jhoogenboom's avatar
jhoogenboom committed
126
127
128
129
      "source": "raw",
      "transform": [
        {
          "type": "lookup",
130
          "on": "aggr",
131
132
          "onKey": "marker",
          "keys": ["marker"],
jhoogenboom's avatar
jhoogenboom committed
133
          "as": ["aggr"],
134
          "default": {"max_total_added": 0, "sum_total_added": 0}
jhoogenboom's avatar
jhoogenboom committed
135
136
137
        },
        {
          "type": "formula",
138
139
          "field": "pct_of_max",
          "expr": "datum.aggr.max_total_added? (datum.total_added / datum.aggr.max_total_added * 100) : 100"
140
141
        },
        {
142
          "type": "formula",
143
144
          "field": "pct_of_sum",
          "expr": "datum.aggr.sum_total_added? (datum.total_added / datum.aggr.sum_total_added * 100) : 100"
145
        },
146
147
148
149
150
151
152
153
154
155
156
        {
          "type": "formula",
          "field": "markersequence",
          "expr": "datum.marker + '\t' + datum.sequence"
        }
      ]
    },
    {
      "name": "annotated",
      "source": "preannotated",
      "transform": [
157
158
159
160
        {
          "type": "filter",
          "test": "datum.sequence != 'Other sequences'"
        },
jhoogenboom's avatar
jhoogenboom committed
161
162
163
164
165
166
167
168
        {
          "type": "formula",
          "field": "shared",
          "expr": "max(0, datum.total_corr)"
        },
        {
          "type": "formula",
          "field": "corr_shared",
169
          "expr": "min(datum.total, datum.total_added)"
jhoogenboom's avatar
jhoogenboom committed
170
171
172
173
174
175
176
177
        },
        {
          "type": "formula",
          "field": "corr_decreased",
          "expr": "max(datum.total, datum.corr_shared)"
        },
        {
          "type": "formula",
178
179
          "field": "forwardpct",
          "expr": "datum.total_added? (100.0 / datum.total_added * datum.forward_added) : 50"
jhoogenboom's avatar
jhoogenboom committed
180
181
182
        },
        {
          "type": "formula",
183
184
          "field": "minimum",
          "expr": "min(0, datum.total_corr)"
jhoogenboom's avatar
jhoogenboom committed
185
        },
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
186
187
188
        {
          "type": "formula",
          "field": "xlow",
189
190
191
192
193
194
          "expr": "datum.minimum*1.05"
        },
        {
          "type": "formula",
          "field": "maximum",
          "expr": "max(datum.total, datum.total_added)"
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
195
196
197
198
        },
        {
          "type": "formula",
          "field": "xhigh",
199
          "expr": "datum.maximum*1.05"
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
200
201
202
203
        },
        {
          "type": "formula",
          "field": "biasmark",
204
205
206
207
208
209
210
211
212
213
          "expr": "50-abs(datum.forwardpct-50) < bias_threshold? '\u2605' : ''"
        },
        {
          "type": "formula",
          "field": "thedatum",
          "expr": "datum"
        }
      ]
    },
    {
214
      "name": "unranked",
215
      "source": "preannotated",
216
      "transform": [
217
218
219
220
221
        {
          "type": "formula",
          "field": "sequence",
          "expr": "((show_negative? abs(datum.total_added) : datum.total_added) >= amplitude_threshold && (show_negative? abs(datum.pct_of_max) : datum.pct_of_max) >= amplitude_pct_threshold && (show_negative? abs(datum.pct_of_sum) : datum.pct_of_sum) >= amplitude_markerpct_threshold && min(show_negative? abs(datum.forward_added) : datum.forward_added, show_negative? abs(datum.reverse_added) : datum.reverse_added) >= orientation_threshold)? datum.sequence : 'Other sequences'"
        },
222
223
        {
          "type": "filter",
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
          "test": "show_other || datum.sequence != 'Other sequences'"
        },
        {
          "type": "aggregate",
          "groupby": ["marker", "sequence"],
          "summarize": [
            {"field": "forward",        "ops": ["sum"], "as": ["forward"]},
            {"field": "reverse",        "ops": ["sum"], "as": ["reverse"]},
            {"field": "total",          "ops": ["sum"], "as": ["total"]},
            {"field": "forward_noise",  "ops": ["sum"], "as": ["forward_noise"]},
            {"field": "reverse_noise",  "ops": ["sum"], "as": ["reverse_noise"]},
            {"field": "total_noise",    "ops": ["sum"], "as": ["total_noise"]},
            {"field": "forward_add",    "ops": ["sum"], "as": ["forward_add"]},
            {"field": "reverse_add",    "ops": ["sum"], "as": ["reverse_add"]},
            {"field": "total_add",      "ops": ["sum"], "as": ["total_add"]},
            {"field": "forward_corr",   "ops": ["sum"], "as": ["forward_corr"]},
            {"field": "reverse_corr",   "ops": ["sum"], "as": ["reverse_corr"]},
            {"field": "total_corr",     "ops": ["sum"], "as": ["total_corr"]},
            {"field": "forward_added",  "ops": ["sum"], "as": ["forward_added"]},
            {"field": "reverse_added",  "ops": ["sum"], "as": ["reverse_added"]},
            {"field": "total_added",    "ops": ["sum"], "as": ["total_added"]}
          ]
        },
        {
          "type": "formula",
          "field": "shared",
          "expr": "max(0, datum.total_corr)"
        },
        {
          "type": "formula",
          "field": "corr_shared",
          "expr": "min(datum.total, datum.total_added)"
        },
        {
          "type": "formula",
          "field": "corr_decreased",
          "expr": "max(datum.total, datum.corr_shared)"
        },
        {
          "type": "formula",
          "field": "forwardpct",
          "expr": "datum.total_added? (100.0 / datum.total_added * datum.forward_added) : 50"
        },
        {
          "type": "formula",
          "field": "minimum",
          "expr": "min(0, datum.total_corr)"
        },
        {
          "type": "formula",
          "field": "xlow",
          "expr": "datum.minimum*1.05"
        },
        {
          "type": "formula",
          "field": "maximum",
          "expr": "max(datum.total, datum.total_added)"
        },
        {
          "type": "formula",
          "field": "xhigh",
          "expr": "datum.maximum*1.05"
        },
        {
          "type": "formula",
          "field": "biasmark",
          "expr": "50-abs(datum.forwardpct-50) < bias_threshold? '\u2605' : ''"
        },
        {
          "type": "formula",
          "field": "markersequence",
          "expr": "datum.marker + '\t' + datum.sequence"
        },
        {
          "type": "lookup",
          "on": "annotated",
          "onKey": "markersequence",
          "keys": ["markersequence"],
          "as": ["thedatum"]
303
304
305
306
307
308
309
310
311
312
313
        }
      ]
    },
    {
      "name": "ranks",
      "source": "unranked",
      "transform": [
        {
          "type": "cross",
          "diagonal": false,
          "filter": "datum.b.marker > datum.a.marker || (datum.b.marker == datum.a.marker && (datum.b.total_added < datum.a.total_added || (datum.b.total_added == datum.a.total_added && (datum.b.total_corr < datum.a.total_corr || (datum.b.total_corr == datum.a.total_corr && (datum.b.total < datum.a.total || (datum.b.total == datum.a.total && datum.b.sequence > datum.a.sequence)))))))"
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
314
        },
jhoogenboom's avatar
jhoogenboom committed
315
        {
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
          "type": "formula",
          "field": "markersequence",
          "expr": "datum.a.markersequence"
        },
        {
          "type": "formula",
          "field": "sequence",
          "expr": "datum.a.sequence"
        },
        {
          "type": "aggregate",
          "groupby": ["markersequence", "sequence"],
          "summarize": [{"field": "*", "ops": ["count"], "as": ["rank"]}]
        },
        {
          "type": "formula",
          "field": "rank",
          "expr": "datum.sequence == 'Other sequences'? -1 : datum.rank"
        }
      ]
    },
    {
      "name": "table",
      "source": "unranked",
      "transform": [
        {
          "type": "lookup",
          "on": "ranks",
          "onKey": "markersequence",
          "keys": ["markersequence"],
          "as": ["rankobj"],
          "default": {"rank": 0}
        },
        {
          "type": "formula",
          "field": "rank",
          "expr": "datum.rankobj.rank"
jhoogenboom's avatar
jhoogenboom committed
353
354
355
356
        }
      ]
    },
    {
357
      "name": "barcounts",
jhoogenboom's avatar
jhoogenboom committed
358
359
360
361
      "source": "table",
      "transform": [
        {
          "type": "aggregate",
362
          "groupby": ["marker"],
jhoogenboom's avatar
jhoogenboom committed
363
364
365
366
367
          "summarize": {"*": "count"}
        }
      ]
    },
    {
368
369
      "name": "subgraphpadding",
      "source": "barcounts",
jhoogenboom's avatar
jhoogenboom committed
370
371
372
      "transform": [
        {
          "type": "cross",
373
          "diagonal": false,
374
          "filter": "datum.b.marker < datum.a.marker"
jhoogenboom's avatar
jhoogenboom committed
375
376
377
        },
        {
          "type": "formula",
378
379
          "field": "marker",
          "expr": "datum.a.marker"
jhoogenboom's avatar
jhoogenboom committed
380
381
382
        },
        {
          "type": "aggregate",
383
          "groupby": ["marker"],
jhoogenboom's avatar
jhoogenboom committed
384
          "summarize": [{"field": "*", "ops": ["count"], "as": ["cumulpadding"]}]
jhoogenboom's avatar
jhoogenboom committed
385
386
387
388
        }
      ]
    },
    {
389
390
      "name": "subgraphoffsets",
      "source": "barcounts",
jhoogenboom's avatar
jhoogenboom committed
391
392
393
      "transform": [
        {
          "type": "cross",
394
395
          "with": "table",
          "diagonal": false,
396
          "filter": "datum.b.marker < datum.a.marker"
jhoogenboom's avatar
jhoogenboom committed
397
398
399
        },
        {
          "type": "formula",
400
401
          "field": "marker",
          "expr": "datum.a.marker"
jhoogenboom's avatar
jhoogenboom committed
402
403
404
        },
        {
          "type": "aggregate",
405
          "groupby": ["marker"],
jhoogenboom's avatar
jhoogenboom committed
406
          "summarize": [{"field": "*", "ops": ["count"], "as": ["cumulcount"]}]
jhoogenboom's avatar
jhoogenboom committed
407
408
409
410
411
        }
      ]
    },
    {
      "name": "yscale",
412
      "source": "barcounts",
jhoogenboom's avatar
jhoogenboom committed
413
414
      "transform": [
        {
jhoogenboom's avatar
jhoogenboom committed
415
          "type": "lookup",
416
          "on": "subgraphpadding",
417
418
          "onKey": "marker",
          "keys": ["marker"],
jhoogenboom's avatar
jhoogenboom committed
419
          "as": ["paddingobj"],
jhoogenboom's avatar
jhoogenboom committed
420
421
422
          "default": {"cumulpadding": 0}
        },
        {
jhoogenboom's avatar
jhoogenboom committed
423
          "type": "lookup",
424
          "on": "subgraphoffsets",
425
426
          "onKey": "marker",
          "keys": ["marker"],
jhoogenboom's avatar
jhoogenboom committed
427
          "as": ["offsetobj"],
jhoogenboom's avatar
jhoogenboom committed
428
429
430
431
432
          "default": {"cumulcount": 0}
        },
        {
          "type": "formula",
          "field": "offset",
433
          "expr": "barwidth*datum.offsetobj.cumulcount + subgraphoffset*datum.paddingobj.cumulpadding"
jhoogenboom's avatar
jhoogenboom committed
434
435
436
437
        },
        {
          "type": "formula",
          "field": "end",
438
          "expr": "datum.offset + barwidth*datum.count"
jhoogenboom's avatar
jhoogenboom committed
439
440
        }
      ]
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
441
442
443
444
445
446
447
    },
    {
      "name": "selectedAlleles",
      "modify": [
        {
          "type": "toggle",
          "signal": "clickedAllele",
448
          "field": "sequence"
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
449
450
451
452
453
        }
      ],
      "transform": [
        {
          "type": "filter",
454
          "test": "datum.sequence"
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
455
456
457
458
459
460
461
462
        }
      ]
    }
  ],
  "predicates": [
    {
      "name": "isSelected",
      "type": "in",
463
      "item": {"arg": "sequence"},
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
464
      "data": "selectedAlleles",
465
      "field": "sequence"
jhoogenboom's avatar
jhoogenboom committed
466
467
468
    }
  ],
  "scales": [
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
469
470
471
472
    {
      "name": "b",
      "type": "ordinal",
      "range": ["black", "red"],
473
      "domain": ["", "\u2605"]
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
474
    },
jhoogenboom's avatar
jhoogenboom committed
475
476
477
478
    {
      "name": "c",
      "type": "ordinal",
      "range": ["#5e3c99", "#b2abd2", "#fdb863", "#e66101"],
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
479
480
481
482
483
484
      "domain": ["Genuine reads", "Noise reads", "Noise/recovered overlap", "Recovered reads"]
    },
    {
      "name": "d",
      "type": "ordinal",
      "range": ["transparent"],
485
      "domain": ["\u2014 Strand balance"]
jhoogenboom's avatar
jhoogenboom committed
486
487
488
489
490
491
492
493
494
    }
  ],
  "marks": [
    {
      "type": "text",
      "from": {
        "data": "yscale"
      },
      "properties": {
495
        "update": {
jhoogenboom's avatar
jhoogenboom committed
496
497
498
          "x": {"field": {"group": "width"}, "mult": 0.5},
          "y": {"field": "offset"},
          "fontWeight": {"value": "bold"},
499
          "text": {"field": "marker"},
jhoogenboom's avatar
jhoogenboom committed
500
501
502
503
504
505
506
507
508
509
510
511
512
          "align": {"value": "center"},
          "baseline": {"value": "bottom"},
          "fill": {"value": "black"}
        }
      }
    },
    {
      "type": "group",
      "from": {
        "data": "table",
        "transform": [
          {
            "type": "facet",
513
            "groupby": ["marker"]
jhoogenboom's avatar
jhoogenboom committed
514
515
          },
          {
jhoogenboom's avatar
jhoogenboom committed
516
517
            "type": "lookup",
            "on": "yscale",
518
519
            "onKey": "marker",
            "keys": ["marker"],
520
            "as": ["subgraphscale"]
jhoogenboom's avatar
jhoogenboom committed
521
522
523
524
          }
        ]
      },
      "properties": {
525
        "update": {
jhoogenboom's avatar
jhoogenboom committed
526
527
          "x": {"value": 0},
          "width": {"field": {"group": "width"}},
528
529
          "y": {"field": "subgraphscale.offset"},
          "y2": {"field": "subgraphscale.end"},
jhoogenboom's avatar
jhoogenboom committed
530
531
532
533
534
535
          "stroke": {"value": "#dddddd"}
        }
      },
      "scales": [
        {
          "name": "x",
536
          "type": "linear",
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
537
          "nice": true,
jhoogenboom's avatar
jhoogenboom committed
538
          "range": "width",
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
539
          "domain": {"field": ["xlow", "xhigh"]}
jhoogenboom's avatar
jhoogenboom committed
540
541
542
543
544
        },
        {
          "name": "y",
          "type": "ordinal",
          "range": "height",
545
546
          "domain": {"field": "sequence", "sort": {"field": "rank", "op": "min"}},
          "reverse": true
jhoogenboom's avatar
jhoogenboom committed
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
        }
      ],
      "axes": [
        {
          "type": "x",
          "scale": "x",
          "grid": true,
          "layer": "back",
          "title": "Number of reads",
          "properties": {
            "labels": {
              "align": {"value": "right"},
              "baseline": {"value": "middle"},
              "dy": {"value": 3},
              "angle": {"value": -25}
            }
          }
        },
        {
          "type": "y",
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
567
568
569
570
571
572
          "scale": "y",
          "properties": {
            "labels": {
              "fill": {"value": "transparent"}
            }
          }
jhoogenboom's avatar
jhoogenboom committed
573
574
575
576
577
578
579
580
581
582
583
584
        }
      ],
      "legends": [
        {
          "fill": "c",
          "properties": {
            "symbols": {
              "size": {"value": 100},
              "stroke": {"value": "transparent"},
              "fillOpacity": {"value": 0.8}
            }
          }
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
585
586
587
588
589
590
591
592
593
594
595
        },
        {
          "fill": "d",
          "properties": {
            "symbols": {
              "stroke": {"value": "transparent"}
            },
            "labels": {
              "x": {"value": 2}
            }
          }
jhoogenboom's avatar
jhoogenboom committed
596
597
598
599
600
601
        }
      ],
      "marks": [
        {
          "type": "rect",
          "properties": {
602
            "update": {
jhoogenboom's avatar
jhoogenboom committed
603
604
              "x": {"scale": "x", "value": 0},
              "x2": {"scale": "x", "field": "shared"},
605
              "y": {"scale": "y", "field": "sequence", "offset": 1},
jhoogenboom's avatar
jhoogenboom committed
606
              "height": {"scale": "y", "band": true, "offset": -2},
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
607
              "fill": {"scale": "c", "value": "Genuine reads"},
jhoogenboom's avatar
jhoogenboom committed
608
609
610
611
612
613
614
              "fillOpacity": {"value": 0.8}
            }
          }
        },
        {
          "type": "rect",
          "properties": {
615
            "update": {
jhoogenboom's avatar
jhoogenboom committed
616
617
              "x": {"scale": "x", "field": "corr_shared"},
              "x2": {"scale": "x", "field": "corr_decreased"},
618
              "y": {"scale": "y", "field": "sequence", "offset": 1},
jhoogenboom's avatar
jhoogenboom committed
619
              "height": {"scale": "y", "band": true, "offset": -2},
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
620
              "fill": {"scale": "c", "value": "Noise reads"},
jhoogenboom's avatar
jhoogenboom committed
621
622
623
624
625
626
627
              "fillOpacity": {"value": 0.8}
            }
          }
        },
        {
          "type": "rect",
          "properties": {
628
            "update": {
jhoogenboom's avatar
jhoogenboom committed
629
630
              "x": {"scale": "x", "field": "total_corr"},
              "x2": {"scale": "x", "field": "corr_shared"},
631
              "y": {"scale": "y", "field": "sequence", "offset": 1},
jhoogenboom's avatar
jhoogenboom committed
632
              "height": {"scale": "y", "band": true, "offset": -2},
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
633
              "fill": {"scale": "c", "value": "Noise/recovered overlap"},
jhoogenboom's avatar
jhoogenboom committed
634
635
636
637
638
639
640
              "fillOpacity": {"value": 0.8}
            }
          }
        },
        {
          "type": "rect",
          "properties": {
641
            "update": {
jhoogenboom's avatar
jhoogenboom committed
642
              "x": {"scale": "x", "field": "corr_shared"},
643
              "x2": {"scale": "x", "field": "total_added"},
644
              "y": {"scale": "y", "field": "sequence", "offset": 1},
jhoogenboom's avatar
jhoogenboom committed
645
              "height": {"scale": "y", "band": true, "offset": -2},
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
646
              "fill": {"scale": "c", "value": "Recovered reads"},
jhoogenboom's avatar
jhoogenboom committed
647
648
649
650
651
652
653
              "fillOpacity": {"value": 0.8}
            }
          }
        },
        {
          "type": "group",
          "from": {
654
            "transform": [{"type": "facet", "groupby": ["sequence"]}]
jhoogenboom's avatar
jhoogenboom committed
655
656
          },
          "properties": {
657
            "update": {
jhoogenboom's avatar
jhoogenboom committed
658
659
660
661
662
663
664
665
666
667
668
              "x": {"value": 0},
              "width": {"field": {"group": "width"}},
              "y": {"scale": "y", "field": "key", "offset": 1},
              "height": {"scale": "y", "band": true, "offset": -2}
            }
          },
          "scales": [
            {
              "name": "balance",
              "range": "height",
              "nice": false,
669
              "clamp": true,
jhoogenboom's avatar
jhoogenboom committed
670
671
672
673
674
              "domain": [0, 100]
            }
          ],
          "marks": [
            {
675
              "type": "rule",
jhoogenboom's avatar
jhoogenboom committed
676
              "properties": {
677
                "update": {
678
                  "x": {"scale": "x", "field": "minimum"},
679
680
681
682
                  "x2": {"scale": "x", "field": "total_added"},
                  "y": {"scale": "balance", "field": "forwardpct"},
                  "stroke": {"scale": "b", "field": "biasmark"},
                  "strokeWidth": {"value": 1}
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
683
684
685
686
687
688
                }
              }
            },
            {
              "type": "text",
              "properties": {
689
                "update": {
690
                  "x": {"scale": "x", "field": "maximum", "offset": 5},
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
691
692
693
694
695
696
697
698
699
700
                  "y": {"scale": "balance", "value": 50},
                  "baseline": {"value": "middle"},
                  "fill": {"scale": "b", "field": "biasmark"},
                  "text": {"field": "biasmark"}
                }
              }
            },
            {
              "type": "text",
              "properties": {
701
                "update": {
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
702
703
704
705
                  "x": {"value": -10},
                  "y": {"scale": "balance", "value": 50},
                  "baseline": {"value": "middle"},
                  "align": {"value": "right"},
706
                  "text": {"field": "sequence"},
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
707
708
709
710
711
                  "fill": {
                    "rule": [
                      {
                        "predicate": {
                          "name": "isSelected",
712
                          "sequence": {"field": "thedatum"}
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
713
714
715
                        },
                        "value": "green"
                      },
716
                      {"value": "#aaaaaa"}
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
717
718
719
720
721
722
723
                    ]
                  },
                  "fontStyle": {
                    "rule": [
                      {
                        "predicate": {
                          "name": "isSelected",
724
                          "sequence": {"field": "thedatum"}
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
725
                        },
726
                        "value": "normal"
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
727
                      },
728
                      {"value": "italic"}
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
729
730
                    ]
                  }
jhoogenboom's avatar
jhoogenboom committed
731
732
733
734
                }
              }
            }
          ]
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
735
736
737
738
739
        },
        {
          "name": "alleleSelector",
          "type": "rect",
          "properties": {
740
            "update": {
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
741
742
              "x": {"value": 0},
              "width": {"field": {"group": "width"}},
743
              "y": {"scale": "y", "field": "sequence"},
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
744
745
746
747
              "height": {"scale": "y", "band": true},
              "fill": {"value": "transparent"}
            }
          }
jhoogenboom's avatar
jhoogenboom committed
748
749
750
751
        }
      ]
    }
  ]
Hoogenboom, Jerry's avatar
Hoogenboom, Jerry committed
752
}