@jbrowse/plugin-linear-genome-view 1.4.4 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/BaseLinearDisplay/components/Block.d.ts +7 -10
  2. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +16 -9
  3. package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +2 -2
  4. package/dist/LinearBareDisplay/model.d.ts +8 -8
  5. package/dist/LinearBasicDisplay/model.d.ts +11 -8
  6. package/dist/LinearGenomeView/components/HelpDialog.d.ts +5 -0
  7. package/dist/LinearGenomeView/components/LinearGenomeView.d.ts +3 -5
  8. package/dist/LinearGenomeView/components/LinearGenomeViewSvg.d.ts +4 -0
  9. package/dist/LinearGenomeView/components/OverviewRubberBand.d.ts +2 -3
  10. package/dist/LinearGenomeView/components/OverviewScaleBar.d.ts +116 -2
  11. package/dist/LinearGenomeView/components/RefNameAutocomplete.d.ts +3 -11
  12. package/dist/LinearGenomeView/components/ScaleBar.d.ts +36 -2
  13. package/dist/LinearGenomeView/components/util.d.ts +2 -0
  14. package/dist/LinearGenomeView/index.d.ts +22 -4
  15. package/dist/index.d.ts +26 -26
  16. package/dist/plugin-linear-genome-view.cjs.development.js +3178 -2884
  17. package/dist/plugin-linear-genome-view.cjs.development.js.map +1 -1
  18. package/dist/plugin-linear-genome-view.cjs.production.min.js +1 -1
  19. package/dist/plugin-linear-genome-view.cjs.production.min.js.map +1 -1
  20. package/dist/plugin-linear-genome-view.esm.js +3191 -2898
  21. package/dist/plugin-linear-genome-view.esm.js.map +1 -1
  22. package/package.json +2 -2
  23. package/src/BaseLinearDisplay/components/BaseLinearDisplay.tsx +3 -0
  24. package/src/BaseLinearDisplay/components/Block.tsx +20 -33
  25. package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +3 -7
  26. package/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts +15 -13
  27. package/src/LinearBasicDisplay/model.ts +25 -3
  28. package/src/LinearGenomeView/components/ExportSvgDialog.tsx +6 -6
  29. package/src/LinearGenomeView/components/Header.tsx +56 -78
  30. package/src/LinearGenomeView/components/HelpDialog.tsx +81 -0
  31. package/src/LinearGenomeView/components/ImportForm.tsx +139 -158
  32. package/src/LinearGenomeView/components/LinearGenomeView.test.js +6 -6
  33. package/src/LinearGenomeView/components/LinearGenomeView.tsx +30 -245
  34. package/src/LinearGenomeView/components/LinearGenomeViewSvg.tsx +317 -0
  35. package/src/LinearGenomeView/components/OverviewRubberBand.tsx +74 -34
  36. package/src/LinearGenomeView/components/OverviewScaleBar.tsx +326 -177
  37. package/src/LinearGenomeView/components/RefNameAutocomplete.tsx +152 -157
  38. package/src/LinearGenomeView/components/SearchResultsDialog.tsx +12 -34
  39. package/src/LinearGenomeView/components/SequenceDialog.tsx +10 -9
  40. package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.js.snap +127 -254
  41. package/src/LinearGenomeView/components/util.ts +10 -0
  42. package/src/LinearGenomeView/index.tsx +69 -27
  43. package/src/index.ts +3 -1
@@ -17,52 +17,54 @@ exports[`<LinearGenomeView /> renders one track, one region 1`] = `
17
17
  >
18
18
  <div
19
19
  class="makeStyles-scaleBarVisibleRegion"
20
- style="width: 800px; left: 0px;"
20
+ style="width: 800px; left: 0px; background: rgba(121, 134, 203, 0.3); border-color: #7986cb;"
21
21
  />
22
22
  <div
23
23
  class="makeStyles-scaleBarContig"
24
24
  style="width: 0px; left: 0px; background-color: rgb(153, 153, 153);"
25
25
  />
26
- <div
27
- class="makeStyles-scaleBarContig makeStyles-scaleBarContigForward"
28
- style="left: 0px; width: 800px; border-color: rgb(153, 102, 0);"
29
- >
26
+ <div>
30
27
  <p
31
28
  class="MuiTypography-root makeStyles-scaleBarRefName MuiTypography-body1"
32
- style="color: rgb(153, 102, 0); z-index: 100;"
29
+ style="left: 3px; color: rgb(153, 102, 0);"
33
30
  >
34
31
  ctgA
35
32
  </p>
36
- <p
37
- class="MuiTypography-root makeStyles-scaleBarLabel MuiTypography-body2"
38
- style="left: 160px; pointer-events: none; color: rgb(153, 102, 0);"
39
- >
40
- 20
41
- </p>
42
- <p
43
- class="MuiTypography-root makeStyles-scaleBarLabel MuiTypography-body2"
44
- style="left: 320px; pointer-events: none; color: rgb(153, 102, 0);"
45
- >
46
- 40
47
- </p>
48
- <p
49
- class="MuiTypography-root makeStyles-scaleBarLabel MuiTypography-body2"
50
- style="left: 480px; pointer-events: none; color: rgb(153, 102, 0);"
51
- >
52
- 60
53
- </p>
54
- <p
55
- class="MuiTypography-root makeStyles-scaleBarLabel MuiTypography-body2"
56
- style="left: 640px; pointer-events: none; color: rgb(153, 102, 0);"
57
- >
58
- 80
59
- </p>
60
- <p
61
- class="MuiTypography-root makeStyles-scaleBarLabel MuiTypography-body2"
62
- style="left: 800px; pointer-events: none; color: rgb(153, 102, 0);"
33
+ <div
34
+ class="makeStyles-scaleBarContig makeStyles-scaleBarContigForward makeStyles-scaleBarBorder"
35
+ style="left: 0px; width: 800px; border-color: rgb(153, 102, 0);"
63
36
  >
64
- 100
65
- </p>
37
+ <p
38
+ class="MuiTypography-root makeStyles-scaleBarLabel MuiTypography-body2"
39
+ style="left: 160px; pointer-events: none; color: rgb(153, 102, 0);"
40
+ >
41
+ 20
42
+ </p>
43
+ <p
44
+ class="MuiTypography-root makeStyles-scaleBarLabel MuiTypography-body2"
45
+ style="left: 320px; pointer-events: none; color: rgb(153, 102, 0);"
46
+ >
47
+ 40
48
+ </p>
49
+ <p
50
+ class="MuiTypography-root makeStyles-scaleBarLabel MuiTypography-body2"
51
+ style="left: 480px; pointer-events: none; color: rgb(153, 102, 0);"
52
+ >
53
+ 60
54
+ </p>
55
+ <p
56
+ class="MuiTypography-root makeStyles-scaleBarLabel MuiTypography-body2"
57
+ style="left: 640px; pointer-events: none; color: rgb(153, 102, 0);"
58
+ >
59
+ 80
60
+ </p>
61
+ <p
62
+ class="MuiTypography-root makeStyles-scaleBarLabel MuiTypography-body2"
63
+ style="left: 800px; pointer-events: none; color: rgb(153, 102, 0);"
64
+ >
65
+ 100
66
+ </p>
67
+ </div>
66
68
  </div>
67
69
  <div
68
70
  class="makeStyles-scaleBarContig"
@@ -77,7 +79,6 @@ exports[`<LinearGenomeView /> renders one track, one region 1`] = `
77
79
  <svg
78
80
  class="makeStyles-overviewSvg"
79
81
  height="48"
80
- width="100%"
81
82
  >
82
83
  <polygon
83
84
  fill="rgba(121, 134, 203, 0.3)"
@@ -206,6 +207,29 @@ exports[`<LinearGenomeView /> renders one track, one region 1`] = `
206
207
  d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"
207
208
  />
208
209
  </svg>
210
+ <button
211
+ class="MuiButtonBase-root MuiIconButton-root"
212
+ tabindex="0"
213
+ type="button"
214
+ >
215
+ <span
216
+ class="MuiIconButton-label"
217
+ >
218
+ <svg
219
+ aria-hidden="true"
220
+ class="MuiSvgIcon-root"
221
+ focusable="false"
222
+ viewBox="0 0 24 24"
223
+ >
224
+ <path
225
+ d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"
226
+ />
227
+ </svg>
228
+ </span>
229
+ <span
230
+ class="MuiTouchRipple-root"
231
+ />
232
+ </button>
209
233
  </div>
210
234
  <div
211
235
  class="MuiAutocomplete-endAdornment"
@@ -563,182 +587,6 @@ exports[`<LinearGenomeView /> renders one track, one region 1`] = `
563
587
  </div>
564
588
  `;
565
589
 
566
- exports[`<LinearGenomeView /> renders setup wizard 1`] = `
567
- <div>
568
- <div
569
- class="MuiContainer-root makeStyles-importFormContainer MuiContainer-maxWidthLg"
570
- >
571
- <div
572
- class="MuiGrid-root MuiGrid-container MuiGrid-spacing-xs-1 MuiGrid-align-items-xs-center MuiGrid-justify-content-xs-center"
573
- >
574
- <div
575
- class="MuiGrid-root MuiGrid-item"
576
- >
577
- <div
578
- class="MuiFormControl-root MuiTextField-root makeStyles-importFormEntry MuiFormControl-marginNormal"
579
- >
580
- <label
581
- class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-shrink MuiInputLabel-outlined MuiFormLabel-filled"
582
- data-shrink="true"
583
- >
584
- Assembly
585
- </label>
586
- <div
587
- class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-formControl"
588
- >
589
- <div
590
- aria-haspopup="listbox"
591
- class="MuiSelect-root MuiSelect-select MuiSelect-selectMenu MuiSelect-outlined MuiInputBase-input MuiOutlinedInput-input"
592
- role="button"
593
- tabindex="0"
594
- >
595
- volMyt1
596
- </div>
597
- <input
598
- aria-hidden="true"
599
- class="MuiSelect-nativeInput"
600
- data-testid="assembly-selector"
601
- tabindex="-1"
602
- value="volMyt1"
603
- />
604
- <svg
605
- aria-hidden="true"
606
- class="MuiSvgIcon-root MuiSelect-icon MuiSelect-iconOutlined"
607
- focusable="false"
608
- viewBox="0 0 24 24"
609
- >
610
- <path
611
- d="M7 10l5 5 5-5z"
612
- />
613
- </svg>
614
- <fieldset
615
- aria-hidden="true"
616
- class="PrivateNotchedOutline-root MuiOutlinedInput-notchedOutline"
617
- >
618
- <legend
619
- class="PrivateNotchedOutline-legendLabelled PrivateNotchedOutline-legendNotched"
620
- >
621
- <span>
622
- Assembly
623
- </span>
624
- </legend>
625
- </fieldset>
626
- </div>
627
- <p
628
- class="MuiFormHelperText-root MuiFormHelperText-contained MuiFormHelperText-filled"
629
- >
630
- Select assembly to view
631
- </p>
632
- </div>
633
- </div>
634
- <div
635
- class="MuiGrid-root MuiGrid-item"
636
- >
637
- <div
638
- aria-expanded="false"
639
- class="MuiAutocomplete-root"
640
- data-testid="autocomplete"
641
- role="combobox"
642
- style="width: 200px;"
643
- >
644
- <div
645
- class="MuiFormControl-root MuiTextField-root MuiFormControl-marginNormal MuiFormControl-fullWidth"
646
- >
647
- <div
648
- class="MuiInputBase-root MuiOutlinedInput-root MuiAutocomplete-inputRoot MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-adornedEnd MuiOutlinedInput-adornedEnd"
649
- >
650
- <input
651
- aria-autocomplete="list"
652
- aria-describedby="refNameAutocomplete-lgv-helper-text"
653
- aria-invalid="false"
654
- autocapitalize="none"
655
- autocomplete="off"
656
- class="MuiInputBase-input MuiOutlinedInput-input MuiAutocomplete-input MuiAutocomplete-inputFocused MuiInputBase-inputAdornedEnd MuiOutlinedInput-inputAdornedEnd"
657
- id="refNameAutocomplete-lgv"
658
- placeholder="Search for location"
659
- spellcheck="false"
660
- type="text"
661
- value="ctgA"
662
- />
663
- <div
664
- class="MuiInputAdornment-root MuiInputAdornment-positionEnd"
665
- style="margin-right: 7px;"
666
- >
667
- <svg
668
- aria-hidden="true"
669
- class="MuiSvgIcon-root"
670
- focusable="false"
671
- viewBox="0 0 24 24"
672
- >
673
- <path
674
- d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"
675
- />
676
- </svg>
677
- </div>
678
- <div
679
- class="MuiAutocomplete-endAdornment"
680
- />
681
- <fieldset
682
- aria-hidden="true"
683
- class="PrivateNotchedOutline-root MuiOutlinedInput-notchedOutline"
684
- style="padding-left: 8px;"
685
- >
686
- <legend
687
- class="PrivateNotchedOutline-legend"
688
- style="width: 0.01px;"
689
- >
690
- <span>
691
-
692
- </span>
693
- </legend>
694
- </fieldset>
695
- </div>
696
- <p
697
- class="MuiFormHelperText-root MuiFormHelperText-contained MuiFormHelperText-filled"
698
- id="refNameAutocomplete-lgv-helper-text"
699
- >
700
- Enter a sequence or location
701
- </p>
702
- </div>
703
- </div>
704
- </div>
705
- <div
706
- class="MuiGrid-root MuiGrid-item"
707
- >
708
- <button
709
- class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-button MuiButton-containedPrimary"
710
- tabindex="0"
711
- type="button"
712
- >
713
- <span
714
- class="MuiButton-label"
715
- >
716
- Open
717
- </span>
718
- <span
719
- class="MuiTouchRipple-root"
720
- />
721
- </button>
722
- <button
723
- class="MuiButtonBase-root MuiButton-root MuiButton-contained makeStyles-button MuiButton-containedSecondary"
724
- tabindex="0"
725
- type="button"
726
- >
727
- <span
728
- class="MuiButton-label"
729
- >
730
- Show all regions in assembly
731
- </span>
732
- <span
733
- class="MuiTouchRipple-root"
734
- />
735
- </button>
736
- </div>
737
- </div>
738
- </div>
739
- </div>
740
- `;
741
-
742
590
  exports[`<LinearGenomeView /> renders two tracks, two regions 1`] = `
743
591
  <div
744
592
  style="position: relative;"
@@ -756,67 +604,70 @@ exports[`<LinearGenomeView /> renders two tracks, two regions 1`] = `
756
604
  >
757
605
  <div
758
606
  class="makeStyles-scaleBarVisibleRegion"
759
- style="width: 580px; left: 0px;"
607
+ style="width: 580px; left: 0px; background: rgba(121, 134, 203, 0.3); border-color: #7986cb;"
760
608
  />
761
609
  <div
762
610
  class="makeStyles-scaleBarContig"
763
611
  style="width: 0px; left: 0px; background-color: rgb(153, 153, 153);"
764
612
  />
765
- <div
766
- class="makeStyles-scaleBarContig makeStyles-scaleBarContigForward"
767
- style="left: 0px; width: 72.72727272727273px; border-color: rgb(153, 102, 0);"
768
- >
613
+ <div>
769
614
  <p
770
615
  class="MuiTypography-root makeStyles-scaleBarRefName MuiTypography-body1"
771
- style="color: rgb(153, 102, 0); z-index: 100;"
616
+ style="left: 3px; color: rgb(153, 102, 0);"
772
617
  >
773
618
  ctgA
774
619
  </p>
620
+ <div
621
+ class="makeStyles-scaleBarContig makeStyles-scaleBarContigForward makeStyles-scaleBarBorder"
622
+ style="left: 0px; width: 72.72727272727273px; border-color: rgb(153, 102, 0);"
623
+ />
775
624
  </div>
776
625
  <div
777
626
  class="makeStyles-scaleBarContig"
778
627
  style="width: 0px; left: 72.72727272727273px; background-color: rgb(153, 153, 153);"
779
628
  />
780
- <div
781
- class="makeStyles-scaleBarContig makeStyles-scaleBarContigForward"
782
- style="left: 72.72727272727273px; width: 727.2727272727273px;"
783
- >
629
+ <div>
784
630
  <p
785
631
  class="MuiTypography-root makeStyles-scaleBarRefName MuiTypography-body1"
786
- style="z-index: 100;"
632
+ style="left: 75.72727272727273px;"
787
633
  >
788
634
  ctgB
789
635
  </p>
790
- <p
791
- class="MuiTypography-root makeStyles-scaleBarLabel MuiTypography-body2"
792
- style="left: 145.0909090909091px; pointer-events: none;"
793
- >
794
- 1,200
795
- </p>
796
- <p
797
- class="MuiTypography-root makeStyles-scaleBarLabel MuiTypography-body2"
798
- style="left: 290.1818181818182px; pointer-events: none;"
799
- >
800
- 1,400
801
- </p>
802
- <p
803
- class="MuiTypography-root makeStyles-scaleBarLabel MuiTypography-body2"
804
- style="left: 435.27272727272725px; pointer-events: none;"
805
- >
806
- 1,600
807
- </p>
808
- <p
809
- class="MuiTypography-root makeStyles-scaleBarLabel MuiTypography-body2"
810
- style="left: 580.3636363636364px; pointer-events: none;"
811
- >
812
- 1,800
813
- </p>
814
- <p
815
- class="MuiTypography-root makeStyles-scaleBarLabel MuiTypography-body2"
816
- style="left: 725.4545454545454px; pointer-events: none;"
636
+ <div
637
+ class="makeStyles-scaleBarContig makeStyles-scaleBarContigForward makeStyles-scaleBarBorder"
638
+ style="left: 72.72727272727273px; width: 727.2727272727273px;"
817
639
  >
818
- 2,000
819
- </p>
640
+ <p
641
+ class="MuiTypography-root makeStyles-scaleBarLabel MuiTypography-body2"
642
+ style="left: 145.0909090909091px; pointer-events: none;"
643
+ >
644
+ 1,200
645
+ </p>
646
+ <p
647
+ class="MuiTypography-root makeStyles-scaleBarLabel MuiTypography-body2"
648
+ style="left: 290.1818181818182px; pointer-events: none;"
649
+ >
650
+ 1,400
651
+ </p>
652
+ <p
653
+ class="MuiTypography-root makeStyles-scaleBarLabel MuiTypography-body2"
654
+ style="left: 435.27272727272725px; pointer-events: none;"
655
+ >
656
+ 1,600
657
+ </p>
658
+ <p
659
+ class="MuiTypography-root makeStyles-scaleBarLabel MuiTypography-body2"
660
+ style="left: 580.3636363636364px; pointer-events: none;"
661
+ >
662
+ 1,800
663
+ </p>
664
+ <p
665
+ class="MuiTypography-root makeStyles-scaleBarLabel MuiTypography-body2"
666
+ style="left: 725.4545454545454px; pointer-events: none;"
667
+ >
668
+ 2,000
669
+ </p>
670
+ </div>
820
671
  </div>
821
672
  <div
822
673
  class="makeStyles-scaleBarContig"
@@ -831,7 +682,6 @@ exports[`<LinearGenomeView /> renders two tracks, two regions 1`] = `
831
682
  <svg
832
683
  class="makeStyles-overviewSvg"
833
684
  height="48"
834
- width="100%"
835
685
  >
836
686
  <polygon
837
687
  fill="rgba(121, 134, 203, 0.3)"
@@ -924,7 +774,7 @@ exports[`<LinearGenomeView /> renders two tracks, two regions 1`] = `
924
774
  class="MuiAutocomplete-root"
925
775
  data-testid="autocomplete"
926
776
  role="combobox"
927
- style="width: 235.22500000000002px;"
777
+ style="width: 255.22500000000002px;"
928
778
  >
929
779
  <div
930
780
  class="MuiFormControl-root MuiTextField-root makeStyles-headerRefName MuiFormControl-fullWidth"
@@ -960,6 +810,29 @@ exports[`<LinearGenomeView /> renders two tracks, two regions 1`] = `
960
810
  d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"
961
811
  />
962
812
  </svg>
813
+ <button
814
+ class="MuiButtonBase-root MuiIconButton-root"
815
+ tabindex="0"
816
+ type="button"
817
+ >
818
+ <span
819
+ class="MuiIconButton-label"
820
+ >
821
+ <svg
822
+ aria-hidden="true"
823
+ class="MuiSvgIcon-root"
824
+ focusable="false"
825
+ viewBox="0 0 24 24"
826
+ >
827
+ <path
828
+ d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"
829
+ />
830
+ </svg>
831
+ </span>
832
+ <span
833
+ class="MuiTouchRipple-root"
834
+ />
835
+ </button>
963
836
  </div>
964
837
  <div
965
838
  class="MuiAutocomplete-endAdornment"
@@ -0,0 +1,10 @@
1
+ import BaseResult from '@jbrowse/core/TextSearch/BaseResults'
2
+
3
+ export function dedupe(
4
+ results: BaseResult[] = [],
5
+ cb: (result: BaseResult) => string,
6
+ ) {
7
+ return results.filter(
8
+ (elt, idx, self) => idx === self.findIndex(t => cb(t) === cb(elt)),
9
+ )
10
+ }
@@ -10,29 +10,34 @@ import {
10
10
  getContainingView,
11
11
  getSession,
12
12
  isViewContainer,
13
+ isSessionModelWithWidgets,
14
+ measureText,
13
15
  parseLocString,
14
16
  springAnimate,
15
- isSessionModelWithWidgets,
16
17
  } from '@jbrowse/core/util'
17
18
  import BaseResult from '@jbrowse/core/TextSearch/BaseResults'
18
19
  import { BlockSet, BaseBlock } from '@jbrowse/core/util/blockTypes'
19
20
  import calculateDynamicBlocks from '@jbrowse/core/util/calculateDynamicBlocks'
20
21
  import calculateStaticBlocks from '@jbrowse/core/util/calculateStaticBlocks'
21
22
  import { getParentRenderProps } from '@jbrowse/core/util/tracks'
22
- // misc
23
23
  import { transaction, autorun } from 'mobx'
24
24
  import {
25
- getSnapshot,
26
- types,
25
+ addDisposer,
27
26
  cast,
28
- Instance,
27
+ getSnapshot,
29
28
  getRoot,
30
29
  resolveIdentifier,
31
- addDisposer,
30
+ types,
31
+ Instance,
32
32
  } from 'mobx-state-tree'
33
33
 
34
34
  import Base1DView from '@jbrowse/core/util/Base1DViewModel'
35
35
  import PluginManager from '@jbrowse/core/PluginManager'
36
+ import clone from 'clone'
37
+ import { AnyConfigurationModel } from '@jbrowse/core/configuration/configurationSchema'
38
+ import { saveAs } from 'file-saver'
39
+
40
+ // icons
36
41
  import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons'
37
42
  import SyncAltIcon from '@material-ui/icons/SyncAlt'
38
43
  import VisibilityIcon from '@material-ui/icons/Visibility'
@@ -41,15 +46,13 @@ import FolderOpenIcon from '@material-ui/icons/FolderOpen'
41
46
  import PhotoCameraIcon from '@material-ui/icons/PhotoCamera'
42
47
  import ZoomInIcon from '@material-ui/icons/ZoomIn'
43
48
  import MenuOpenIcon from '@material-ui/icons/MenuOpen'
44
- import clone from 'clone'
45
- import { AnyConfigurationModel } from '@jbrowse/core/configuration/configurationSchema'
46
- import { saveAs } from 'file-saver'
47
- import { renderToSvg } from './components/LinearGenomeView'
49
+
50
+ // locals
51
+ import { renderToSvg } from './components/LinearGenomeViewSvg'
52
+ import RefNameAutocomplete from './components/RefNameAutocomplete'
48
53
  import ExportSvgDlg from './components/ExportSvgDialog'
49
54
  import ReturnToImportFormDlg from './components/ReturnToImportFormDialog'
50
55
 
51
- export { default as ReactComponent } from './components/LinearGenomeView'
52
-
53
56
  export interface BpOffset {
54
57
  refName?: string
55
58
  index: number
@@ -121,6 +124,7 @@ export function stateModelFactory(pluginManager: PluginManager) {
121
124
  ),
122
125
  trackLabels: 'overlapping' as 'overlapping' | 'hidden' | 'offset',
123
126
  showCenterLine: false,
127
+ showCytobandsSetting: true,
124
128
  }),
125
129
  )
126
130
  .volatile(() => ({
@@ -468,6 +472,9 @@ export function stateModelFactory(pluginManager: PluginManager) {
468
472
  },
469
473
  }))
470
474
  .actions(self => ({
475
+ setShowCytobands(flag: boolean) {
476
+ self.showCytobandsSetting = flag
477
+ },
471
478
  setWidth(newWidth: number) {
472
479
  self.volatileWidth = newWidth
473
480
  },
@@ -551,9 +558,8 @@ export function stateModelFactory(pluginManager: PluginManager) {
551
558
  initialSnapshot = {},
552
559
  displayInitialSnapshot = {},
553
560
  ) {
554
- const trackConfigSchema = pluginManager.pluggableConfigSchemaType(
555
- 'track',
556
- )
561
+ const trackConfigSchema =
562
+ pluginManager.pluggableConfigSchemaType('track')
557
563
  const configuration = resolveIdentifier(
558
564
  trackConfigSchema,
559
565
  getRoot(self),
@@ -602,9 +608,8 @@ export function stateModelFactory(pluginManager: PluginManager) {
602
608
  },
603
609
 
604
610
  hideTrack(trackId: string) {
605
- const trackConfigSchema = pluginManager.pluggableConfigSchemaType(
606
- 'track',
607
- )
611
+ const trackConfigSchema =
612
+ pluginManager.pluggableConfigSchemaType('track')
608
613
  const configuration = resolveIdentifier(
609
614
  trackConfigSchema,
610
615
  getRoot(self),
@@ -1216,18 +1221,42 @@ export function stateModelFactory(pluginManager: PluginManager) {
1216
1221
 
1217
1222
  return { zoom }
1218
1223
  })
1224
+ .views(self => ({
1225
+ get canShowCytobands() {
1226
+ return self.displayedRegions.length === 1 && this.anyCytobandsExist
1227
+ },
1228
+ get showCytobands() {
1229
+ return this.canShowCytobands && self.showCytobandsSetting
1230
+ },
1231
+ get anyCytobandsExist() {
1232
+ const { assemblyManager } = getSession(self)
1233
+ const { assemblyNames } = self
1234
+ return assemblyNames.some(
1235
+ asm => assemblyManager.get(asm)?.cytobands?.length,
1236
+ )
1237
+ },
1238
+
1239
+ get cytobandOffset() {
1240
+ return this.showCytobands
1241
+ ? measureText(self.displayedRegions[0].refName, 12) + 15
1242
+ : 0
1243
+ },
1244
+ }))
1219
1245
  .views(self => {
1220
1246
  let currentlyCalculatedStaticBlocks: BlockSet | undefined
1221
1247
  let stringifiedCurrentlyCalculatedStaticBlocks = ''
1222
1248
  return {
1223
1249
  menuItems(): MenuItem[] {
1250
+ const { canShowCytobands, showCytobands } = self
1251
+
1224
1252
  const menuItems: MenuItem[] = [
1225
1253
  {
1226
1254
  label: 'Return to import form',
1227
1255
  onClick: () => {
1228
- getSession(self).setDialogComponent(ReturnToImportFormDlg, {
1229
- model: self,
1230
- })
1256
+ getSession(self).queueDialog((doneCallback: Function) => [
1257
+ ReturnToImportFormDlg,
1258
+ { model: self, handleClose: doneCallback },
1259
+ ])
1231
1260
  },
1232
1261
  icon: FolderOpenIcon,
1233
1262
  },
@@ -1235,9 +1264,10 @@ export function stateModelFactory(pluginManager: PluginManager) {
1235
1264
  label: 'Export SVG',
1236
1265
  icon: PhotoCameraIcon,
1237
1266
  onClick: () => {
1238
- getSession(self).setDialogComponent(ExportSvgDlg, {
1239
- model: self,
1240
- })
1267
+ getSession(self).queueDialog((doneCallback: Function) => [
1268
+ ExportSvgDlg,
1269
+ { model: self, handleClose: doneCallback },
1270
+ ])
1241
1271
  },
1242
1272
  },
1243
1273
  {
@@ -1305,6 +1335,16 @@ export function stateModelFactory(pluginManager: PluginManager) {
1305
1335
  },
1306
1336
  ],
1307
1337
  },
1338
+ ...(canShowCytobands
1339
+ ? [
1340
+ {
1341
+ label: showCytobands ? 'Hide ideogram' : 'Show ideograms',
1342
+ onClick: () => {
1343
+ self.setShowCytobands(!showCytobands)
1344
+ },
1345
+ },
1346
+ ]
1347
+ : []),
1308
1348
  ]
1309
1349
 
1310
1350
  // add track's view level menu options
@@ -1398,8 +1438,9 @@ export function stateModelFactory(pluginManager: PluginManager) {
1398
1438
  label: 'Zoom to region',
1399
1439
  icon: ZoomInIcon,
1400
1440
  onClick: () => {
1401
- if (self.leftOffset && self.rightOffset) {
1402
- self.moveTo(self.leftOffset, self.rightOffset)
1441
+ const { leftOffset, rightOffset } = self
1442
+ if (leftOffset && rightOffset) {
1443
+ self.moveTo(leftOffset, rightOffset)
1403
1444
  }
1404
1445
  },
1405
1446
  },
@@ -1415,6 +1456,7 @@ export function stateModelFactory(pluginManager: PluginManager) {
1415
1456
  }))
1416
1457
  }
1417
1458
 
1418
- export { renderToSvg }
1459
+ export { renderToSvg, RefNameAutocomplete }
1419
1460
  export type LinearGenomeViewStateModel = ReturnType<typeof stateModelFactory>
1420
1461
  export type LinearGenomeViewModel = Instance<LinearGenomeViewStateModel>
1462
+ export { default as ReactComponent } from './components/LinearGenomeView'