@jbrowse/plugin-linear-comparative-view 2.11.2 → 2.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.js +1 -1
  2. package/dist/LGVSyntenyDisplay/components/util.js +2 -3
  3. package/dist/LGVSyntenyDisplay/index.js +1 -1
  4. package/dist/LGVSyntenyDisplay/model.d.ts +35 -36
  5. package/dist/LaunchLinearSyntenyView.js +1 -1
  6. package/dist/LinearComparativeDisplay/index.js +1 -1
  7. package/dist/LinearComparativeDisplay/stateModelFactory.d.ts +34 -49
  8. package/dist/LinearComparativeView/index.js +1 -1
  9. package/dist/LinearComparativeView/model.d.ts +23 -178
  10. package/dist/LinearComparativeView/model.js +0 -23
  11. package/dist/LinearReadVsRef/LinearReadVsRef.js +1 -1
  12. package/dist/LinearReadVsRef/index.js +1 -1
  13. package/dist/LinearSyntenyDisplay/afterAttach.js +1 -2
  14. package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +54 -101
  15. package/dist/LinearSyntenyDisplay/components/SyntenyContextMenu.js +1 -1
  16. package/dist/LinearSyntenyDisplay/components/util.d.ts +10 -0
  17. package/dist/LinearSyntenyDisplay/components/util.js +90 -5
  18. package/dist/LinearSyntenyDisplay/drawSynteny.js +4 -4
  19. package/dist/LinearSyntenyDisplay/index.js +1 -1
  20. package/dist/LinearSyntenyDisplay/model.d.ts +26 -36
  21. package/dist/LinearSyntenyView/components/ExportSvgDialog.js +1 -1
  22. package/dist/LinearSyntenyView/components/Icons.js +2 -3
  23. package/dist/LinearSyntenyView/components/ImportForm/index.js +1 -0
  24. package/dist/LinearSyntenyView/components/ImportForm/util.js +4 -5
  25. package/dist/LinearSyntenyView/index.js +1 -1
  26. package/dist/LinearSyntenyView/model.d.ts +26 -943
  27. package/dist/LinearSyntenyView/model.js +1 -9
  28. package/dist/LinearSyntenyView/svgcomponents/SVGBackground.js +1 -1
  29. package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +1 -2
  30. package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.d.ts +5 -3
  31. package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.js +2 -4
  32. package/dist/SyntenyFeatureDetail/index.js +1 -1
  33. package/dist/SyntenyTrack/index.js +1 -1
  34. package/dist/util.js +5 -6
  35. package/esm/LGVSyntenyDisplay/components/util.js +1 -1
  36. package/esm/LGVSyntenyDisplay/model.d.ts +35 -36
  37. package/esm/LinearComparativeDisplay/stateModelFactory.d.ts +34 -49
  38. package/esm/LinearComparativeView/model.d.ts +23 -178
  39. package/esm/LinearComparativeView/model.js +1 -24
  40. package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +54 -101
  41. package/esm/LinearSyntenyDisplay/components/util.d.ts +10 -0
  42. package/esm/LinearSyntenyDisplay/components/util.js +84 -1
  43. package/esm/LinearSyntenyDisplay/model.d.ts +26 -36
  44. package/esm/LinearSyntenyView/components/ImportForm/index.js +1 -0
  45. package/esm/LinearSyntenyView/model.d.ts +26 -943
  46. package/esm/LinearSyntenyView/model.js +0 -8
  47. package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.d.ts +5 -3
  48. package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.js +2 -4
  49. package/package.json +2 -2
@@ -1,4 +1,6 @@
1
- import { doesIntersect2 } from '@jbrowse/core/util';
1
+ import { assembleLocString, doesIntersect2, getSession, isSessionModelWithWidgets, } from '@jbrowse/core/util';
2
+ // locals
3
+ import { getId, MAX_COLOR_RANGE } from '../drawSynteny';
2
4
  export function drawMatchSimple({ feature, ctx, offsets, cb, height, drawCurves, oobLimit, viewWidth, hideTiny, }) {
3
5
  const { p11, p12, p21, p22 } = feature;
4
6
  const x11 = p11.offsetPx - offsets[0];
@@ -74,3 +76,84 @@ export function drawBezierBox(ctx, x1, x2, y1, x3, x4, y2, mid) {
74
76
  ctx.closePath();
75
77
  ctx.fill();
76
78
  }
79
+ export function onSynClick(event, model) {
80
+ const ref1 = model.clickMapCanvas;
81
+ const ref2 = model.cigarClickMapCanvas;
82
+ if (!ref1 || !ref2) {
83
+ return;
84
+ }
85
+ const rect = ref1.getBoundingClientRect();
86
+ const ctx1 = ref1.getContext('2d');
87
+ const ctx2 = ref2.getContext('2d');
88
+ if (!ctx1 || !ctx2) {
89
+ return;
90
+ }
91
+ const x = event.clientX - rect.left;
92
+ const y = event.clientY - rect.top;
93
+ const [r1, g1, b1] = ctx1.getImageData(x, y, 1, 1).data;
94
+ const unitMultiplier = Math.floor(MAX_COLOR_RANGE / model.numFeats);
95
+ const id = getId(r1, g1, b1, unitMultiplier);
96
+ const feat = model.featPositions[id];
97
+ if (feat) {
98
+ const { f } = feat;
99
+ model.setClickId(f.id());
100
+ const session = getSession(model);
101
+ if (isSessionModelWithWidgets(session)) {
102
+ session.showWidget(session.addWidget('SyntenyFeatureWidget', 'syntenyFeature', {
103
+ featureData: {
104
+ feature1: f.toJSON(),
105
+ feature2: f.get('mate'),
106
+ },
107
+ }));
108
+ }
109
+ }
110
+ return feat;
111
+ }
112
+ export function onSynContextClick(event, model, setAnchorEl) {
113
+ event.preventDefault();
114
+ const ref1 = model.clickMapCanvas;
115
+ const ref2 = model.cigarClickMapCanvas;
116
+ if (!ref1 || !ref2) {
117
+ return;
118
+ }
119
+ const rect = ref1.getBoundingClientRect();
120
+ const ctx1 = ref1.getContext('2d');
121
+ const ctx2 = ref2.getContext('2d');
122
+ if (!ctx1 || !ctx2) {
123
+ return;
124
+ }
125
+ const { clientX, clientY } = event;
126
+ const x = clientX - rect.left;
127
+ const y = clientY - rect.top;
128
+ const [r1, g1, b1] = ctx1.getImageData(x, y, 1, 1).data;
129
+ const unitMultiplier = Math.floor(MAX_COLOR_RANGE / model.numFeats);
130
+ const id = getId(r1, g1, b1, unitMultiplier);
131
+ const f = model.featPositions[id];
132
+ if (f) {
133
+ model.setClickId(f.f.id());
134
+ setAnchorEl({ clientX, clientY, feature: f });
135
+ }
136
+ }
137
+ export function getTooltip(f, cigarOp, cigarOpLen) {
138
+ // @ts-expect-error
139
+ const f1 = f.toJSON();
140
+ const f2 = f1.mate;
141
+ const l1 = f1.end - f1.start;
142
+ const l2 = f2.end - f2.start;
143
+ const identity = f1.identity;
144
+ const n1 = f1.name;
145
+ const n2 = f2.name;
146
+ return [
147
+ `Loc1: ${assembleLocString(f1)}`,
148
+ `Loc2: ${assembleLocString(f2)}`,
149
+ `Inverted: ${f1.strand === -1}`,
150
+ `Query len: ${l1.toLocaleString('en-US')}`,
151
+ `Target len: ${l2.toLocaleString('en-US')}`,
152
+ identity ? `Identity: ${identity.toPrecision(2)}` : '',
153
+ cigarOp ? `CIGAR operator: ${cigarOp}${cigarOpLen}` : '',
154
+ n1 ? `Name 1: ${n1}` : '',
155
+ n2 ? `Name 1: ${n2}` : '',
156
+ ]
157
+ .filter(f => !!f)
158
+ .join('<br/>');
159
+ }
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Instance } from 'mobx-state-tree';
3
2
  import { AnyConfigurationSchemaType } from '@jbrowse/core/configuration';
4
3
  import { Feature } from '@jbrowse/core/util';
@@ -58,8 +57,8 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
58
57
  error: unknown;
59
58
  message: string | undefined;
60
59
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
61
- onHorizontalScroll?: Function | undefined;
62
- blockState?: Record<string, any> | undefined;
60
+ onHorizontalScroll?: Function;
61
+ blockState?: Record<string, any>;
63
62
  }>;
64
63
  readonly DisplayBlurb: import("react").FC<{
65
64
  model: {
@@ -82,19 +81,14 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
82
81
  }> | null;
83
82
  readonly adapterConfig: any;
84
83
  readonly parentTrack: any;
85
- renderProps(): any; /**
86
- * #getter
87
- */
84
+ renderProps(): any;
88
85
  readonly rendererType: import("@jbrowse/core/pluggableElementTypes").RendererType;
89
- readonly DisplayMessageComponent: import("react").FC<any> | undefined;
86
+ readonly DisplayMessageComponent: undefined | import("react").FC<any>;
90
87
  trackMenuItems(): import("@jbrowse/core/ui").MenuItem[];
91
- readonly viewMenuActions: import("@jbrowse/core/ui").MenuItem[]; /**
92
- * #getter
93
- * used for synteny svg rendering
94
- */
88
+ readonly viewMenuActions: import("@jbrowse/core/ui").MenuItem[];
95
89
  regionCannotBeRendered(): null;
96
90
  } & {
97
- setMessage(arg?: string | undefined): void;
91
+ setMessage(arg?: string): void;
98
92
  setError(error?: unknown): void;
99
93
  setRpcDriverName(rpcDriverName: string): void;
100
94
  reload(): void;
@@ -112,7 +106,13 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
112
106
  configuration: {
113
107
  [x: string]: any;
114
108
  } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
115
- setSubschema(slotName: string, data: unknown): any;
109
+ setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
110
+ [x: string]: any;
111
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
112
+ setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
113
+ [x: string]: any;
114
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<AnyConfigurationSchemaType>);
115
+ } & import("mobx-state-tree").IStateTreeNode<AnyConfigurationSchemaType>);
116
116
  } & import("mobx-state-tree").IStateTreeNode<AnyConfigurationSchemaType>;
117
117
  height: number;
118
118
  } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
@@ -138,8 +138,8 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
138
138
  error: unknown;
139
139
  message: string | undefined;
140
140
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
141
- onHorizontalScroll?: Function | undefined;
142
- blockState?: Record<string, any> | undefined;
141
+ onHorizontalScroll?: Function;
142
+ blockState?: Record<string, any>;
143
143
  }>;
144
144
  readonly DisplayBlurb: import("react").FC<{
145
145
  model: {
@@ -162,19 +162,14 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
162
162
  }> | null;
163
163
  readonly adapterConfig: any;
164
164
  readonly parentTrack: any;
165
- renderProps(): any; /**
166
- * #getter
167
- */
165
+ renderProps(): any;
168
166
  readonly rendererType: import("@jbrowse/core/pluggableElementTypes").RendererType;
169
- readonly DisplayMessageComponent: import("react").FC<any> | undefined;
167
+ readonly DisplayMessageComponent: undefined | import("react").FC<any>;
170
168
  trackMenuItems(): import("@jbrowse/core/ui").MenuItem[];
171
- readonly viewMenuActions: import("@jbrowse/core/ui").MenuItem[]; /**
172
- * #getter
173
- * used for synteny svg rendering
174
- */
169
+ readonly viewMenuActions: import("@jbrowse/core/ui").MenuItem[];
175
170
  regionCannotBeRendered(): null;
176
171
  } & {
177
- setMessage(arg?: string | undefined): void;
172
+ setMessage(arg?: string): void;
178
173
  setError(error?: unknown): void;
179
174
  setRpcDriverName(rpcDriverName: string): void;
180
175
  reload(): void;
@@ -213,8 +208,8 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
213
208
  error: unknown;
214
209
  message: string | undefined;
215
210
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
216
- onHorizontalScroll?: Function | undefined;
217
- blockState?: Record<string, any> | undefined;
211
+ onHorizontalScroll?: Function;
212
+ blockState?: Record<string, any>;
218
213
  }>;
219
214
  readonly DisplayBlurb: import("react").FC<{
220
215
  model: {
@@ -237,19 +232,14 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
237
232
  }> | null;
238
233
  readonly adapterConfig: any;
239
234
  readonly parentTrack: any;
240
- renderProps(): any; /**
241
- * #getter
242
- */
235
+ renderProps(): any;
243
236
  readonly rendererType: import("@jbrowse/core/pluggableElementTypes").RendererType;
244
- readonly DisplayMessageComponent: import("react").FC<any> | undefined;
237
+ readonly DisplayMessageComponent: undefined | import("react").FC<any>;
245
238
  trackMenuItems(): import("@jbrowse/core/ui").MenuItem[];
246
- readonly viewMenuActions: import("@jbrowse/core/ui").MenuItem[]; /**
247
- * #getter
248
- * used for synteny svg rendering
249
- */
239
+ readonly viewMenuActions: import("@jbrowse/core/ui").MenuItem[];
250
240
  regionCannotBeRendered(): null;
251
241
  } & {
252
- setMessage(arg?: string | undefined): void;
242
+ setMessage(arg?: string): void;
253
243
  setError(error?: unknown): void;
254
244
  setRpcDriverName(rpcDriverName: string): void;
255
245
  reload(): void;
@@ -265,7 +255,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
265
255
  setMessage(messageText: string): void;
266
256
  setRendered(args?: {
267
257
  features: Feature[];
268
- } | undefined): void;
258
+ }): void;
269
259
  setError(error: unknown): void;
270
260
  } & {
271
261
  afterAttach(): void;
@@ -65,6 +65,7 @@ const LinearSyntenyViewImportForm = observer(function ({ model, }) {
65
65
  };
66
66
  })));
67
67
  model.views.forEach(view => view.setWidth(model.width));
68
+ model.views.forEach(view => view.showAllRegions());
68
69
  if (sessionTrackData) {
69
70
  session.addTrackConf(sessionTrackData);
70
71
  model.toggleTrack(sessionTrackData.trackId);