@jbrowse/plugin-linear-genome-view 5.0.0-beta.19 → 5.0.0-beta.20
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/LinearGenomeView/afterAttach.d.ts +17 -0
- package/esm/LinearGenomeView/afterAttach.js +71 -43
- package/esm/LinearGenomeView/components/CenterLine.js +6 -3
- package/esm/LinearGenomeView/components/ConnectedHoverHighlight.js +2 -3
- package/esm/LinearGenomeView/components/ExportSvgDialog.js +12 -3
- package/esm/LinearGenomeView/components/Header.js +1 -1
- package/esm/LinearGenomeView/components/HeaderZoomControls.js +3 -2
- package/esm/LinearGenomeView/components/HighlightBand.js +7 -7
- package/esm/LinearGenomeView/components/ImportForm.js +3 -3
- package/esm/LinearGenomeView/components/MiniControls.js +1 -1
- package/esm/LinearGenomeView/components/OverviewRubberband.js +5 -3
- package/esm/LinearGenomeView/components/ResizeAllTracksHandle.js +7 -4
- package/esm/LinearGenomeView/components/SVGHighlightBand.d.ts +10 -1
- package/esm/LinearGenomeView/components/SVGHighlightBand.js +15 -3
- package/esm/LinearGenomeView/components/SearchBox.js +3 -2
- package/esm/LinearGenomeView/components/SearchResultsTable.js +2 -2
- package/esm/LinearGenomeView/components/TrackContainer.js +1 -1
- package/esm/LinearGenomeView/components/TrackLabelDragHandle.js +2 -3
- package/esm/LinearGenomeView/components/fetchSequence.js +15 -7
- package/esm/LinearGenomeView/components/useRangeSelect.js +5 -2
- package/esm/LinearGenomeView/menuItems.js +5 -5
- package/esm/LinearGenomeView/model.d.ts +52 -40
- package/esm/LinearGenomeView/model.js +71 -50
- package/esm/LinearGenomeView/rExport/exportLinearView.d.ts +4 -0
- package/esm/LinearGenomeView/rExport/exportLinearView.js +26 -6
- package/esm/LinearGenomeView/rExport/rScript.d.ts +19 -9
- package/esm/LinearGenomeView/rExport/rScript.js +91 -53
- package/esm/LinearGenomeView/showRegionsWithUndo.js +5 -3
- package/esm/LinearGenomeView/svgcomponents/SVGHighlights.d.ts +3 -1
- package/esm/LinearGenomeView/svgcomponents/SVGHighlights.js +2 -2
- package/esm/LinearGenomeView/svgcomponents/SVGHighlightsOverlay.d.ts +3 -1
- package/esm/LinearGenomeView/svgcomponents/SVGHighlightsOverlay.js +2 -2
- package/esm/LinearGenomeView/svgcomponents/SVGView.js +15 -1
- package/esm/LinearGenomeView/svgcomponents/util.d.ts +1 -0
- package/esm/LinearGenomeView/types.d.ts +6 -0
- package/esm/LinearGenomeView/types.js +0 -1
- package/esm/LinearGenomeView/util.js +9 -9
- package/esm/MultiLevelRubberband/useRangeSelect.js +14 -12
- package/esm/TrackModifiers/index.d.ts +4 -1
- package/esm/TrackModifiers/index.js +26 -7
- package/esm/displayKitTests/perRegionTestEnv.d.ts +2 -0
- package/esm/index.d.ts +2 -2
- package/esm/index.js +1 -1
- package/esm/searchUtils.d.ts +1 -3
- package/esm/searchUtils.js +33 -44
- package/esm/shared/useWindowDrag.js +11 -9
- package/package.json +7 -7
|
@@ -101,7 +101,7 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
101
101
|
trackSelectorType: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
102
102
|
showCenterLine: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
103
103
|
showCytobands: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
104
|
-
trackLabels: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<
|
|
104
|
+
trackLabels: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<"" | "hidden" | "offset" | "overlapping">, [undefined]>;
|
|
105
105
|
axis: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
106
106
|
readonly grid: {
|
|
107
107
|
type: "boolean";
|
|
@@ -955,6 +955,11 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
955
955
|
* short by the unmeasured bands.
|
|
956
956
|
*/
|
|
957
957
|
getTrackYOffset(trackId: string): number | undefined;
|
|
958
|
+
/**
|
|
959
|
+
* #getter
|
|
960
|
+
* `getTrackYOffset` for every shown track, by trackId, from one walk
|
|
961
|
+
*/
|
|
962
|
+
readonly trackYOffsets: Map<string, number>;
|
|
958
963
|
/**
|
|
959
964
|
* #method
|
|
960
965
|
* the pinned or unpinned sibling list a track renders within; move
|
|
@@ -1256,24 +1261,6 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
1256
1261
|
* #action
|
|
1257
1262
|
*/
|
|
1258
1263
|
toggleTrackSelector(): import("@jbrowse/core/util").Widget;
|
|
1259
|
-
/**
|
|
1260
|
-
* #method
|
|
1261
|
-
* Helper method for the fetchSequence.
|
|
1262
|
-
* Returns the regions the user selected with the
|
|
1263
|
-
* rubberband
|
|
1264
|
-
*
|
|
1265
|
-
* @param leftOffset - `object as {start, end, index, offset}`, offset = start
|
|
1266
|
-
* of user drag
|
|
1267
|
-
* @param rightOffset - `object as {start, end, index, offset}`,
|
|
1268
|
-
* offset = end of user drag
|
|
1269
|
-
* @returns array of Region[]
|
|
1270
|
-
*/
|
|
1271
|
-
getSelectedRegions(leftOffset?: BpOffset, rightOffset?: BpOffset): {
|
|
1272
|
-
assemblyName: string;
|
|
1273
|
-
refName: string;
|
|
1274
|
-
start: number;
|
|
1275
|
-
end: number;
|
|
1276
|
-
}[];
|
|
1277
1264
|
/**
|
|
1278
1265
|
* #action
|
|
1279
1266
|
*/
|
|
@@ -1293,6 +1280,25 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
1293
1280
|
* #action
|
|
1294
1281
|
*/
|
|
1295
1282
|
setLaunch(launch?: LaunchInput<InitState>): void;
|
|
1283
|
+
} & {
|
|
1284
|
+
/**
|
|
1285
|
+
* #method
|
|
1286
|
+
* Helper method for the fetchSequence.
|
|
1287
|
+
* Returns the regions the user selected with the
|
|
1288
|
+
* rubberband
|
|
1289
|
+
*
|
|
1290
|
+
* @param leftOffset - `object as {start, end, index, offset}`, offset = start
|
|
1291
|
+
* of user drag
|
|
1292
|
+
* @param rightOffset - `object as {start, end, index, offset}`,
|
|
1293
|
+
* offset = end of user drag
|
|
1294
|
+
* @returns array of Region[]
|
|
1295
|
+
*/
|
|
1296
|
+
getSelectedRegions(leftOffset?: BpOffset, rightOffset?: BpOffset): {
|
|
1297
|
+
assemblyName: string;
|
|
1298
|
+
refName: string;
|
|
1299
|
+
start: number;
|
|
1300
|
+
end: number;
|
|
1301
|
+
}[];
|
|
1296
1302
|
} & {
|
|
1297
1303
|
slide: (viewWidths: number) => void;
|
|
1298
1304
|
zoom: (targetBpPerPx: number) => void;
|
|
@@ -2054,7 +2060,7 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
2054
2060
|
trackSelectorType: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
2055
2061
|
showCenterLine: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
2056
2062
|
showCytobands: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
2057
|
-
trackLabels: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<
|
|
2063
|
+
trackLabels: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<"" | "hidden" | "offset" | "overlapping">, [undefined]>;
|
|
2058
2064
|
axis: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2059
2065
|
readonly grid: {
|
|
2060
2066
|
type: "boolean";
|
|
@@ -2908,6 +2914,11 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
2908
2914
|
* short by the unmeasured bands.
|
|
2909
2915
|
*/
|
|
2910
2916
|
getTrackYOffset(trackId: string): number | undefined;
|
|
2917
|
+
/**
|
|
2918
|
+
* #getter
|
|
2919
|
+
* `getTrackYOffset` for every shown track, by trackId, from one walk
|
|
2920
|
+
*/
|
|
2921
|
+
readonly trackYOffsets: Map<string, number>;
|
|
2911
2922
|
/**
|
|
2912
2923
|
* #method
|
|
2913
2924
|
* the pinned or unpinned sibling list a track renders within; move
|
|
@@ -3209,24 +3220,6 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
3209
3220
|
* #action
|
|
3210
3221
|
*/
|
|
3211
3222
|
toggleTrackSelector(): import("@jbrowse/core/util").Widget;
|
|
3212
|
-
/**
|
|
3213
|
-
* #method
|
|
3214
|
-
* Helper method for the fetchSequence.
|
|
3215
|
-
* Returns the regions the user selected with the
|
|
3216
|
-
* rubberband
|
|
3217
|
-
*
|
|
3218
|
-
* @param leftOffset - `object as {start, end, index, offset}`, offset = start
|
|
3219
|
-
* of user drag
|
|
3220
|
-
* @param rightOffset - `object as {start, end, index, offset}`,
|
|
3221
|
-
* offset = end of user drag
|
|
3222
|
-
* @returns array of Region[]
|
|
3223
|
-
*/
|
|
3224
|
-
getSelectedRegions(leftOffset?: BpOffset, rightOffset?: BpOffset): {
|
|
3225
|
-
assemblyName: string;
|
|
3226
|
-
refName: string;
|
|
3227
|
-
start: number;
|
|
3228
|
-
end: number;
|
|
3229
|
-
}[];
|
|
3230
3223
|
/**
|
|
3231
3224
|
* #action
|
|
3232
3225
|
*/
|
|
@@ -3246,6 +3239,25 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
3246
3239
|
* #action
|
|
3247
3240
|
*/
|
|
3248
3241
|
setLaunch(launch?: LaunchInput<InitState>): void;
|
|
3242
|
+
} & {
|
|
3243
|
+
/**
|
|
3244
|
+
* #method
|
|
3245
|
+
* Helper method for the fetchSequence.
|
|
3246
|
+
* Returns the regions the user selected with the
|
|
3247
|
+
* rubberband
|
|
3248
|
+
*
|
|
3249
|
+
* @param leftOffset - `object as {start, end, index, offset}`, offset = start
|
|
3250
|
+
* of user drag
|
|
3251
|
+
* @param rightOffset - `object as {start, end, index, offset}`,
|
|
3252
|
+
* offset = end of user drag
|
|
3253
|
+
* @returns array of Region[]
|
|
3254
|
+
*/
|
|
3255
|
+
getSelectedRegions(leftOffset?: BpOffset, rightOffset?: BpOffset): {
|
|
3256
|
+
assemblyName: string;
|
|
3257
|
+
refName: string;
|
|
3258
|
+
start: number;
|
|
3259
|
+
end: number;
|
|
3260
|
+
}[];
|
|
3249
3261
|
} & {
|
|
3250
3262
|
slide: (viewWidths: number) => void;
|
|
3251
3263
|
zoom: (targetBpPerPx: number) => void;
|
|
@@ -4004,8 +4016,8 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
4004
4016
|
hideNoTracksActive: boolean;
|
|
4005
4017
|
trackSelectorType: string;
|
|
4006
4018
|
showCytobands: boolean;
|
|
4007
|
-
trackLabels:
|
|
4008
|
-
axis: import("@jbrowse/mobx-state-tree").ModelSnapshotType<Record<string,
|
|
4019
|
+
trackLabels: "" | "hidden" | "offset" | "overlapping";
|
|
4020
|
+
axis: import("@jbrowse/mobx-state-tree").ModelSnapshotType<Record<string, import("@jbrowse/mobx-state-tree").IAnyType>>;
|
|
4009
4021
|
colorByFrame: boolean;
|
|
4010
4022
|
showAminoAcids: boolean;
|
|
4011
4023
|
showTrackOutlines: boolean;
|
|
@@ -17,6 +17,7 @@ import { assemblyErrorMessage, computeViewStatus, viewLoading, } from '@jbrowse/
|
|
|
17
17
|
import { pendingLaunch, withLaunchInput, } from '@jbrowse/core/util/withLaunchInput';
|
|
18
18
|
import { MIN_DISPLAY_HEIGHT } from '@jbrowse/display-kit/const';
|
|
19
19
|
import { contentRightEdgePx } from '@jbrowse/display-kit/regionHost';
|
|
20
|
+
import { VIEW_TRACK_LABEL_MODES } from '@jbrowse/display-kit/types';
|
|
20
21
|
import { cast, getParent, getSnapshot, hasParent, isAlive, types, } from '@jbrowse/mobx-state-tree';
|
|
21
22
|
import { observable, when } from 'mobx';
|
|
22
23
|
import { fetchResults, handleSelectedRegion, isOpenInView, navToOption, } from '../searchUtils.js';
|
|
@@ -91,6 +92,11 @@ function canonicalHighlight(self, region) {
|
|
|
91
92
|
}
|
|
92
93
|
// bpPerPx deltas smaller than this are treated as no zoom change, avoiding
|
|
93
94
|
// pointless offset re-anchoring on micro-steps
|
|
95
|
+
// a stored mode this build does not know reads as unset, the plugin default
|
|
96
|
+
function storedTrackLabels() {
|
|
97
|
+
const stored = localStorageGetItem('lgv-trackLabels');
|
|
98
|
+
return VIEW_TRACK_LABEL_MODES.find(mode => mode === stored) ?? '';
|
|
99
|
+
}
|
|
94
100
|
const BP_PER_PX_EPSILON = 0.000001;
|
|
95
101
|
// px of blank space a view may scroll past either end of its regions, enough to
|
|
96
102
|
// read as an edge and too little to lose the content
|
|
@@ -165,16 +171,17 @@ function openTrackSelectorWidget(self) {
|
|
|
165
171
|
throw new Error('session does not support widgets');
|
|
166
172
|
}
|
|
167
173
|
/**
|
|
168
|
-
* Whether the
|
|
174
|
+
* Whether the drawer is showing this view's track selector right now. One
|
|
169
175
|
* spelling for the `isTrackSelectorOpen` getter (which lights up the header
|
|
170
|
-
* button) and for `toggleTrackSelector` (which decides hide-vs-show)
|
|
171
|
-
*
|
|
172
|
-
*
|
|
176
|
+
* button) and for `toggleTrackSelector` (which decides hide-vs-show). The
|
|
177
|
+
* widget id is shared by every view, so the selector's `view` is what says
|
|
178
|
+
* whose it is.
|
|
173
179
|
*/
|
|
174
180
|
function isTrackSelectorVisible(self) {
|
|
175
181
|
const session = getSession(self);
|
|
176
182
|
return (isSessionModelWithWidgets(session) &&
|
|
177
183
|
session.visibleWidget?.id === TRACK_SELECTOR_WIDGET_ID &&
|
|
184
|
+
session.visibleWidget.view?.id === self.id &&
|
|
178
185
|
!session.minimized);
|
|
179
186
|
}
|
|
180
187
|
/**
|
|
@@ -327,7 +334,7 @@ export function stateModelFactory(pluginManager) {
|
|
|
327
334
|
* https://jbrowse.org/jb2/docs/config/lineargenomeviewconfigschema/ for
|
|
328
335
|
* how the config is used
|
|
329
336
|
*/
|
|
330
|
-
trackLabels: types.optional(types.
|
|
337
|
+
trackLabels: types.optional(types.enumeration('ViewTrackLabels', ['', ...VIEW_TRACK_LABEL_MODES]), () => storedTrackLabels()),
|
|
331
338
|
/**
|
|
332
339
|
* #property
|
|
333
340
|
* The ruler's guide, a [](/docs/config/lineargenomeviewaxis) object:
|
|
@@ -919,15 +926,21 @@ export function stateModelFactory(pluginManager) {
|
|
|
919
926
|
* short by the unmeasured bands.
|
|
920
927
|
*/
|
|
921
928
|
getTrackYOffset(trackId) {
|
|
929
|
+
return this.trackYOffsets.get(trackId);
|
|
930
|
+
},
|
|
931
|
+
/**
|
|
932
|
+
* #getter
|
|
933
|
+
* `getTrackYOffset` for every shown track, by trackId, from one walk
|
|
934
|
+
*/
|
|
935
|
+
get trackYOffsets() {
|
|
936
|
+
const offsets = new Map();
|
|
922
937
|
let y = this.headerHeight + this.scalebarHeight + this.trackLeadingChrome;
|
|
923
938
|
for (const t of [...self.pinnedTracks, ...self.unpinnedTracks]) {
|
|
924
939
|
y += this.trackLabelBand(t);
|
|
925
|
-
|
|
926
|
-
return y;
|
|
927
|
-
}
|
|
940
|
+
offsets.set(t.configuration.trackId, y);
|
|
928
941
|
y += this.trackHeight(t) + this.trackChromeHeight;
|
|
929
942
|
}
|
|
930
|
-
return
|
|
943
|
+
return offsets;
|
|
931
944
|
},
|
|
932
945
|
/**
|
|
933
946
|
* #method
|
|
@@ -1518,8 +1531,9 @@ export function stateModelFactory(pluginManager) {
|
|
|
1518
1531
|
* #action
|
|
1519
1532
|
*/
|
|
1520
1533
|
toggleTrackSelector() {
|
|
1534
|
+
const wasVisible = isTrackSelectorVisible(self);
|
|
1521
1535
|
const { session, selector } = openTrackSelectorWidget(self);
|
|
1522
|
-
if (
|
|
1536
|
+
if (wasVisible) {
|
|
1523
1537
|
session.hideWidget(selector);
|
|
1524
1538
|
}
|
|
1525
1539
|
else {
|
|
@@ -1527,40 +1541,6 @@ export function stateModelFactory(pluginManager) {
|
|
|
1527
1541
|
}
|
|
1528
1542
|
return selector;
|
|
1529
1543
|
},
|
|
1530
|
-
/**
|
|
1531
|
-
* #method
|
|
1532
|
-
* Helper method for the fetchSequence.
|
|
1533
|
-
* Returns the regions the user selected with the
|
|
1534
|
-
* rubberband
|
|
1535
|
-
*
|
|
1536
|
-
* @param leftOffset - `object as {start, end, index, offset}`, offset = start
|
|
1537
|
-
* of user drag
|
|
1538
|
-
* @param rightOffset - `object as {start, end, index, offset}`,
|
|
1539
|
-
* offset = end of user drag
|
|
1540
|
-
* @returns array of Region[]
|
|
1541
|
-
*/
|
|
1542
|
-
getSelectedRegions(leftOffset, rightOffset) {
|
|
1543
|
-
if (!leftOffset || !rightOffset) {
|
|
1544
|
-
return [];
|
|
1545
|
-
}
|
|
1546
|
-
const layout = {
|
|
1547
|
-
displayedRegions: self.displayedRegions,
|
|
1548
|
-
bpPerPx: self.bpPerPx,
|
|
1549
|
-
offsetPx: self.offsetPx,
|
|
1550
|
-
width: self.width,
|
|
1551
|
-
minimumBlockWidth: self.minimumBlockWidth,
|
|
1552
|
-
};
|
|
1553
|
-
const { bpPerPx, offsetPx: rawOffsetPx } = computeMoveToLayout(layout, leftOffset, rightOffset);
|
|
1554
|
-
// mirror Base1DView.scrollTo clamping: raw offsetPx can be far outside
|
|
1555
|
-
// the valid range when both offsets are oob on the same side
|
|
1556
|
-
const { min, max } = offsetBounds(self.totalBp / bpPerPx, self.width);
|
|
1557
|
-
const offsetPx = clamp(rawOffsetPx, min, max);
|
|
1558
|
-
return wholeBaseRegions(calculateDynamicBlocks({
|
|
1559
|
-
...layout,
|
|
1560
|
-
bpPerPx,
|
|
1561
|
-
offsetPx,
|
|
1562
|
-
}).contentBlocks);
|
|
1563
|
-
},
|
|
1564
1544
|
/**
|
|
1565
1545
|
* #action
|
|
1566
1546
|
*/
|
|
@@ -1605,6 +1585,42 @@ export function stateModelFactory(pluginManager) {
|
|
|
1605
1585
|
setLaunch(launch) {
|
|
1606
1586
|
self.launch = launch;
|
|
1607
1587
|
},
|
|
1588
|
+
}))
|
|
1589
|
+
.views(self => ({
|
|
1590
|
+
/**
|
|
1591
|
+
* #method
|
|
1592
|
+
* Helper method for the fetchSequence.
|
|
1593
|
+
* Returns the regions the user selected with the
|
|
1594
|
+
* rubberband
|
|
1595
|
+
*
|
|
1596
|
+
* @param leftOffset - `object as {start, end, index, offset}`, offset = start
|
|
1597
|
+
* of user drag
|
|
1598
|
+
* @param rightOffset - `object as {start, end, index, offset}`,
|
|
1599
|
+
* offset = end of user drag
|
|
1600
|
+
* @returns array of Region[]
|
|
1601
|
+
*/
|
|
1602
|
+
getSelectedRegions(leftOffset, rightOffset) {
|
|
1603
|
+
if (!leftOffset || !rightOffset) {
|
|
1604
|
+
return [];
|
|
1605
|
+
}
|
|
1606
|
+
const layout = {
|
|
1607
|
+
displayedRegions: self.displayedRegions,
|
|
1608
|
+
bpPerPx: self.bpPerPx,
|
|
1609
|
+
offsetPx: self.offsetPx,
|
|
1610
|
+
width: self.width,
|
|
1611
|
+
minimumBlockWidth: self.minimumBlockWidth,
|
|
1612
|
+
};
|
|
1613
|
+
const { bpPerPx, offsetPx: rawOffsetPx } = computeMoveToLayout(layout, leftOffset, rightOffset);
|
|
1614
|
+
// mirror Base1DView.scrollTo clamping: raw offsetPx can be far outside
|
|
1615
|
+
// the valid range when both offsets are oob on the same side
|
|
1616
|
+
const { min, max } = offsetBounds(self.totalBp / bpPerPx, self.width);
|
|
1617
|
+
const offsetPx = clamp(rawOffsetPx, min, max);
|
|
1618
|
+
return wholeBaseRegions(calculateDynamicBlocks({
|
|
1619
|
+
...layout,
|
|
1620
|
+
bpPerPx,
|
|
1621
|
+
offsetPx,
|
|
1622
|
+
}).contentBlocks);
|
|
1623
|
+
},
|
|
1608
1624
|
}))
|
|
1609
1625
|
.actions(self => {
|
|
1610
1626
|
let cancelLastSlide = () => { };
|
|
@@ -2381,9 +2397,13 @@ export function stateModelFactory(pluginManager) {
|
|
|
2381
2397
|
// [minOffset, maxOffset]. scrollTo is called explicitly rather than
|
|
2382
2398
|
// left to zoomTo's internal scrollTo, which is skipped when bpPerPx
|
|
2383
2399
|
// is already in range — shrinking the region set would otherwise
|
|
2384
|
-
// strand the view scrolled past the end, on blank space.
|
|
2385
|
-
|
|
2386
|
-
|
|
2400
|
+
// strand the view scrolled past the end, on blank space. An unmeasured
|
|
2401
|
+
// view has no bounds to clamp to, and keeps its window as a restored
|
|
2402
|
+
// snapshot does.
|
|
2403
|
+
if (self.bpPerPx > 0) {
|
|
2404
|
+
self.zoomTo(self.bpPerPx);
|
|
2405
|
+
self.scrollTo(self.offsetPx);
|
|
2406
|
+
}
|
|
2387
2407
|
self.settleCoarseBlocks();
|
|
2388
2408
|
},
|
|
2389
2409
|
/**
|
|
@@ -2765,10 +2785,11 @@ export function stateModelFactory(pluginManager) {
|
|
|
2765
2785
|
*/
|
|
2766
2786
|
nonGenomicTrackBands() {
|
|
2767
2787
|
const y0 = self.headerHeight + self.scalebarHeight;
|
|
2788
|
+
const { trackYOffsets } = self;
|
|
2768
2789
|
return [...self.pinnedTracks, ...self.unpinnedTracks].flatMap(track => {
|
|
2769
|
-
const
|
|
2770
|
-
|
|
2771
|
-
|
|
2790
|
+
const top = trackYOffsets.get(track.configuration.trackId);
|
|
2791
|
+
return track.activeDisplay.drawsGenomicCoordinates === false &&
|
|
2792
|
+
top !== undefined
|
|
2772
2793
|
? [{ top: top - y0, height: self.trackHeight(track) }]
|
|
2773
2794
|
: [];
|
|
2774
2795
|
});
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { LinearGenomeViewModel } from '../model.ts';
|
|
2
|
+
export declare function recordsDrawnAlone(display: object): {
|
|
3
|
+
height: number;
|
|
4
|
+
fits: boolean;
|
|
5
|
+
} | undefined;
|
|
2
6
|
/** The R script that redraws the tracks open in the view, over its visible regions. */
|
|
3
7
|
export declare function exportLinearViewToR(view: LinearGenomeViewModel, out?: string): {
|
|
4
8
|
drawn: number;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { fullConfSnapshot, readConfObject } from '@jbrowse/core/configuration';
|
|
2
|
+
import { svgTrackName } from '@jbrowse/core/svg/trackNames';
|
|
2
3
|
import { getSession } from '@jbrowse/core/util';
|
|
3
4
|
import { getSnapshot } from '@jbrowse/mobx-state-tree';
|
|
4
5
|
import { exportTracksToR } from './rScript.js';
|
|
@@ -40,22 +41,41 @@ function assemblyOf(view) {
|
|
|
40
41
|
? getSnapshot(configuration)
|
|
41
42
|
: undefined;
|
|
42
43
|
}
|
|
44
|
+
// The variant display drawing no genotype rows (none in the file, or hidden)
|
|
45
|
+
// states, as `recordsAlone`, its records as the feature track R reads them
|
|
46
|
+
// as: the height they draw at, and whether they fit into it whatever the
|
|
47
|
+
// track's `heightMode`.
|
|
48
|
+
export function recordsDrawnAlone(display) {
|
|
49
|
+
const alone = 'recordsAlone' in display ? display.recordsAlone : undefined;
|
|
50
|
+
return typeof alone === 'object' &&
|
|
51
|
+
alone !== null &&
|
|
52
|
+
'height' in alone &&
|
|
53
|
+
typeof alone.height === 'number' &&
|
|
54
|
+
'fits' in alone &&
|
|
55
|
+
typeof alone.fits === 'boolean'
|
|
56
|
+
? { height: alone.height, fits: alone.fits }
|
|
57
|
+
: undefined;
|
|
58
|
+
}
|
|
59
|
+
// The tracks the screen draws, in the order it draws them, named as the SVG
|
|
60
|
+
// export names them: pinned first, minimized ones left out.
|
|
43
61
|
function tracksOf(view) {
|
|
62
|
+
const session = getSession(view);
|
|
44
63
|
const tracks = [];
|
|
45
|
-
for (const track of view.
|
|
64
|
+
for (const track of [...view.pinnedTracks, ...view.unpinnedTracks]) {
|
|
46
65
|
const display = track.displays[0];
|
|
47
|
-
if (display) {
|
|
66
|
+
if (display && !track.minimized) {
|
|
48
67
|
const { type, displayId, ...written } = getSnapshot(display.configuration);
|
|
49
68
|
const { heightMode, height } = fullConfSnapshot(display.configuration);
|
|
69
|
+
const records = recordsDrawnAlone(display);
|
|
50
70
|
tracks.push({
|
|
51
71
|
trackId: track.configuration.trackId,
|
|
52
|
-
trackName:
|
|
53
|
-
track.configuration.trackId,
|
|
72
|
+
trackName: svgTrackName(track, session),
|
|
54
73
|
displayType: display.type,
|
|
55
74
|
adapter: readConfObject(track.configuration, 'adapter'),
|
|
56
75
|
display: written,
|
|
57
|
-
heightMode,
|
|
58
|
-
height,
|
|
76
|
+
heightMode: records?.fits ? 'fit' : heightMode,
|
|
77
|
+
height: records ? records.height : height,
|
|
78
|
+
recordsOnly: records !== undefined,
|
|
59
79
|
});
|
|
60
80
|
}
|
|
61
81
|
}
|
|
@@ -14,21 +14,30 @@ export interface RExportTrack {
|
|
|
14
14
|
/** The display's resolved sizing, which a feature track exports so the figure drops what the view drops. */
|
|
15
15
|
heightMode?: unknown;
|
|
16
16
|
height?: unknown;
|
|
17
|
+
/** A variant display drawing its records alone, its genotype rows absent or hidden, which reads as a feature track. */
|
|
18
|
+
recordsOnly?: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface ReaderAdapter {
|
|
21
|
+
slot?: string;
|
|
22
|
+
ext?: RegExp;
|
|
23
|
+
index?: string;
|
|
17
24
|
}
|
|
18
25
|
/**
|
|
19
26
|
* Each display ggjbrowse reads, by the reader that reads it, and the adapters
|
|
20
|
-
* it opens
|
|
21
|
-
*
|
|
27
|
+
* it opens: the slot holding the file, the extension the reader knows it by,
|
|
28
|
+
* and the suffix of the index the reader looks for beside it.
|
|
22
29
|
*/
|
|
23
30
|
export declare const READERS: Record<string, {
|
|
24
31
|
call: string;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}>;
|
|
32
|
+
/** The reader for the display drawing no sample rows, its records alone. */
|
|
33
|
+
recordsOnlyCall?: string;
|
|
34
|
+
adapters: Record<string, ReaderAdapter>;
|
|
29
35
|
}>;
|
|
30
|
-
/**
|
|
31
|
-
|
|
36
|
+
/**
|
|
37
|
+
* The ggjbrowse release the script is tested against: its floor, and the tag
|
|
38
|
+
* its install line pins. The R export workflow installs this tag on a push.
|
|
39
|
+
*/
|
|
40
|
+
export declare const GGJBROWSE_VERSION = "0.11.0";
|
|
32
41
|
/**
|
|
33
42
|
* A resolved config writes an unset slot as `''`, `[]` or `{}`, which a reader
|
|
34
43
|
* would take for a setting. Keeps `false` and `0`, which are values.
|
|
@@ -81,7 +90,7 @@ export declare function exportTracksToR({ tracks, regions, assembly: assemblySna
|
|
|
81
90
|
/** The view's assembly config as written, which names its sequence and its contigs' aliases. */
|
|
82
91
|
assembly?: Record<string, unknown>;
|
|
83
92
|
/** The view's zoom, which decides what a feature or quantitative display shows. */
|
|
84
|
-
bpPerPx
|
|
93
|
+
bpPerPx: number;
|
|
85
94
|
/** The view's "CDS reading frame colors", which a feature track takes. */
|
|
86
95
|
colorByFrame?: boolean;
|
|
87
96
|
/** The view's "Amino acids when zoomed in", which a feature track takes. */
|
|
@@ -98,3 +107,4 @@ export declare function exportTracksToR({ tracks, regions, assembly: assemblySna
|
|
|
98
107
|
script: string;
|
|
99
108
|
notes: string[];
|
|
100
109
|
};
|
|
110
|
+
export {};
|