UNPKG

@jbrowse/plugin-wiggle

Version:

JBrowse 2 wiggle adapters, tracks, etc.

26 lines (25 loc) 1.23 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { forwardRef } from 'react'; import { observer } from 'mobx-react'; import Tooltip from '../../Tooltip'; import { toP } from '../../util'; const en = (n) => n.toLocaleString('en-US'); const TooltipContents = forwardRef(function TooltipContents2({ feature }, ref) { const start = feature.get('start') + 1; const end = feature.get('end'); const refName = feature.get('refName'); const name = feature.get('name'); const loc = [ refName, name, start === end ? en(start) : `${en(start)}..${en(end)}`, ] .filter(f => !!f) .join(':'); return feature.get('summary') !== undefined ? (_jsxs("div", { ref: ref, children: [loc, _jsx("br", {}), "Max: ", toP(feature.get('maxScore')), _jsx("br", {}), "Avg: ", toP(feature.get('score')), _jsx("br", {}), "Min: ", toP(feature.get('minScore'))] })) : (_jsxs("div", { ref: ref, children: [loc, _jsx("br", {}), `${toP(feature.get('score'))}`] })); }); const WiggleTooltip = observer(function (props) { return _jsx(Tooltip, { TooltipContents: TooltipContents, ...props }); }); export default WiggleTooltip; export { default as Tooltip } from '../../Tooltip';