jbrowse-plugin-msaview 2.7.2 → 2.7.4

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 (64) hide show
  1. package/dist/AddHighlightModel/MsaToGenomeHighlight.js +6 -5
  2. package/dist/LaunchMsaView/components/LaunchMsaViewDialog.js +7 -1
  3. package/dist/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.js +1 -1
  4. package/dist/LaunchMsaView/components/NCBIBlastQuery/useCachedBlastResults.d.ts +1 -1
  5. package/dist/LaunchMsaView/components/NCBIBlastQuery/useCachedBlastResults.js +5 -2
  6. package/dist/LaunchMsaView/components/OrthologQuery/OrthologPanel.d.ts +8 -0
  7. package/dist/LaunchMsaView/components/OrthologQuery/OrthologPanel.js +86 -0
  8. package/dist/LaunchMsaView/components/OrthologQuery/orthologLaunchView.d.ts +9 -0
  9. package/dist/LaunchMsaView/components/OrthologQuery/orthologLaunchView.js +13 -0
  10. package/dist/MsaViewPanel/afterCreateAutoruns.d.ts +8 -0
  11. package/dist/MsaViewPanel/afterCreateAutoruns.js +28 -0
  12. package/dist/MsaViewPanel/doLaunchBlast.js +10 -22
  13. package/dist/MsaViewPanel/doLaunchOrthologs.d.ts +23 -0
  14. package/dist/MsaViewPanel/doLaunchOrthologs.js +97 -0
  15. package/dist/MsaViewPanel/genomeToMSA.js +13 -6
  16. package/dist/MsaViewPanel/genomeToMSA.test.js +35 -6
  17. package/dist/MsaViewPanel/model.d.ts +88 -70
  18. package/dist/MsaViewPanel/model.js +26 -13
  19. package/dist/MsaViewPanel/msaCoordToGenomeCoord.d.ts +32 -13
  20. package/dist/MsaViewPanel/msaCoordToGenomeCoord.js +43 -14
  21. package/dist/MsaViewPanel/msaCoordToGenomeCoord.test.js +108 -18
  22. package/dist/MsaViewPanel/msaDataStore.js +8 -17
  23. package/dist/MsaViewPanel/syncGenomeHoverToMsaColumn.test.js +8 -6
  24. package/dist/jbrowse-plugin-msaview.umd.production.min.js +35 -31
  25. package/dist/jbrowse-plugin-msaview.umd.production.min.js.map +4 -4
  26. package/dist/utils/blastCache.d.ts +1 -2
  27. package/dist/utils/blastCache.js +9 -22
  28. package/dist/utils/domainCache.js +6 -15
  29. package/dist/utils/idb.d.ts +12 -0
  30. package/dist/utils/idb.js +21 -0
  31. package/dist/utils/ncbiOrthologs.d.ts +105 -0
  32. package/dist/utils/ncbiOrthologs.js +211 -0
  33. package/dist/utils/ncbiOrthologs.test.d.ts +1 -0
  34. package/dist/utils/ncbiOrthologs.test.js +41 -0
  35. package/dist/utils/taxonomyNames.js +13 -18
  36. package/dist/version.d.ts +1 -1
  37. package/dist/version.js +1 -1
  38. package/package.json +3 -3
  39. package/src/AddHighlightModel/MsaToGenomeHighlight.tsx +6 -8
  40. package/src/LaunchMsaView/components/LaunchMsaViewDialog.tsx +13 -2
  41. package/src/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.tsx +1 -1
  42. package/src/LaunchMsaView/components/NCBIBlastQuery/useCachedBlastResults.ts +4 -2
  43. package/src/LaunchMsaView/components/OrthologQuery/OrthologPanel.tsx +172 -0
  44. package/src/LaunchMsaView/components/OrthologQuery/orthologLaunchView.ts +28 -0
  45. package/src/MsaViewPanel/afterCreateAutoruns.ts +27 -0
  46. package/src/MsaViewPanel/doLaunchBlast.ts +20 -29
  47. package/src/MsaViewPanel/doLaunchOrthologs.ts +123 -0
  48. package/src/MsaViewPanel/genomeToMSA.test.ts +38 -6
  49. package/src/MsaViewPanel/genomeToMSA.ts +14 -6
  50. package/src/MsaViewPanel/model.ts +41 -12
  51. package/src/MsaViewPanel/msaCoordToGenomeCoord.test.ts +117 -18
  52. package/src/MsaViewPanel/msaCoordToGenomeCoord.ts +70 -26
  53. package/src/MsaViewPanel/msaDataStore.ts +17 -17
  54. package/src/MsaViewPanel/syncGenomeHoverToMsaColumn.test.ts +8 -6
  55. package/src/utils/blastCache.ts +20 -23
  56. package/src/utils/domainCache.ts +14 -18
  57. package/src/utils/idb.ts +28 -0
  58. package/src/utils/ncbiOrthologs.test.ts +56 -0
  59. package/src/utils/ncbiOrthologs.ts +320 -0
  60. package/src/utils/taxonomyNames.ts +22 -24
  61. package/src/version.ts +1 -1
  62. package/dist/MsaViewPanel/blosum62.d.ts +0 -2
  63. package/dist/MsaViewPanel/blosum62.js +0 -627
  64. package/src/MsaViewPanel/blosum62.ts +0 -628
@@ -20,6 +20,17 @@ export interface BlastParams {
20
20
  proteinSequence: string;
21
21
  rid?: string;
22
22
  }
23
+ export interface OrthologParams {
24
+ /** NCBI taxon id of the assembly the query gene came from */
25
+ taxId: number;
26
+ /** taxon ids to include as rows (the query taxon is represented by QUERY) */
27
+ taxa: number[];
28
+ /** candidate gene identifiers off the feature, tried in order */
29
+ geneCandidates: string[];
30
+ msaAlgorithm: MsaAlgorithm;
31
+ selectedTranscript?: Feature;
32
+ proteinSequence: string;
33
+ }
23
34
  /**
24
35
  * #stateModel MsaViewPlugin
25
36
  * extends
@@ -29,7 +40,7 @@ export default function stateModelFactory(): import("@jbrowse/mobx-state-tree").
29
40
  id: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<string>, [undefined]>;
30
41
  displayName: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
31
42
  minimized: import("@jbrowse/mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
32
- }, "height" | "id" | "type" | "drawLabels" | "labelsAlignRight" | "treeAreaWidth" | "treeWidth" | "showBranchLen" | "drawTree" | "drawNodeBubbles" | "autoTreeAreaWidth" | "bgColor" | "colorSchemeName" | "showColumnStats" | "msaFormat" | "data" | "showDomains" | "hideGaps" | "allowedGappyness" | "subFeatureRows" | "drawMsaLetters" | "scrollZoom" | "rowHeight" | "scrollY" | "scrollX" | "colWidth" | "treeFilehandle" | "msaFilehandle" | "treeMetadataFilehandle" | "gffFilehandle" | "currentAlignment" | "collapsed" | "showOnly" | "turnedOffTracks" | "featureFilters" | "relativeTo" | "highlightColumns"> & Omit<Omit<Omit<{}, "drawLabels" | "labelsAlignRight" | "treeAreaWidth" | "treeWidth" | "showBranchLen" | "drawTree" | "drawNodeBubbles" | "autoTreeAreaWidth"> & {
43
+ }, "height" | "id" | "type" | "autoTreeAreaWidth" | "drawLabels" | "drawNodeBubbles" | "drawTree" | "labelsAlignRight" | "showBranchLen" | "treeAreaWidth" | "treeWidth" | "bgColor" | "colorSchemeName" | "msaFormat" | "showColumnStats" | "allowedGappyness" | "colWidth" | "collapsed" | "currentAlignment" | "data" | "drawMsaLetters" | "featureFilters" | "gffFilehandle" | "hideGaps" | "highlightColumns" | "msaFilehandle" | "relativeTo" | "rowHeight" | "scrollX" | "scrollY" | "scrollZoom" | "showDomains" | "showOnly" | "subFeatureRows" | "treeFilehandle" | "treeMetadataFilehandle" | "turnedOffTracks"> & Omit<Omit<Omit<{}, "autoTreeAreaWidth" | "drawLabels" | "drawNodeBubbles" | "drawTree" | "labelsAlignRight" | "showBranchLen" | "treeAreaWidth" | "treeWidth"> & {
33
44
  drawLabels: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>, [undefined]>;
34
45
  labelsAlignRight: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>, [undefined]>;
35
46
  treeAreaWidth: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<number>, [undefined]>;
@@ -38,12 +49,12 @@ export default function stateModelFactory(): import("@jbrowse/mobx-state-tree").
38
49
  drawTree: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>, [undefined]>;
39
50
  drawNodeBubbles: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>, [undefined]>;
40
51
  autoTreeAreaWidth: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>, [undefined]>;
41
- }, "bgColor" | "colorSchemeName" | "showColumnStats" | "msaFormat"> & {
52
+ }, "bgColor" | "colorSchemeName" | "msaFormat" | "showColumnStats"> & {
42
53
  bgColor: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>, [undefined]>;
43
54
  colorSchemeName: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<string>, [undefined]>;
44
55
  showColumnStats: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>, [undefined]>;
45
- msaFormat: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<import("react-msaview").MSAFormat>>;
46
- }, "height" | "id" | "type" | "data" | "showDomains" | "hideGaps" | "allowedGappyness" | "subFeatureRows" | "drawMsaLetters" | "scrollZoom" | "rowHeight" | "scrollY" | "scrollX" | "colWidth" | "treeFilehandle" | "msaFilehandle" | "treeMetadataFilehandle" | "gffFilehandle" | "currentAlignment" | "collapsed" | "showOnly" | "turnedOffTracks" | "featureFilters" | "relativeTo" | "highlightColumns"> & {
56
+ msaFormat: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<import("msa-parsers").MSAFormat>>;
57
+ }, "height" | "id" | "type" | "allowedGappyness" | "colWidth" | "collapsed" | "currentAlignment" | "data" | "drawMsaLetters" | "featureFilters" | "gffFilehandle" | "hideGaps" | "highlightColumns" | "msaFilehandle" | "relativeTo" | "rowHeight" | "scrollX" | "scrollY" | "scrollZoom" | "showDomains" | "showOnly" | "subFeatureRows" | "treeFilehandle" | "treeMetadataFilehandle" | "turnedOffTracks"> & {
47
58
  id: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<string>, [undefined]>;
48
59
  showDomains: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>, [undefined]>;
49
60
  hideGaps: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>, [undefined]>;
@@ -97,18 +108,6 @@ export default function stateModelFactory(): import("@jbrowse/mobx-state-tree").
97
108
  authInfo: import("@jbrowse/mobx-state-tree").IType<any, any, any>;
98
109
  }> | undefined;
99
110
  }, ({
100
- locationType: "UriLocation";
101
- uri: string;
102
- } & Partial<{
103
- locationType: "UriLocation";
104
- uri: string;
105
- baseUri: string | undefined;
106
- internetAccountId: string | undefined;
107
- internetAccountPreAuthorization: import("@jbrowse/mobx-state-tree").ModelCreationType<{
108
- internetAccountType: string;
109
- authInfo: any;
110
- }> | undefined;
111
- }>) | ({
112
111
  blobId: string;
113
112
  locationType: "BlobLocation";
114
113
  name: string;
@@ -130,6 +129,18 @@ export default function stateModelFactory(): import("@jbrowse/mobx-state-tree").
130
129
  } & Partial<{
131
130
  locationType: "LocalPathLocation";
132
131
  localPath: string;
132
+ }>) | ({
133
+ locationType: "UriLocation";
134
+ uri: string;
135
+ } & Partial<{
136
+ locationType: "UriLocation";
137
+ uri: string;
138
+ baseUri: string | undefined;
139
+ internetAccountId: string | undefined;
140
+ internetAccountPreAuthorization: import("@jbrowse/mobx-state-tree").ModelCreationType<{
141
+ internetAccountType: string;
142
+ authInfo: any;
143
+ }> | undefined;
133
144
  }>)>, import("@jbrowse/core/util/types/mst").LegacyFileLocation | import("@jbrowse/mobx-state-tree").ModelCreationType<{
134
145
  locationType: "LocalPathLocation";
135
146
  localPath: string;
@@ -191,18 +202,6 @@ export default function stateModelFactory(): import("@jbrowse/mobx-state-tree").
191
202
  authInfo: import("@jbrowse/mobx-state-tree").IType<any, any, any>;
192
203
  }> | undefined;
193
204
  }, ({
194
- locationType: "UriLocation";
195
- uri: string;
196
- } & Partial<{
197
- locationType: "UriLocation";
198
- uri: string;
199
- baseUri: string | undefined;
200
- internetAccountId: string | undefined;
201
- internetAccountPreAuthorization: import("@jbrowse/mobx-state-tree").ModelCreationType<{
202
- internetAccountType: string;
203
- authInfo: any;
204
- }> | undefined;
205
- }>) | ({
206
205
  blobId: string;
207
206
  locationType: "BlobLocation";
208
207
  name: string;
@@ -224,6 +223,18 @@ export default function stateModelFactory(): import("@jbrowse/mobx-state-tree").
224
223
  } & Partial<{
225
224
  locationType: "LocalPathLocation";
226
225
  localPath: string;
226
+ }>) | ({
227
+ locationType: "UriLocation";
228
+ uri: string;
229
+ } & Partial<{
230
+ locationType: "UriLocation";
231
+ uri: string;
232
+ baseUri: string | undefined;
233
+ internetAccountId: string | undefined;
234
+ internetAccountPreAuthorization: import("@jbrowse/mobx-state-tree").ModelCreationType<{
235
+ internetAccountType: string;
236
+ authInfo: any;
237
+ }> | undefined;
227
238
  }>)>, import("@jbrowse/core/util/types/mst").LegacyFileLocation | import("@jbrowse/mobx-state-tree").ModelCreationType<{
228
239
  locationType: "LocalPathLocation";
229
240
  localPath: string;
@@ -285,18 +296,6 @@ export default function stateModelFactory(): import("@jbrowse/mobx-state-tree").
285
296
  authInfo: import("@jbrowse/mobx-state-tree").IType<any, any, any>;
286
297
  }> | undefined;
287
298
  }, ({
288
- locationType: "UriLocation";
289
- uri: string;
290
- } & Partial<{
291
- locationType: "UriLocation";
292
- uri: string;
293
- baseUri: string | undefined;
294
- internetAccountId: string | undefined;
295
- internetAccountPreAuthorization: import("@jbrowse/mobx-state-tree").ModelCreationType<{
296
- internetAccountType: string;
297
- authInfo: any;
298
- }> | undefined;
299
- }>) | ({
300
299
  blobId: string;
301
300
  locationType: "BlobLocation";
302
301
  name: string;
@@ -318,6 +317,18 @@ export default function stateModelFactory(): import("@jbrowse/mobx-state-tree").
318
317
  } & Partial<{
319
318
  locationType: "LocalPathLocation";
320
319
  localPath: string;
320
+ }>) | ({
321
+ locationType: "UriLocation";
322
+ uri: string;
323
+ } & Partial<{
324
+ locationType: "UriLocation";
325
+ uri: string;
326
+ baseUri: string | undefined;
327
+ internetAccountId: string | undefined;
328
+ internetAccountPreAuthorization: import("@jbrowse/mobx-state-tree").ModelCreationType<{
329
+ internetAccountType: string;
330
+ authInfo: any;
331
+ }> | undefined;
321
332
  }>)>, import("@jbrowse/core/util/types/mst").LegacyFileLocation | import("@jbrowse/mobx-state-tree").ModelCreationType<{
322
333
  locationType: "LocalPathLocation";
323
334
  localPath: string;
@@ -379,18 +390,6 @@ export default function stateModelFactory(): import("@jbrowse/mobx-state-tree").
379
390
  authInfo: import("@jbrowse/mobx-state-tree").IType<any, any, any>;
380
391
  }> | undefined;
381
392
  }, ({
382
- locationType: "UriLocation";
383
- uri: string;
384
- } & Partial<{
385
- locationType: "UriLocation";
386
- uri: string;
387
- baseUri: string | undefined;
388
- internetAccountId: string | undefined;
389
- internetAccountPreAuthorization: import("@jbrowse/mobx-state-tree").ModelCreationType<{
390
- internetAccountType: string;
391
- authInfo: any;
392
- }> | undefined;
393
- }>) | ({
394
393
  blobId: string;
395
394
  locationType: "BlobLocation";
396
395
  name: string;
@@ -412,6 +411,18 @@ export default function stateModelFactory(): import("@jbrowse/mobx-state-tree").
412
411
  } & Partial<{
413
412
  locationType: "LocalPathLocation";
414
413
  localPath: string;
414
+ }>) | ({
415
+ locationType: "UriLocation";
416
+ uri: string;
417
+ } & Partial<{
418
+ locationType: "UriLocation";
419
+ uri: string;
420
+ baseUri: string | undefined;
421
+ internetAccountId: string | undefined;
422
+ internetAccountPreAuthorization: import("@jbrowse/mobx-state-tree").ModelCreationType<{
423
+ internetAccountType: string;
424
+ authInfo: any;
425
+ }> | undefined;
415
426
  }>)>, import("@jbrowse/core/util/types/mst").LegacyFileLocation | import("@jbrowse/mobx-state-tree").ModelCreationType<{
416
427
  locationType: "LocalPathLocation";
417
428
  localPath: string;
@@ -456,10 +467,11 @@ export default function stateModelFactory(): import("@jbrowse/mobx-state-tree").
456
467
  featureFilters: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IMapType<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>>, [undefined]>;
457
468
  relativeTo: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
458
469
  highlightColumns: import("@jbrowse/mobx-state-tree").IType<number[] | undefined, number[] | undefined, number[] | undefined>;
459
- }, "init" | "querySeqName" | "zoomToBaseLevel" | "connectedViewId" | "connectedFeature" | "blastParams" | "uniprotId" | "dataStoreId" | "mafRegion"> & {
470
+ }, "init" | "querySeqName" | "zoomToBaseLevel" | "connectedViewId" | "connectedFeature" | "blastParams" | "orthologParams" | "uniprotId" | "dataStoreId" | "mafRegion"> & {
460
471
  connectedViewId: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
461
472
  connectedFeature: import("@jbrowse/mobx-state-tree").IType<any, any, any>;
462
473
  blastParams: import("@jbrowse/mobx-state-tree").IType<BlastParams | undefined, BlastParams | undefined, BlastParams | undefined>;
474
+ orthologParams: import("@jbrowse/mobx-state-tree").IType<OrthologParams | undefined, OrthologParams | undefined, OrthologParams | undefined>;
463
475
  querySeqName: import("@jbrowse/mobx-state-tree").IType<string | undefined, string, string>;
464
476
  uniprotId: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
465
477
  zoomToBaseLevel: import("@jbrowse/mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
@@ -495,7 +507,7 @@ export default function stateModelFactory(): import("@jbrowse/mobx-state-tree").
495
507
  setColorSchemeName(name: string): void;
496
508
  setBgColor(arg: boolean): void;
497
509
  setShowColumnStats(arg: boolean): void;
498
- setMSAFormat(arg?: import("react-msaview").MSAFormat): void;
510
+ setMSAFormat(arg?: import("msa-parsers").MSAFormat): void;
499
511
  } & {
500
512
  headerHeight: number;
501
513
  status: {
@@ -581,8 +593,8 @@ export default function stateModelFactory(): import("@jbrowse/mobx-state-tree").
581
593
  readonly noTree: boolean;
582
594
  readonly noDomains: boolean;
583
595
  menuItems(): never[];
584
- readonly treeMetadata: any;
585
- readonly MSA: import("react-msaview").MSAParserType | null;
596
+ readonly treeMetadata: Record<string, Record<string, string> | undefined>;
597
+ readonly MSA: import("msa-parsers").MSAParserType | null;
586
598
  readonly numColumns: number;
587
599
  readonly tree: import("react-msaview").NodeWithIds;
588
600
  readonly rowNames: string[];
@@ -789,7 +801,7 @@ export default function stateModelFactory(): import("@jbrowse/mobx-state-tree").
789
801
  accession?: string;
790
802
  dbxref?: string;
791
803
  } | undefined;
792
- treeMetadata: any;
804
+ treeMetadata: Record<string, string> | undefined;
793
805
  };
794
806
  } & {
795
807
  setHeaderHeight(arg: number): void;
@@ -841,19 +853,21 @@ export default function stateModelFactory(): import("@jbrowse/mobx-state-tree").
841
853
  } & {
842
854
  /**
843
855
  * #getter
844
- * Genome region under the current MSA hover column. Suppressed on the LGV
856
+ * Genome regions under the current MSA hover column. Suppressed on the LGV
845
857
  * while it's being hovered (GenomeMouseoverHighlight shows the crisp 1bp
846
858
  * marker there instead of this wider codon band).
847
859
  */
848
- readonly connectedHoverHighlight: IRegion | undefined;
860
+ readonly connectedHoverHighlights: IRegion[];
849
861
  /**
850
862
  * #getter
851
- * Genome region under the persistent MSA click selection. Shown
863
+ * Genome regions under the persistent MSA click selection. Shown
852
864
  * regardless of LGV hover, so hovering the genome doesn't hide it.
853
865
  */
854
- readonly connectedClickHighlight: IRegion | undefined;
866
+ readonly connectedClickHighlights: IRegion[];
855
867
  /**
856
868
  * #getter
869
+ * cross-plugin contract: jbrowse-plugin-mafviewer reads this off the view
870
+ * to draw the same highlights in its own display
857
871
  */
858
872
  readonly connectedHighlights: IRegion[];
859
873
  } & {
@@ -877,6 +891,10 @@ export default function stateModelFactory(): import("@jbrowse/mobx-state-tree").
877
891
  * #action
878
892
  */
879
893
  setBlastParams(args?: BlastParams): void;
894
+ /**
895
+ * #action
896
+ */
897
+ setOrthologParams(args?: OrthologParams): void;
880
898
  /**
881
899
  * #action
882
900
  */
@@ -935,11 +953,10 @@ export default function stateModelFactory(): import("@jbrowse/mobx-state-tree").
935
953
  displayName: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
936
954
  minimized: import("@jbrowse/mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
937
955
  }> & {
938
- data: {
939
- treeMetadata?: string | undefined;
940
- msa?: string | undefined;
941
- tree?: string | undefined;
942
- };
956
+ bgColor: boolean;
957
+ colorSchemeName: string;
958
+ showColumnStats: boolean;
959
+ msaFormat: import("msa-parsers").MSAFormat | undefined;
943
960
  drawLabels: boolean;
944
961
  labelsAlignRight: boolean;
945
962
  treeAreaWidth: number;
@@ -948,10 +965,6 @@ export default function stateModelFactory(): import("@jbrowse/mobx-state-tree").
948
965
  drawTree: boolean;
949
966
  drawNodeBubbles: boolean;
950
967
  autoTreeAreaWidth: boolean;
951
- bgColor: boolean;
952
- colorSchemeName: string;
953
- showColumnStats: boolean;
954
- msaFormat: import("react-msaview").MSAFormat | undefined;
955
968
  id: string;
956
969
  showDomains: boolean;
957
970
  hideGaps: boolean;
@@ -1052,6 +1065,11 @@ export default function stateModelFactory(): import("@jbrowse/mobx-state-tree").
1052
1065
  featureFilters: import("mobx").IKeyValueMap<boolean>;
1053
1066
  relativeTo: string | undefined;
1054
1067
  highlightColumns: number[] | undefined;
1068
+ data: {
1069
+ tree?: string | undefined;
1070
+ msa?: string | undefined;
1071
+ treeMetadata?: string | undefined;
1072
+ };
1055
1073
  } & import("@jbrowse/mobx-state-tree")._NotCustomized>;
1056
1074
  export type JBrowsePluginMsaViewStateModel = ReturnType<typeof stateModelFactory>;
1057
1075
  export type JBrowsePluginMsaViewModel = Instance<JBrowsePluginMsaViewStateModel>;
@@ -4,8 +4,8 @@ import { addDisposer, types } from '@jbrowse/mobx-state-tree';
4
4
  import { genomeToTranscriptSeqMapping } from 'g2p_mapper';
5
5
  import { autorun } from 'mobx';
6
6
  import { MSAModelF } from 'react-msaview';
7
- import { autoLoadProteinDomains, launchBlastIfNeeded, loadStoredData, observeProteinHighlights, processInit, runCleanup, storeDataToIndexedDB, syncGenomeHoverToMsaColumn, } from './afterCreateAutoruns';
8
- import { msaCoordToGenomeCoord } from './msaCoordToGenomeCoord';
7
+ import { autoLoadProteinDomains, launchBlastIfNeeded, launchOrthologsIfNeeded, loadStoredData, observeProteinHighlights, processInit, runCleanup, storeDataToIndexedDB, syncGenomeHoverToMsaColumn, } from './afterCreateAutoruns';
8
+ import { msaCoordToGenomeCoord, msaCoordToGenomeRegions, } from './msaCoordToGenomeCoord';
9
9
  /**
10
10
  * #stateModel MsaViewPlugin
11
11
  * extends
@@ -26,6 +26,10 @@ export default function stateModelFactory() {
26
26
  * #property
27
27
  */
28
28
  blastParams: types.frozen(),
29
+ /**
30
+ * #property
31
+ */
32
+ orthologParams: types.frozen(),
29
33
  /**
30
34
  * #property
31
35
  */
@@ -119,35 +123,37 @@ export default function stateModelFactory() {
119
123
  .views(self => ({
120
124
  /**
121
125
  * #getter
122
- * Genome region under the current MSA hover column. Suppressed on the LGV
126
+ * Genome regions under the current MSA hover column. Suppressed on the LGV
123
127
  * while it's being hovered (GenomeMouseoverHighlight shows the crisp 1bp
124
128
  * marker there instead of this wider codon band).
125
129
  */
126
- get connectedHoverHighlight() {
130
+ get connectedHoverHighlights() {
127
131
  const { mouseCol } = self;
128
132
  return mouseCol === undefined
129
- ? undefined
130
- : msaCoordToGenomeCoord({ model: self, coord: mouseCol });
133
+ ? []
134
+ : msaCoordToGenomeRegions({ model: self, coord: mouseCol });
131
135
  },
132
136
  /**
133
137
  * #getter
134
- * Genome region under the persistent MSA click selection. Shown
138
+ * Genome regions under the persistent MSA click selection. Shown
135
139
  * regardless of LGV hover, so hovering the genome doesn't hide it.
136
140
  */
137
- get connectedClickHighlight() {
141
+ get connectedClickHighlights() {
138
142
  const { mouseClickCol } = self;
139
143
  return mouseClickCol === undefined
140
- ? undefined
141
- : msaCoordToGenomeCoord({ model: self, coord: mouseClickCol });
144
+ ? []
145
+ : msaCoordToGenomeRegions({ model: self, coord: mouseClickCol });
142
146
  },
143
147
  /**
144
148
  * #getter
149
+ * cross-plugin contract: jbrowse-plugin-mafviewer reads this off the view
150
+ * to draw the same highlights in its own display
145
151
  */
146
152
  get connectedHighlights() {
147
153
  return [
148
- this.connectedHoverHighlight,
149
- this.connectedClickHighlight,
150
- ].filter((r) => r !== undefined);
154
+ ...this.connectedHoverHighlights,
155
+ ...this.connectedClickHighlights,
156
+ ];
151
157
  },
152
158
  }))
153
159
  .actions(self => ({
@@ -181,6 +187,12 @@ export default function stateModelFactory() {
181
187
  setBlastParams(args) {
182
188
  self.blastParams = args;
183
189
  },
190
+ /**
191
+ * #action
192
+ */
193
+ setOrthologParams(args) {
194
+ self.orthologParams = args;
195
+ },
184
196
  /**
185
197
  * #action
186
198
  */
@@ -287,6 +299,7 @@ export default function stateModelFactory() {
287
299
  loadStoredData,
288
300
  storeDataToIndexedDB,
289
301
  launchBlastIfNeeded,
302
+ launchOrthologsIfNeeded,
290
303
  processInit,
291
304
  autoLoadProteinDomains,
292
305
  ]) {
@@ -1,17 +1,36 @@
1
1
  import type { MafRegion } from './types';
2
- export declare function msaCoordToGenomeCoord({ model, coord: mouseCol, }: {
3
- model: {
4
- querySeqName: string;
5
- transcriptToMsaMap: {
6
- refName: string;
7
- p2g: Record<number, number>;
8
- } | undefined;
9
- mafRegion?: MafRegion;
10
- rows: string[][];
11
- };
12
- coord: number;
13
- }): {
2
+ interface GenomeRegion {
14
3
  refName: string;
15
4
  start: number;
16
5
  end: number;
17
- } | undefined;
6
+ }
7
+ interface CoordModel {
8
+ querySeqName: string;
9
+ transcriptToMsaMap: {
10
+ refName: string;
11
+ p2gCodon: Record<number, number[]>;
12
+ } | undefined;
13
+ mafRegion?: MafRegion;
14
+ rows: string[][];
15
+ }
16
+ /**
17
+ * The genome regions covered by MSA column `coord` of the query row, in 0-based
18
+ * half-open coordinates (what bpToPx and navTo take).
19
+ *
20
+ * Usually one region -- one codon, or one base in a MAF alignment -- but a
21
+ * codon split across an exon boundary yields one region per contiguous piece,
22
+ * which is why this returns a list.
23
+ */
24
+ export declare function msaCoordToGenomeRegions({ model, coord: mouseCol, }: {
25
+ model: CoordModel;
26
+ coord: number;
27
+ }): GenomeRegion[];
28
+ /**
29
+ * A single region spanning the codon at MSA column `coord`, for navigation. For
30
+ * a codon split across an exon boundary this spans the intervening intron.
31
+ */
32
+ export declare function msaCoordToGenomeCoord(args: {
33
+ model: CoordModel;
34
+ coord: number;
35
+ }): GenomeRegion | undefined;
36
+ export {};
@@ -1,27 +1,56 @@
1
+ import { getCodonRanges } from 'g2p_mapper';
1
2
  import { gappedToUngappedPosition } from './structureConnection';
2
- export function msaCoordToGenomeCoord({ model, coord: mouseCol, }) {
3
- const { querySeqName, transcriptToMsaMap, mafRegion } = model;
4
- const querySeq = model.rows.find(f => f[0] === querySeqName)?.[1];
3
+ /**
4
+ * The genome regions covered by MSA column `coord` of the query row, in 0-based
5
+ * half-open coordinates (what bpToPx and navTo take).
6
+ *
7
+ * Usually one region -- one codon, or one base in a MAF alignment -- but a
8
+ * codon split across an exon boundary yields one region per contiguous piece,
9
+ * which is why this returns a list.
10
+ */
11
+ export function msaCoordToGenomeRegions({ model, coord: mouseCol, }) {
12
+ const { querySeqName, transcriptToMsaMap, mafRegion, rows } = model;
13
+ const querySeq = rows.find(f => f[0] === querySeqName)?.[1];
5
14
  if (!querySeq) {
6
- return undefined;
15
+ return [];
7
16
  }
8
17
  const ungappedPos = gappedToUngappedPosition(querySeq, mouseCol);
9
18
  if (ungappedPos === undefined) {
10
- return undefined;
19
+ return [];
11
20
  }
12
21
  if (mafRegion) {
13
22
  const genomePos = mafRegion.start + ungappedPos;
14
23
  return genomePos < mafRegion.end
15
- ? { refName: mafRegion.refName, start: genomePos, end: genomePos + 1 }
16
- : undefined;
24
+ ? [{ refName: mafRegion.refName, start: genomePos, end: genomePos + 1 }]
25
+ : [];
17
26
  }
18
27
  if (transcriptToMsaMap) {
19
- const { refName, p2g } = transcriptToMsaMap;
20
- const s = p2g[ungappedPos];
21
- const e = p2g[ungappedPos + 1];
22
- return s !== undefined && e !== undefined
23
- ? { refName, start: Math.min(s, e), end: Math.max(s, e) }
24
- : undefined;
28
+ const { refName, p2gCodon } = transcriptToMsaMap;
29
+ // p2gCodon holds every genomic base of the codon, so the range is exact on
30
+ // either strand. Deriving it from consecutive p2g entries instead
31
+ // (p2g[pos]..p2g[pos+1]) was off by one base on the reverse strand -- where
32
+ // p2g stores the codon's *highest* coordinate -- dropped the final residue,
33
+ // whose successor has no p2g entry, and spanned the whole intron for a
34
+ // codon split across an exon boundary.
35
+ return (getCodonRanges(p2gCodon, ungappedPos)?.map(([start, end]) => ({
36
+ refName,
37
+ start,
38
+ end,
39
+ })) ?? []);
25
40
  }
26
- return undefined;
41
+ return [];
42
+ }
43
+ /**
44
+ * A single region spanning the codon at MSA column `coord`, for navigation. For
45
+ * a codon split across an exon boundary this spans the intervening intron.
46
+ */
47
+ export function msaCoordToGenomeCoord(args) {
48
+ const regions = msaCoordToGenomeRegions(args);
49
+ const first = regions[0];
50
+ const last = regions.at(-1);
51
+ // getCodonRanges returns ranges sorted ascending, so first.start..last.end
52
+ // bounds the codon
53
+ return first && last
54
+ ? { refName: first.refName, start: first.start, end: last.end }
55
+ : undefined;
27
56
  }