view x/static/js/5682.ea285a50.chunk.js.map @ 133:cec274db51c0 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7d28252954cae9f8db5f8a85d8f29cb2865b504b-dirty
author fubar
date Fri, 18 Oct 2024 11:57:55 +0000
parents 49f3d3878413
children
line wrap: on
line source

{"version":3,"file":"static/js/5682.ea285a50.chunk.js","mappings":"sQAeA,MAAM,WAAEA,GAAeC,EAAAA,GAEvB,SAASC,EAAEC,GACT,OAAOC,KAAKC,MAAMF,EACpB,CACA,SAASG,EAAeC,EAAiBC,GACvC,IAAIC,EAAQ,EACRC,EAAQ,EACZ,IAAK,IAAIC,EAAI,EAAGA,EAAIJ,EAAMK,OAAQD,IAAK,CACrC,MAAME,GAAON,EAAMI,GACbG,EAAKP,EAAMI,EAAI,GACfI,EAAMX,KAAKW,IAAIF,EAAKL,EAASC,GAEnC,GAAIA,GAASD,EACX,MAES,MAAPM,EACFJ,GAASG,EACO,MAAPC,EACTL,GAASM,EACO,MAAPD,GAAqB,MAAPA,GAAqB,MAAPA,IACrCJ,GAASK,EACTN,GAASM,EAEb,CACA,MAAO,CAACN,EAAOC,EACjB,CC3BA,MAAMM,GAAYC,E,SAAAA,KAAAA,CAAa,CAC7BC,QAAS,CACPC,OAAQ,GACRC,OAAQ,oBAIG,SAASC,GAAwB,MAC9CC,EAAK,QACLC,EAAO,YACPC,IAMA,MAAM,QAAEC,GAAYT,IACdU,GAAsC,IAA3BH,EAAQI,IAAI,WACtBC,EAAkBC,IAAuBC,EAAAA,EAAAA,UAASJ,IAClDK,EAAYC,IAAiBF,EAAAA,EAAAA,UAAS,QAC7C,OACEG,EAAAA,cAACC,EAAAA,OAAM,CAACC,MAAI,EAACC,MAAM,sBAAsBC,QAASb,GAChDS,EAAAA,cAACK,EAAAA,EAAa,KACXZ,EACCO,EAAAA,cAACM,EAAAA,EAAgB,CACfC,UAAWf,EAAQP,QACnBuB,QACER,EAAAA,cAACS,EAAAA,EAAQ,CAC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B,EAAQC,CAC7D,MACEP,EAAab,EACbc,EAAWb,EACXU,EAAaR,EACbS,EAAWR,EAEb,MAAMiB,EAAUjC,EAAMkC,cAAcD,QAE9BE,EAAQrC,EAAQsC,QAAQ,oBAAqB,CACjDC,KAAM,oBACNC,MAAO,CACL,CACEC,GAAI,GAAG7F,KAAK8F,WACZH,KAAM,mBACNI,YAAY,GAEd,CACEF,GAAI,GAAG7F,KAAK8F,WACZH,KAAM,mBACNI,YAAY,IAGhBC,OAAQ,CACN,CACER,cAAeD,EACfI,KAAM,eACNM,SAAU,CACR,CACEN,KAAM,uBACNH,cAAe,GAAGD,+BAMtBW,EAAK,GAAGtB,KAAW9E,EAAEiF,EAAa5B,MAAOrD,EAAEkF,EAAW7B,KACtDgD,EAAKnG,KAAKW,IAAIkE,EAAYC,GAC1BsB,EAAKpG,KAAKqG,IAAIxB,EAAYC,GAC1BwB,EAAK,GAAG7B,KAAW3E,EAAEqG,EAAKhD,MAAOrD,EAAEsG,EAAKjD,KAC5C3B,EAAmB,QAAU,WAEzB+E,QAAQC,IAAI,CAChBf,EAAMG,MAAM,GAAIa,eAAeP,EAAIvB,GACnCc,EAAMG,MAAM,GAAIa,eAAeH,EAAI/B,IAEvC,CCpEsBmC,CAAa,CACjBvF,UACAQ,YAAaA,EACbH,mBACAN,SAEJ,CAAE,MAAOyF,GACPC,QAAQC,MAAMF,IACdtD,EAAAA,EAAAA,YAAWnC,GAAO4F,YAAY,GAAGH,IAAKA,EACxC,CACD,EAZA,GAaDvF,GAAa,GAEhB,UAGDS,EAAAA,cAACkB,EAAAA,EAAM,CACLC,QAAQ,YACR+D,MAAM,YACN9D,QAASA,KACP7B,GAAa,GAEhB,WAMT,C","sources":["../../../plugins/linear-comparative-view/src/LGVSyntenyDisplay/components/util.ts","../../../plugins/linear-comparative-view/src/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.tsx"],"sourcesContent":["import {\n  getSession,\n  getContainingTrack,\n  getContainingView,\n  Feature,\n} from '@jbrowse/core/util'\nimport { MismatchParser } from '@jbrowse/plugin-alignments'\nimport { IAnyStateTreeNode } from 'mobx-state-tree'\nimport { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'\n\n// locals\nimport { LinearSyntenyViewModel } from '../../LinearSyntenyView/model'\n\ntype LSV = LinearSyntenyViewModel\n\nconst { parseCigar } = MismatchParser\n\nfunction f(n: number) {\n  return Math.floor(n)\n}\nfunction findPosInCigar(cigar: string[], startX: number) {\n  let featX = 0\n  let mateX = 0\n  for (let i = 0; i < cigar.length; i++) {\n    const len = +cigar[i]!\n    const op = cigar[i + 1]!\n    const min = Math.min(len, startX - featX)\n\n    if (featX >= startX) {\n      break\n    }\n    if (op === 'I') {\n      mateX += len\n    } else if (op === 'D') {\n      featX += min\n    } else if (op === 'M' || op === '=' || op === 'X') {\n      mateX += min\n      featX += min\n    }\n  }\n  return [featX, mateX] as const\n}\n\nexport async function navToSynteny({\n  feature,\n  windowSize: ws,\n  model,\n  horizontallyFlip,\n}: {\n  windowSize: number\n  horizontallyFlip: boolean\n  feature: Feature\n  model: IAnyStateTreeNode\n}) {\n  const session = getSession(model)\n  const track = getContainingTrack(model)\n  const view = getContainingView(model) as LinearGenomeViewModel\n  const reg = view.dynamicBlocks.contentBlocks[0]\n  if (!reg) {\n    throw new Error('no visible region')\n  }\n  const cigar = feature.get('CIGAR')\n  const strand = feature.get('strand')\n  const regStart = reg.start\n  const regEnd = reg.end\n  const featStart = feature.get('start')\n  const featEnd = feature.get('end')\n  const mate = feature.get('mate')\n  const mateStart = mate.start\n  const mateEnd = mate.end\n  const mateAsm = mate.assemblyName\n  const mateRef = mate.refName\n  const featAsm = reg.assemblyName\n  const featRef = reg.refName\n\n  let rMateStart: number\n  let rMateEnd: number\n  let rFeatStart: number\n  let rFeatEnd: number\n\n  if (cigar) {\n    const p = parseCigar(cigar)\n    const [fStartX, mStartX] = findPosInCigar(p, regStart - featStart)\n    const [fEndX, mEndX] = findPosInCigar(p, regEnd - featStart)\n\n    // avoid multiply by 0 with strand undefined\n    const flipper = strand === -1 ? -1 : 1\n    rFeatStart = featStart + fStartX\n    rFeatEnd = featStart + fEndX\n    rMateStart = (strand === -1 ? mateEnd : mateStart) + mStartX * flipper\n    rMateEnd = (strand === -1 ? mateEnd : mateStart) + mEndX * flipper\n  } else {\n    rFeatStart = featStart\n    rFeatEnd = featEnd\n    rMateStart = mateStart\n    rMateEnd = mateEnd\n  }\n  const trackId = track.configuration.trackId\n\n  const view2 = session.addView('LinearSyntenyView', {\n    type: 'LinearSyntenyView',\n    views: [\n      {\n        id: `${Math.random()}`,\n        type: 'LinearGenomeView',\n        hideHeader: true,\n      },\n      {\n        id: `${Math.random()}`,\n        type: 'LinearGenomeView',\n        hideHeader: true,\n      },\n    ],\n    tracks: [\n      {\n        configuration: trackId,\n        type: 'SyntenyTrack',\n        displays: [\n          {\n            type: 'LinearSyntenyDisplay',\n            configuration: `${trackId}-LinearSyntenyDisplay`,\n          },\n        ],\n      },\n    ],\n  }) as LSV\n  const l1 = `${featRef}:${f(rFeatStart - ws)}-${f(rFeatEnd + ws)}`\n  const m1 = Math.min(rMateStart, rMateEnd)\n  const m2 = Math.max(rMateStart, rMateEnd)\n  const l2 = `${mateRef}:${f(m1 - ws)}-${f(m2 + ws)}${\n    horizontallyFlip ? '[rev]' : ''\n  }`\n  await Promise.all([\n    view2.views[0]!.navToLocString(l1, featAsm),\n    view2.views[1]!.navToLocString(l2, mateAsm),\n  ])\n}\n","import React, { useState } from 'react'\nimport { Dialog } from '@jbrowse/core/ui'\nimport { Feature, getSession } from '@jbrowse/core/util'\nimport {\n  Button,\n  Checkbox,\n  DialogActions,\n  DialogContent,\n  FormControlLabel,\n  TextField,\n} from '@mui/material'\nimport { navToSynteny } from './util'\nimport { makeStyles } from 'tss-react/mui'\n\nconst useStyles = makeStyles()({\n  padding: {\n    margin: 10,\n    border: '1px solid #ccc',\n  },\n})\n\nexport default function LaunchSyntenyViewDialog({\n  model,\n  feature,\n  handleClose,\n}: {\n  model: unknown\n  feature: Feature\n  handleClose: () => void\n}) {\n  const { classes } = useStyles()\n  const inverted = feature.get('strand') === -1\n  const [horizontallyFlip, setHorizontallyFlip] = useState(inverted)\n  const [windowSize, setWindowSize] = useState('1000')\n  return (\n    <Dialog open title=\"Launch synteny view\" onClose={handleClose}>\n      <DialogContent>\n        {inverted ? (\n          <FormControlLabel\n            className={classes.padding}\n            control={\n              <Checkbox\n                checked={horizontallyFlip}\n                onChange={event => {\n                  setHorizontallyFlip(event.target.checked)\n                }}\n              />\n            }\n            label=\"Note: The feature is inverted in orientation on the target\n            sequence. This will result in the lower panel having genomic\n            coordinates decreasing left to right. Horizontally flip?\"\n          />\n        ) : null}\n        <TextField\n          label=\"Add window size in bp\"\n          value={windowSize}\n          onChange={event => {\n            setWindowSize(event.target.value)\n          }}\n        />\n      </DialogContent>\n      <DialogActions>\n        <Button\n          variant=\"contained\"\n          onClick={() => {\n            // eslint-disable-next-line @typescript-eslint/no-floating-promises\n            ;(async () => {\n              try {\n                await navToSynteny({\n                  feature,\n                  windowSize: +windowSize,\n                  horizontallyFlip,\n                  model,\n                })\n              } catch (e) {\n                console.error(e)\n                getSession(model).notifyError(`${e}`, e)\n              }\n            })()\n            handleClose()\n          }}\n        >\n          Submit\n        </Button>\n        <Button\n          variant=\"contained\"\n          color=\"secondary\"\n          onClick={() => {\n            handleClose()\n          }}\n        >\n          Cancel\n        </Button>\n      </DialogActions>\n    </Dialog>\n  )\n}\n"],"names":["parseCigar","MismatchParser","f","n","Math","floor","findPosInCigar","cigar","startX","featX","mateX","i","length","len","op","min","useStyles","makeStyles","padding","margin","border","LaunchSyntenyViewDialog","model","feature","handleClose","classes","inverted","get","horizontallyFlip","setHorizontallyFlip","useState","windowSize","setWindowSize","React","Dialog","open","title","onClose","DialogContent","FormControlLabel","className","control","Checkbox","checked","onChange","event","target","label","TextField","value","DialogActions","Button","variant","onClick","async","ws","session","getSession","track","getContainingTrack","reg","getContainingView","dynamicBlocks","contentBlocks","Error","strand","regStart","start","regEnd","end","featStart","featEnd","mate","mateStart","mateEnd","mateAsm","assemblyName","mateRef","refName","featAsm","featRef","rMateStart","rMateEnd","rFeatStart","rFeatEnd","p","fStartX","mStartX","fEndX","mEndX","flipper","trackId","configuration","view2","addView","type","views","id","random","hideHeader","tracks","displays","l1","m1","m2","max","l2","Promise","all","navToLocString","navToSynteny","e","console","error","notifyError","color"],"sourceRoot":""}