@jbrowse/plugin-linear-comparative-view
Auto-generated from exported functions tagged #api in the source. See
imports and re-exports for how to
import these from a plugin.
isLinearSyntenyView
Whether a session's view is a synteny view, for a host that finds it in
session.views to draw it with SyntenyStack.
import { isLinearSyntenyView } from '@jbrowse/plugin-linear-comparative-view'
function isLinearSyntenyView(view: unknown): view is LinearSyntenyViewmultiwayTables
A multi-genome synteny track as the multi-way display stacks it under a
linear genome view, as tables: lanes, the anchor first and then each
mate lane in the order a fresh load stacks it, with the contig, zoom and orientation
it picked; segments, the stretches of each lane's sequence across the
view, cut where a lane opens a hole for a deletion and stopped at the
ends of its contig where the lane's assembly is given, each with the px it
spans; blocks, each alignment's placement on each lane; ribbons, what
each gutter draws in paint order, a trapezoid from a span on its upper
lane to a span on its lower one, with its color and the alpha it
composites at; alignments, the records the ribbons draw; legend, the
key, and legendAlpha, the alpha the display draws its chips at; and
config, the display's config with its defaults filled. Positions are
genomic on each lane, and px across the view's width, where a lane's
own frame puts them. A segment's and a block's region, and a ribbon
foot's upperRegion and lowerRegion, is the 0-based index of the
anchor's region it is drawn on, read from its px; 0 on a mate lane, whose
frame is one stretch of one contig. Heights are px down from the
stack's top as the display lays it out over display.height: height is
the whole stack, each lane's yTop and yBottom bound its gene boxes,
and each ribbon's bound its gutter, the height its thin flag and fade
are measured at.
import { multiwayTables } from '@jbrowse/plugin-linear-comparative-view/tables'
function multiwayTables(
pluginManager: PluginManager,
opts: MultiWayTablesArgs,
): Promise<{
height: number
tickInterval: number
rowsVsAnchor: boolean
config: Record<string, unknown>
legend: { label: string[]; color: string[] }
legendTitle: string
legendAlpha: number
ramps: {
offset: number[]
color: string[]
opacity: number[]
minLabel: string
maxLabel: string
id: string
title: string
}[]
ribbons: {
alignment: number[]
group: string[]
kind: string[]
gutter: number[]
upperLane: number[]
lowerLane: number[]
upperRegion: number[]
upperChrom: string[]
upperStart: number[]
upperEnd: number[]
lowerRegion: number[]
lowerChrom: string[]
lowerStart: number[]
lowerEnd: number[]
upperX1: number[]
upperX2: number[]
lowerX1: number[]
lowerX2: number[]
yTop: number[]
yBottom: number[]
color: string[]
alpha: number[]
thin: boolean[]
bridge: boolean[]
}
alignments: {
id: string[]
group: string[]
name: (string | null)[]
assembly: (string | null)[]
chrom: string[]
start: number[]
end: number[]
strand: (1 | -1)[]
mateAssembly: (string | null)[]
mateChrom: (string | null)[]
mateStart: (number | null)[]
mateEnd: (number | null)[]
}
blocks: {
lane: number[]
region: number[]
group: string[]
name: (string | null)[]
chrom: string[]
start: number[]
end: number[]
strand: number[]
x1: number[]
x2: number[]
}
lanes: {
lane: number[]
assembly: string[]
label: string[]
anchor: boolean[]
chrom: (string | null)[]
flipped: boolean[]
bpPerPx: number[]
alsoOn: string[]
yTop: number[]
yBottom: number[]
}
segments: {
lane: number[]
region: number[]
chrom: string[]
start: number[]
end: number[]
x1: number[]
x2: number[]
}
}>recordedOffscreenStrips
What drawOffscreenMates paints of strips over a band height px tall:
every mark and every label, in px from the band's top left, each named by
the axis whose edge it hangs off.
import { recordedOffscreenStrips } from '@jbrowse/plugin-linear-comparative-view/tables'
function recordedOffscreenStrips(
strips: OffscreenMateLane[],
height: number,
): {
marks: {
x: number[]
y: number[]
width: number[]
height: number[]
color: string[]
alpha: number[]
axis: ('query' | 'target')[]
}
labels: {
label: string[]
x: number[]
y: number[]
color: string[]
alpha: number[]
halo: string[]
axis: ('query' | 'target')[]
}
fontPx: number
}SyntenyLevel
One ribbon band between two rows of a synteny view: the shared ribbon canvas,
with each synteny display's own tooltip, context menu and fetch status over
it. children draw over the band too.
The band takes its height from the level, not from what is drawn in it: the
canvas is absolutely positioned, and a level with no synteny track is legal.
The overlays come from linearSyntenyDisplays, the list the canvas uploads
geometry for, so a painted ribbon always has an overlay to hover.
import { SyntenyLevel } from '@jbrowse/plugin-linear-comparative-view'
function SyntenyLevel(opts: {
level: LinearSyntenyViewHelper
children?: ReactNode
}): ElementSyntenyStack
A synteny view drawn without its Material UI chrome: each row, with a ribbon
band between neighbours, or the view's status until it is ready. The
bring-your-own counterpart of TrackStack from @jbrowse/display-ui/embed.
Each row is an ordinary linear genome view, drawn by renderRow, which
defaults to a TrackStack:
<SyntenyStack
view={view}
renderRow={row => (
<TrackStack view={row}>{row.assemblyNames[0]}</TrackStack>
)}
/>import { SyntenyStack } from '@jbrowse/plugin-linear-comparative-view'
function SyntenyStack(opts: {
view: LinearSyntenyView
renderRow?: (row: LinearGenomeView, index: number) => ReactNode
style?: CSSProperties
}): ElementsyntenyTables
A pair of rows of a linear synteny view as the display fetches, lays out
and colors it, as tables: alignments, each alignment block the two rows
share, with its span on each, its strand, name and measurements, in the
color the view's encoding.color paints it; ribbons, what the band draws between
the rows in paint order, each a trapezoid from a span on the query row to
a span on the target row (match for the block, insertion, deletion
and skip for the CIGAR ops wide enough to draw, marker for a location
tick), with its color and the alpha it composites at, an indel already
blended over the band's ground and opaque as the band paints it, and
whether it draws as a centerline, less those the band culls past its
overdraw;
offscreen, the blocks whose mate lies on a contig the other row is not
showing or past its window and overdraw, in the color the strip along
that row's edge paints them, offscreenContigs, the count and aligned bp
of each contig the strip's marks name and the line its hover prints, and offscreenStrip, the marks and
labels the strips along the band's edges paint, in px;
legend and ramps, the key, and legendAlpha, the alpha the view
composites its chips at, alpha floored for legibility; and config, the view's settings with
their defaults filled, encoding.color and encoding.opacity as config objects. For a host that draws
them itself, such as R through V8. Positions are genomic, on the axis's
region named by queryRegion and targetRegion; a ribbon's
queryX1/queryX2 and targetX1/targetX2 are its feet in px across
the row's width, the regions end to end with no gap, each foot clamped
to its region, X1 joining X1 along one edge and X2 joining X2.
import { syntenyTables } from '@jbrowse/plugin-linear-comparative-view/tables'
function syntenyTables(
pluginManager: PluginManager,
opts: SyntenyTablesArgs,
): Promise<{
config: {
encoding: {
color: Record<string, unknown>
opacity: Record<string, unknown>
}
filter: FieldPredicate[]
indels: Record<string, unknown>
mark: Record<string, unknown>
axis: Record<string, unknown>
render: Record<string, unknown>
height: number
}
alpha: number
assemblyNames: string[]
legend: { label: string[]; color: string[] }
legendTitle: string
legendAlpha: number
ramps: {
offset: number[]
color: string[]
opacity: number[]
minLabel: string
maxLabel: string
id: string
title: string
}[]
alignments: {
color: string[]
alpha: number[]
id: string[]
name: string[]
queryChrom: string[]
queryStart: number[]
queryEnd: number[]
targetChrom: string[]
targetStart: number[]
targetEnd: number[]
strand: number[]
length: number[]
}
ribbons: {
alignment: number[]
kind: string[]
queryRegion: number[]
queryChrom: string[]
queryStart: number[]
queryEnd: number[]
targetRegion: number[]
targetChrom: string[]
targetStart: number[]
targetEnd: number[]
queryX1: number[]
queryX2: number[]
targetX1: number[]
targetX2: number[]
color: string[]
alpha: number[]
thin: boolean[]
}
offscreen: {
axis: ('query' | 'target')[]
region: number[]
chrom: string[]
start: number[]
end: number[]
mateChrom: string[]
mateStart: number[]
mateEnd: number[]
length: number[]
color: string[]
alpha: number[]
drawn: boolean[]
}
offscreenContigs: {
axis: ('query' | 'target')[]
mateChrom: string[]
count: number[]
alignedBp: number[]
label: string[]
color: string[]
alpha: number[]
}
offscreenStrip: {
marks: {
x: number[]
y: number[]
width: number[]
height: number[]
color: string[]
alpha: number[]
axis: ('query' | 'target')[]
}
labels: {
label: string[]
x: number[]
y: number[]
color: string[]
alpha: number[]
halo: string[]
axis: ('query' | 'target')[]
}
fontPx: number
}
}>