-
Notifications
You must be signed in to change notification settings - Fork 29
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: React-less and HiGlass-less Gosling.js #1094
base: main
Are you sure you want to change the base?
Conversation
feat: new demo page
feat: PixiManager
feat: vendored HiGlass imports
feat: Dummy track
feat: TextTrack
feat: Circular Brush
feat: more data types
feat: tooltip
setHg(h); | ||
}} | ||
/> | ||
<GoslingComponent spec={goslingSpec} width={1000} height={2000} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional implementation needed here for removed options.
export { init } from './core/init'; | ||
// export { init } from './core/init'; | ||
export { compile } from './compiler/compile'; | ||
export { validateGoslingSpec } from '@gosling-lang/gosling-schema'; | ||
export { GoslingComponent } from './core/gosling-component'; | ||
// export { GoslingComponent } from './core/gosling-component'; | ||
export type { GoslingRef } from './core/gosling-component'; | ||
export { embed } from './core/gosling-embed'; | ||
// export { embed } from './core/gosling-embed'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be reverted back
@@ -484,6 +481,10 @@ declare module '@higlass/tracks' { | |||
abstract mouseMoveZoomHandler(absX?: number, abxY?: number): void; | |||
} | |||
|
|||
export abstract class HeatmapTiledPixiTrack<Options> extends Tiled1DPixiTrack<TileData, Options> { | |||
// TODO: fill this out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TS types to be added here
I'll try to tackle at least some of the typescript errors we get at Edit: some low-hanging fruit fixes bring this to |
PIXI API changed
Seems to be needed to solve an type error coming from PIXI (see: pixijs/pixijs#9729).
callback: CompileCallback, | ||
templates: TemplateTrackDef[], | ||
theme: Required<CompleteThemeDeep>, | ||
containerStatus: { | ||
containerSize?: { width: number; height: number }; | ||
containerParentSize?: { width: number; height: number }; | ||
}, | ||
urlToFetchOptions?: UrlToFetchOptions | ||
) { | ||
): CompileResult { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change makes sense (i.e., returning desired objects instead of passing over the callback function) but is not consistently reflected on other parts of code (e.g., several test fails come from this). I will stick to this change and address other parts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! I was slightly confused about the changes to compile
function and didn't want to touch it in case the callback approach is needed for some use case.
* fixed test fails related to compiled callback functions * fix all tests except one * remove comment statements
* chore: upgrade lint and prettier for new TS version * fix: all lint/prettier errors * chore: update the gosling schema
/** | ||
* After the Gosling spec is compiled, it is a "processed spec". | ||
* A processed spec has most of the same properties as the original spec, but some properties are | ||
* added or modified during the compilation process. | ||
* | ||
* For example, a valid Gosling spec may have no 'id' property, but a processed spec will always have an 'id' property. | ||
* | ||
* This file contains the types for the processed spec. | ||
* | ||
* TODO: this file is incomplete. It should be updated to include all the properties that a processed spec can have. | ||
*/ | ||
|
||
/** A Track after it has been compiled */ | ||
export type ProcessedTrack = ProcessedLinearTrack | ProcessedCircularTrack | ProcessedDummyTrack; | ||
/** All tracks potentially have these properties */ | ||
export interface ProcessedTrackBase { | ||
id: string; | ||
height: number; | ||
width: number; | ||
static: boolean; | ||
mark?: string; | ||
orientation: 'horizontal' | 'vertical'; | ||
title?: string; | ||
subtitle?: string; | ||
data?: DataDeep; | ||
assembly?: Assembly; | ||
overlayOnPreviousTrack?: boolean; | ||
_overlay?: OverlayTrack[]; | ||
color?: { value: string }; | ||
stroke?: { value: string }; | ||
opacity?: { value: number }; | ||
strokeWidth?: { value: number }; | ||
} | ||
|
||
export type ProcessedLinearTrack = ProcessedTrackBase & { | ||
layout: 'linear'; | ||
}; | ||
|
||
export type ProcessedCircularTrack = ProcessedTrackBase & { | ||
id: string; | ||
layout: 'circular'; | ||
startAngle: number; | ||
endAngle: number; | ||
outerRadius: number; | ||
innerRadius: number; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this change. I will see how I could address the TS errors that are occurred by this change.
I just realized one thing: function renderGosling(/* ... */) {
const compileResult = compile(gs, [], getTheme('light'), { containerSize: { width: 0, height: 0 } });
const { trackInfos, gs: processedSpec, theme } = compileResult;
/* ... */
} the // Make HiGlass models for individual tracks
const compileResult = createHiGlassModels(specCopy, trackInfos, theme, urlToFetchOptions); But the higlass part of The explanation in this diagram was super helpful to realize this. I hope I'm not mistaken. So I guess besides just documenting my confusion from today, the insight for the PR itself is that there's a lot more fat that needs trimming in the code! |
Ah, that's good to know. I didn't realize that those HiGlass-related parts are largely unused. I can try to see how I can cut the fat, and it may make the compiling process simpler. |
This is a PR of @etowahadams's fork that tries to get rid of HiGlass and React dependencies. Not yet ready to merge.
Issues to Address
pnpm build
gives a bunch of TypeScript errors (Found 43 errors in 13 files as of 8b3cea)pnpm test
gives 7 fails in 2 files → Fixed in #1097pnpm run format
gives 74 problems (29 errors, 45 warnings) → Fixed in #1099/demo
to eslint scope and fix lint errorsbam-data-fetcher.ts:55 Uncaught (in promise) ReferenceError: Buffer is not defined
). Probably, this should work in the preview (pnpm preview
).Track Templates: Genes, Sequence, and Ideograms
example in the Editor)src
. Currently they are underdemo