view x/static/js/3304.65e5d8dd.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/3304.65e5d8dd.chunk.js","mappings":"kMAgBA,SAASA,EAAOC,GACd,OAAuB,EAAhBC,KAAKC,SAAeF,EAAIA,CACjC,CASA,SAASG,EACPC,EACAC,EACAC,EACAC,GAGAH,EAAII,YAAcD,EAClBH,EAAIK,YACJL,EAAIM,OAAOL,EAAQ,GACnBD,EAAIO,OAAON,EAAQC,GACnBF,EAAIQ,QACN,CAEO,SAASC,EACdC,EACAV,EACAW,EACAT,GAEA,MAAM,UACJU,EAAS,QACTC,EAAO,UACPC,EAAS,cACTC,EAAa,iBACbC,EAAgB,UAChBC,GACEP,EACJ,IAAKE,EACH,OAEF,MAAMM,GAAOC,EAAAA,EAAAA,mBAAkBT,IACzB,gBAAEU,IAAoBC,EAAAA,EAAAA,YAAWX,IACjC,OAAEY,EAAM,MAAEC,GAAUX,EACpBY,GAAYC,EAAAA,EAAAA,GAAeb,GAC3Bc,EAAMN,EAAgBO,IAAIT,EAAKU,cAAc,IAC7CC,EAAOhB,GAASgB,MAAQ,2BAC9B,GAAKH,EAAL,CAGA1B,EAAI8B,UAAYd,EA6GhB,IAAK,MAAMe,KAAST,EAElB,GAAqB,IAAjBS,EAAMC,QAAgBjB,EAAe,CACvC,MAAMkB,EAAIF,EAAM,GAChB,IAAIP,GAAyB,EAAVS,EAAEC,MAQd,CACL,MAAMC,EAAW,CAACF,MAAMG,EAAAA,EAAAA,aAAYH,EAAEI,GAAIJ,EAAEK,GAAIL,EAAEM,OAAQN,EAAEO,OAAOC,MACjE,CAACC,EAAGC,IAAMD,EAAEE,QAAUD,EAAEC,UAE1B,IAAK,IAAIC,EAAI,EAAGA,EAAIV,EAASH,OAAS,EA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CAmCF,C,kBC/MO,SAASuB,EAAeU,GAC7B,IAAK,MAAMF,KAAKE,EAASb,OAAOiE,SAC9B,GAAkB,EAAdtD,EAAE,GAAIC,MACR,OAAO,EAGX,OAAO,CACT,C","sources":["../../../plugins/alignments/src/LinearReadArcsDisplay/drawFeats.ts","../../../plugins/alignments/src/shared/util.ts"],"sourcesContent":["import { getContainingView, getSession } from '@jbrowse/core/util'\nimport { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'\nimport { Assembly } from '@jbrowse/core/assemblyManager/assembly'\n\n// locals\nimport {\n  getPairedOrientationColor,\n  getPairedInsertSizeColor,\n  getPairedInsertSizeAndOrientationColor,\n} from '../shared/color'\nimport { featurizeSA } from '../MismatchParser'\nimport { LinearReadArcsDisplayModel } from './model'\nimport { hasPairedReads } from '../shared/util'\n\ntype LGV = LinearGenomeViewModel\n\nfunction jitter(n: number) {\n  return Math.random() * 2 * n - n\n}\n\ninterface CoreFeat {\n  strand: number\n  refName: string\n  start: number\n  end: number\n}\n\nfunction drawLineAtOffset(\n  ctx: CanvasRenderingContext2D,\n  offset: number,\n  height: number,\n  color: string,\n) {\n  // draws a vertical line off to middle of nowhere if the second end not found\n  ctx.strokeStyle = color\n  ctx.beginPath()\n  ctx.moveTo(offset, 0)\n  ctx.lineTo(offset, height)\n  ctx.stroke()\n}\n\nexport function drawFeats(\n  self: LinearReadArcsDisplayModel,\n  ctx: CanvasRenderingContext2D,\n  width: number,\n  height: number,\n) {\n  const {\n    chainData,\n    colorBy,\n    drawInter,\n    drawLongRange,\n    lineWidthSetting,\n    jitterVal,\n  } = self\n  if (!chainData) {\n    return\n  }\n  const view = getContainingView(self) as LGV\n  const { assemblyManager } = getSession(self)\n  const { chains, stats } = chainData\n  const hasPaired = hasPairedReads(chainData)\n  const asm = assemblyManager.get(view.assemblyNames[0]!)\n  const type = colorBy?.type || 'insertSizeAndOrientation'\n  if (!asm) {\n    return\n  }\n  ctx.lineWidth = lineWidthSetting\n\n  function draw(\n    k1: CoreFeat & { tlen?: number; pair_orientation?: string },\n    k2: CoreFeat,\n    assembly: Assembly,\n    longRange?: boolean,\n  ) {\n    const s1 = k1.strand\n    const s2 = k2.strand\n    const f1 = s1 === -1\n    const f2 = s2 === -1\n\n    const p1 = f1 ? k1.start : k1.end\n    const p2 = hasPaired ? (f2 ? k2.start : k2.end) : f2 ? k2.end : k2.start\n    const ra1 = assembly.getCanonicalRefName(k1.refName) || k1.refName\n    const ra2 = assembly.getCanonicalRefName(k2.refName) || k2.refName\n    const r1 = view.bpToPx({ refName: ra1, coord: p1 })?.offsetPx\n    const r2 = view.bpToPx({ refName: ra2, coord: p2 })?.offsetPx\n\n    if (r1 !== undefined && r2 !== undefined) {\n      const radius = (r2 - r1) / 2\n      const absrad = Math.abs(radius)\n      const p = r1 - view.offsetPx\n      const p2 = r2 - view.offsetPx\n      const drawArcInsteadOfBezier = absrad > 10_000\n\n      // bezier (used for non-long-range arcs) requires moveTo before beginPath\n      // arc (used for long-range) requires moveTo after beginPath (or else a\n      // unwanted line at y=0 is rendered along with the arc)\n      if (longRange && drawArcInsteadOfBezier) {\n        ctx.moveTo(p, 0)\n        ctx.beginPath()\n      } else {\n        ctx.beginPath()\n        ctx.moveTo(p, 0)\n      }\n\n      if (longRange && drawArcInsteadOfBezier) {\n        ctx.strokeStyle = 'red'\n      } else {\n        if (hasPaired) {\n          if (type === 'insertSizeAndOrientation') {\n            ctx.strokeStyle = getPairedInsertSizeAndOrientationColor(\n              k1,\n              k2,\n              stats,\n            )[0]\n          } else if (type === 'orientation') {\n            ctx.strokeStyle = getPairedOrientationColor(k1)[0]\n          } else if (type === 'insertSize') {\n            ctx.strokeStyle =\n              getPairedInsertSizeColor(k1, k2, stats)?.[0] || 'grey'\n          } else if (type === 'gradient') {\n            ctx.strokeStyle = `hsl(${Math.log10(absrad) * 10},50%,50%)`\n          }\n        } else {\n          if (type === 'orientation' || type === 'insertSizeAndOrientation') {\n            if (s1 === -1 && s2 === 1) {\n              ctx.strokeStyle = 'navy'\n            } else if (s1 === 1 && s2 === -1) {\n              ctx.strokeStyle = 'green'\n            } else {\n              ctx.strokeStyle = 'grey'\n            }\n          } else if (type === 'gradient') {\n            ctx.strokeStyle = `hsl(${Math.log10(absrad) * 10},50%,50%)`\n          }\n        }\n      }\n\n      const destX = p + radius * 2\n      const destY = Math.min(height + jitter(jitterVal), absrad)\n      if (longRange) {\n        // avoid drawing gigantic circles that glitch out the rendering,\n        // instead draw vertical lines\n        if (absrad > 100_000) {\n          drawLineAtOffset(ctx, p + jitter(jitterVal), height, 'red')\n          drawLineAtOffset(ctx, p2 + jitter(jitterVal), height, 'red')\n        } else if (drawArcInsteadOfBezier) {\n          ctx.arc(p + radius + jitter(jitterVal), 0, absrad, 0, Math.PI)\n          ctx.stroke()\n        } else {\n          ctx.bezierCurveTo(\n            p + jitter(jitterVal),\n            destY,\n            destX,\n            destY,\n            destX + jitter(jitterVal),\n            0,\n          )\n          ctx.stroke()\n        }\n      } else {\n        ctx.bezierCurveTo(\n          p + jitter(jitterVal),\n          destY,\n          destX,\n          destY,\n          destX + jitter(jitterVal),\n          0,\n        )\n        ctx.stroke()\n      }\n    } else if (r1 && drawInter) {\n      drawLineAtOffset(ctx, r1 - view.offsetPx, height, 'purple')\n    }\n  }\n\n  for (const chain of chains) {\n    // chain.length === 1, singleton (other pairs/mates not in view)\n    if (chain.length === 1 && drawLongRange) {\n      const f = chain[0]!\n      if (hasPaired && !(f.flags & 8)) {\n        const mate = {\n          refName: f.next_ref || '',\n          start: f.next_pos || 0,\n          end: f.next_pos || 0,\n          strand: f.strand,\n        }\n        draw(f, mate, asm, true)\n      } else {\n        const features = [f, ...featurizeSA(f.SA, f.id, f.strand, f.name)].sort(\n          (a, b) => a.clipPos - b.clipPos,\n        )\n        for (let i = 0; i < features.length - 1; i++) {\n          const f = features[i]!\n          const v1 = features[i + 1]!\n          draw(f, v1, asm, true)\n        }\n      }\n    } else {\n      const res = hasPaired\n        ? chain.filter(f => !(f.flags & 2048) && !(f.flags & 8))\n        : chain\n            .sort((a, b) => a.clipPos - b.clipPos)\n            .filter(f => !(f.flags & 256))\n      for (let i = 0; i < res.length - 1; i++) {\n        draw(res[i]!, res[i + 1]!, asm, false)\n      }\n    }\n  }\n}\n","import { ChainData } from './fetchChains'\n\nexport function hasPairedReads(features: ChainData) {\n  for (const f of features.chains.values()) {\n    if (f[0]!.flags & 1) {\n      return true\n    }\n  }\n  return false\n}\n"],"names":["jitter","n","Math","random","drawLineAtOffset","ctx","offset","height","color","strokeStyle","beginPath","moveTo","lineTo","stroke","drawFeats","self","width","chainData","colorBy","drawInter","drawLongRange","lineWidthSetting","jitterVal","view","getContainingView","assemblyManager","getSession","chains","stats","hasPaired","hasPairedReads","asm","get","assemblyNames","type","lineWidth","chain","length","f","flags","features","featurizeSA","SA","id","strand","name","sort","a","b","clipPos","i","draw","refName","next_ref","start","next_pos","end","res","filter","k1","k2","assembly","longRange","s1","s2","f2","p1","p2","ra1","getCanonicalRefName","ra2","r1","bpToPx","coord","offsetPx","r2","undefined","radius","absrad","abs","p","drawArcInsteadOfBezier","getPairedInsertSizeAndOrientationColor","getPairedOrientationColor","getPairedInsertSizeColor","log10","destX","destY","min","arc","PI","bezierCurveTo","values"],"sourceRoot":""}