loom-browser 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/loom-react.esm.js +277 -6
- package/dist/loom-react.esm.min.js +1 -1
- package/dist/loom-react.esm.min.js.map +1 -1
- package/dist/loom.esm.js +129 -1
- package/dist/loom.esm.min.js +1 -1
- package/dist/loom.esm.min.js.map +1 -1
- package/dist/loom.js +129 -0
- package/dist/loom.min.js +1 -1
- package/dist/loom.min.js.map +1 -1
- package/dist/tsconfig.src.tsbuildinfo +1 -1
- package/dist/types/dataSources/memoryDataSource.d.ts +32 -0
- package/dist/types/headlessGenomeBrowser.d.ts +33 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/types/react/GenomeBrowserContext.d.ts +3 -0
- package/dist/types/react/tracks/BedTrack.d.ts +8 -3
- package/dist/types/react/tracks/WigTrack.d.ts +6 -3
- package/dist/types/react/ui/Navbar.d.ts +4 -1
- package/dist/types/types.d.ts +4 -1
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DataSource backed by an in-memory feature array.
|
|
3
|
+
*
|
|
4
|
+
* Wraps a pre-loaded feature array in a FeatureCache for spatial queries,
|
|
5
|
+
* enabling inline features to flow through the same data lifecycle as
|
|
6
|
+
* URL-based data sources.
|
|
7
|
+
*
|
|
8
|
+
* Layer 1 (Data + Layout): no DOM, no canvas.
|
|
9
|
+
*/
|
|
10
|
+
import type { DataSource, Locus } from '../types';
|
|
11
|
+
import type { CacheableFeature } from '../featureCache';
|
|
12
|
+
import type { CumulativeOffsets } from '../genome/chromSizes';
|
|
13
|
+
/**
|
|
14
|
+
* DataSource that serves features from an in-memory array.
|
|
15
|
+
*
|
|
16
|
+
* Features are indexed in a FeatureCache on construction for efficient
|
|
17
|
+
* spatial queries. Calling `setFeatures()` replaces the cache entirely.
|
|
18
|
+
*/
|
|
19
|
+
export declare class MemoryDataSource<F extends CacheableFeature = CacheableFeature> implements DataSource<F> {
|
|
20
|
+
private cache;
|
|
21
|
+
private _resolveChromName?;
|
|
22
|
+
private _cumulativeOffsets?;
|
|
23
|
+
constructor(features: F[]);
|
|
24
|
+
/** Replace the in-memory features and rebuild the spatial index. */
|
|
25
|
+
setFeatures(features: F[]): void;
|
|
26
|
+
/** Set a chromosome name resolver for alias resolution. */
|
|
27
|
+
setChromNameResolver(resolver: (chr: string) => string): void;
|
|
28
|
+
/** Set cumulative offsets for whole genome view coordinate transformation. */
|
|
29
|
+
setCumulativeOffsets(offsets: CumulativeOffsets): void;
|
|
30
|
+
fetch(locus: Locus, _bpPerPixel: number, _signal: AbortSignal): Promise<F[]>;
|
|
31
|
+
private fetchWG;
|
|
32
|
+
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* browser.setLocus({ chr: 'chr17', start: 7670000, end: 7680000 })
|
|
17
17
|
* browser.dispose()
|
|
18
18
|
*/
|
|
19
|
-
import type { Locus, Track, DataSource, FeatureCacheEntry, SessionConfig, TrackSessionConfig, DataSourceConfig, TrackInteractionEvent, TrackContextMenuEvent, WindowFunction, WigRenderConfig, AnnotationRenderConfig, RulerRenderConfig, SequenceRenderConfig, InteractionRenderConfig, TextFileFormat, SequenceProvider, Genome, ROI, ROISetConfig, ROIInteractionEvent } from './types';
|
|
19
|
+
import type { Locus, Track, DataSource, FeatureCacheEntry, SessionConfig, TrackSessionConfig, DataSourceConfig, TrackInteractionEvent, TrackContextMenuEvent, WindowFunction, WigFeature, AnnotationFeature, WigRenderConfig, AnnotationRenderConfig, RulerRenderConfig, SequenceRenderConfig, InteractionRenderConfig, TextFileFormat, SequenceProvider, Genome, ROI, ROISetConfig, ROIInteractionEvent } from './types';
|
|
20
20
|
import { ROISet } from './roi/roiSet';
|
|
21
21
|
import type { CanvasProvider } from './canvasProvider';
|
|
22
22
|
import type { WorkerProvider } from './workerProvider';
|
|
@@ -231,6 +231,32 @@ export interface AddAnnotationTrackOptions {
|
|
|
231
231
|
/** Arbitrary key-value metadata (e.g., assay, biosample, tissue). */
|
|
232
232
|
metadata?: Record<string, string>;
|
|
233
233
|
}
|
|
234
|
+
export interface AddWigTrackWithFeaturesOptions {
|
|
235
|
+
config?: Partial<WigRenderConfig>;
|
|
236
|
+
/** Fixed pixel height (overrides config.height). */
|
|
237
|
+
height?: number;
|
|
238
|
+
/** Background color. */
|
|
239
|
+
background?: string;
|
|
240
|
+
/** Max visible height — enables scrollable container in DOM browser. */
|
|
241
|
+
maxTrackHeight?: number;
|
|
242
|
+
/** Track name for axis label. */
|
|
243
|
+
name?: string;
|
|
244
|
+
/** Arbitrary key-value metadata (e.g., assay, biosample, tissue). */
|
|
245
|
+
metadata?: Record<string, string>;
|
|
246
|
+
}
|
|
247
|
+
export interface AddBedTrackWithFeaturesOptions {
|
|
248
|
+
config?: Partial<AnnotationRenderConfig>;
|
|
249
|
+
/** Fixed pixel height. */
|
|
250
|
+
height?: number;
|
|
251
|
+
/** Background color. */
|
|
252
|
+
background?: string;
|
|
253
|
+
/** Max visible height — enables scrollable container in DOM browser. */
|
|
254
|
+
maxTrackHeight?: number;
|
|
255
|
+
/** Track name for axis label. */
|
|
256
|
+
name?: string;
|
|
257
|
+
/** Arbitrary key-value metadata (e.g., assay, biosample, tissue). */
|
|
258
|
+
metadata?: Record<string, string>;
|
|
259
|
+
}
|
|
234
260
|
export declare class HeadlessGenomeBrowser {
|
|
235
261
|
protected _locus: Locus;
|
|
236
262
|
protected _viewportWidth: number;
|
|
@@ -434,6 +460,12 @@ export declare class HeadlessGenomeBrowser {
|
|
|
434
460
|
addBedTrack(url: string, options?: AddBedTrackOptions): AnnotationTrackCanvas;
|
|
435
461
|
/** Add an interaction (arc/BEDPE) track from a URL. */
|
|
436
462
|
addInteractionTrack(url: string, options?: AddInteractionTrackOptions): InteractionTrackCanvas;
|
|
463
|
+
/** Add a BigWig-style signal track backed by in-memory features (no URL required). */
|
|
464
|
+
addWigTrackWithFeatures(features: WigFeature[], options?: AddWigTrackWithFeaturesOptions): WigTrackCanvas;
|
|
465
|
+
/** Add a BED/annotation track backed by in-memory features (no URL required). Features must include `chr`. */
|
|
466
|
+
addBedTrackWithFeatures(features: (AnnotationFeature & {
|
|
467
|
+
chr: string;
|
|
468
|
+
})[], options?: AddBedTrackWithFeaturesOptions): AnnotationTrackCanvas;
|
|
437
469
|
/** Add a DNA/RNA sequence track. Data fetching is handled automatically via the genome's sequence provider. */
|
|
438
470
|
addSequenceTrack(options?: AddSequenceTrackOptions): SequenceTrackCanvas;
|
|
439
471
|
/** Apply a new render theme to the browser and all existing tracks. */
|
package/dist/types/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export type { InteractionFeature, InteractionRenderConfig, ArcOrientation, ArcDi
|
|
|
19
19
|
export { defaultInteractionRenderConfig } from './types';
|
|
20
20
|
export type { DataSource, FeatureCacheEntry, DataDrivenTrack } from './types';
|
|
21
21
|
export type { PopupDataItem, HitTestResult, TrackInteractionEvent, ContextMenuItem, TrackContextMenuEvent, NumericState, ROI, ROISetConfig, ROIInteractionEvent } from './types';
|
|
22
|
-
export type { SessionConfig, TrackSessionConfig, WigTrackSessionConfig, AnnotationTrackSessionConfig, RulerTrackSessionConfig, WigSessionOverrides, AnnotationSessionOverrides, RulerSessionOverrides, DataSourceConfig, BigWigDataSourceConfig, GtxDataSourceConfig, UCSCDataSourceConfig, TextDataSourceConfig, SequenceProvider, IgvSessionObject, IgvReferenceConfig, IgvTrackConfig, Chromosome, Genome, GenomeConfig, ChromAliasRecord, Strand, TextFileFormat, BedFeature, PeakFeature, BedGraphFeature, GFFRecord, GFFFeature, TextFeature, } from './types';
|
|
22
|
+
export type { SessionConfig, TrackSessionConfig, WigTrackSessionConfig, AnnotationTrackSessionConfig, RulerTrackSessionConfig, WigSessionOverrides, AnnotationSessionOverrides, RulerSessionOverrides, DataSourceConfig, BigWigDataSourceConfig, GtxDataSourceConfig, UCSCDataSourceConfig, TextDataSourceConfig, MemoryDataSourceConfig, SequenceProvider, IgvSessionObject, IgvReferenceConfig, IgvTrackConfig, Chromosome, Genome, GenomeConfig, ChromAliasRecord, Strand, TextFileFormat, BedFeature, PeakFeature, BedGraphFeature, GFFRecord, GFFFeature, TextFeature, } from './types';
|
|
23
23
|
export { defaultAnnotationRenderConfig, defaultRulerRenderConfig, defaultWigRenderConfig } from './types';
|
|
24
24
|
export type { Packable } from './pack';
|
|
25
25
|
export { packFeatures } from './pack';
|
|
@@ -36,7 +36,7 @@ export { WigTrackCanvas } from './tracks/wig/wigTrackCanvas';
|
|
|
36
36
|
export type { WigTrackCanvasOptions } from './tracks/wig/wigTrackCanvas';
|
|
37
37
|
export { summarizeWigData, computeWigDataRange } from './tracks/wig/wigSummary';
|
|
38
38
|
export { HeadlessGenomeBrowser, BrowserEvent } from './headlessGenomeBrowser';
|
|
39
|
-
export type { HeadlessGenomeBrowserOptions, ManagedTrack, AddRulerOptions, AddWigTrackOptions, AddGtxTrackOptions, AddBedTrackOptions, AddAnnotationTrackOptions, AddInteractionTrackOptions, AddSequenceTrackOptions } from './headlessGenomeBrowser';
|
|
39
|
+
export type { HeadlessGenomeBrowserOptions, ManagedTrack, AddRulerOptions, AddWigTrackOptions, AddGtxTrackOptions, AddBedTrackOptions, AddAnnotationTrackOptions, AddInteractionTrackOptions, AddSequenceTrackOptions, AddWigTrackWithFeaturesOptions, AddBedTrackWithFeaturesOptions } from './headlessGenomeBrowser';
|
|
40
40
|
export { GenomeBrowser } from './genomeBrowser';
|
|
41
41
|
export type { GenomeBrowserOptions, BrowserEvents } from './genomeBrowser';
|
|
42
42
|
export type { ChromSizes, CumulativeOffsets } from './genome/chromSizes';
|
|
@@ -92,6 +92,7 @@ export { GeneDataSource } from './dataSources/geneDataSource';
|
|
|
92
92
|
export { TextFeatureSource } from './dataSources/textFeatureSource';
|
|
93
93
|
export type { TextFeatureSourceConfig } from './dataSources/textFeatureSource';
|
|
94
94
|
export { SequenceDataSource } from './dataSources/sequenceDataSource';
|
|
95
|
+
export { MemoryDataSource } from './dataSources/memoryDataSource';
|
|
95
96
|
export { createFeatureSource } from './dataSources/featureSourceFactory';
|
|
96
97
|
export type { FeatureSourceConfig, FeatureSourceResult } from './dataSources/featureSourceFactory';
|
|
97
98
|
export { dataSourceCacheKey } from './dataSources/dataSourceCacheKey';
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { GenomeBrowser } from '../genomeBrowser';
|
|
2
|
+
import type { ShellTheme } from '../ui/themes';
|
|
2
3
|
export interface GenomeBrowserContextValue {
|
|
3
4
|
/** The underlying GenomeBrowser instance. null before initialization or during SSR. */
|
|
4
5
|
browser: GenomeBrowser | null;
|
|
6
|
+
/** Inferred shell theme for UI components. */
|
|
7
|
+
shellTheme: ShellTheme;
|
|
5
8
|
}
|
|
6
9
|
export declare const GenomeBrowserContext: import("react").Context<GenomeBrowserContextValue | null>;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import type { AnnotationRenderConfig, TextFileFormat } from '../../types';
|
|
1
|
+
import type { AnnotationFeature, AnnotationRenderConfig, TextFileFormat } from '../../types';
|
|
2
2
|
export interface BedTrackProps {
|
|
3
|
-
|
|
3
|
+
/** URL to a BED/peak file. Mutually exclusive with `features`. */
|
|
4
|
+
url?: string;
|
|
5
|
+
/** In-memory annotation features. Mutually exclusive with `url`. Features must include `chr`. */
|
|
6
|
+
features?: (AnnotationFeature & {
|
|
7
|
+
chr: string;
|
|
8
|
+
})[];
|
|
4
9
|
config?: Partial<AnnotationRenderConfig>;
|
|
5
10
|
height?: number;
|
|
6
11
|
background?: string;
|
|
@@ -11,4 +16,4 @@ export interface BedTrackProps {
|
|
|
11
16
|
name?: string;
|
|
12
17
|
metadata?: Record<string, string>;
|
|
13
18
|
}
|
|
14
|
-
export declare function BedTrack({ url, config, height, background, format, indexURL, indexed, maxTrackHeight, name, metadata }: BedTrackProps): null;
|
|
19
|
+
export declare function BedTrack({ url, features, config, height, background, format, indexURL, indexed, maxTrackHeight, name, metadata }: BedTrackProps): null;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type { WigRenderConfig, WindowFunction } from '../../types';
|
|
1
|
+
import type { WigFeature, WigRenderConfig, WindowFunction } from '../../types';
|
|
2
2
|
export interface WigTrackProps {
|
|
3
|
-
|
|
3
|
+
/** URL to a BigWig file. Mutually exclusive with `features`. */
|
|
4
|
+
url?: string;
|
|
5
|
+
/** In-memory wig features. Mutually exclusive with `url`. */
|
|
6
|
+
features?: WigFeature[];
|
|
4
7
|
config?: Partial<WigRenderConfig>;
|
|
5
8
|
height?: number;
|
|
6
9
|
background?: string;
|
|
@@ -9,4 +12,4 @@ export interface WigTrackProps {
|
|
|
9
12
|
name?: string;
|
|
10
13
|
metadata?: Record<string, string>;
|
|
11
14
|
}
|
|
12
|
-
export declare function WigTrack({ url, config, height, background, windowFunction, maxTrackHeight, name, metadata }: WigTrackProps): null;
|
|
15
|
+
export declare function WigTrack({ url, features, config, height, background, windowFunction, maxTrackHeight, name, metadata }: WigTrackProps): null;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { GenomeBrowser } from '../../genomeBrowser';
|
|
2
|
+
import type { ShellTheme } from '../../ui/themes';
|
|
2
3
|
import './types';
|
|
3
4
|
export interface NavbarProps {
|
|
4
5
|
/** Override the browser from context. */
|
|
5
6
|
browser?: GenomeBrowser | null;
|
|
7
|
+
/** Override the shell theme. By default, inferred from the parent LoomBrowser's render theme. */
|
|
8
|
+
theme?: ShellTheme;
|
|
6
9
|
}
|
|
7
|
-
export declare function Navbar({ browser: browserProp }: NavbarProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function Navbar({ browser: browserProp, theme: themeProp }: NavbarProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -736,7 +736,7 @@ export type SequenceSessionOverrides = Partial<SequenceRenderConfig>;
|
|
|
736
736
|
/** Serializable subset of InteractionRenderConfig (all fields are already serializable). */
|
|
737
737
|
export type InteractionSessionOverrides = Partial<InteractionRenderConfig>;
|
|
738
738
|
/** Discriminated union for data source reconstruction. */
|
|
739
|
-
export type DataSourceConfig = BigWigDataSourceConfig | GtxDataSourceConfig | UCSCDataSourceConfig | TextDataSourceConfig;
|
|
739
|
+
export type DataSourceConfig = BigWigDataSourceConfig | GtxDataSourceConfig | UCSCDataSourceConfig | TextDataSourceConfig | MemoryDataSourceConfig;
|
|
740
740
|
export interface BigWigDataSourceConfig {
|
|
741
741
|
type: 'bigwig';
|
|
742
742
|
url: string;
|
|
@@ -763,6 +763,9 @@ export interface TextDataSourceConfig {
|
|
|
763
763
|
/** Whether the file is indexed (tabix). When absent, auto-detected from indexURL presence. */
|
|
764
764
|
indexed?: boolean;
|
|
765
765
|
}
|
|
766
|
+
export interface MemoryDataSourceConfig {
|
|
767
|
+
type: 'memory';
|
|
768
|
+
}
|
|
766
769
|
/** Strand value for genomic features. */
|
|
767
770
|
export type Strand = '+' | '-' | '.';
|
|
768
771
|
/** Known text genomic file formats supported by the format detection system. */
|