Assembly
Auto-generated @jbrowse/mobx-state-tree API for the current JBrowse release — see pluggable elements for concepts. Built into JBrowse core. View source.
Properties
| Member | Description |
|---|---|
configurationconfiguration: types.safeReference(assemblyConfigType) |
Volatiles
| Member | Description |
|---|---|
errorerror | |
loadingPloadingP: undefined as Promise<void> | undefined | |
| adapterLoads | |
volatileRegionsvolatileRegions: undefined as BasicRegion[] | undefined | |
refNameAliasesrefNameAliases: undefined as RefNameAliases | undefined | |
| canonicalToSeqAdapterRefNames | Maps canonical refName -> sequence adapter refName (in FASTA). These may differ when refNameAliases with override:true remap names. |
cytobandscytobands: undefined as Feature[] | undefined | |
| loadedGeneticCodes | refName -> NCBI genetic-code id loaded from geneticCodesLocation; merged with (and overridden by) the inline geneticCodes config slot |
lowerCaseRefNameAliaseslowerCaseRefNameAliases: undefined as RefNameAliases | undefined | Precomputed in loadPre to avoid expensive synchronous computation when MobX triggers the autorun after setLoaded |
statusMessagestatusMessage: undefined as string | undefined | What the in-flight load is doing ("Downloading chromosome sizes"), for a view that is showing a spinner while it waits. Same split as BaseDisplayModel's status fields, so the same LoadingProgress UI renders both. |
statusProgressstatusProgress: undefined as number | undefined | Fraction in [0,1] when the load reports determinate progress |
statusSourcestatusSource: undefined as string | undefined | The URL the in-flight phase is fetching, when it named one. A load that hangs shows this and not the label: "Downloading chromosome aliases" forever says nothing a user can act on, and the address of the server that stopped answering does. |
refNameMismatchesrefNameMismatches: new Map<string, RefNameMismatch>() | adapter cache key -> the empty-intersection verdict loadRefNameMap reached for that adapter under this assembly. Sits beside adapterLoads and is keyed the same way, so it inherits that cache's once-per-(assembly, adapter config) property: the diagnostic is recorded exactly as often as the map is built, which is once.Written by replacing the Map rather than mutating it — a Map inside a volatile is one observable, not a deeply observable collection, so a .set() would leave every reader stale. |
Getters
| Member | Description |
|---|---|
namestring | |
aliasesstring[] | |
displayNamestring | |
refNameColorsstring[] | |
allAliasesstring[] | |
initializedboolean | |
regionsBasicRegion[] | undefined | |
allRefNamesstring[] | undefined | note: lowerCaseRefNameAliases not included here: this allows the list of refnames to be just the "normal casing", but things like getCanonicalRefName can resolve a lower-case name if needed |
namesByCanonicalRefNameMap<string, string[]> | undefined | canonical refName -> every name this assembly has for that sequence, canonical first. The inverse of refNameAliases, memoized here because the readers that want it want the whole table (the About dialog's alias listing) rather than one row. Undefined until the aliases load. |
rpcManagerRpcManager | |
refNamesstring[] | undefined | |
refNameToIndexMap<string, number> | undefined | memoized refName -> first region index, so getRefNameColor is O(1) instead of an O(n) indexOf per call (matters for assemblies with many contigs rendered in overview scalebars/rulers) |
Methods
| Member | Description |
|---|---|
getConf(arg: string) => any | |
hasName(name: string) => boolean | |
getCanonicalRefName(refName: string) => string | Returns the canonical refName for a given alias or refName. Note: The canonical name may differ from what's in the FASTA file when refNameAliases with override:true are configured. To get the name that matches the FASTA file, use getSeqAdapterRefName(). |
getRefNameColor(refName: string) => string | undefined | |
getRegionForRefName(refName: string) => BasicRegion | undefined | The whole-contig region for a CANONICAL refName — its extents, and so the bounds anything placing a span on it has to clamp into. Undefined before regions loads, and for a refName this assembly doesn't have.Reads the refNameToIndex memo, which is why this exists rather than each caller writing assembly.regions?.find(r => r.refName === name): five of them did, and that scan is O(contigs) per call on an assembly whose whole point is that it may have thousands. |
getGeneticCodeId(refName: string) => number | NCBI genetic-code (translation table) id for a refName, from the assembly's geneticCodes config map (e.g. a mitochondrial contig = 2). Falls back to the standard code (1) for unlisted refNames. |
getSeqAdapterRefName(canonicalRefName: string) => string | Given a canonical refName, returns the refName used by the sequence adapter (what's in the FASTA file). Falls back to the input if no mapping exists. |
getCanonicalRefName2(refName: string) => string | The total canonical-refName resolver, for any name arriving from outside — off a feature, out of an RPC result, out of a session spec. A name the assembly does not know comes back unchanged, and so does one asked for before the aliases load, where getCanonicalRefName answers undefined for the first and THROWS for the second.The throw is the reason to call this rather than hand-roll getCanonicalRefName(x) ?? x: that idiom looks total and is not, and these resolutions sit in getters and render paths that run from the first frame, before the alias file has landed. Answering with the input there means the comparison downstream may miss, but it misses for one frame and re-runs, where a throw out of a getter takes the view down. initialized is the gate for a caller that needs to know which answer it got.See getCanonicalRefName() for what canonical means when refNameAliases carries an override. |
isValidRefName(refName: string) => boolean | |
getAliasesForRefName(refName: string) => string[] | The other names this assembly has for the same sequence as refName — its aliases, whether the name handed in is an alias or the canonical name. chr1, 1 and NC_000001.11 each answer with the other two.Empty for a name this assembly does not have, and also before the aliases load: this resolves through getCanonicalRefName2 so it can be called from a render, and initialized is what distinguishes the two. |
| getRefNameMapForAdapter | get Map of canonical-name -> adapter-specific-name, memoized per adapter config so concurrent callers share one loadThe load reports progress (the adapter's index download, or for an in-memory adapter the whole file) through the statusCallback of whichever caller started it. The others await it silently, and that is deliberate rather than a gap worth plumbing around: the callers sharing an entry are almost always the N displayed regions of ONE display, so their callbacks all write into that display's aggregated status bar and the first one is already reporting on behalf of the rest. The costs of getting this "right" — a listener set per key, registration, and deregistration on settle — buy visibility only for a second display on the same file, and for a first caller torn down mid-load, which is a no-op rather than a hazard because the callbacks are isAlive-guarded at the display end.If that ever stops being enough, the fix is not a subscription list bolted on here: it is for the assembly to hold the in-flight status as observable state that consumers read, which is what this model is already made of. |
getRefNameMismatch(adapterCacheKey: string) => RefNameMismatch | undefined | The empty-intersection verdict for an adapter under this assembly, if the map load reached one. Keyed by adapterConfigCacheKey, which is what a track already computes as its rpcSessionId — so a track looks up its own diagnostic with no plumbing between here and it. Undefined until the map has loaded, which is the same instant the track's first fetch resolves. |
Actions
| Member | Description |
|---|---|
setStatus(status?: RpcStatus | undefined) => void | Records what the in-flight load is doing. Its own actions block (rather than sitting next to setLoaded) so loadPre can hand self.setStatus to the adapters as a plain callback: it fires after awaits, outside the action that started the load, and a volatile write there has to go through an action of its own. |
setRefNameMismatch(adapterCacheKey: string, mismatch: RefNameMismatch) => void | Record that an adapter's reference names and this assembly's have nothing in common. Diagnostic only: loadRefNameMap still returns its map and the track still loads, because a wrong guess here must not take a working track away from anyone. |
| setLoaded | Applies all load-time state in a single transaction so dependent autoruns fire once, with the precomputed lowercase/name lookups already in place by the time refNameAliases becomes observable. |
setError(e: unknown) => void | |
setLoadingP(p?: Promise<void> | undefined) => void | |
loadPre() => Promise<void> | |
load() => Promise<void> | Resolves once regions + refNameAliases are set, and rejects with the load failure. Idempotent: concurrent callers share one attempt, and a failed attempt is discarded so the next call retries. The rejection is the authoritative signal for a caller that awaits it. self.error mirrors it for reactive consumers only (the UI renders it), and must not be consulted after an await: a concurrent retry clears it, so an awaiter reading it can see a cleared error and mistake a failed load for a successful one. |