UNPKG

@jbrowse/plugin-wiggle

Version:

JBrowse 2 wiggle adapters, tracks, etc.

30 lines (29 loc) 1.38 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { forwardRef } from 'react'; import { toLocale } from '@jbrowse/core/util'; import { observer } from 'mobx-react'; import Tooltip from "../../Tooltip.js"; import { toP } from "../../util.js"; const en = toLocale; 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(':'); const minScore = feature.get('minScore'); const maxScore = feature.get('maxScore'); const hasSummary = feature.get('summary') && minScore != null; return hasSummary ? (_jsxs("div", { ref: ref, children: [loc, _jsx("br", {}), "Max: ", toP(maxScore), _jsx("br", {}), "Avg: ", toP(feature.get('score')), _jsx("br", {}), "Min: ", toP(minScore)] })) : (_jsxs("div", { ref: ref, children: [loc, _jsx("br", {}), `${toP(feature.get('score'))}`] })); }); const WiggleTooltip = observer(function WiggleTooltip(props) { return _jsx(Tooltip, { TooltipContents: TooltipContents, ...props }); }); export default WiggleTooltip; export { default as Tooltip } from "../../Tooltip.js";