Coverage¶
The "coverage"
transform computes
coverage for overlapping
segments. The result is a new list of non-overlapping segments with the coverage
values. The segments must be sorted by their start coordinates before passing
them to the coverage transform.
Parameters¶
as
-
Type: string
The output field for the computed coverage.
asChrom
-
Type: string
The output field for the chromosome.
Default: Same as
chrom
asEnd
-
Type: string
The output field for the end coordinate.
Default: Same as
end
asStart
-
Type: string
The output field for the start coordinate.
Default: Same as
start
chrom
-
Type: string (field name)
An optional chromosome field that is passed through. TODO: groupby
end
Required-
Type: string (field name)
The field representing the end coordinate of the segment (exclusive).
start
Required-
Type: string (field name)
The field representing the start coordinate of the segment (inclusive).
weight
-
Type: string (field name)
A field representing an optional weight for the segment. Can be used with copy ratios, for example.
Example¶
Given the following data:
start | end |
---|---|
0 | 4 |
1 | 3 |
... and configuration:
{
"type": "coverage",
"start": "startpos",
"end": "endpos"
}
A new list of segments is produced:
start | end | coverage |
---|---|---|
0 | 1 | 1 |
1 | 3 | 2 |
3 | 4 | 1 |
Interactive example¶
The following example demonstrates both "coverage"
and "pileup"
transforms.
{
"data": {
"sequence": {
"start": 1,
"stop": 100,
"as": "start"
}
},
"transform": [
{
"type": "formula",
"expr": "datum.start + ceil(random() * 20)",
"as": "end"
}
],
"resolve": { "scale": { "x": "shared" } },
"vconcat": [
{
"transform": [
{
"type": "coverage",
"start": "start",
"end": "end",
"as": "coverage"
}
],
"mark": "rect",
"encoding": {
"x": { "field": "start", "type": "index" },
"x2": { "field": "end" },
"y": { "field": "coverage", "type": "quantitative" }
}
},
{
"transform": [
{
"type": "pileup",
"start": "start",
"end": "end",
"as": "lane"
}
],
"mark": "rect",
"encoding": {
"x": { "field": "start", "type": "index" },
"x2": { "field": "end" },
"y": {
"field": "lane",
"type": "index",
"scale": {
"padding": 0.2,
"reverse": true,
"zoom": false
}
}
}
}
]
}