UNPKG

higlass

Version:

HiGlass Hi-C / genomic / large data viewer

763 lines (762 loc) 29.2 kB
export default HiGlassComponent; declare class HiGlassComponent extends React.Component<any, any, any> { constructor(props: any); topDivRef: React.RefObject<any>; pubSub: any; domEvent: any; pubSubs: any[]; minHorizontalHeight: number; minVerticalWidth: number; resizeSensor: ResizeSensor | null; uid: string; /** @type {Record<string, import('./TiledPlot').TiledPlot> */ tiledPlots: Record<string, import("./TiledPlot").TiledPlot>; genomePositionSearchBoxes: {}; /** @type {Record<string, import('./TrackRenderer').Scale>} */ xScales: Record<string, import("./TrackRenderer").Scale>; /** @type {Record<string, import('./TrackRenderer').Scale>} */ yScales: Record<string, import("./TrackRenderer").Scale>; projectionXDomains: {}; projectionYDomains: {}; topDiv: any; zoomToDataExtentOnInit: Set<any>; viewTrackUidsToCombinedUid: {}; combinedUidToViewTrack: {}; scalesChangedListeners: {}; draggingChangedListeners: {}; valueScalesChangedListeners: {}; zoomLocks: {}; locationLocks: {}; locationLocksAxisWise: { x: {}; y: {}; }; valueScaleLocks: {}; prevAuthToken: any; setCenters: {}; plusImg: {}; configImg: {}; viewMarginTop: number; viewMarginBottom: number; viewMarginLeft: number; viewMarginRight: number; viewPaddingTop: number; viewPaddingBottom: number; viewPaddingLeft: number; viewPaddingRight: number; genomePositionSearchBox: any; viewHeaders: {}; boundRefreshView: () => void; unsetOnLocationChange: any[]; viewconfLoaded: boolean; pixiRoot: PIXI.Container<PIXI.DisplayObject>; pixiStage: PIXI.Container<PIXI.DisplayObject>; pixiMask: PIXI.Graphics; element: any; scrollTop: number; mounted: boolean; pluginTracks: {}; pluginDataFetchers: any; state: { currentBreakpoint: string; width: number; height: number; rowHeight: number; svgElement: null; canvasElement: null; customDialog: null; views: {}; viewConfig: any; addTrackPositionMenuPosition: null; typedEditable: undefined; mouseOverOverlayUid: null; mouseTool: string; overTrackChooser: null; isDarkTheme: boolean; rangeSelection1dSize: number[]; rangeSelectionToInt: boolean; modal: null; sizeMode: any; }; attachedToDOM: boolean; api: { readonly version: string; setBroadcastMousePositionGlobally(isBroadcastMousePositionGlobally?: boolean): void; setShowGlobalMousePosition(isShowGlobalMousePosition?: boolean): void; setGlobalMousePosition(isGlobalMousePosition?: boolean): void; setAuthHeader(newHeader: string): void; getAuthHeader(): string | null; getComponent(): HiGlassComponent; reload(target: array): void; destroy(): void; setRangeSelectionToInt(): void; setRangeSelectionToFloat(): void; setRangeSelection1dSize(minSize?: number, maxSize?: number): void; setViewConfig(newViewConfig: obj, resolveImmediately?: boolean): Promise<any>; getViewConfig(): any; validateViewConfig(viewConfig: any, { verbose }?: { verbose?: boolean | undefined; }): boolean | PromiseLike<any>; getMinMaxValue(viewId: string, trackId: string, ignoreOffScreenValues?: bool, ignoreFixedScale?: bool): any[]; shareViewConfigAsLink(url: string): Object; showAvailableTrackPositions(track: obj): void; hideAvailableTrackPositions(): void; measureSize(): void; showTrackChooser(callback: Function): [type]; hideTrackChooser(): void; setTrackValueScaleLimits(viewId?: string, trackId?: string, minValue: any, maxValue: any): void; setDarkTheme(darkTheme: any): void; setTheme(theme: any): void; zoomTo(viewUid: string, start1Abs: number, end1Abs: number, start2Abs: number, end2Abs: number, animateTime?: number): void; zoomToGene(viewUid: string, geneName: string, padding?: string, animateTime?: number): void; suggestGene(viewUid: string, keyword: string, callback: Function): void; zoomToDataExtent(viewUid: string): void; resetViewport(viewId: string): void; activateTool(tool: any): void; setSizeMode(sizeMode: string): void; exportAsPngBlobPromise(): promise; exportAsSvg(): string; exportAsViewConfString(): string; getRangeSelection(): any[]; getLocation(viewId?: string): obj; getTrackObject(viewId: string, trackId: string): obj; option(key: string, value: any): obj; off(event: string, listenerId: any, viewId: string): void; on(event: string, callback: Function, viewId: string, callbackId: any): any; }; apiDestroy: () => void; apiPublish: any; apiStack: any; viewChangeListener: any[]; triggerViewChangeDb: { (...args: any[]): void; cancel(): void; }; rangeSelection: null[]; prevMouseHoverTrack: any; zooming: boolean; appClickHandlerBound: (data: any) => void; canvasClickHandlerBound: (evt: any) => void; keyDownHandlerBound: (event: any) => void; keyUpHandlerBound: (event: any) => void; resizeHandlerBound: () => void; dispatchEventBound: (e: any) => void; animateOnMouseMoveHandlerBound: (active: any) => void; zoomStartHandlerBound: () => void; zoomEndHandlerBound: () => void; zoomHandlerBound: (evt: any) => void; trackDroppedHandlerBound: () => void; trackDimensionsModifiedHandlerBound: (settings: { viewId: string; trackId: string; height: number; width: nmber; }) => void; animateBound: () => void; animateOnGlobalEventBound: ({ sourceUid }?: {}) => void; requestReceivedHandlerBound: () => void; wheelHandlerBound: (evt: any) => void; mouseMoveHandlerBound: (e: object) => void; onMouseLeaveHandlerBound: () => void; onBlurHandlerBound: () => void; openModalBound: (modal: any) => void; closeModalBound: () => void; handleEditViewConfigBound: () => void; onScrollHandlerBound: () => void; viewUidToNameBound: (viewUid: any) => string; typedText: string; typedTextTimeout: NodeJS.Timeout | null; modal: { open: (modal: any) => void; close: () => void; }; UNSAFE_componentWillMount(): void; get sizeMode(): any; setBroadcastMousePositionGlobally(isBroadcastMousePositionGlobally?: boolean): void; isBroadcastMousePositionGlobally: boolean | undefined; setShowGlobalMousePosition(isShowGlobalMousePosition?: boolean): void; isShowGlobalMousePosition: boolean | undefined; globalMousePositionListener: createPubSub.Subscription | undefined; zoomStartHandler(): void; zoomEndHandler(): void; zoomHandler(evt: any): void; waitForDOMAttachment(callback: any): void; componentDidMount(): void; pixiRenderer: any; getTrackObject(viewUid: any, trackUid: any): import("./types").TrackObject | undefined; getTrackRenderer(viewUid: any): import("./TrackRenderer").TrackRenderer | null; UNSAFE_componentWillReceiveProps(newProps: any): void; UNSAFE_componentWillUpdate(): void; reload(): void; componentDidUpdate(): void; componentWillUnmount(): void; setTheme(newTheme?: any, isDarkTheme?: any): void; theme: string | typeof THEME_LIGHT | typeof THEME_DARK | undefined; dispatchEvent(e: any): void; trackDroppedHandler(): void; requestReceivedHandler(): void; animateOnMouseMoveHandler(active: any): void; animateOnMouseMove: any; fitPixiToParentContainer(): void; /** * Add default track options. These can come from two places: * * 1. The track definitions (configs/tracks-info.js) * 2. The default options passed into the component * * Of these, #2 takes precendence over #1. * * @param {array} track The track to add default options to */ addDefaultTrackOptions(track: array): void; toggleTypedEditable(): void; /** Handle typed commands (e.g. e-d-i-t) */ typedTextHandler(event: any): void; keyDownHandler(event: any): void; keyUpHandler(event: any): void; openModal(modal: any): void; modalRef: any; closeModal(): void; handleEditViewConfig(): void; animate(): void; isRequestingAnimationFrame: boolean | undefined; animateOnGlobalEvent({ sourceUid }?: {}): void; measureSize(): void; updateAfterResize(): void; onBreakpointChange(breakpoint: any): void; handleOverlayMouseEnter(uid: any): void; handleOverlayMouseLeave(): void; /** * We want to lock the zoom of this view to the zoom of another view. * * First we pick which other view we want to lock to. * * The we calculate the current zoom offset and center offset. The differences * between the center of the two views will always remain the same, as will the * different between the zoom levels. */ handleLockLocation(uid: any): void; /** * Can views be added, removed or rearranged and are the view headers * visible? */ isEditable(): any; /** * Can views be added, removed or rearranged and are the view headers * visible? */ isTrackMenuDisabled(): any; /** * Can views be added, removed or rearranged and are the view headers * visible? */ isViewHeaderDisabled(): any; /** * Iteratate over all of the views in this component */ iterateOverViews(): string[]; iterateOverTracksInView(viewId: any): { viewId: any; trackId: any; track: any; }[]; /** * Iterate over all the tracks in this component. */ iterateOverTracks(): { viewId: string; trackId: string; track: import("./types").UnknownTrackConfig; }[]; setMouseTool(mouseTool: any): void; setSizeMode(sizeMode: any): void; /** * Checks if a track's value scale is locked with another track */ isValueScaleLocked(viewUid: any, trackUid: any): boolean; /** * Computed the minimal and maximal values of all tracks that are in the same * lockGroup as a given track * @param {string} viewUid The id of the view containing the track * @param {string} trackUid The id of the track * @return {array} Tuple [min,max] containing the overall extrema - or null. */ getLockGroupExtrema(viewUid: string, trackUid: string): array; /** * Syncing the values of locked scales * * Arguments * --------- * viewUid: string * The id of the view containing the track whose value scale initially changed * trackUid: string * The id of the track that whose value scale changed * * Returns * ------- * Nothing */ syncValueScales(viewUid: any, trackUid: any): void; handleNewTilesLoaded(viewUid: any, trackUid: any): void; notifyDragChangedListeners(dragging: any): void; /** * Add a listener that will be called every time the view is updated. * * @param viewUid: The uid of the view being observed * @param listenerUid: The uid of the listener * @param eventHandler: The handler to be called when the scales change * Event handler is called with parameters (xScale, yScale) */ addDraggingChangedListener(viewUid: any, listenerUid: any, eventHandler: any): void; /** * Remove a scale change event listener * * @param viewUid: The view that it's listening on. * @param listenerUid: The uid of the listener itself. */ removeDraggingChangedListener(viewUid: any, listenerUid: any): void; /** * Add an event listener that will be called every time the scale * of the view with uid viewUid is changed. * * @param viewUid: The uid of the view being observed * @param listenerUid: The uid of the listener * @param eventHandler: The handler to be called when the scales change * Event handler is called with parameters (xScale, yScale) */ addScalesChangedListener(viewUid: any, listenerUid: any, eventHandler: any): void; /** * Remove a scale change event listener * * @param viewUid: The view that it's listening on. * @param listenerUid: The uid of the listener itself. */ removeScalesChangedListener(viewUid: any, listenerUid: any): void; createSVG(): any; createSVGString(): string; handleExportSVG(): void; offPostCreateSVG(): void; postCreateSVGCallback: any; onPostCreateSVG(callback: any): void; createPNGBlobPromise(): Promise<any>; handleExportPNG(): void; handleScalesChanged(uid: any, xScale: any, yScale: any, notify?: boolean): void; handleProjectViewport(uid: any): void; /** * Adjust the zoom level so that all of the data is visible * * @param viewUid: The view uid for which to adjust the zoom level */ handleZoomToData(viewUid: any): void; /** * Reset the viewport to the initial x and y domain * @param {number} viewId - ID of the view for which the viewport should be * reset. */ resetViewport(viewId: number): void; /** * We want to yank some attributes from another view. * * This will create a view selection overlay and then call the selected * provided function. */ handleYankFunction(uid: any, yankFunction: any): void; /** * We want to unlock uid from the zoom group that it's in. * * @param uid: The uid of a view. */ handleUnlock(uid: any, lockGroups: any): void; viewScalesLockData(uid: any): [xCenter: number, yCenter: number, k: number] | null; addLock(uid1: any, uid2: any, lockGroups: any, lockData: any): void; handleLocationLockChosen(uid1: any, uid2: any): void; handleZoomLockChosen(uid1: any, uid2: any): void; /** * We want to project the viewport of fromView onto toTrack of toView. * * @param fromView: The uid of the view that we want to project * @param toView: The uid of the view that we want to project to * @param toTrack: The track we want to project to * * Returns * ------- * * newTrackUid: string * The uid of the newly created viewport projection track */ handleViewportProjected(fromView: any, toView: any, toTrack: any): string | null; /** * Uid1 is copying the center of uid2 */ handleLocationYanked(uid1: any, uid2: any): void; /** * Uid1 yanked the zoom of uid2, now make sure that they're synchronized. */ handleZoomYanked(uid1: any, uid2: any): void; /** * The user has chosen a position for the new track. The actual * track selection will be handled by TiledPlot * * We just need to close the menu here. */ handleTrackPositionChosen(viewUid: any, position: any, extent: any): void; /** * Update the height of each row in the layout so that it takes up all * of the available space in the div. */ updateRowHeight(): void; /** * Notify the children that the layout has changed so that they * know to redraw themselves */ handleLayoutChange(layout: any): void; /** * Maybe somebody started dragging again before the previous drag * timeout fired. In that case, we need to clear this timeout so * that it doesn't override a previously set one. */ clearDragTimeout(): void; dragTimeout: NodeJS.Timeout | null | undefined; getTrackInfo(trackType: any): any; forceRefreshView(): void; refreshView(timeout?: number): void; handleDragStart(): void; handleDragStop(): void; resizeHandler(): void; /** * Get the dimensions for this view, counting just the tracks * that are present in it * * @param view: A view containing a list of tracks as a member. * @return: A width and a height pair (e.g. [width, height]) */ calculateViewDimensions(view: any): { totalWidth: number; totalHeight: number; topHeight: number; bottomHeight: number; leftWidth: number; rightWidth: number; centerWidth: number; centerHeight: number; minNecessaryHeight: number; }; calculateZoomLimits(view: any, initialXDomain: any): number[]; generateViewLayout(view: any): any; /** * Remove all the tracks from a view * * @param {viewUid} Thie view's identifier */ handleClearView(viewUid: any): void; /** * A view needs to be closed. Remove it from from the viewConfig and then clean * up all of its connections (zoom links, workers, etc...) * * @param {uid} This view's identifier */ handleCloseView(uid: any): void; /** * We're adding a new dataset to an existing track * * @param newTrack: The new track to be added. * @param position: Where the new series should be placed. * (This could also be inferred from the hostTrack, but since * we already have it, we might as well use it) * @param hostTrack: The track that will host the new series. */ handleSeriesAdded(viewId: any, newTrack: any, position: any, hostTrack: any): void; handleNoTrackAdded(): void; /** * Add multiple new tracks (likely from the AddTrackModal dialog) * * @param trackInfo: A JSON object that can be used as a track * definition * @param position: The position the track is being added to * @param host: If this track is being added to another track */ handleTracksAdded(viewId: any, newTracks: any, position: any, extent: any, host: any): void; /** * Change the type of a track. For example, convert a line to a bar track. * * Parameters * ---------- * viewUid: string * The view containing the track to be changed * trackUid: string * The uid identifying the existin track * newType: string * The type to switch this track to. */ handleChangeTrackType(viewUid: any, trackUid: any, newType: any): void; /** * Change the data source for a track. E.g. when adding or * removing a divisor. * * Parameters * ---------- * viewUid: string * The view containing the track to be changed * trackUid: string * The uid identifying the existin track * newData: object * The new data source section */ handleChangeTrackData(viewUid: any, trackUid: any, newData: any): void; /** * A track was added from the AddTrackModal dialog. * * @param trackInfo: A JSON object that can be used as a track * definition * @param position: The position the track is being added to * @param host: If this track is being added to another track * * @returns {Object}: A trackConfig (\{ uid: "", width: x \}) * describing this track */ handleTrackAdded(viewId: any, newTrack: any, position: any, extent?: null, host?: null): Object; /** * We're adding a new heatmap to a combined track. We need to make sure that * their options are compatible. * * @param {object} newTrack New heatmap track * @param {object} combinedTrack Combined track the new heatmap is added to */ compatibilityfyStackedHeatmaps(newTrack: object, combinedTrack: object): void; /** * Go through each track and store its size in the viewconf. * * This is so that sizes don't get lost when the view is unbounded * and new tracks are added. * * Parameters * ---------- * * viewId : string * The id of the view whose tracks we're measuring * * Returns * ------- * * Nothing */ storeTrackSizes(viewId: any): void; adjustLayoutToTrackSizes(view: any): void; handleCloseTrack(viewId: any, uid: any): {}; handleLockValueScale(fromViewUid: any, fromTrackUid: any): void; combineViewAndTrackUid(viewUid: any, trackUid: any): any; /** * Update all locks involving this track to use a new track uid. * * @param {string} viewUid The view's uid * @param {string} oldTrackUid The track's old uid * @param {string} newTrackUid The track's new uid */ updateTrackLocks(viewUid: string, oldTrackUid: string, newTrackUid: string): void; handleUnlockValueScale(viewUid: any, trackUid: any): void; handleValueScaleLocked(fromViewUid: any, fromTrackUid: any, toViewUid: any, toTrackUid: any): void; /** * Add callbacks for functions that need them * * Done in place. * * @param {string} viewUid * @param {{ * type: string; * uid: string; * fromViewUid: string; * registerViewportChanged: (string: trackId, listener: () => void) => void; * removeViewportChanged: (string: trackId) => void; * removeScalesChangedListener: (string: trackId) => void; * }} track A view with tracks. */ addCallbacks(viewUid: string, track: { type: string; uid: string; fromViewUid: string; registerViewportChanged: (string: trackId, listener: () => void) => void; removeViewportChanged: (string: trackId) => void; removeScalesChangedListener: (string: trackId) => void; }): void; validateLocks(locks: any): void; deserializeLocationLocks(viewConfig: any): void; deserializeZoomLocks(viewConfig: any): void; deserializeValueScaleLocks(viewConfig: any): void; serializeLocks(locks: any): { locksByViewUid: {}; locksDict: {}; }; getViewsAsJson(views: any): any; getViewsAsString(): string; handleExportViewAsJSON(): void; handleExportViewsAsLink(url?: any, fromApi?: boolean): Promise<{ id: any; url: string; }>; handleDataDomainChanged(viewUid: any, newXDomain: any, newYDomain: any): void; /** * Check if we can place a view at this position */ viewPositionAvailable(pX: any, pY: any, w: any, h: any): boolean; /** * User clicked on the "Add View" button. We'll duplicate the last * view. */ handleAddView(view: any, newViewParams: any, noUpdate: any): { newViewUid: any; newViewconf: any; }; createGenomePostionSearchBoxEntry(existingGenomePositionSearchBox: any, suggestedAssembly: any): any; handleTogglePositionSearchBox(viewUid: any): void; handleTrackOptionsChanged(viewUid: any, trackUid: any, newOptions: any): void; /** * For convenience we adjust some options of split heatmap tracks when they are newly added. * This function has no effect when we get split heatmap tracks that are already correctly configured * (i.e. correctly set "lower-extend"/"upper-extend" options) * @param {object} track Track whose options have changed * @param {object} options New track options * @param {list} allTracks All tracks * @param {string} viewUid Related view UID */ adjustSplitHeatmapTrackOptions(track: object, options: object, allTracks: list, viewUid: string): void; handleViewOptionsChanged(viewUid: any, newOptions: any): void; /** * Determine whether a track is valid and can be displayed. * * Tracks can be invalid due to inconsistent input such as * referral to views that don't exist * * @param track (object): A track definition * @param viewUidsPresent (Set): The view uids which are available */ isTrackValid(track: any, viewUidsPresent: any): boolean; /** * Remove tracks which can no longer be shown (possibly because the views they * refer to no longer exist */ removeInvalidTracks(viewsByUid: any): any; processViewConfig(viewConfig: any): {}; handleWindowFocused(): void; /** * Handle range selection events. * * @description * Store active range selectio and forward the range selection event to the * API. * * @param {Array} range Double array of the selected range. */ rangeSelectionHandler(range: any[]): void; offViewChange(callback: any): void; onViewChange(callback: any): number; triggerViewChange(): void; getGenomeLocation(viewId: any): Promise<[startChromName: string, startChromPos: number, endChromName: string, endChromPos: number, startChromName: string, startChromPos: number, endChromName: string, endChromPos: number] | undefined>; offLocationChange(viewId: any, listenerId: any): void; zoomTo(viewUid: any, start1Abs: any, end1Abs: any, start2Abs: any, end2Abs: any, animateTime: any): void; zoomToGene(viewUid: any, geneName: any, padding: any, animateTime: any): void; suggestGene(viewUid: any, keyword: any, callback: any): void; onLocationChange(viewId: any, callback: any, callbackId: any): number | null; /** * List all the views that are at the given position view position */ getTiledPlotAtPosition(x: any, y: any): import("./TiledPlot").TiledPlot | undefined; /** * Handle mousemove events by republishing the event using pubSub. * * @param {object} e Event object. */ mouseMoveHandler(e: object): void; getMinMaxValue(viewId: any, trackId: any, ignoreOffScreenValues: any, ignoreFixedScale: any): any[] | undefined; /** * Show a menu displaying some information about the track under it */ showHoverMenu(evt: any): void; /** * Hide the hover menu when e.g. the user starts zooming */ hideHoverMenu(): void; /** * Close the custom dialog (e.g. when the close button is clicked) */ closeCustomDialog(): void; /** * Handle internally broadcasted click events */ appClickHandler(data: any): void; /** Handle click events on the canvas. The canvas is preferrable * to the top level div because the canvas's events aren't forwarded * so we only receive one click event */ canvasClickHandler(evt: any): void; /** * Handle mousemove and zoom events. */ mouseMoveZoomHandler(data: any): void; /** * Handle gene search events. */ geneSearchHandler(data: any): void; /** * Handle mousedown events/ */ mouseDownHandler(evt: any): void; onScrollHandler(): void; setTrackValueScaleLimits(viewId: any, trackId: any, minValue: any, maxValue: any): void; setChromInfo(chromInfoPath: any, callback: any): void; chromInfo: any; onMouseLeaveHandler(): void; onBlurHandler(): void; isZoomFixed(view: any): any; /** * Handle trackDimensionsModified events * @param {Object} settings * @param {string} settings.viewId = id of the view * @param {string} settings.trackId = id of the track * @param {number} settings.height = new height of the track or undefined if current height should remain * @param {nmber} settings.width = new width of the track or undefined if current width should remain */ trackDimensionsModifiedHandler(settings: { viewId: string; trackId: string; height: number; width: nmber; }): void; wheelHandler(evt: any): void; /** Convert a viewUid to a view name so that when we create * viewport projects, we can show which view they refer to. * The name is usually a single letter like 'A' * The view's name will also be visible in the header. */ viewUidToName(viewUid: any): string; render(): React.JSX.Element; tiledAreasDivs: {} | undefined; tiledAreas: React.JSX.Element | React.JSX.Element[] | undefined; gridLayout: any; canvasElement: HTMLCanvasElement | null | undefined; scrollContainer: HTMLDivElement | null | undefined; divDrawingSurface: HTMLDivElement | null | undefined; svgElement: SVGSVGElement | null | undefined; } declare namespace HiGlassComponent { namespace defaultProps { let options: {}; let zoomFixed: boolean; let compactLayout: boolean; } namespace propTypes { export let getApi: PropTypes.Requireable<(...args: any[]) => any>; let options_1: PropTypes.Requireable<object>; export { options_1 as options }; export let viewConfig: PropTypes.Validator<NonNullable<NonNullable<string | object | null | undefined>>>; let zoomFixed_1: PropTypes.Requireable<boolean>; export { zoomFixed_1 as zoomFixed }; let compactLayout_1: PropTypes.Requireable<boolean>; export { compactLayout_1 as compactLayout }; } } import React from 'react'; import { ResizeSensor } from 'css-element-queries'; import * as PIXI from 'pixi.js'; import createPubSub from 'pub-sub-es'; import { THEME_LIGHT } from './configs'; import { THEME_DARK } from './configs'; import PropTypes from 'prop-types';