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