MarkTransform
Auto-generated from the config schema in the source — see the config guide for concepts. Provided by the marks plugin. View source.
One step of a transform list, which runs over the region's features in
order, each step reading what the one before it produced. A step names its
type and takes that step's settings; a key belonging to another step
is refused at load.
filter keeps the features an expression admits; formula writes an
expression's value into a field; bin snaps each feature to a
genome-aligned bin, or with fields cuts it into a piece per bin it
overlaps; aggregate folds each group into one feature with
its summaries; window writes each feature with summaries over the
features of its group around it in start order, a moving average over a
fixed number of features; coverage replaces the
features with runs of how many
overlap each stretch; flatten fans out an array or a record field;
cells replaces each aligned row with its runs of match, mismatch and gap
against the reference it was fanned out of and an interbase insertion per
run of reference gaps, with state, base, match and length written;
pileup writes
each feature's row in a greedy first-fit packing; mate yields one
feature per other end a record states, the mate a paired adapter fills
in (BEDPE, STAR-Fusion), each VCF ALT naming a locus, or a paired read's
next_ref and next_pos, with mate.refName, mate.start, mate.end
and mate.mateDirection, the record's mateDirection, the alt it
came from and svType written, a record with no other end dropped and a
pair of ends yielding one feature.
Example usage
Count features per bin that follows the zoom:
transform: [
{ type: 'bin', step: 'auto' },
{ type: 'aggregate', ops: [{ op: 'count' }] },
]A moving average of each file's score over 101 sites, weighted by read
depth. groupby keeps each file's average to its own sites; the color
field splits the line into one series per file:
{
mark: 'line',
transform: [
{
type: 'window',
groupby: ['source'],
frame: [-50, 50],
ops: [{ op: 'mean', field: 'score', weight: 'n_valid_cov', as: 'meth' }],
},
],
encoding: { y: 'meth', color: { field: 'source' } },
}The fraction of aligned bases matching the reference per bin, no reference
N counted, behind a
cells step, each run weighted by the bases it puts in the bin:
transform: [
{ type: 'bin', step: 'auto', fields: ['start', 'end'] },
{
type: 'aggregate',
ops: [{ op: 'mean', field: 'match', weight: 'overlap', as: 'identity' }],
},
]Config slots
A MarkTransform is one of the types its rows begin with, named by its type, and takes only that type's rows: filter.expr is written { "type": "filter", "expr": ... }, and a key belonging to another type is refused where the config is read. Slot types (fileLocation, frozen, ...) are explained in the config slot types reference. Slots a base configuration contributes are listed here too, so this table is the whole surface.
| Slot | Description |
|---|---|
filter.exprstring = '' | A jexl callback over feature. The features it admits are kept and the rest dropped before the steps behind it run.callback args: feature |
formula.exprstring = '' | A jexl callback over feature whose value is written into as.callback args: feature |
formula.asstring = 'value' | The field the value is written to. |
bin.stepnumber = 10000 | The bin width in bp, aligned to the genome, or "auto" for a width that follows the view's zoom — the target of four pixels per bin, snapped up to the next 1/2/5 rung, resolved before the fetch and keyed into it. |
bin.fieldstring = 'start' | The field placing a feature in a bin: a name, or a dotted path into a structured field (INFO.END). A formula step in front computes one. |
bin.fieldsstringArray = [] | An interval's start and end fields, in place of field: each feature is cut at the bin edges into one piece per bin it overlaps, and each piece writes overlap, the bases of the interval inside its bin, which an aggregate op's weight reads for a mean per base. Empty bins by field. |
bin.asstringArray = ['start', 'end'] | The two fields the bin's edges are written to. An aggregate behind the bin that names no groupby groups by these. |
aggregate.ops.opstringEnum (count, sum, mean, min, max) = 'count' | count needs no field; sum, mean, min and max read one. |
aggregate.ops.fieldstring = '' | The feature field the op reads, for every op but count. |
aggregate.ops.weightstring = '' | A field each feature counts by: count sums it, sum sums the value times it, and mean divides that by its sum. overlap behind a bin over fields weights a mean by bases. min and max read none. Empty counts every feature once. |
aggregate.ops.asstring = '' | The output field. Empty is count, or <op>_<field>. |
aggregate.groupbystringArray = [] | The fields whose distinct value sets make the groups. Empty takes the edges the last bin before it wrote, in this mark's transform, the facet's or the display's, so binning and counting needs no restatement; with none there it folds the whole region into one feature. |
| aggregate.ops list of sub-schema entries | The summaries computed for each group. |
window.groupbystringArray = [] | The fields whose distinct value sets make the groups a frame stays inside, within a facet's section. Empty is one group per section. |
window.framefrozen = [...DEFAULT_WINDOW_FRAME] | The rows before and after each row that its summaries read, in its group's start order: [-10, 10] reads 21 rows, whatever bases they span, and null runs to the group's end, so [null, 0] is a running total. |
window.opstypes.array(aggregateOpSchema) | The summaries each row is written with, named as an aggregate's are. |
coverage.asstring = 'coverage' | The field each run's depth is written to. |
flatten.fieldstring = 'subfeatures' | The field fanned out, one feature per element of an array or per entry of a record keyed by name: a name or a dotted path. |
flatten.indexstring = '' | The field each element's position in its array is written to. Empty writes none. |
flatten.keystring = '' | The field each entry's key is written to where the field is a record: the sample of a VCF samples entry, the species of a MAF block's alignments entry. Empty writes none. |
flatten.keepEmptyboolean = false | Keep a feature whose field holds nothing, which is otherwise dropped. |
cells.fieldstring = 'seq' | The field holding each row's aligned text, gaps as -; the reference's is the same field on the feature the row was fanned out of. |
pileup.asstring = 'row' | The field each feature's row is written to, which a span encoding row then reads. |
pileup.fieldsstringArray = ['start', 'end'] | The two fields giving the interval it packs. |
pileup.paddingnumber = 0 | bp of clearance kept between two features sharing a row, so a pileup does not butt its reads together. |
Related links
- Config guide: Mark display