@jbrowse/plugin-linear-genome-view 5.0.0-beta.16 → 5.0.0-beta.18
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.
- package/esm/FeatureTrack/configSchema.d.ts +3 -1
- package/esm/FeatureTrack/configSchema.js +3 -1
- package/esm/LinearGenomeView/afterAttach.js +6 -4
- package/esm/LinearGenomeView/axisConfigSchema.d.ts +18 -0
- package/esm/LinearGenomeView/axisConfigSchema.js +22 -0
- package/esm/LinearGenomeView/components/Highlight.js +21 -5
- package/esm/LinearGenomeView/components/HighlightBand.js +18 -13
- package/esm/LinearGenomeView/components/HighlightChip.js +9 -4
- package/esm/LinearGenomeView/components/HighlightLabelDialog.d.ts +6 -0
- package/esm/LinearGenomeView/components/HighlightLabelDialog.js +18 -0
- package/esm/LinearGenomeView/components/LinearGenomeViewContainer.js +3 -1
- package/esm/LinearGenomeView/components/SVGHighlightBand.js +3 -3
- package/esm/LinearGenomeView/components/TracksContainer.js +2 -2
- package/esm/LinearGenomeView/components/useSearchBoxPrefs.d.ts +1 -1
- package/esm/LinearGenomeView/components/useSearchBoxPrefs.js +1 -1
- package/esm/LinearGenomeView/components/useSideScroll.d.ts +3 -2
- package/esm/LinearGenomeView/components/useSideScroll.js +13 -8
- package/esm/LinearGenomeView/launchKeys.d.ts +1 -1
- package/esm/LinearGenomeView/launchKeys.js +6 -5
- package/esm/LinearGenomeView/menuItems.js +4 -4
- package/esm/LinearGenomeView/model.d.ts +114 -22
- package/esm/LinearGenomeView/model.js +133 -50
- package/esm/LinearGenomeView/rExport/rScript.d.ts +21 -0
- package/esm/LinearGenomeView/rExport/rScript.js +3 -3
- package/esm/LinearGenomeView/sharedScaleContainer.js +2 -12
- package/esm/LinearGenomeView/showFiles.d.ts +2 -0
- package/esm/LinearGenomeView/showFiles.js +19 -0
- package/esm/LinearGenomeView/svgcomponents/useViewSvgFigure.js +2 -2
- package/esm/TrackModifiers/index.d.ts +80 -0
- package/esm/TrackModifiers/index.js +212 -0
- package/esm/index.d.ts +3 -1
- package/esm/index.js +1 -0
- package/package.json +9 -8
|
@@ -5,7 +5,7 @@ import { resolveUri } from '@jbrowse/core/util';
|
|
|
5
5
|
* it opens (the slot holding the file and the extension the reader knows it
|
|
6
6
|
* by).
|
|
7
7
|
*/
|
|
8
|
-
const READERS = {
|
|
8
|
+
export const READERS = {
|
|
9
9
|
LinearBasicDisplay: {
|
|
10
10
|
call: 'jbrowse_features',
|
|
11
11
|
adapters: {
|
|
@@ -216,7 +216,7 @@ function fileArgument(adapters, adapter) {
|
|
|
216
216
|
* Each sequence adapter `jbrowse_assembly()` builds from a path, by the
|
|
217
217
|
* extension ggjbrowse reads it off, and the index each takes beside it.
|
|
218
218
|
*/
|
|
219
|
-
const SEQUENCE_ADAPTERS = {
|
|
219
|
+
export const SEQUENCE_ADAPTERS = {
|
|
220
220
|
TwoBitAdapter: { slot: 'twoBitLocation', ext: /\.2bit$/, beside: {} },
|
|
221
221
|
BgzipFastaAdapter: {
|
|
222
222
|
slot: 'fastaLocation',
|
|
@@ -330,7 +330,7 @@ function trackNames(tracks) {
|
|
|
330
330
|
}
|
|
331
331
|
/** What the figure cannot show of a track whose settings ggjbrowse reads. */
|
|
332
332
|
function settingNotes(track) {
|
|
333
|
-
const color = track.display.
|
|
333
|
+
const { color } = track.display.encoding ?? {};
|
|
334
334
|
return [
|
|
335
335
|
...(color?.field === 'mateRefName'
|
|
336
336
|
? [
|
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { findParent } from '@jbrowse/mobx-state-tree';
|
|
2
2
|
export function isSharedScaleContainer(thing) {
|
|
3
3
|
return typeof thing === 'object' && thing !== null && 'sharedFit' in thing;
|
|
4
4
|
}
|
|
5
|
-
// Walks rather than using findParentThatIs because having no such container is
|
|
6
|
-
// the ordinary standalone case here, not the error that helper reports.
|
|
7
5
|
export function sharedScaleContainerOf(node) {
|
|
8
|
-
|
|
9
|
-
let found;
|
|
10
|
-
while (!found && hasParent(current) && isAlive(current)) {
|
|
11
|
-
current = getParent(current);
|
|
12
|
-
if (isSharedScaleContainer(current)) {
|
|
13
|
-
found = current;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return found;
|
|
6
|
+
return findParent(node, isSharedScaleContainer);
|
|
17
7
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { fileToLocation, getEnv, getSession, isSessionWithAddSessionTrack, } from '@jbrowse/core/util';
|
|
2
|
+
import { pairIndexFiles } from '@jbrowse/core/util/indexCandidates';
|
|
3
|
+
import { guessTrackConfForLocation } from '@jbrowse/core/util/tracks';
|
|
4
|
+
// Every type is guessed before any track is added, so a selection holding one
|
|
5
|
+
// file of no known type adds nothing rather than half of itself.
|
|
6
|
+
export async function showFiles(view, files) {
|
|
7
|
+
const session = getSession(view);
|
|
8
|
+
if (!isSessionWithAddSessionTrack(session)) {
|
|
9
|
+
throw new Error('this session does not take new tracks');
|
|
10
|
+
}
|
|
11
|
+
const { pluginManager } = getEnv(view);
|
|
12
|
+
const assemblyName = view.assemblyNames[0] ?? view.launchAssemblyName;
|
|
13
|
+
const confs = pairIndexFiles(files).map(({ data, index }) => guessTrackConfForLocation(fileToLocation(data), index && fileToLocation(index), pluginManager, assemblyName));
|
|
14
|
+
for (const conf of confs) {
|
|
15
|
+
session.addSessionTrackConf(conf);
|
|
16
|
+
}
|
|
17
|
+
await Promise.all(confs.map(conf => view.launchTrack(conf.trackId)));
|
|
18
|
+
return confs.map(conf => conf.trackId);
|
|
19
|
+
}
|
|
@@ -126,7 +126,7 @@ const FrozenSvgFigure = memo(function FrozenSvgFigure({ view, snapshot, }) {
|
|
|
126
126
|
* (hidden sections, collapses, height overrides: `groupStateKey`), which are
|
|
127
127
|
* volatile and in no snapshot; **the reload counter**, since a Retry or a Force
|
|
128
128
|
* load leaves every snapshot as it was while the figure has an error or a
|
|
129
|
-
* too-large note to replace; **the view's coloring toggles** (`
|
|
129
|
+
* too-large note to replace; **the view's coloring toggles** (`colorByFrame`,
|
|
130
130
|
* `showAminoAcids`), named one by one because the view's own snapshot moves
|
|
131
131
|
* every pan frame; **the width**, since a resize can widen the canvas without
|
|
132
132
|
* moving the locus; **the theme**, since each display bakes colors into its own
|
|
@@ -172,7 +172,7 @@ function figureKey(view, themeName) {
|
|
|
172
172
|
display?.reloadCounter,
|
|
173
173
|
];
|
|
174
174
|
}),
|
|
175
|
-
view.
|
|
175
|
+
view.colorByFrame,
|
|
176
176
|
view.showAminoAcids,
|
|
177
177
|
session.getActiveThemeOptions?.(themeName),
|
|
178
178
|
session.highlightsVisible ? view.highlights : false,
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { FieldPredicate } from '@jbrowse/core/util/fieldPredicate';
|
|
2
|
+
import type { TrackInit } from '@jbrowse/core/util/tracks';
|
|
3
|
+
import type { DisplaySettings } from '@jbrowse/launch-args/displaySettings';
|
|
4
|
+
import type { IAnyStateTreeNode } from '@jbrowse/mobx-state-tree';
|
|
5
|
+
/** The linear view a command line's tracks open in, as these helpers read it. */
|
|
6
|
+
export interface ModifierView {
|
|
7
|
+
centerLineInfo?: {
|
|
8
|
+
refName?: string;
|
|
9
|
+
offset: number;
|
|
10
|
+
start: number;
|
|
11
|
+
end: number;
|
|
12
|
+
reversed?: boolean;
|
|
13
|
+
oob?: boolean;
|
|
14
|
+
};
|
|
15
|
+
launchTrack: (trackId: string, trackSnapshot?: object, displaySnapshot?: object) => Promise<{
|
|
16
|
+
displays: unknown[];
|
|
17
|
+
} | undefined>;
|
|
18
|
+
showTrack: (trackId: string, trackSnapshot?: object, displaySnapshot?: object) => unknown;
|
|
19
|
+
tracks: {
|
|
20
|
+
configuration: {
|
|
21
|
+
trackId: string;
|
|
22
|
+
};
|
|
23
|
+
displays: unknown[];
|
|
24
|
+
activeDisplay: {
|
|
25
|
+
configuration: Record<string, unknown>;
|
|
26
|
+
};
|
|
27
|
+
}[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* `displayTypeOf` for a track the session holds, undefined for one it does
|
|
31
|
+
* not; `displayType` is the display the caller opens it as when no
|
|
32
|
+
* `display:` modifier names one.
|
|
33
|
+
*/
|
|
34
|
+
export declare function openedDisplayType(session: {
|
|
35
|
+
getTrackById: (trackId: string) => unknown;
|
|
36
|
+
}, trackId: string, modifiers: string[], displayType?: string): string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Write the `filter` of `trackId`'s `settings` onto its display open in
|
|
39
|
+
* `view`, by field over the configured filter, as the track menu would.
|
|
40
|
+
* Returns the display's filter as written, which reopens the track as drawn,
|
|
41
|
+
* or undefined when the settings write no filter.
|
|
42
|
+
*/
|
|
43
|
+
export declare function writeFilter(view: Pick<ModifierView, 'tracks' | 'showTrack'>, trackId: string, settings: DisplaySettings): FieldPredicate[] | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated `writeFilter`, which every display category takes. This one
|
|
46
|
+
* writes an alignments `display`'s filter only.
|
|
47
|
+
*/
|
|
48
|
+
export declare function writeReadFilter(display: unknown, displayType: string | undefined, settings: DisplaySettings): FieldPredicate[] | undefined;
|
|
49
|
+
interface LaunchOptions {
|
|
50
|
+
/** the track entry's own display settings, which the modifiers write over */
|
|
51
|
+
displaySnapshot?: Record<string, unknown>;
|
|
52
|
+
trackSnapshot?: Record<string, unknown>;
|
|
53
|
+
/** changes the settings after the center-line sort resolves, before the open */
|
|
54
|
+
adjust?: (settings: DisplaySettings) => void;
|
|
55
|
+
warn?: (message: string) => void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Open `trackId` in `view` with its command-line modifiers applied, and return
|
|
59
|
+
* the session-spec track entry that reopens it as drawn, or undefined when the
|
|
60
|
+
* open fails, which `launchTrack` reports to the session.
|
|
61
|
+
*/
|
|
62
|
+
export declare function launchTrackWithModifiers(view: ModifierView, trackId: string, displayType: string | undefined, modifiers: string[], { displaySnapshot, trackSnapshot, adjust, warn, }?: LaunchOptions): Promise<{
|
|
63
|
+
trackId: string;
|
|
64
|
+
filter?: FieldPredicate[] | undefined;
|
|
65
|
+
} | undefined>;
|
|
66
|
+
/**
|
|
67
|
+
* Open a session spec's track entry in a navigated `view`, its `modifiers`
|
|
68
|
+
* written over its display settings. When a modifier or the open fails, the
|
|
69
|
+
* session's snackbar says why and the track opens with its own settings.
|
|
70
|
+
*/
|
|
71
|
+
export declare function launchTrackInit(view: ModifierView & IAnyStateTreeNode, t: TrackInit): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Write a track's `memberWrites` onto what its display in `view` already has,
|
|
74
|
+
* after every other modifier, so a member write keeps the rest of the setting
|
|
75
|
+
* whatever order the command line gives them in. A display replaces a color
|
|
76
|
+
* or facet object whole, which is why these cannot ride in on the launch
|
|
77
|
+
* snapshot.
|
|
78
|
+
*/
|
|
79
|
+
export declare function writeMembers(view: Pick<ModifierView, 'tracks' | 'showTrack'>, trackId: string, members: string[]): Record<string, unknown>;
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { mergeConfSettings } from '@jbrowse/core/configuration';
|
|
2
|
+
import { getEnv, getSession } from '@jbrowse/core/util';
|
|
3
|
+
import { basePaintedAt } from '@jbrowse/core/util/Base1DUtils';
|
|
4
|
+
import { predicatesOf, testsSomething, withFields, } from '@jbrowse/core/util/fieldPredicate';
|
|
5
|
+
import { normalizeTrackInit, trackDisplayType } from '@jbrowse/core/util/tracks';
|
|
6
|
+
import { buildDisplaySnapshot, displayCategory, memberPatch, memberWrites, mergeSettings, requestedDisplayType, } from '@jbrowse/launch-args/displaySettings';
|
|
7
|
+
import { getSnapshot, getType, isArrayType, isStateTreeNode, } from '@jbrowse/mobx-state-tree';
|
|
8
|
+
/**
|
|
9
|
+
* The display a linear view opens `conf` as, read off the display picker so it
|
|
10
|
+
* follows `display:` and the adapter rather than a list of track types.
|
|
11
|
+
*/
|
|
12
|
+
function displayTypeOf(pluginManager, conf, modifiers, displayType) {
|
|
13
|
+
return trackDisplayType(pluginManager, conf, 'LinearGenomeView', requestedDisplayType(modifiers) ?? displayType);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* `displayTypeOf` for a track the session holds, undefined for one it does
|
|
17
|
+
* not; `displayType` is the display the caller opens it as when no
|
|
18
|
+
* `display:` modifier names one.
|
|
19
|
+
*/
|
|
20
|
+
export function openedDisplayType(session, trackId, modifiers, displayType) {
|
|
21
|
+
const conf = session.getTrackById(trackId);
|
|
22
|
+
return conf
|
|
23
|
+
? displayTypeOf(getEnv(session).pluginManager, (isStateTreeNode(conf) ? getSnapshot(conf) : conf), modifiers, displayType)
|
|
24
|
+
: undefined;
|
|
25
|
+
}
|
|
26
|
+
const consoleWarn = (message) => {
|
|
27
|
+
console.warn(`Warning: ${message}`);
|
|
28
|
+
};
|
|
29
|
+
function modifierLaunch(displayType, modifiers, warn = consoleWarn) {
|
|
30
|
+
return {
|
|
31
|
+
displayType,
|
|
32
|
+
settings: buildDisplaySnapshot(displayType, modifiers, warn),
|
|
33
|
+
members: memberWrites(displayType, modifiers),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
// the entries grouped by field, as `setFilterFields` takes them: a field whose
|
|
37
|
+
// entries are all bare is `[]`, which clears it, defaults included
|
|
38
|
+
function filterPatch(entries) {
|
|
39
|
+
const patch = {};
|
|
40
|
+
for (const p of entries) {
|
|
41
|
+
patch[p.field] = [
|
|
42
|
+
...(patch[p.field] ?? []),
|
|
43
|
+
...(testsSomething(p) ? [p] : []),
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
return patch;
|
|
47
|
+
}
|
|
48
|
+
// the display snapshot a track opens with. `filter` stays out of it:
|
|
49
|
+
// `writeFilter` writes it once the track is open, since the list in a
|
|
50
|
+
// snapshot would replace the configured one
|
|
51
|
+
function launchSnapshot({ settings }) {
|
|
52
|
+
const { snap, displayType } = settings;
|
|
53
|
+
const { filter: _filter, ...unfiltered } = snap;
|
|
54
|
+
return {
|
|
55
|
+
...unfiltered,
|
|
56
|
+
...(displayType ? { type: displayType } : {}),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Write the `filter` of `trackId`'s `settings` onto its display open in
|
|
61
|
+
* `view`, by field over the configured filter, as the track menu would.
|
|
62
|
+
* Returns the display's filter as written, which reopens the track as drawn,
|
|
63
|
+
* or undefined when the settings write no filter.
|
|
64
|
+
*/
|
|
65
|
+
export function writeFilter(view, trackId, settings) {
|
|
66
|
+
const { filter } = settings.snap;
|
|
67
|
+
const track = view.tracks.find(t => t.configuration.trackId === trackId);
|
|
68
|
+
if (!filter || !track) {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
const patch = filterPatch(filter);
|
|
72
|
+
const display = track.displays[0];
|
|
73
|
+
if (display?.setFilterFields) {
|
|
74
|
+
display.setFilterFields(patch);
|
|
75
|
+
return display.writtenFilter;
|
|
76
|
+
}
|
|
77
|
+
const written = withFields(predicatesOf(track.activeDisplay.configuration.filter), patch);
|
|
78
|
+
view.showTrack(trackId, {}, { filter: written });
|
|
79
|
+
return written;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* @deprecated `writeFilter`, which every display category takes. This one
|
|
83
|
+
* writes an alignments `display`'s filter only.
|
|
84
|
+
*/
|
|
85
|
+
export function writeReadFilter(display, displayType, settings) {
|
|
86
|
+
const { filter } = settings.snap;
|
|
87
|
+
if (displayCategory(displayType) !== 'alignments' || !filter) {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
const filterDisplay = display;
|
|
91
|
+
filterDisplay?.setFilterFields?.(filterPatch(filter));
|
|
92
|
+
return filterDisplay?.writtenFilter;
|
|
93
|
+
}
|
|
94
|
+
// the pivot is the base under the view's center, which a view has only once
|
|
95
|
+
// it shows a region
|
|
96
|
+
function centerSort(view, trackId, field, warn) {
|
|
97
|
+
const center = view.centerLineInfo;
|
|
98
|
+
if (center && !center.oob) {
|
|
99
|
+
return {
|
|
100
|
+
field,
|
|
101
|
+
pos: basePaintedAt(center, center.offset),
|
|
102
|
+
refName: center.refName ?? '',
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
warn(`sort:${field} on "${trackId}" ignored — the view has no center position to sort at (pass --loc)`);
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// The modifiers' settings written over the entry's own as a settings bag
|
|
111
|
+
// writes them (`mergeConfSettings`): a namespace such as `pileup` member by
|
|
112
|
+
// member, a bare value lifted first, and a channel such as `encoding.color`
|
|
113
|
+
// whole, so a `color:` modifier is not mixed into the entry's color by field.
|
|
114
|
+
// Plain JSON where no registered display type says which is which.
|
|
115
|
+
function overEntry(view, displayType, entry, over) {
|
|
116
|
+
const pluginManager = isStateTreeNode(view)
|
|
117
|
+
? getEnv(view).pluginManager
|
|
118
|
+
: undefined;
|
|
119
|
+
return displayType && pluginManager?.displayTypes.has(displayType)
|
|
120
|
+
? mergeConfSettings(pluginManager.getDisplayType(displayType).configSchema, entry, over)
|
|
121
|
+
: mergeSettings(structuredClone(entry), over);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Open `trackId` in `view` with its command-line modifiers applied, and return
|
|
125
|
+
* the session-spec track entry that reopens it as drawn, or undefined when the
|
|
126
|
+
* open fails, which `launchTrack` reports to the session.
|
|
127
|
+
*/
|
|
128
|
+
export async function launchTrackWithModifiers(view, trackId, displayType, modifiers, { displaySnapshot = {}, trackSnapshot = {}, adjust, warn = consoleWarn, } = {}) {
|
|
129
|
+
const launch = modifierLaunch(displayType, modifiers, warn);
|
|
130
|
+
const { snap, sort } = launch.settings;
|
|
131
|
+
const at = sort && centerSort(view, trackId, sort.field, warn);
|
|
132
|
+
if (at) {
|
|
133
|
+
snap.sort = at;
|
|
134
|
+
}
|
|
135
|
+
adjust?.(launch.settings);
|
|
136
|
+
const launched = overEntry(view, displayType, displaySnapshot, launchSnapshot(launch));
|
|
137
|
+
const opened = await view.launchTrack(trackId, trackSnapshot, launched);
|
|
138
|
+
if (!opened) {
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
141
|
+
const drawnFilter = writeFilter(view, trackId, launch.settings);
|
|
142
|
+
const members = writeMembers(view, trackId, launch.members);
|
|
143
|
+
return {
|
|
144
|
+
trackId,
|
|
145
|
+
...launched,
|
|
146
|
+
...(drawnFilter ? { filter: drawnFilter } : {}),
|
|
147
|
+
...members,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Open a session spec's track entry in a navigated `view`, its `modifiers`
|
|
152
|
+
* written over its display settings. When a modifier or the open fails, the
|
|
153
|
+
* session's snackbar says why and the track opens with its own settings.
|
|
154
|
+
*/
|
|
155
|
+
export async function launchTrackInit(view, t) {
|
|
156
|
+
const { trackId, trackSnapshot, displaySnapshot, modifiers } = normalizeTrackInit(t);
|
|
157
|
+
if (modifiers.length === 0) {
|
|
158
|
+
await view.launchTrack(trackId, trackSnapshot, displaySnapshot);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const session = getSession(view);
|
|
162
|
+
const { type } = displaySnapshot;
|
|
163
|
+
const notes = [];
|
|
164
|
+
try {
|
|
165
|
+
await launchTrackWithModifiers(view, trackId, openedDisplayType(session, trackId, modifiers, typeof type === 'string' ? type : undefined), modifiers, {
|
|
166
|
+
trackSnapshot,
|
|
167
|
+
displaySnapshot,
|
|
168
|
+
warn: message => notes.push(message),
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
catch (e) {
|
|
172
|
+
console.error(e);
|
|
173
|
+
session.notifyError(`"${trackId}" ${modifiers.join(' ')}: ${e}`, e);
|
|
174
|
+
}
|
|
175
|
+
// launchTrack reports its own failure, such as a display:
|
|
176
|
+
// the track cannot open as
|
|
177
|
+
if (!view.tracks.some(t => t.configuration.trackId === trackId)) {
|
|
178
|
+
await view.launchTrack(trackId, trackSnapshot, displaySnapshot);
|
|
179
|
+
}
|
|
180
|
+
if (notes.length) {
|
|
181
|
+
session.notify(notes.join('; '), 'warning');
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Write a track's `memberWrites` onto what its display in `view` already has,
|
|
186
|
+
* after every other modifier, so a member write keeps the rest of the setting
|
|
187
|
+
* whatever order the command line gives them in. A display replaces a color
|
|
188
|
+
* or facet object whole, which is why these cannot ride in on the launch
|
|
189
|
+
* snapshot.
|
|
190
|
+
*/
|
|
191
|
+
export function writeMembers(view, trackId, members) {
|
|
192
|
+
if (members.length === 0) {
|
|
193
|
+
return {};
|
|
194
|
+
}
|
|
195
|
+
const track = view.tracks.find(t => t.configuration.trackId === trackId);
|
|
196
|
+
if (!track) {
|
|
197
|
+
throw new Error(`"${trackId}" is not open, so ${members.join(' ')} has nothing to write to`);
|
|
198
|
+
}
|
|
199
|
+
const { configuration } = track.activeDisplay;
|
|
200
|
+
const configured = getSnapshot(configuration);
|
|
201
|
+
const patch = memberPatch(members, root => {
|
|
202
|
+
// a list at a default the snapshot strips, Manhattan's marks, still seeds
|
|
203
|
+
// the write, so `marks.0.mark=bar` edits the mark drawn
|
|
204
|
+
const member = configuration[root];
|
|
205
|
+
return (configured[root] ??
|
|
206
|
+
(isStateTreeNode(member) && isArrayType(getType(member))
|
|
207
|
+
? getSnapshot(member)
|
|
208
|
+
: undefined));
|
|
209
|
+
});
|
|
210
|
+
view.showTrack(trackId, {}, patch);
|
|
211
|
+
return patch;
|
|
212
|
+
}
|
package/esm/index.d.ts
CHANGED
|
@@ -29,12 +29,14 @@ export { searchBoxMenuItems, useSearchBoxPrefs, } from './LinearGenomeView/compo
|
|
|
29
29
|
export type { SearchBoxPrefs } from './LinearGenomeView/components/useSearchBoxPrefs.ts';
|
|
30
30
|
export { normalizeTrackInit } from '@jbrowse/core/util/tracks';
|
|
31
31
|
export { applyInitHighlights } from './LinearGenomeView/afterAttach.ts';
|
|
32
|
+
export { launchTrackInit, launchTrackWithModifiers, openedDisplayType, writeFilter, writeMembers, writeReadFilter, } from './TrackModifiers/index.ts';
|
|
33
|
+
export type { ModifierView } from './TrackModifiers/index.ts';
|
|
32
34
|
export { MultiLevelRubberband, multiLevelRowClickMenuItems, multiLevelRowMenuItems, rowLabels, } from './MultiLevelRubberband/index.ts';
|
|
33
35
|
export { fetchResults, SearchResultsNotFoundError } from './searchUtils.ts';
|
|
34
36
|
export type { LaunchLinearGenomeViewArgs } from './LaunchLinearGenomeView/index.ts';
|
|
35
37
|
export type { BpOffset, ExportSvgOptions, HighlightInput, HighlightType, InitState, LinearGenomeViewLaunchProps, NavLocation, TrackLabelMode, ViewTrackLabelMode, VolatileGuide, } from './LinearGenomeView/types.ts';
|
|
36
38
|
export type { ScalebarRefNameLabel } from './LinearGenomeView/util.ts';
|
|
37
|
-
export type { HighlightRegion, SearchPickerRow, SearchPickerState, } from './LinearGenomeView/model.ts';
|
|
39
|
+
export type { HighlightRegion, SearchHits, SearchPickerRow, SearchPickerState, } from './LinearGenomeView/model.ts';
|
|
38
40
|
export type { RegionsOrientation } from './LinearGenomeView/util.ts';
|
|
39
41
|
export type { RegionEdit } from './LinearGenomeView/util.ts';
|
|
40
42
|
export { makeTicks } from './LinearGenomeView/util.ts';
|
package/esm/index.js
CHANGED
|
@@ -71,6 +71,7 @@ export { default as HeaderSearchBoxRow } from './LinearGenomeView/components/Hea
|
|
|
71
71
|
export { searchBoxMenuItems, useSearchBoxPrefs, } from './LinearGenomeView/components/useSearchBoxPrefs.js';
|
|
72
72
|
export { normalizeTrackInit } from '@jbrowse/core/util/tracks';
|
|
73
73
|
export { applyInitHighlights } from './LinearGenomeView/afterAttach.js';
|
|
74
|
+
export { launchTrackInit, launchTrackWithModifiers, openedDisplayType, writeFilter, writeMembers, writeReadFilter, } from './TrackModifiers/index.js';
|
|
74
75
|
export { MultiLevelRubberband, multiLevelRowClickMenuItems, multiLevelRowMenuItems, rowLabels, } from './MultiLevelRubberband/index.js';
|
|
75
76
|
export { fetchResults, SearchResultsNotFoundError } from './searchUtils.js';
|
|
76
77
|
// The scalebar's grid, published because it is a contract other views draw
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-linear-genome-view",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.18",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "JBrowse 2 linear genome view",
|
|
6
6
|
"keywords": [
|
|
@@ -21,15 +21,16 @@
|
|
|
21
21
|
"esm"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@jbrowse/mobx-state-tree": "^6.
|
|
24
|
+
"@jbrowse/mobx-state-tree": "^6.10.0",
|
|
25
25
|
"@mui/icons-material": "^9.5.0",
|
|
26
26
|
"@mui/material": "^9.5.0",
|
|
27
|
-
"mobx": "^7.
|
|
27
|
+
"mobx": "^7.1.1",
|
|
28
28
|
"mobx-react": "^10.0.2",
|
|
29
|
-
"@jbrowse/
|
|
30
|
-
"@jbrowse/display-kit": "^5.0.0-beta.
|
|
31
|
-
"@jbrowse/
|
|
32
|
-
"@jbrowse/render-core": "^5.0.0-beta.
|
|
29
|
+
"@jbrowse/display-ui": "^5.0.0-beta.18",
|
|
30
|
+
"@jbrowse/display-kit": "^5.0.0-beta.18",
|
|
31
|
+
"@jbrowse/launch-args": "^5.0.0-beta.18",
|
|
32
|
+
"@jbrowse/render-core": "^5.0.0-beta.18",
|
|
33
|
+
"@jbrowse/core": "^5.0.0-beta.18"
|
|
33
34
|
},
|
|
34
35
|
"peerDependencies": {
|
|
35
36
|
"react": ">=19.0.0",
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
},
|
|
41
42
|
"sideEffects": false,
|
|
42
43
|
"devDependencies": {
|
|
43
|
-
"@jbrowse/display-test-utils": "^5.0.0-beta.
|
|
44
|
+
"@jbrowse/display-test-utils": "^5.0.0-beta.18"
|
|
44
45
|
},
|
|
45
46
|
"scripts": {
|
|
46
47
|
"prebuild": "pnpm clean",
|