Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): publish traversed spec to gosling api #978

Merged
merged 3 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/compiler/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type { UrlToFetchOptions } from 'src/core/gosling-component';
import { renderHiGlass as createHiGlassModels } from './create-higlass-models';
import { manageResponsiveSpecs } from './responsive';
import type { IdTable } from '../api/track-and-view-ids';
import { publish } from '../api/pubsub';

/** The callback function called everytime after the spec has been compiled */
export type CompileCallback = (
Expand Down Expand Up @@ -69,6 +70,13 @@ export function compile(
trackInfos = getRelativeTrackInfo(specCopy, theme).trackInfos;
}

// publish the fixed spec
// used for alt-gosling
publish('specProcessed', {
id: specCopy.id,
spec: specCopy
});

// Make HiGlass models for individual tracks
createHiGlassModels(specCopy, trackInfos, callback, theme, urlToFetchOptions);
}
8 changes: 8 additions & 0 deletions src/gosling-schema/gosling.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,13 @@ interface CommonEventData {
data: Datum[];
}

interface SpecEventData {
/** Source visualization ID, i.e., `track.id` */
id: string;
/** Gosling spec */
spec: GoslingSpec;
}

export interface GenomicPosition {
chromosome: string;
position: number;
Expand Down Expand Up @@ -372,6 +379,7 @@ export type _EventMap = {
click: PointMouseEventData;
rangeSelect: RangeMouseEventData;
rawData: CommonEventData;
specProcessed: SpecEventData;
trackMouseOver: TrackApiData;
trackClick: TrackApiData; // TODO (Jul-25-2022): with https://github.com/higlass/higlass/pull/1098, we can support circular layouts
onNewTrack: OnNewTrackEventData;
Expand Down
Loading