@jbrowse/capture 5.0.0-beta.10 → 5.0.0-beta.13

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/README.md CHANGED
@@ -57,7 +57,9 @@ decides the answer:
57
57
  Then one check on what the frame shows, which the marker does not answer. The
58
58
  marker is about WORK, so it reads `ready` over a display whose fetch failed or
59
59
  that the user canceled. Capture names every display that is unpainted, canceled
60
- or showing an error banner, and fails.
60
+ or showing an error banner, and fails. It fails too on an error toast or error
61
+ box, which no display carries: a track whose config fails to load never becomes
62
+ a display, so the frame lacks it while every display present has painted.
61
63
 
62
64
  **The instance has to be JBrowse v5 or later**, the first release to publish the
63
65
  marker. Capture reads the instance's `version.txt` before launching a browser
@@ -140,7 +142,9 @@ the frame as it stands.
140
142
  ```
141
143
 
142
144
  `allowUnsettled` (`--allowUnsettled`) takes the frame as it stands instead, and
143
- still tells you what did not settle.
145
+ still tells you what did not settle. It does not cover the session gate: a
146
+ trackId or assembly that never opens throws either way, since that frame lacks
147
+ the thing you asked to capture.
144
148
 
145
149
  ## Reading the result
146
150
 
@@ -158,6 +162,52 @@ Three fields on a successful capture:
158
162
  asked. The capture still succeeds, since that is the app working as designed,
159
163
  and the CLI prints a warning naming them. Narrow the location to draw them.
160
164
 
165
+ ## Callouts
166
+
167
+ `--annotations` draws arrows, boxes, labels, numbered badges, legends and
168
+ lineage trapezoids over the view once it has settled, from a JSON array (inline,
169
+ a path, or `-` for stdin). These are the callouts on the JBrowse documentation's
170
+ figures, drawn by the same code, so a figure's **Open or rebuild this view**
171
+ dialog hands you its callouts as a file to pass here.
172
+
173
+ ```bash
174
+ cat > callouts.json <<'JSON'
175
+ [
176
+ { "type": "box", "anchor": { "loc": "chr17:43,044,295-43,125,483" } },
177
+ {
178
+ "type": "text",
179
+ "text": "BRCA1",
180
+ "leader": true,
181
+ "anchor": { "trackId": "hg38-ncbiRefSeqCurated", "loc": "chr17:43,044,295", "fracY": 0.5 },
182
+ "dx": -60,
183
+ "dy": -30
184
+ }
185
+ ]
186
+ JSON
187
+ npx @jbrowse/capture --hub hg38 --loc BRCA1 --track hg38-ncbiRefSeqCurated \
188
+ --annotations callouts.json -o brca1.png
189
+ ```
190
+
191
+ Each callout places itself through an `anchor` that resolves against the running
192
+ session, so none of them is a pixel measured off an earlier capture:
193
+
194
+ - `loc`, with an optional `trackId` and `fracY` (0 is the track's top, 1 its
195
+ bottom), lands on a genomic position in a linear genome view. A `view` index
196
+ picks the view, and an array (`[0, 1]`) descends into a synteny view's rows.
197
+ - `graphNode` names a GFA segment in a graph view or graph track.
198
+ - `hLoc` and `vLoc` name a dotplot's cell, as a whole chromosome (`chr4`) or a
199
+ span (`chr4:1-5,000,000`).
200
+ - `selector` and `text` name an element of the page, such as a menu item.
201
+
202
+ `dx` and `dy` nudge a callout off its anchor, and `fromAnchor` anchors an
203
+ arrow's tail. The full vocabulary is `Annotation` in `annotationOverlay.ts`,
204
+ exported as types from this package. An anchor that resolves to nothing, or a
205
+ callout that lands outside the image, fails the run rather than writing a
206
+ picture with the callout missing or parked in a corner.
207
+
208
+ In a script, pass the same array as `annotations` to `captureJBrowse`, or call
209
+ `drawAnnotations(page, annotations)` on the page `openJBrowse` returns.
210
+
161
211
  ## CLI
162
212
 
163
213
  `jb2capture --help` for the full list. Also:
@@ -0,0 +1,77 @@
1
+ export interface AnnotationAnchor {
2
+ selector?: string;
3
+ text?: string;
4
+ graphNode?: string;
5
+ hLoc?: string;
6
+ vLoc?: string;
7
+ view?: number | number[];
8
+ trackId?: string;
9
+ loc?: string;
10
+ fracY?: number;
11
+ alignX?: 'left' | 'center' | 'right';
12
+ alignY?: 'top' | 'center' | 'bottom';
13
+ dx?: number;
14
+ dy?: number;
15
+ fracX?: [number, number];
16
+ }
17
+ export declare const ANNOTATION_TYPES: readonly ['arrow', 'box', 'text', 'circle', 'legend', 'trapezoid'];
18
+ export interface Annotation {
19
+ type: (typeof ANNOTATION_TYPES)[number];
20
+ entries?: {
21
+ label: string;
22
+ color: string;
23
+ }[];
24
+ from?: {
25
+ x: number;
26
+ y: number;
27
+ };
28
+ to?: {
29
+ x: number;
30
+ y: number;
31
+ };
32
+ x?: number;
33
+ y?: number;
34
+ width?: number;
35
+ height?: number;
36
+ radius?: number;
37
+ pad?: number;
38
+ text?: string;
39
+ color?: string;
40
+ textColor?: string;
41
+ background?: string;
42
+ maxWidth?: number;
43
+ textAlign?: 'start' | 'end';
44
+ leader?: boolean;
45
+ fontSize?: number;
46
+ strokeWidth?: number;
47
+ fillOpacity?: number;
48
+ anchor?: AnnotationAnchor;
49
+ fromAnchor?: AnnotationAnchor;
50
+ dx?: number;
51
+ dy?: number;
52
+ }
53
+ export interface AnnotationRegion {
54
+ refName: string;
55
+ start: number;
56
+ end: number;
57
+ }
58
+ export type ResolvedAnnotationAnchor = AnnotationAnchor & {
59
+ region?: AnnotationRegion;
60
+ rect?: {
61
+ left: number;
62
+ top: number;
63
+ width: number;
64
+ height: number;
65
+ };
66
+ };
67
+ export type PayloadAnnotation = Omit<Annotation, 'anchor' | 'fromAnchor'> & {
68
+ anchor?: ResolvedAnnotationAnchor;
69
+ fromAnchor?: ResolvedAnnotationAnchor;
70
+ };
71
+ export declare const ANNOTATION_OVERLAY_ID = "__screenshot_annotation_overlay";
72
+ export declare function parseAnnotationLocus(locus: string, wrap?: boolean): AnnotationRegion;
73
+ export interface AnnotationOverlayProblems {
74
+ unresolved: string[];
75
+ offFrame: string[];
76
+ }
77
+ export declare function drawAnnotationOverlay(items: PayloadAnnotation[], overlayId: string): AnnotationOverlayProblems;