File size: 5,189 Bytes
f3042bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Gosling 1.0.7 submission contract

Build one complete Gosling 1.0.7 specification for the task by composing constructors. The host renders it in a fixed 900 × 620 CSS-pixel viewport with hg38 assembly metadata supplied by the host.

Submit a complete JavaScript program with the `code` tool. Constructors are functions in scope; each validates its own input and returns a fragment. Every constructor is async: always await it. Build bottom-up: create leaf objects such as channels, data, and styles first, then compose them into larger objects such as tracks, and finish with the root constructor. The program returns the root object a constructor produced. The TypeScript signatures are reference only: write plain JavaScript, with no type annotations. Imports, files, and network access are disabled.

A root object that no constructor produced is refused. Fragments are not validated as complete specifications; the root is validated when it is submitted.

Constructor signatures start unloaded. The appendix names every constructor; look up the ones you need with `get_signature({ names: [...] })`, by exact name, at most 20 per call. A result holds only the signatures that call newly revealed: a name already looked up, repeated, past the limit, or not in the index returns nothing. A program can call a constructor once its lookup result has arrived; any other constructor name is undefined in the program, including one looked up in the same turn.

Bind the task rows by name with `data: { type: "json", name: "table", chromosomeField: "<field>", genomicFields: ["<field>", ...] }`, naming the rows' chromosome and genomic position fields, passed to the constructor that takes data. The host replaces each such reference with exactly the rows shown in the task before validation. Do not copy the rows into the specification: inline data is rejected. Tracks may filter or reuse the same rows.

The program may also read the same rows, for example to compute domains:

```typescript
declare function getData(): Promise<Array<Record<string, unknown>>>;
```

The host accepts a submission only after JSON-Schema validation, native compilation, and a render without console, page, or network errors all succeed. A rejected constructor call or submission returns its error. Repair it by submitting another complete program.

Each attempt is retained for evaluation. The latest submission, not the last accepted one, controls the final outcome: a later invalid submission makes the final outcome invalid even when an earlier accepted chart is retained for audit. Stop after acceptance.

---

Constructor index:

All 73 constructors generated from the Gosling 1.0.7 schema, by name:

create_aggregate, create_assembly, create_axis_position, create_bin_aggregate, create_x, create_genomic_domain, create_domain_interval, create_domain_chr_interval, create_domain_chr, create_value_extent, create_y, create_row, create_color, create_range, create_size, create_stroke, create_stroke_width, create_opacity, create_text, create_channel_value, create_data_deep, create_data_transform, create_displacement_type, create_field_type, create_displacement, create_orientation, create_dummy_track_style, create_event_style, create_layout, create_logical_operation, create_mark, create_mouse_events_deep, create_style, create_style_part2, create_style_part3, create_zoom_limits, create_overlaid_track, create_overlaid_track_part2, create_overlaid_track_part3, create_overlaid_track_part4, create_overlaid_track_part5, create_overlaid_track_part6, create_overlaid_track_overlay_item, create_overlaid_track_overlay_item_part2, create_overlaid_track_overlay_item_part3, create_overlaid_track_overlay_item_part4, create_overlaid_track_overlay_item_part5, create_overlaid_track_overlay_item_part6, create_tooltip, create_visibility_condition, create_partial_track, create_partial_track_part2, create_partial_track_part3, create_partial_track_part4, create_partial_track_part5, create_partial_track_part6, create_partial_track_overlay_item, create_partial_track_overlay_item_part2, create_partial_track_overlay_item_part3, create_partial_track_overlay_item_part4, create_partial_track_overlay_item_part5, create_partial_track_overlay_item_part6, create_single_track, create_single_track_part2, create_single_track_part3, create_single_track_part4, create_single_track_part5, create_single_track_part6, create_template_track, create_template_track_part2, create_template_track_part3, create_template_track_part4, create_spec

Composition example, as a program; a JSON tool call takes the same argument object:

```javascript
const x = await create_x({ field: "position", type: "genomic", axis: "bottom" });
const y = await create_y({ field: "score", type: "quantitative" });
const data = await create_data_deep({ value: { type: "json", name: "table", chromosomeField: "chromosome", genomicFields: ["position"] } });
const track = await create_single_track({ data, mark: "point" });
const size = await create_single_track_part2({ height: 120 });
const channels = await create_single_track_part5({ x, y, width: 400 });
return await create_spec({ value: { tracks: [{ ...track, ...size, ...channels }] } });
```