Grammar Reference
This is the reference documentation for the Gosling grammar.
A Gosling visualization is created using a Gosling specification, which is a JSON object. The possible keys and values of the JSON object are determined by the Gosling grammar.
Specification Root
The root object a Gosling specification is a View with the following optional properties.
property | type | description |
---|---|---|
title | string | Title of the visualization |
subtitle | number | Subtitle of the visualization, shown below the title |
description | number | Description of the visualization, shown below the subtitle |
Example:
{
"title": "My First Gosling Visualization",
"subtitle": "The first of many",
"description": "This describes what you see",
"tracks": [
...
]
}
View
There are two types of views: track-containing views, and view-containing views.
Track-containing view
A view which contains the "track" property defines the genomic location for all the tracks it contains.
Track-containing views can also take any Track property, which the tracks within it will inherit
property | type | description |
---|---|---|
tracks | (Track | Track-containing View)[] | The tracks or views that are contained within the view. The axes of these tracks and views will be synced together. Required. |
alignment | string | One of "stack" or "overlay" . If "overlay" is set, the tracks within the view will be overlaid on top of each other. If "stack" is set, the tracks will be placed next to each other. Default: "stack" |
Example
This is an outline of a track-containing view.
{
// Optional properties from Track that the tracks will inherit
"xDomain": {"chromosome": "chr1", "interval": [1, 3000500]},
// Track-containing view specific properties
"alignment": "overlay", // How the tracks will be aligned
"tracks": [
...
]
}
View-containing view
A view can also contain multiple views. The genomic axes of these sub-views will not be synced together.
property | type | description |
---|---|---|
views | View[] | Views to show within the view. If a view takes this property, the "tracks" property should not be set. In addition, the view cannot contain any Track properties. |
arrangement | string | One of "parallel" , "serial" , "vertical" , "horizontal" |
Example
This is an outline of a Gosling specification containing multiple views.
{
"arrangement": "horizontal", // can be "parallel", "serial", "vertical", "horizontal"
"views": [
...
]
}
Optional properties
Regardless of whether a view contains tracks or views, a view can these additional properties:
property | type | description |
---|---|---|
| array | |
| number | Specify the y offset of views in the unit of pixels |
| Specify the visible region of genomic y-axis | |
| number | Specify the x offset of views in the unit of pixels |
| Specify the visible region of genomic x-axis | |
| Define the style of multive views. Will be overwritten by the style of children elements (e.g., view, track). | |
| boolean | Whether to disable Zooming and Panning, Default: |
| number | The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the |
| string | One of |
| string | Specify an ID for linking multiple views |
| string | One of |
| string | The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view |
| number | Proportion of the radius of the center white space.
Default: |
| string | array | A string that specifies the genome builds to use. Currently support |
Track
A track
is a unit building block in Gosling which can be represented as a bar chart, a line chart, or an ideogram.
The genomic range of multiple tracks can be synchronized when the tracks belong to the same View.
Track layout properties
These properties specify the layout and data to be used in the track.
property | type | description |
---|---|---|
| JsonData | CsvData | BedData | BigWigData | MultivecData | BeddbData | VectorData | MatrixData | BamData | VcfData | GffData | Required. |
| array | |
| number | Specify the y offset of views in the unit of pixels |
| Specify the visible region of genomic y-axis | |
| number | Specify the x offset of views in the unit of pixels |
| Specify the visible region of genomic x-axis | |
| number | Specify the track width in pixels. |
| string | If defined, will show the textual label on the left-top corner of a track. |
| string | |
| Define the style of multive views. Will be overwritten by the style of children elements (e.g., view, track). | |
| boolean | Whether to disable Zooming and Panning, Default: |
| number | Specify the start angle (in the range of [0, 360]) of circular tracks ( |
| number | The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the |
| boolean | |
| number | Specify the outer radius of tracks when |
| string | One of |
| string | Specify an ID for linking multiple views |
| string | One of |
| number | Specify the inner radius of tracks when ( |
| string | Assigned to |
| number | Specify the track height in pixels. |
| number | Specify the end angle (in the range of [0, 360]) of circular tracks ( |
| number | Proportion of the radius of the center white space.
Default: |
| string | array | A string that specifies the genome builds to use. Currently support |
Track encoding properties
These properties specify how to associate data to visual elements.
property | type | description |
---|---|---|
| string | Required. One of |
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| boolean | |
| ||
| ||
| boolean | |
| ||
| boolean | |
| Each object follows the format | |
| Each object follows the format | |
| ||
| ||
| number |
Example
This is a Gosling specification of a view containing a single track.
{
"tracks": [
{
"layout": "linear",
"width": 800,
"height": 180,
"data": {
"url": "https://resgen.io/api/v1/tileset_info/?d=UvVPeLHuRDiYA3qwFlm7xQ",
"type": "multivec",
"row": "sample",
"column": "position",
"value": "peak",
"categories": ["sample 1"],
"binSize": 5
},
"mark": "bar",
"x": {"field": "start", "type": "genomic"},
"xe": {"field": "end", "type": "genomic"},
"y": {"field": "peak", "type": "quantitative"}
}
]
}
Track template property
A track can use a preset track template using this property.
property | type | description |
---|---|---|
template | string | The template to use with the track. |
DummyTrack
A DummyTrack is a track that is used a placeholder in a Gosling visualization. Non-Gosling visualizations can be incorporated using it.
property | type | description |
---|---|---|
| string | Required. Must be |
| number | Specify the track width in pixels. |
| string | Text that gets shown on the DummyTrack |
| Defines how the track is styled | |
| boolean | Must be |
| string | One of |
| string | Must be |
| string | Assigned to |
| number | Specify the track height in pixels. |
Example
This is a Gosling specification containing a single DummyTrack.
{
"tracks": [
{
"type": "dummy-track",
"title": "Placeholder",
"id": "my_track",
"height": 200,
"width": 300,
"style": {"background": "#e6e6e6", "textFontSize": 8, "textFontWeight": "normal"}
}
]
}
Visual Channel
Different visual channels are supported depending on the mark type.
mark type | supported visual channels |
---|---|
point | x , y , row , size , color , strokeWidth , opacity |
line | x , y , row , color , strokeWidth |
rect | x , xe , row , color , strokeWidth , opacity |
bar | x , y , row , color , strokeWidth , opacity |
area | x , y , row , color , strokeWidth |
link | x , xe , x1 , x1e , color , opacity |
triangle | x , xe , row , size , color , opacity |
text | x , xe , row , color , opacity |
ChannelValue
property | type | description |
---|---|---|
| number|string | Required. Assign a constant value for a visual channel. |
X
X specifies a mark's position in the horizontal direction.
property | type | description |
---|---|---|
| string | Must be |
| string[] | number[] | Values of the visual channel. |
| string | Users need to assign a unique linkingId for linking views and Brushing and Linking |
| boolean | Whether to display legend. Default: |
| boolean | Whether to display grid. Default: |
| string | Name of the data field. |
| Values of the data | |
| string | One of |
| string | One of |
DomainInterval
property | type | description |
---|---|---|
| number[] | Required. Show a certain interval within entire chromosome |
DomainChr
property | type | description |
---|---|---|
| string | Required. |
DomainChrInterval
property | type | description |
---|---|---|
| number[] | Required. |
| string | Required. If specified, only showing a certain interval in a chromosome. |
Y
Y specifies a mark's position in the vertical direction.
property | type | description |
---|---|---|
| boolean | Specify whether to use zero baseline. Default: |
| string | One of |
| string[] | number[] | Values of the visual channel. |
| string | Users need to assign a unique linkingId for linking views and Brushing and Linking |
| boolean | Whether to display legend. Default: |
| boolean | Whether to display grid. Default: |
| boolean | Whether to flip the y-axis. This is done by inverting the |
| string | Name of the data field. |
| string[] | number[] | DomainInterval | DomainChrInterval | DomainChr | Values of the data |
| string|number | Custom baseline of the y-axis. Default: |
| string | One of |
| string | One of |
Text
property | type | description |
---|---|---|
| string | One of |
| string[] | Ranges of visual channel values |
| string | Name of the data field |
| string[] | Values of the data |
Color
property | type | description |
---|---|---|
| string | One of |
| string | Title of the legend. Default: |
| number[] | Whether to use offset of the domain proportionally. This is bound to brushes on the color legend. Default: |
| string | One of |
| string[] | number[] | string | Determine the colors that should be bound to data value. Default properties are determined considering the field type. |
| boolean | Whether to display legend. Default: |
| string | Name of the data field |
| string[] | number[] | Values of the data |
Size
property | type | description |
---|---|---|
| string | One of |
| string[] | number[] | Ranges of visual channel values |
| string | Name of the data field |
| string[] | number[] | Values of the data |
Row
Row is used with to stratify a visualization with categorical values.
property | type | description |
---|---|---|
| string | Must be |
| string[] | number[] | Determine the start and end position of rendering area of this track along vertical axis. Default: |
| number | Determines the size of inner white spaces on the top and bottom of individiual rows. Default: |
| boolean | Whether to display legend. Default: |
| boolean | Whether to display grid. Default: |
| string | Name of the data field |
| string[] | number[] | Values of the data |
| boolean | Clip row when the actual y value exceeds the max value of the y scale. Used only for bar marks at the moment. Default: |
Opacity
property | type | description |
---|---|---|
| string | One of |
| string[] | number[] | Ranges of visual channel values |
| string | Name of the data field |
| string[] | number[] | Values of the data |
Stroke
property | type | description |
---|---|---|
| string | One of |
| string | Title of the legend. Default: |
| number[] | Whether to use offset of the domain proportionally. This is bound to brushes on the color legend. Default: |
| string[] | number[] | string | Ranges of visual channel values |
| boolean | Whether to display legend. Default: |
| string | Name of the data field |
| string[] | number[] | Values of the data |
StrokeWidth
property | type | description |
---|---|---|
| string | One of |
| string[] | number[] | Ranges of visual channel values |
| string | Name of the data field |
| string[] | number[] | Values of the data |
VisibilityCondition
These are for semantic zoom.
SizeVisibilityCondition
property | type | description |
---|---|---|
| number | string | Required. Specify the threshold as one of:
|
| string | Required. One of |
| string | Required. One of
|
| string | Required. One of |
| number | Specify the buffer size (in pixel) of width or height for smooth transition.
Default: |
| number | Specify the buffer size (in pixel) of width or height when calculating the visibility.
Default: |
ZoomLevelVisibilityCondition
property | type | description |
---|---|---|
| number | Required. Set a threshold in the unit of base pairs (bp) |
| string | Required. One of |
| string | Required. One of
|
| string | Required. Must be |
| number | Specify the buffer size (in pixel) of width or height for smooth transition.
Default: |
| number | Specify the buffer size (in pixel) of width or height when calculating the visibility.
Default: |
Tooltip
property | type | description |
---|---|---|
| string | Required. One of |
| string | Required. Specifiy a data field whose value will show in the tooltip. |
| string | format of the data value. |
| string | Name of the data field for showing in the tooltip. Will use the field name if not specified. |
Style
A View and Track have a style
property which can be set to an object with the following properties.
property | type | description |
---|---|---|
| boolean | Whether to show vertical lines that connect to the baseline (axis) when |
| number | Specify the stroke width of |
| string | Specify the stroke of |
| string | One of |
| number | Specify the font size of |
| string | One of |
| Customize visual effects of | |
| number | |
| string | |
| Customize visual effects of | |
| string | One of |
| string | One of |
| number | The minimum height of |
| string | One of |
| Each object follows the format | |
| string | If defined, show legend title on the top or left |
| boolean | Specify whether to show legend in a single horizontal line? |
| boolean | Whether to enable smooth paths when drawing curves.
Default: |
| number | Offset the position of marks in y direction. This property is currently only supported for |
| number | Offset the position of marks in x direction. This property is currently only supported for |
| number[] | Specify the pattern of dashes and gaps for |
| string | One of |
| Customize the style of the brush mark in the | |
| number | |
| string | |
| string | One of |
linePattern
property | type | description |
---|---|---|
| string | Required. One of |
| number | Required. |
EventStyle
property | type | description |
---|---|---|
| number | stroke width of the marks when mouse events are triggered |
| number | |
| string | stroke color of the marks when mouse events are triggered |
| number | opacity of the marks when mouse events are triggered |
| string | color of the marks when mouse events are triggered |
| string | One of |
Brush
property | type | description |
---|---|---|
| number | stroke width of the marks when mouse events are triggered |
| number | |
| string | stroke color of the marks when mouse events are triggered |
| number | opacity of the marks when mouse events are triggered |
| string | color of the marks when mouse events are triggered |
DummyTrackStyle
A DummyTrack can take an style object with the following properties:
property | type | description |
---|---|---|
| number | Specify the stroke width of the title. |
| string | Specify the stroke color of title. |
| string | One of |
| number | Specify the font size of the title |
| string | Color of the outline of the track |
| string | Background color of the track |
Data
JsonData
property | type | description |
---|---|---|
| Required. Values in the form of JSON. | |
| string | Required. Must be |
| number | Specify the number of rows loaded from the URL.
Default: |
| object[] | Experimental Proerty. Each object follows the format |
| string[] | Specify the name of genomic data fields. |
| string | Specify the name of chromosome data fields. |
Datum
property | type | description |
---|---|---|
stringKey | number|string | Values in the form of JSON. |
CsvData
property | type | description |
---|---|---|
| string | Required. Specify the URL address of the data file. |
| string | Required. Must be |
| string | Specify file separator, Default: ',' |
| number | Specify the number of rows loaded from the URL.
Default: |
| string | Experimental Proerty. |
| string[] | Specify the names of data fields if a CSV file does not contain a header. |
| object[] | Experimental Proerty. Each object follows the format |
| string[] | Specify the name of genomic data fields. |
| string | Specify the chromosome prefix if chromosomes are denoted using a prefix besides "chr" or a number |
| string | Specify the name of chromosome data fields. |
BedData
property | type | description |
---|---|---|
| string | Required. Specify the URL address of the data file. |
| string | Required. Must be |
| string | Required. Specify the URL address of the data file index. |
| number | Specify the number of rows loaded from the URL.
Default: |
| string[] | An array of strings, where each string is the name of a non-standard field in the BED file. If there are |
BigWigData
property | type | description |
---|---|---|
| string | Required. Specify the URL address of the data file. |
| string | Required. Must be |
| string | Assign a field name of quantitative values. Default: |
| string | Assign a field name of the start position of genomic intervals. Default: |
| string | Assign a field name of the end position of genomic intervals. Default: |
| string | Assign a field name of the middle position of genomic intervals. Default: |
| number | Binning the genomic interval in tiles (unit size: 256). |
| string | One of |
MultivecData
property | type | description |
---|---|---|
| string | Required. Specify the URL address of the data file. |
| string | Required. Must be |
| string | Assign a field name of quantitative values. Default: |
| string | Assign a field name of the start position of genomic intervals. Default: |
| string | Assign a field name of samples. Default: |
| string | Assign a field name of the end position of genomic intervals. Default: |
| string | Assign a field name of the middle position of genomic intervals. Default: |
| string[] | assign names of individual samples. |
| number | Binning the genomic interval in tiles (unit size: 256). |
| string | One of |
BeddbData
property | type | description |
---|---|---|
| string | Required. Specify the URL address of the data file. |
| string | Required. Must be |
| object[] | Required. Each object follows the format |
| object[] | Each object follows the format |
| [object, object] | Experimental Proerty. |
VectorData
property | type | description |
---|---|---|
| string | Required. Specify the URL address of the data file. |
| string | Required. Must be |
| string | Assign a field name of quantitative values. Default: |
| string | Assign a field name of the start position of genomic intervals. Default: |
| string | Assign a field name of the end position of genomic intervals. Default: |
| string | Assign a field name of the middle position of genomic intervals. Default: |
| number | Binning the genomic interval in tiles (unit size: 256). |
| string | One of |
MatrixData
property | type | description |
---|---|---|
| string | Required. URL link to the matrix data file |
| string | Required. Must be |
| string | The name of the value field. Default: |
| string | The name of the first genomic field. Default: |
| string | The name of the first genomic field. Default: |
| number | Determine the number of nearby cells to aggregate. Default: |
BamData
property | type | description |
---|---|---|
| string | Required. URL link to the BAM data file |
| string | Required. Must be |
| string | Required. URL link to the index file of the BAM file |
| number | Determines the threshold of insert sizes for determining the structural variants. Default: |
| boolean | Load mates that are located in the same chromosome. Default: |
| number | Determine the threshold of coverage when extracting exon-to-exon junctions. Default: |
| boolean | Determine whether to extract exon-to-exon junctions. Default: |
VcfData
property | type | description |
---|---|---|
| string | Required. URL link to the VCF file |
| string | Required. Must be |
| string | Required. URL link to the tabix index file |
| number | The maximum number of rows to be loaded from the URL. Default: |
GffData
property | type | description |
---|---|---|
| string | Required. URL link to the GFF file |
| string | Required. Must be |
| string | Required. URL link to the tabix index file |
| number | The maximum number of samples to be shown on the track. Samples are uniformly randomly selected so that this threshold is not exceeded. Default: |
| object[] | Each object follows the format |
DataTransform
OneOfFilter
property | type | description |
---|---|---|
| string | Required. Must be |
| array | Required. Check whether the value is an element in the provided list. |
| string | Required. A filter is applied based on the values of the specified data field |
| boolean | when |
IncludeFilter
property | type | description |
---|---|---|
| string | Required. Must be |
| string | Required. Check whether the value includes a substring. |
| string | Required. A filter is applied based on the values of the specified data field |
| boolean | when |
StrConcatTransform
property | type | description |
---|---|---|
| string | Required. Must be |
| string | Required. |
| string | Required. |
| string[] | Required. |
StrReplaceTransform
property | type | description |
---|---|---|
| string | Required. Must be |
| object[] | Required. Each object follows the format |
| string | Required. |
| string | Required. |
LogTransform
property | type | description |
---|---|---|
| string | Required. Must be |
| string | Required. |
| string | If specified, store transformed values in a new field. |
| number | string | If not specified, 10 is used. |
DisplaceTransform
property | type | description |
---|---|---|
| string | Required. Must be |
| string | Required. |
| string | Required. One of |
| Required. | |
| number | Specify maximum rows to be generated (default has no limit). |
boundingBox
property | type | description |
---|---|---|
| string | Required. The name of a quantitative field that represents the start position. |
| string | Required. The name of a quantitative field that represents the end position. |
| number | The padding around visual lements. Either px or bp |
| boolean | Whether to consider |
| string | The name of a nominal field to group rows by in prior to piling-up. |
ExonSplitTransform
property | type | description |
---|---|---|
| string | Required. Must be |
| string | Required. |
| Required. Each object follows the format | |
| object[] | Required. Each object follows the format |
GenomicLengthTransform
property | type | description |
---|---|---|
| string | Required. Must be |
| string | Required. |
| string | Required. |
| string | Required. |
SvTypeTransform
property | type | description |
---|---|---|
| string | Required. Must be |
| Required. Based on the BEDPE, infer SV types. SV types are specified as one of the following strings: DUP, TRA, DEL, t2tINV, h2hINV. | |
| string | Required. |
| Required. Based on the BEDPE, infer SV types. SV types are specified as one of the following strings: DUP, TRA, DEL, t2tINV, h2hINV. |
firstBp
property | type | description |
---|---|---|
| string | Required. |
| string | Required. |
| string | Required. |
secondBp
property | type | description |
---|---|---|
| string | Required. |
| string | Required. |
| string | Required. |
CoverageTransform
property | type | description |
---|---|---|
| string | Required. Must be |
| string | Required. |
| string | Required. |
| string | |
| string | The name of a nominal field to group rows by in prior to piling-up |
JsonParseTransform
property | type | description |
---|---|---|
| string | Required. Must be |
| string | Required. Length of genomic interval. |
| string | Required. Relative genomic position to parse. |
| string | Required. The field that contains the JSON object array. |
| string | Required. Base genomic position when parsing relative position. |