view x/static/js/1752.a727a500.chunk.js.map @ 125:49f3d3878413 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 5ea1f9c1eef1de76232e69aa6d34cda77d90d566
author fubar
date Sat, 05 Oct 2024 23:58:05 +0000
parents
children
line wrap: on
line source

{"version":3,"file":"static/js/1752.a727a500.chunk.js","mappings":"+MAcA,MAAM,WAAEA,GAAeC,EAAAA,GAajBC,EAAI,4CACJC,EAAK,wCACLC,EAAK,2CACLC,EAAc,EAEpB,SAASC,EAAQC,EAA+BC,EAAWC,EAAWP,EAAI,GACxEK,EAAIG,YACJH,EAAII,IAAIH,EAAGC,EAAGP,EAAI,EAAG,EAAG,EAAIU,KAAKC,IACjCN,EAAIO,MACN,CAEOC,eAAeC,EACpBT,EACAU,GAEA,MAAM,OAAEC,EAAM,MAAEC,EAAK,OAAEC,EAAM,UAAEC,EAAS,MAAEC,GAAUL,EAC9CM,GAAQC,EAAAA,EAAAA,gBAAeN,EAAQ,SAC/BO,GAAWD,EAAAA,EAAAA,gBAAeN,EAAQ,YAClCQ,GAAWF,EAAAA,EAAAA,gBAAeN,EAAQ,YAClCS,GAAUH,EAAAA,EAAAA,gBAAeN,EAAQ,WACjCU,GAAYJ,EAAAA,EAAAA,gBAAeN,EAAQ,aACnCW,GAAaL,EAAAA,EAAAA,gBAAeN,EAAQ,cACpCY,GAAUN,EAAAA,EAAAA,gBAAeN,EAAQ,qBACjCa,EAAab,EAAOK,MAAMQ,WAC1BC,EAAQb,EAAM,GACdc,EAAQd,EAAM,GACde,EAAMF,EAAMG,cAAcC,cAAc,IAAIC,SAC5CC,EAAML,EAAME,cAAcC,cAAc,IAAIC,SAC5CE,EAAW,GACjBhC,EAAIqB,UAAYA,EAIhB,MAAQY,QAASC,GAAaT,GACtBQ,QAASE,GAAaT,EAE9B,SAASU,EACPC,EACAC,EACAC,EACAC,GAEA,MAAMC,EAASD,EAAQE,IAAI,WAAa,EAIxC,IAHgB,IAAZD,KACAF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B,CAEAjF,EAAI0F,QACN,MACE1F,EAAIG,YACJH,EAAIoF,OAAOT,EAAI9D,EAASgE,GACxB7E,EAAIyF,OAAOb,EAAI/D,EAASiE,GACxB9E,EAAI0F,QAER,CACF,MACM1D,EAAS8B,QAAU,SACTY,IAARP,QAA6BO,IAARH,EACvBvC,EAASc,KAAK,CACZC,QAAS,iBAAiBF,KAAWF,KAASC,wCAC9CI,OAAQ,yBAGVhB,EAASc,KAAK,CACZC,QAAS,iBAAiBY,KAAWT,EAAKP,SAASO,EAAKN,0CACxDI,OAAQ,yBAKlB,CAEA,MAAO,CAAEhB,WACX,C","sources":["../../../plugins/dotplot-view/src/DotplotRenderer/drawDotplot.ts"],"sourcesContent":["import {\n  readConfObject,\n  AnyConfigurationModel,\n} from '@jbrowse/core/configuration'\nimport { Feature } from '@jbrowse/core/util'\nimport { bpToPx } from '@jbrowse/core/util/Base1DUtils'\nimport { getSnapshot } from 'mobx-state-tree'\nimport { RenderArgsDeserialized } from '@jbrowse/core/pluggableElementTypes/renderers/ComparativeServerSideRendererType'\nimport { MismatchParser } from '@jbrowse/plugin-alignments'\n\n// locals\nimport { Dotplot1DViewModel } from '../DotplotView/model'\nimport { createJBrowseTheme } from '@jbrowse/core/ui'\n\nconst { parseCigar } = MismatchParser\n\nexport interface DotplotRenderArgsDeserialized extends RenderArgsDeserialized {\n  adapterConfig: AnyConfigurationModel\n  height: number\n  width: number\n  highResolutionScaling: number\n  view: {\n    hview: Dotplot1DViewModel\n    vview: Dotplot1DViewModel\n  }\n}\n\nconst r = 'fell outside of range due to CIGAR string'\nconst lt = '(less than min coordinate of feature)'\nconst gt = '(greater than max coordinate of feature)'\nconst fudgeFactor = 1 // allow 1px fuzzyness before warn\n\nfunction drawCir(ctx: CanvasRenderingContext2D, x: number, y: number, r = 1) {\n  ctx.beginPath()\n  ctx.arc(x, y, r / 2, 0, 2 * Math.PI)\n  ctx.fill()\n}\n\nexport async function drawDotplot(\n  ctx: CanvasRenderingContext2D,\n  props: DotplotRenderArgsDeserialized & { views: Dotplot1DViewModel[] },\n) {\n  const { config, views, height, drawCigar, theme } = props\n  const color = readConfObject(config, 'color')\n  const posColor = readConfObject(config, 'posColor')\n  const negColor = readConfObject(config, 'negColor')\n  const colorBy = readConfObject(config, 'colorBy')\n  const lineWidth = readConfObject(config, 'lineWidth')\n  const thresholds = readConfObject(config, 'thresholds')\n  const palette = readConfObject(config, 'thresholdsPalette') as string[]\n  const isCallback = config.color.isCallback\n  const hview = views[0]!\n  const vview = views[1]!\n  const db1 = hview.dynamicBlocks.contentBlocks[0]?.offsetPx\n  const db2 = vview.dynamicBlocks.contentBlocks[0]?.offsetPx\n  const warnings = [] as { message: string; effect: string }[]\n  ctx.lineWidth = lineWidth\n\n  // we operate on snapshots of these attributes of the hview/vview because\n  // it is significantly faster than accessing the mobx objects\n  const { bpPerPx: hBpPerPx } = hview\n  const { bpPerPx: vBpPerPx } = vview\n\n  function clampWithWarnX(\n    num: number,\n    min: number,\n    max: number,\n    feature: Feature,\n  ) {\n    const strand = feature.get('strand') || 1\n    if (strand === -1) {\n      ;[max, min] = [min, max]\n    }\n    if (num < min - fudgeFactor) {\n      let start = feature.get('start')\n      let end = feature.get('end')\n      const refName = feature.get('refName')\n      if (strand === -1) {\n        ;[end, start] = [start, end]\n      }\n\n      warnings.push({\n        message: `feature at (X ${refName}:${start}-${end}) ${r} ${lt}`,\n        effect: 'clipped the feature',\n      })\n      return min\n    }\n    if (num > max + fudgeFactor) {\n      const strand = feature.get('strand') || 1\n      const start = strand === 1 ? feature.get('start') : feature.get('end')\n      const end = strand === 1 ? feature.get('end') : feature.get('start')\n      const refName = feature.get('refName')\n\n      warnings.push({\n        message: `feature at (X ${refName}:${start}-${end}) ${r} ${gt}`,\n        effect: 'clipped the feature',\n      })\n      return max\n    }\n    return num\n  }\n\n  function clampWithWarnY(\n    num: number,\n    min: number,\n    max: number,\n    feature: Feature,\n  ) {\n    if (num < min - fudgeFactor) {\n      const mate = feature.get('mate')\n      const { refName, start, end } = mate\n      warnings.push({\n        message: `feature at (Y ${refName}:${start}-${end}) ${r} ${lt}`,\n        effect: 'clipped the feature',\n      })\n      return min\n    }\n    if (num > max + fudgeFactor) {\n      const mate = feature.get('mate')\n      const { refName, start, end } = mate\n\n      warnings.push({\n        message: `feature at (Y ${refName}:${start}-${end}) ${r} ${gt}`,\n        effect: 'clipped the feature',\n      })\n      return max\n    }\n    return num\n  }\n\n  const hsnap = {\n    ...getSnapshot(hview),\n    staticBlocks: hview.staticBlocks,\n    width: hview.width,\n  }\n  const vsnap = {\n    ...getSnapshot(vview),\n    staticBlocks: vview.staticBlocks,\n    width: vview.width,\n  }\n  const t = createJBrowseTheme(theme)\n  for (const feature of hview.features || []) {\n    const strand = feature.get('strand') || 1\n    const start = strand === 1 ? feature.get('start') : feature.get('end')\n    const end = strand === 1 ? feature.get('end') : feature.get('start')\n    const refName = feature.get('refName')\n    const mate = feature.get('mate')\n    const mateRef = mate.refName\n\n    let r = 'black'\n    if (colorBy === 'identity') {\n      const identity = feature.get('identity')\n      for (let i = 0; i < thresholds.length; i++) {\n        if (identity > +thresholds[i]) {\n          r = palette[i] || 'black'\n          break\n        }\n      }\n    } else if (colorBy === 'meanQueryIdentity') {\n      r = `hsl(${feature.get('meanScore') * 200},100%,40%)`\n    } else if (colorBy === 'mappingQuality') {\n      r = `hsl(${feature.get('mappingQual')},100%,40%)`\n    } else if (colorBy === 'strand') {\n      r = strand === -1 ? negColor : posColor\n    } else if (colorBy === 'default') {\n      r = isCallback\n        ? readConfObject(config, 'color', { feature })\n        : color === '#f0f'\n          ? t.palette.text.primary\n          : color\n    }\n    ctx.fillStyle = r\n    ctx.strokeStyle = r\n\n    const b10 = bpToPx({ self: hsnap, refName, coord: start })\n    const b20 = bpToPx({ self: hsnap, refName, coord: end })\n    const e10 = bpToPx({ self: vsnap, refName: mateRef, coord: mate.start })\n    const e20 = bpToPx({ self: vsnap, refName: mateRef, coord: mate.end })\n    if (\n      b10 !== undefined &&\n      b20 !== undefined &&\n      e10 !== undefined &&\n      e20 !== undefined\n    ) {\n      const b1 = b10.offsetPx - db1!\n      const b2 = b20.offsetPx - db1!\n      const e1 = e10.offsetPx - db2!\n      const e2 = e20.offsetPx - db2!\n      if (Math.abs(b1 - b2) <= 4 && Math.abs(e1 - e2) <= 4) {\n        drawCir(ctx, b1, height - e1, lineWidth)\n      } else {\n        let currX = b1\n        let currY = e1\n        const cigar = feature.get('CIGAR')\n        if (drawCigar && cigar) {\n          const cigarOps = parseCigar(cigar)\n\n          ctx.beginPath()\n          ctx.moveTo(currX, height - currY)\n\n          let lastDrawnX = currX\n          let lastDrawnY = currX\n          for (let i = 0; i < cigarOps.length; i += 2) {\n            const val = +cigarOps[i]!\n            const op = cigarOps[i + 1]!\n            if (op === 'M' || op === '=' || op === 'X') {\n              currX += (val / hBpPerPx) * strand\n              currY += val / vBpPerPx\n            } else if (op === 'D' || op === 'N') {\n              currX += (val / hBpPerPx) * strand\n            } else if (op === 'I') {\n              currY += val / vBpPerPx\n            }\n            currX = clampWithWarnX(currX, b1, b2, feature)\n            currY = clampWithWarnY(currY, e1, e2, feature)\n\n            // only draw a line segment if it is bigger than 0.5px\n            if (\n              Math.abs(currX - lastDrawnX) > 0.5 ||\n              Math.abs(currY - lastDrawnY) > 0.5\n            ) {\n              ctx.lineTo(currX, height - currY)\n              lastDrawnX = currX\n              lastDrawnY = currY\n            }\n          }\n\n          ctx.stroke()\n        } else {\n          ctx.beginPath()\n          ctx.moveTo(b1, height - e1)\n          ctx.lineTo(b2, height - e2)\n          ctx.stroke()\n        }\n      }\n    } else {\n      if (warnings.length <= 5) {\n        if (b10 === undefined || b20 === undefined) {\n          warnings.push({\n            message: `feature at (X ${refName}:${start}-${end}) not plotted, fell outside of range`,\n            effect: 'feature not rendered',\n          })\n        } else {\n          warnings.push({\n            message: `feature at (Y ${mateRef}:${mate.start}-${mate.end}) not plotted, fell outside of range`,\n            effect: 'feature not rendered',\n          })\n        }\n      }\n    }\n  }\n\n  return { warnings }\n}\n"],"names":["parseCigar","MismatchParser","r","lt","gt","fudgeFactor","drawCir","ctx","x","y","beginPath","arc","Math","PI","fill","async","drawDotplot","props","config","views","height","drawCigar","theme","color","readConfObject","posColor","negColor","colorBy","lineWidth","thresholds","palette","isCallback","hview","vview","db1","dynamicBlocks","contentBlocks","offsetPx","db2","warnings","bpPerPx","hBpPerPx","vBpPerPx","clampWithWarnX","num","min","max","feature","strand","get","start","end","refName","push","message","effect","clampWithWarnY","mate","hsnap","getSnapshot","staticBlocks","width","vsnap","t","createJBrowseTheme","features","mateRef","identity","i","length","text","primary","fillStyle","strokeStyle","b10","bpToPx","self","coord","b20","e10","e20","undefined","b1","b2","e1","e2","abs","currX","currY","cigar","cigarOps","moveTo","lastDrawnX","lastDrawnY","val","op","lineTo","stroke"],"sourceRoot":""}