@jbrowse/plugin-linear-comparative-view 2.7.2 → 2.9.0

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 (27) hide show
  1. package/dist/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.d.ts +7 -0
  2. package/dist/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.js +68 -0
  3. package/dist/LGVSyntenyDisplay/components/util.d.ts +8 -0
  4. package/dist/LGVSyntenyDisplay/components/util.js +111 -0
  5. package/dist/LGVSyntenyDisplay/model.d.ts +15 -14
  6. package/dist/LGVSyntenyDisplay/model.js +35 -104
  7. package/dist/LaunchLinearSyntenyView.js +6 -2
  8. package/dist/LinearComparativeView/model.d.ts +122 -2
  9. package/dist/LinearComparativeView/model.js +2 -2
  10. package/dist/LinearReadVsRef/LinearReadVsRef.js +1 -1
  11. package/dist/LinearSyntenyView/components/ImportForm/index.js +1 -1
  12. package/dist/LinearSyntenyView/model.d.ts +364 -4
  13. package/dist/SyntenyTrack/configSchema.d.ts +5 -0
  14. package/esm/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.d.ts +7 -0
  15. package/esm/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.js +42 -0
  16. package/esm/LGVSyntenyDisplay/components/util.d.ts +8 -0
  17. package/esm/LGVSyntenyDisplay/components/util.js +107 -0
  18. package/esm/LGVSyntenyDisplay/model.d.ts +15 -14
  19. package/esm/LGVSyntenyDisplay/model.js +14 -106
  20. package/esm/LaunchLinearSyntenyView.js +6 -2
  21. package/esm/LinearComparativeView/model.d.ts +122 -2
  22. package/esm/LinearComparativeView/model.js +2 -2
  23. package/esm/LinearReadVsRef/LinearReadVsRef.js +1 -1
  24. package/esm/LinearSyntenyView/components/ImportForm/index.js +1 -1
  25. package/esm/LinearSyntenyView/model.d.ts +364 -4
  26. package/esm/SyntenyTrack/configSchema.d.ts +5 -0
  27. package/package.json +2 -2
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { AnyConfigurationSchemaType } from '@jbrowse/core/configuration';
3
- import { Feature } from '@jbrowse/core/util';
4
3
  /**
5
4
  * #stateModel LGVSyntenyDisplay
6
5
  * extends `LinearPileupDisplay`, displays location of "synteny" feature in a
@@ -35,7 +34,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
35
34
  renderInProgress: AbortController | undefined;
36
35
  filled: boolean;
37
36
  reactElement: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
38
- features: Map<string, Feature> | undefined;
37
+ features: Map<string, import("@jbrowse/core/util").Feature> | undefined;
39
38
  layout: any;
40
39
  status: string;
41
40
  error: unknown;
@@ -53,7 +52,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
53
52
  setMessage(messageText: string): void;
54
53
  setRendered(props: {
55
54
  reactElement: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
56
- features: Map<string, Feature>;
55
+ features: Map<string, import("@jbrowse/core/util").Feature>;
57
56
  layout: any;
58
57
  maxHeightReached: boolean;
59
58
  renderProps: any;
@@ -70,7 +69,9 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
70
69
  };
71
70
  fetchSizeLimit: {
72
71
  type: string;
73
- defaultValue: number;
72
+ defaultValue: number; /**
73
+ * #property
74
+ */
74
75
  description: string;
75
76
  };
76
77
  height: {
@@ -208,7 +209,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
208
209
  regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react").JSX.Element | null;
209
210
  } & {
210
211
  featureIdUnderMouse: string | undefined;
211
- contextMenuFeature: Feature | undefined;
212
+ contextMenuFeature: import("@jbrowse/core/util").Feature | undefined;
212
213
  } & {
213
214
  readonly blockType: "dynamicBlocks" | "staticBlocks";
214
215
  readonly blockDefinitions: import("@jbrowse/core/util/blockTypes").BlockSet;
@@ -218,18 +219,18 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
218
219
  readonly selectedFeatureId: string | undefined;
219
220
  readonly DisplayMessageComponent: import("react").FC<any> | undefined;
220
221
  } & {
221
- readonly features: import("@jbrowse/core/util/compositeMap").default<string, Feature>;
222
- readonly featureUnderMouse: Feature | undefined;
222
+ readonly features: import("@jbrowse/core/util/compositeMap").default<string, import("@jbrowse/core/util").Feature>;
223
+ readonly featureUnderMouse: import("@jbrowse/core/util").Feature | undefined;
223
224
  getFeatureOverlapping(blockKey: string, x: number, y: number): string | undefined;
224
225
  getFeatureByID(blockKey: string, id: string): [number, number, number, number] | undefined;
225
226
  searchFeatureByID(id: string): [number, number, number, number] | undefined;
226
227
  } & {
227
228
  addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
228
229
  deleteBlock(key: string): void;
229
- selectFeature(feature: Feature): void;
230
+ selectFeature(feature: import("@jbrowse/core/util").Feature): void;
230
231
  clearFeatureSelection(): void;
231
232
  setFeatureIdUnderMouse(feature?: string | undefined): void;
232
- setContextMenuFeature(feature?: Feature | undefined): void;
233
+ setContextMenuFeature(feature?: import("@jbrowse/core/util").Feature | undefined): void;
233
234
  } & {
234
235
  reload(): Promise<void>;
235
236
  } & {
@@ -241,7 +242,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
241
242
  afterAttach(): void;
242
243
  } & {
243
244
  colorTagMap: import("mobx").ObservableMap<string, string>;
244
- featureUnderMouseVolatile: Feature | undefined;
245
+ featureUnderMouseVolatile: import("@jbrowse/core/util").Feature | undefined;
245
246
  tagsReady: boolean;
246
247
  } & {
247
248
  readonly autorunReady: boolean;
@@ -256,9 +257,9 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
256
257
  extra?: import("@jbrowse/plugin-alignments/src/shared/color").ExtraColorBy | undefined;
257
258
  }): void;
258
259
  updateColorTagMap(uniqueTag: string[]): void;
259
- setFeatureUnderMouse(feat?: Feature | undefined): void;
260
- selectFeature(feature: Feature): void;
261
- copyFeatureToClipboard(feature: Feature): void;
260
+ setFeatureUnderMouse(feat?: import("@jbrowse/core/util").Feature | undefined): void;
261
+ selectFeature(feature: import("@jbrowse/core/util").Feature): void;
262
+ copyFeatureToClipboard(feature: import("@jbrowse/core/util").Feature): void;
262
263
  setConfig(conf: {
263
264
  [x: string]: any;
264
265
  } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
@@ -275,7 +276,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
275
276
  } & {
276
277
  readonly maxHeight: any;
277
278
  readonly featureHeightSetting: any;
278
- readonly featureUnderMouse: Feature | undefined;
279
+ readonly featureUnderMouse: import("@jbrowse/core/util").Feature | undefined;
279
280
  renderReady(): boolean;
280
281
  readonly filters: import("@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain").default;
281
282
  } & {
@@ -1,110 +1,9 @@
1
+ import { lazy } from 'react';
1
2
  import { ConfigurationReference, } from '@jbrowse/core/configuration';
2
- import { getSession, getContainingTrack, getContainingView, } from '@jbrowse/core/util';
3
- import { MismatchParser, SharedLinearPileupDisplayMixin, } from '@jbrowse/plugin-alignments';
3
+ import { getSession } from '@jbrowse/core/util';
4
+ import { SharedLinearPileupDisplayMixin } from '@jbrowse/plugin-alignments';
4
5
  import { types } from 'mobx-state-tree';
5
- import { when } from 'mobx';
6
- const { parseCigar } = MismatchParser;
7
- function findPosInCigar(cigar, startX) {
8
- let featX = 0;
9
- let mateX = 0;
10
- for (let i = 0; i < cigar.length; i++) {
11
- const len = +cigar[i];
12
- const op = cigar[i + 1];
13
- const min = Math.min(len, startX - featX);
14
- if (featX >= startX) {
15
- break;
16
- }
17
- else if (op === 'I') {
18
- mateX += len;
19
- }
20
- else if (op === 'D') {
21
- featX += min;
22
- }
23
- else if (op === 'M') {
24
- mateX += min;
25
- featX += min;
26
- }
27
- }
28
- return [featX, mateX];
29
- }
30
- async function navToSynteny(feature, self) {
31
- const session = getSession(self);
32
- const track = getContainingTrack(self);
33
- const view = getContainingView(self);
34
- const reg = view.dynamicBlocks.contentBlocks[0];
35
- const cigar = feature.get('CIGAR');
36
- const strand = feature.get('strand');
37
- const regStart = reg.start;
38
- const regEnd = reg.end;
39
- const featStart = feature.get('start');
40
- const featEnd = feature.get('end');
41
- const mate = feature.get('mate');
42
- const mateStart = mate.start;
43
- const mateEnd = mate.end;
44
- const mateAsm = mate.assemblyName;
45
- const mateRef = mate.refName;
46
- const featAsm = reg.assemblyName;
47
- const featRef = reg.refName;
48
- let rMateStart;
49
- let rMateEnd;
50
- let rFeatStart;
51
- let rFeatEnd;
52
- if (cigar) {
53
- const p = parseCigar(cigar);
54
- const [fStartX, mStartX] = findPosInCigar(p, regStart - featStart);
55
- const [fEndX, mEndX] = findPosInCigar(p, regEnd - featStart);
56
- // avoid multiply by 0 with strand undefined
57
- const flipper = strand === -1 ? -1 : 1;
58
- rFeatStart = featStart + fStartX;
59
- rFeatEnd = featStart + fEndX;
60
- rMateStart = (strand === -1 ? mateEnd : mateStart) + mStartX * flipper;
61
- rMateEnd = (strand === -1 ? mateEnd : mateStart) + mEndX * flipper;
62
- }
63
- else {
64
- rFeatStart = featStart;
65
- rFeatEnd = featEnd;
66
- rMateStart = mateStart;
67
- rMateEnd = mateEnd;
68
- }
69
- const trackId = track.configuration.trackId;
70
- const view2 = session.addView('LinearSyntenyView', {
71
- type: 'LinearSyntenyView',
72
- views: [
73
- {
74
- id: `${Math.random()}`,
75
- type: 'LinearGenomeView',
76
- hideHeader: true,
77
- },
78
- {
79
- id: `${Math.random()}`,
80
- type: 'LinearGenomeView',
81
- hideHeader: true,
82
- },
83
- ],
84
- tracks: [
85
- {
86
- configuration: trackId,
87
- type: 'SyntenyTrack',
88
- displays: [
89
- {
90
- type: 'LinearSyntenyDisplay',
91
- configuration: `${trackId}-LinearSyntenyDisplay`,
92
- },
93
- ],
94
- },
95
- ],
96
- });
97
- const f = (n) => Math.floor(n);
98
- const l1 = `${featRef}:${f(rFeatStart)}-${f(rFeatEnd)}`;
99
- const m1 = Math.min(rMateStart, rMateEnd);
100
- const m2 = Math.max(rMateStart, rMateEnd);
101
- const l2 = `${mateRef}:${f(m1)}-${f(m2)}${strand === -1 ? '[rev]' : ''}`;
102
- await when(() => view2.width !== undefined);
103
- await Promise.all([
104
- view2.views[0].navToLocString(l1, featAsm),
105
- view2.views[1].navToLocString(l2, mateAsm),
106
- ]);
107
- }
6
+ const LaunchSyntenyViewDialog = lazy(() => import('./components/LaunchSyntenyViewDialog'));
108
7
  /**
109
8
  * #stateModel LGVSyntenyDisplay
110
9
  * extends `LinearPileupDisplay`, displays location of "synteny" feature in a
@@ -133,7 +32,16 @@ function stateModelFactory(schema) {
133
32
  ? [
134
33
  {
135
34
  label: 'Open synteny view for this position',
136
- onClick: () => navToSynteny(feature, self),
35
+ onClick: () => {
36
+ getSession(self).queueDialog(handleClose => [
37
+ LaunchSyntenyViewDialog,
38
+ {
39
+ model: self,
40
+ handleClose,
41
+ feature,
42
+ },
43
+ ]);
44
+ },
137
45
  },
138
46
  ]
139
47
  : []),
@@ -24,8 +24,12 @@ export default function LaunchLinearSyntenyView(pluginManager) {
24
24
  const idsNotFound = [];
25
25
  await Promise.all(views.map(async (data, idx) => {
26
26
  const view = model.views[idx];
27
- const { loc, tracks = [] } = data;
28
- await view.navToLocString(loc);
27
+ const { assembly, loc, tracks = [] } = data;
28
+ const asm = await assemblyManager.waitForAssembly(assembly);
29
+ if (!asm) {
30
+ throw new Error(`Assembly ${data.assembly} failed to load`);
31
+ }
32
+ await view.navToSearchString({ input: loc, assembly: asm });
29
33
  tracks.forEach(track => tryTrack(view, track, idsNotFound));
30
34
  }));
31
35
  tracks.forEach(track => tryTrack(model, track, idsNotFound));
@@ -123,7 +123,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
123
123
  } & {
124
124
  moveTrack(movingId: string, targetId: string): void;
125
125
  closeView(): void;
126
- toggleTrack(trackId: string): void;
126
+ toggleTrack(trackId: string): boolean;
127
127
  setTrackLabels(setting: "offset" | "hidden" | "overlapping"): void;
128
128
  toggleCenterLine(): void;
129
129
  setDisplayedRegions(regions: import("@jbrowse/core/util").Region[]): void;
@@ -173,6 +173,126 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
173
173
  } & {
174
174
  moveTo(start?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined, end?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined): void;
175
175
  navToLocString(input: string, optAssemblyName?: string | undefined): Promise<void>;
176
+ navToSearchString({ input, assembly, }: {
177
+ input: string;
178
+ assembly: {
179
+ configuration: any;
180
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
181
+ error: unknown;
182
+ loaded: boolean;
183
+ loadingP: Promise<void> | undefined;
184
+ volatileRegions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[] | undefined;
185
+ refNameAliases: {
186
+ [x: string]: string | undefined;
187
+ } | undefined;
188
+ lowerCaseRefNameAliases: {
189
+ [x: string]: string | undefined;
190
+ } | undefined;
191
+ cytobands: import("@jbrowse/core/util").Feature[] | undefined;
192
+ } & {
193
+ getConf(arg: string): any;
194
+ } & {
195
+ readonly initialized: boolean; /**
196
+ * #property
197
+ */
198
+ readonly name: string;
199
+ readonly regions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[] | undefined;
200
+ readonly aliases: string[];
201
+ readonly displayName: string | undefined;
202
+ hasName(name: string): boolean;
203
+ readonly allAliases: string[];
204
+ readonly allRefNames: string[] | undefined;
205
+ readonly lowerCaseRefNames: string[] | undefined;
206
+ readonly allRefNamesWithLowerCase: string[] | undefined;
207
+ readonly rpcManager: import("@jbrowse/core/rpc/RpcManager").default;
208
+ readonly refNameColors: string[];
209
+ } & {
210
+ readonly refNames: string[] | undefined;
211
+ } & {
212
+ getCanonicalRefName(refName: string): string | undefined;
213
+ getRefNameColor(refName: string): string | undefined;
214
+ isValidRefName(refName: string): boolean;
215
+ } & {
216
+ setLoaded({ adapterRegionsWithAssembly, refNameAliases, lowerCaseRefNameAliases, cytobands, }: import("@jbrowse/core/assemblyManager/assembly").Loading): void;
217
+ setError(e: unknown): void;
218
+ setRegions(regions: import("@jbrowse/core/util").Region[]): void;
219
+ setRefNameAliases(aliases: {
220
+ [x: string]: string | undefined;
221
+ }, lcAliases: {
222
+ [x: string]: string | undefined;
223
+ }): void;
224
+ setCytobands(cytobands: import("@jbrowse/core/util").Feature[]): void;
225
+ setLoadingP(p?: Promise<void> | undefined): void;
226
+ load(): Promise<void>;
227
+ loadPre(): Promise<void>;
228
+ } & {
229
+ getAdapterMapEntry(adapterConf: unknown, options: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<import("@jbrowse/core/assemblyManager/assembly").RefNameMap>;
230
+ getRefNameMapForAdapter(adapterConf: unknown, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
231
+ [x: string]: string | undefined;
232
+ }>;
233
+ getReverseRefNameMapForAdapter(adapterConf: unknown, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
234
+ [x: string]: string | undefined;
235
+ }>;
236
+ } & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
237
+ configuration: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
238
+ }, {
239
+ error: unknown;
240
+ loaded: boolean;
241
+ loadingP: Promise<void> | undefined;
242
+ volatileRegions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[] | undefined;
243
+ refNameAliases: {
244
+ [x: string]: string | undefined;
245
+ } | undefined;
246
+ lowerCaseRefNameAliases: {
247
+ [x: string]: string | undefined;
248
+ } | undefined;
249
+ cytobands: import("@jbrowse/core/util").Feature[] | undefined;
250
+ } & {
251
+ getConf(arg: string): any;
252
+ } & {
253
+ readonly initialized: boolean; /**
254
+ * #property
255
+ */
256
+ readonly name: string;
257
+ readonly regions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[] | undefined;
258
+ readonly aliases: string[];
259
+ readonly displayName: string | undefined;
260
+ hasName(name: string): boolean;
261
+ readonly allAliases: string[];
262
+ readonly allRefNames: string[] | undefined;
263
+ readonly lowerCaseRefNames: string[] | undefined;
264
+ readonly allRefNamesWithLowerCase: string[] | undefined;
265
+ readonly rpcManager: import("@jbrowse/core/rpc/RpcManager").default;
266
+ readonly refNameColors: string[];
267
+ } & {
268
+ readonly refNames: string[] | undefined;
269
+ } & {
270
+ getCanonicalRefName(refName: string): string | undefined;
271
+ getRefNameColor(refName: string): string | undefined;
272
+ isValidRefName(refName: string): boolean;
273
+ } & {
274
+ setLoaded({ adapterRegionsWithAssembly, refNameAliases, lowerCaseRefNameAliases, cytobands, }: import("@jbrowse/core/assemblyManager/assembly").Loading): void;
275
+ setError(e: unknown): void;
276
+ setRegions(regions: import("@jbrowse/core/util").Region[]): void;
277
+ setRefNameAliases(aliases: {
278
+ [x: string]: string | undefined;
279
+ }, lcAliases: {
280
+ [x: string]: string | undefined;
281
+ }): void;
282
+ setCytobands(cytobands: import("@jbrowse/core/util").Feature[]): void;
283
+ setLoadingP(p?: Promise<void> | undefined): void;
284
+ load(): Promise<void>;
285
+ loadPre(): Promise<void>;
286
+ } & {
287
+ getAdapterMapEntry(adapterConf: unknown, options: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<import("@jbrowse/core/assemblyManager/assembly").RefNameMap>;
288
+ getRefNameMapForAdapter(adapterConf: unknown, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
289
+ [x: string]: string | undefined;
290
+ }>;
291
+ getReverseRefNameMapForAdapter(adapterConf: unknown, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
292
+ [x: string]: string | undefined;
293
+ }>;
294
+ }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
295
+ }): Promise<void>;
176
296
  navToLocations(parsedLocStrings: import("@jbrowse/core/util").ParsedLocString[], assemblyName?: string | undefined): Promise<void>;
177
297
  navTo(query: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").NavLocation): void;
178
298
  navToMultiple(locations: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").NavLocation[]): void;
@@ -277,7 +397,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
277
397
  /**
278
398
  * #action
279
399
  */
280
- toggleTrack(trackId: string): void;
400
+ toggleTrack(trackId: string): boolean;
281
401
  /**
282
402
  * #action
283
403
  */
@@ -186,12 +186,12 @@ function stateModelFactory(pluginManager) {
186
186
  * #action
187
187
  */
188
188
  toggleTrack(trackId) {
189
- // if we have any tracks with that configuration, turn them off
190
189
  const hiddenCount = this.hideTrack(trackId);
191
- // if none had that configuration, turn one on
192
190
  if (!hiddenCount) {
193
191
  this.showTrack(trackId);
192
+ return true;
194
193
  }
194
+ return false;
195
195
  },
196
196
  /**
197
197
  * #action
@@ -144,7 +144,7 @@ export default function ReadVsRefDialog({ track, feature: preFeature, handleClos
144
144
  {
145
145
  start: 0,
146
146
  end: totalLength,
147
- seq: featSeq || '',
147
+ seq: featSeq || '', // can be empty if user clicks secondary read
148
148
  refName: readName,
149
149
  uniqueId: `${Math.random()}`,
150
150
  },
@@ -17,7 +17,7 @@ const useStyles = makeStyles()(theme => ({
17
17
  },
18
18
  }));
19
19
  function TrackSelector({ setSessionTrackData, setShowTrackId, sessionTrackData, assembly1, assembly2, model, }) {
20
- const [choice, setChoice] = useState('none');
20
+ const [choice, setChoice] = useState('tracklist');
21
21
  useEffect(() => {
22
22
  if (choice === 'none') {
23
23
  setSessionTrackData(undefined);