Skip to main content

LinearGenomeView

Note: this document is automatically generated from mobx-state-tree objects in our source code. See Core concepts and intro to pluggable elements for more info

Source file

plugins/linear-genome-view/src/LinearGenomeView/model.ts

extends

LinearGenomeView - Properties

property: id

// type signature
IOptionalIType<ISimpleType<string>, [undefined]>
// code
id: ElementId

property: type

this is a string instead of the const literal 'LinearGenomeView' to reduce some typescripting strictness, but you should pass the string 'LinearGenomeView' to the model explicitly

// type signature
string
// code
type: types.literal('LinearGenomeView') as unknown as string

property: offsetPx

corresponds roughly to the horizontal scroll of the LGV

// type signature
number
// code
offsetPx: 0

property: bpPerPx

corresponds roughly to the zoom level, base-pairs per pixel

// type signature
number
// code
bpPerPx: 1

property: displayedRegions

currently displayed regions, can be a single chromosome, arbitrary subsections, or the entire set of chromosomes in the genome, but it not advised to use the entire set of chromosomes if your assembly is very fragmented

// type signature
IOptionalIType<IType<Region[], Region[], Region[]>, [undefined]>
// code
displayedRegions: types.optional(types.frozen<IRegion[]>(), [])

property: tracks

array of currently displayed tracks state models instances

// type signature
IArrayType<IAnyType>
// code
tracks: types.array(
pluginManager.pluggableMstType('track', 'stateModel'),
)

property: hideHeader

// type signature
false
// code
hideHeader: false

property: hideHeaderOverview

// type signature
false
// code
hideHeaderOverview: false

property: hideNoTracksActive

// type signature
false
// code
hideNoTracksActive: false

property: trackSelectorType

// type signature
IOptionalIType<ISimpleType<string>, [undefined]>
// code
trackSelectorType: types.optional(
types.enumeration(['hierarchical']),
'hierarchical',
)

property: showCenterLine

show the "center line"

// type signature
IOptionalIType<ISimpleType<boolean>, [undefined]>
// code
showCenterLine: types.optional(types.boolean, () =>
Boolean(
JSON.parse(localStorageGetItem('lgv-showCenterLine') || 'false'),
),
)

property: showCytobandsSetting

show the "cytobands" in the overview scale bar

// type signature
IOptionalIType<ISimpleType<boolean>, [undefined]>
// code
showCytobandsSetting: types.optional(types.boolean, () =>
Boolean(
JSON.parse(localStorageGetItem('lgv-showCytobands') || 'true'),
),
)

property: trackLabels

how to display the track labels, can be "overlapping", "offset", or "hidden", or empty string "" (which results in conf being used). see LinearGenomeViewPlugin https://jbrowse.org/jb2/docs/config/lineargenomeviewplugin/ docs for how conf is used

// type signature
IOptionalIType<ISimpleType<string>, [undefined]>
// code
trackLabels: types.optional(
types.string,
() => localStorageGetItem('lgv-trackLabels') || '',
)

property: showGridlines

show the "gridlines" in the track area

// type signature
true
// code
showGridlines: true

property: highlight

highlights on the LGV from the URL parameters

// type signature
IOptionalIType<IArrayType<IType<HighlightType, HighlightType, HighlightType>>, [undefined]>
// code
highlight: types.optional(
types.array(types.frozen<HighlightType>()),
[],
)

property: colorByCDS

color by CDS

// type signature
IOptionalIType<ISimpleType<boolean>, [undefined]>
// code
colorByCDS: types.optional(types.boolean, () =>
Boolean(JSON.parse(localStorageGetItem('lgv-colorByCDS') || 'false')),
)

property: showTrackOutlines

color by CDS

// type signature
IOptionalIType<ISimpleType<boolean>, [undefined]>
// code
showTrackOutlines: types.optional(types.boolean, () =>
Boolean(
JSON.parse(localStorageGetItem('lgv-showTrackOutlines') || 'true'),
),
)

LinearGenomeView - Getters

getter: trackLabelsSetting

this is the effective value of the track labels setting, incorporating both the config and view state. use this instead of view.trackLabels

// type
any

getter: width

// type
number

getter: interRegionPaddingWidth

// type
number

getter: assemblyNames

// type
any[]

getter: assemblyErrors

// type
string

getter: assembliesInitialized

// type
boolean

getter: initialized

// type
any

getter: hasDisplayedRegions

// type
boolean

getter: scaleBarHeight

// type
number

getter: headerHeight

// type
number

getter: trackHeights

// type
number

getter: trackHeightsWithResizeHandles

// type
any

getter: height

// type
any

getter: totalBp

// type
number

getter: maxBpPerPx

// type
number

getter: minBpPerPx

// type
number

getter: error

// type
unknown

getter: maxOffset

// type
number

getter: minOffset

// type
number

getter: displayedRegionsTotalPx

// type
number

getter: trackTypeActions

// type
Map<string, MenuItem[]>

getter: canShowCytobands

// type
any

getter: showCytobands

// type
boolean

getter: anyCytobandsExist

// type
boolean

getter: cytobandOffset

the cytoband is displayed to the right of the chromosome name, and that offset is calculated manually with this method

// type
number

getter: staticBlocks

static blocks are an important concept jbrowse uses to avoid re-rendering when you scroll to the side. when you horizontally scroll to the right, old blocks to the left may be removed, and new blocks may be instantiated on the right. tracks may use the static blocks to render their data for the region represented by the block

// type
BlockSet

getter: dynamicBlocks

dynamic blocks represent the exact coordinates of the currently visible genome regions on the screen. they are similar to static blocks, but static blocks can go offscreen while dynamic blocks represent exactly what is on screen

// type
BlockSet

getter: roundedDynamicBlocks

rounded dynamic blocks are dynamic blocks without fractions of bp

// type
any

getter: visibleLocStrings

a single "combo-locstring" representing all the regions visible on the screen

// type
string

getter: coarseVisibleLocStrings

same as visibleLocStrings, but only updated every 300ms

// type
string

getter: centerLineInfo

// type
any

LinearGenomeView - Methods

method: scaleBarDisplayPrefix

// type signature
scaleBarDisplayPrefix: () => any

method: MiniControlsComponent

// type signature
MiniControlsComponent: () => React.FC<any>

method: HeaderComponent

// type signature
HeaderComponent: () => React.FC<any>

method: renderProps

// type signature
renderProps: () => any

method: searchScope

// type signature
searchScope: (assemblyName: string) => { assemblyName: string; includeAggregateIndexes: boolean; tracks: IMSTArray<IAnyType> & IStateTreeNode<IArrayType<IAnyType>>; }

method: getTrack

// type signature
getTrack: (id: string) => any

method: rankSearchResults

// type signature
rankSearchResults: (results: BaseResult[]) => BaseResult[]

method: rewriteOnClicks

modifies view menu action onClick to apply to all tracks of same type

// type signature
rewriteOnClicks: (trackType: string, viewMenuActions: MenuItem[]) => void

method: getSelectedRegions

Helper method for the fetchSequence. Retrieves the corresponding regions that were selected by the rubberband

// type signature
getSelectedRegions: (leftOffset?: BpOffset, rightOffset?: BpOffset) => { start: number; end: number; type: string; regionNumber?: number; reversed?: boolean; refName: string; assemblyName: string; ... 4 more ...; isLeftEndOfDisplayedRegion?: boolean; }[]

method: exportSvg

creates an svg export and save using FileSaver

// type signature
exportSvg: (opts?: ExportSvgOptions) => Promise<void>

method: menuItems

return the view menu items

// type signature
menuItems: () => MenuItem[]

method: rubberBandMenuItems

// type signature
rubberBandMenuItems: () => MenuItem[]

method: bpToPx

// type signature
bpToPx: ({ refName, coord, regionNumber, }: { refName: string; coord: number; regionNumber?: number; }) => { index: number; offsetPx: number; }

method: centerAt

scrolls the view to center on the given bp. if that is not in any of the displayed regions, does nothing

// type signature
centerAt: (coord: number, refName: string, regionNumber?: number) => void

method: pxToBp

// type signature
pxToBp: (px: number) => { coord: number; index: number; refName: string; oob: boolean; assemblyName: string; offset: number; start: number; end: number; reversed?: boolean; }

LinearGenomeView - Actions

action: setShowTrackOutlines

// type signature
setShowTrackOutlines: (arg: boolean) => void

action: setColorByCDS

// type signature
setColorByCDS: (flag: boolean) => void

action: setShowCytobands

// type signature
setShowCytobands: (flag: boolean) => void

action: setWidth

// type signature
setWidth: (newWidth: number) => void

action: setError

// type signature
setError: (error: unknown) => void

action: setHideHeader

// type signature
setHideHeader: (b: boolean) => void

action: setHideHeaderOverview

// type signature
setHideHeaderOverview: (b: boolean) => void

action: setHideNoTracksActive

// type signature
setHideNoTracksActive: (b: boolean) => void

action: setShowGridlines

// type signature
setShowGridlines: (b: boolean) => void

action: addToHighlights

// type signature
addToHighlights: (highlight: HighlightType) => void

action: setHighlight

// type signature
setHighlight: (highlight?: HighlightType[]) => void

action: removeHighlight

// type signature
removeHighlight: (highlight: HighlightType) => void

action: scrollTo

// type signature
scrollTo: (offsetPx: number) => number

action: zoomTo

// type signature
zoomTo: (bpPerPx: number, offset?: number, centerAtOffset?: boolean) => number

action: setOffsets

sets offsets of rubberband, used in the get sequence dialog can call view.getSelectedRegions(view.leftOffset,view.rightOffset) to compute the selected regions from the offsets

// type signature
setOffsets: (left?: BpOffset, right?: BpOffset) => void

action: setSearchResults

// type signature
setSearchResults: (searchResults: BaseResult[], searchQuery: string, assemblyName?: string) => void

action: setNewView

// type signature
setNewView: (bpPerPx: number, offsetPx: number) => void

action: horizontallyFlip

// type signature
horizontallyFlip: () => void

action: showTrack

// type signature
showTrack: (trackId: string, initialSnapshot?: {}, displayInitialSnapshot?: {}) => any

action: hideTrack

// type signature
hideTrack: (trackId: string) => number

action: moveTrackDown

// type signature
moveTrackDown: (id: string) => void

action: moveTrackUp

// type signature
moveTrackUp: (id: string) => void

action: moveTrackToTop

// type signature
moveTrackToTop: (id: string) => void

action: moveTrackToBottom

// type signature
moveTrackToBottom: (id: string) => void

action: moveTrack

// type signature
moveTrack: (movingId: string, targetId: string) => void

action: toggleTrack

// type signature
toggleTrack: (trackId: string) => boolean

action: setTrackLabels

// type signature
setTrackLabels: (setting: "offset" | "hidden" | "overlapping") => void

action: setShowCenterLine

// type signature
setShowCenterLine: (b: boolean) => void

action: setDisplayedRegions

// type signature
setDisplayedRegions: (regions: Region[]) => void

action: activateTrackSelector

// type signature
activateTrackSelector: () => Widget

action: afterDisplayedRegionsSet

schedule something to be run after the next time displayedRegions is set

// type signature
afterDisplayedRegionsSet: (cb: () => void) => void

action: horizontalScroll

// type signature
horizontalScroll: (distance: number) => number

action: center

// type signature
center: () => void

action: showAllRegions

// type signature
showAllRegions: () => void

action: showAllRegionsInAssembly

// type signature
showAllRegionsInAssembly: (assemblyName?: string) => void

action: setDraggingTrackId

// type signature
setDraggingTrackId: (idx?: string) => void

action: setScaleFactor

// type signature
setScaleFactor: (factor: number) => void

action: clearView

this "clears the view" and makes the view return to the import form

// type signature
clearView: () => void

action: slide

perform animated slide

// type signature
slide: (viewWidths: number) => void

action: zoom

perform animated zoom

// type signature
zoom: (targetBpPerPx: number) => void

action: setCoarseDynamicBlocks

// type signature
setCoarseDynamicBlocks: (blocks: BlockSet) => void

action: moveTo

offset is the base-pair-offset in the displayed region, index is the index of the displayed region in the linear genome view

// type signature
moveTo: (start?: BpOffset, end?: BpOffset) => void

action: navToLocString

Navigate to the given locstring, will change displayed regions if needed, and wait for assemblies to be initialized

// type signature
navToLocString: (input: string, optAssemblyName?: string) => Promise<any>

action: navToSearchString

Performs a text index search, and navigates to it immediately if a single result is returned. Will pop up a search dialog if multiple results are returned

// type signature
navToSearchString: ({ input, assembly, }: { input: string; assembly: { configuration: any; } & NonEmptyObject & { error: unknown; loadingP: Promise<void> | undefined; volatileRegions: BasicRegion[] | undefined; refNameAliases: RefNameAliases | undefined; lowerCaseRefNameAliases: RefNameAliases | undefined; cytobands: Feature[] | undef...

action: navToLocations

Similar to navToLocString, but accepts parsed location objects instead of strings. Will try to perform setDisplayedRegions if changing regions

// type signature
navToLocations: (parsedLocStrings: ParsedLocString[], assemblyName?: string) => Promise<void>

action: navTo

Navigate to a location based on its refName and optionally start, end, and assemblyName. Will not try to change displayed regions, use navToLocations instead. Only navigates to a location if it is entirely within a displayedRegion. Navigates to the first matching location encountered.

Throws an error if navigation was unsuccessful

// type signature
navTo: (query: NavLocation) => void

action: navToMultiple

Navigate to a location based on its refName and optionally start, end, and assemblyName. Will not try to change displayed regions, use navToLocations instead. Only navigates to a location if it is entirely within a displayedRegion. Navigates to the first matching location encountered.

Throws an error if navigation was unsuccessful

// type signature
navToMultiple: (locations: NavLocation[]) => void