view x/static/js/7409.8e71acc1.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/7409.8e71acc1.chunk.js","mappings":"6PA2Be,MAAMA,UAAyBC,EAAAA,uBAKrCC,WAAAA,CACLC,EACAC,EACAC,GAEAC,MAAMH,EAAQC,EAAeC,GAC7B,MAAME,GAAgBC,EAAAA,EAAAA,gBAAeL,EAAQ,iBACvCM,GAAYD,EAAAA,EAAAA,gBAAeL,EAAQ,CAAC,QAAS,cAC7CO,GAAWF,EAAAA,EAAAA,gBAAeL,EAAQ,CAAC,QAAS,aAC5CQ,GAAiBH,EAAAA,EAAAA,gBAAeL,EAAQ,kBAE9CS,KAAKD,eAAiBA,GAAkB,CAAC,aAAc,SAAU,UACjEC,KAAKC,IAAM,IAAIC,EAAAA,GAAiB,CAC9BC,YAAYC,EAAAA,EAAAA,cAAaT,EAAeK,KAAKP,eAC7CY,cACgB,QAAdR,GACIO,EAAAA,EAAAA,cAAaN,EAAUE,KAAKP,oBAC5Ba,EACNC,cACgB,QAAdV,GACIO,EAAAA,EAAAA,cAAaN,EAAUE,KAAKP,oBAC5Ba,EACNE,eAAgB,SAChBC,cAAgBC,GAAcA,GAElC,CAEA,iBAAaC,CAAYC,EAAoB,CAAC,GAC5C,OAAOZ,KAAKC,IAAIY,0BAA0BD,EAC5C,CAEA,eAAaE,GACX,OAAOd,KAAKC,IAAIa,WAClB,CAEOC,WAAAA,CAAYC,EAAeJ,EAAoB,CAAC,GACrD,OAAOK,EAAAA,EAAAA,mBAA0BC,UAC/B,MAAMC,QAAiBnB,KAAKC,IAAImB,oBAC1BpB,KAAKqB,kBAAkBL,EAAOJ,EAAMO,EAAUG,GAAU,EAAK,GAClEV,EAAKW,OACV,CAEA,uBAAcF,CACZL,EACA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AAYrC,EAAYqC,OAG5C,C","sources":["../../../plugins/gff3/src/Gff3TabixAdapter/Gff3TabixAdapter.ts","../../../plugins/gff3/src/featureData.ts"],"sourcesContent":["import {\n  BaseFeatureDataAdapter,\n  BaseOptions,\n} from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { doesIntersect2 } from '@jbrowse/core/util/range'\nimport { Region } from '@jbrowse/core/util/types'\nimport { openLocation } from '@jbrowse/core/util/io'\nimport { ObservableCreate } from '@jbrowse/core/util/rxjs'\nimport SimpleFeature, { Feature } from '@jbrowse/core/util/simpleFeature'\nimport { TabixIndexedFile } from '@gmod/tabix'\nimport { parseStringSync } from 'gff-nostream'\nimport { Observer } from 'rxjs'\nimport {\n  readConfObject,\n  AnyConfigurationModel,\n} from '@jbrowse/core/configuration'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache'\nimport { featureData } from '../featureData'\n\ninterface LineFeature {\n  start: number\n  end: number\n  lineHash: number\n  fields: string[]\n}\n\nexport default class Gff3TabixAdapter extends BaseFeatureDataAdapter {\n  protected gff: TabixIndexedFile\n\n  protected dontRedispatch: string[]\n\n  public constructor(\n    config: AnyConfigurationModel,\n    getSubAdapter?: getSubAdapterType,\n    pluginManager?: PluginManager,\n  ) {\n    super(config, getSubAdapter, pluginManager)\n    const gffGzLocation = readConfObject(config, 'gffGzLocation')\n    const indexType = readConfObject(config, ['index', 'indexType'])\n    const location = readConfObject(config, ['index', 'location'])\n    const dontRedispatch = readConfObject(config, 'dontRedispatch')\n\n    this.dontRedispatch = dontRedispatch || ['chromosome', 'contig', 'region']\n    this.gff = new TabixIndexedFile({\n      filehandle: openLocation(gffGzLocation, this.pluginManager),\n      csiFilehandle:\n        indexType === 'CSI'\n          ? openLocation(location, this.pluginManager)\n          : undefined,\n      tbiFilehandle:\n        indexType !== 'CSI'\n          ? openLocation(location, this.pluginManager)\n          : undefined,\n      chunkCacheSize: 50 * 2 ** 20,\n      renameRefSeqs: (n: string) => n,\n    })\n  }\n\n  public async getRefNames(opts: BaseOptions = {}) {\n    return this.gff.getReferenceSequenceNames(opts)\n  }\n\n  public async getHeader() {\n    return this.gff.getHeader()\n  }\n\n  public getFeatures(query: Region, opts: BaseOptions = {}) {\n    return ObservableCreate<Feature>(async observer => {\n      const metadata = await this.gff.getMetadata()\n      await this.getFeaturesHelper(query, opts, metadata, observer, true)\n    }, opts.signal)\n  }\n\n  private async getFeaturesHelper(\n    query: Region,\n    opts: BaseOptions,\n    metadata: { columnNumbers: { start: number; end: number } },\n    observer: Observer<Feature>,\n    allowRedispatch: boolean,\n    originalQuery = query,\n  ) {\n    try {\n      const lines: LineFeature[] = []\n\n      await this.gff.getLines(\n        query.refName,\n        query.start,\n        query.end,\n        (line, fileOffset) => {\n          lines.push(this.parseLine(metadata.columnNumbers, line, fileOffset))\n        },\n      )\n      if (allowRedispatch && lines.length) {\n        let minStart = Number.POSITIVE_INFINITY\n        let maxEnd = Number.NEGATIVE_INFINITY\n        for (const line of lines) {\n          const featureType = line.fields[2]!\n          // only expand redispatch range if feature is not a \"dontRedispatch\"\n          // type skips large regions like chromosome,region\n          if (!this.dontRedispatch.includes(featureType)) {\n            const start = line.start - 1 // gff is 1-based\n            if (start < minStart) {\n              minStart = start\n            }\n            if (line.end > maxEnd) {\n              maxEnd = line.end\n            }\n          }\n        }\n        if (maxEnd > query.end || minStart < query.start) {\n          // make a new feature callback to only return top-level features\n          // in the original query range\n          await this.getFeaturesHelper(\n            { ...query, start: minStart, end: maxEnd },\n            opts,\n            metadata,\n            observer,\n            false,\n            query,\n          )\n          return\n        }\n      }\n\n      const gff3 = lines\n        .map(lineRecord => {\n          if (lineRecord.fields[8] && lineRecord.fields[8] !== '.') {\n            if (!lineRecord.fields[8].includes('_lineHash')) {\n              lineRecord.fields[8] += `;_lineHash=${lineRecord.lineHash}`\n            }\n          } else {\n            lineRecord.fields[8] = `_lineHash=${lineRecord.lineHash}`\n          }\n          return lineRecord.fields.join('\\t')\n        })\n        .join('\\n')\n\n      for (const featureLocs of parseStringSync(gff3)) {\n        for (const featureLoc of featureLocs) {\n          const f = new SimpleFeature({\n            data: featureData(featureLoc),\n            id: `${this.id}-offset-${featureLoc.attributes?._lineHash?.[0]}`,\n          })\n          if (\n            doesIntersect2(\n              f.get('start'),\n              f.get('end'),\n              originalQuery.start,\n              originalQuery.end,\n            )\n          ) {\n            observer.next(f)\n          }\n        }\n      }\n      observer.complete()\n    } catch (e) {\n      observer.error(e)\n    }\n  }\n\n  private parseLine(\n    columnNumbers: { start: number; end: number },\n    line: string,\n    fileOffset: number,\n  ) {\n    const fields = line.split('\\t')\n\n    // note: index column numbers are 1-based\n    return {\n      start: +fields[columnNumbers.start - 1]!,\n      end: +fields[columnNumbers.end - 1]!,\n      lineHash: fileOffset,\n      fields,\n    }\n  }\n\n  public freeResources(/* { region } */) {}\n}\n","import { GFF3FeatureLineWithRefs } from 'gff-nostream'\n\ninterface GFF3Feature {\n  start: number\n  end: number\n  strand?: number\n  type: string | null\n  source: string | null\n  refName: string\n  derived_features: unknown[] | null\n  phase?: number\n  score?: number\n  subfeatures: GFF3Feature[] | undefined\n  [key: string]: unknown\n}\n\nexport function featureData(data: GFF3FeatureLineWithRefs): GFF3Feature {\n  const {\n    end,\n    start,\n    child_features,\n    derived_features,\n    attributes,\n    type,\n    source,\n    phase,\n    seq_id,\n    score,\n    strand,\n  } = data\n\n  let strand2: number | undefined\n  if (strand === '+') {\n    strand2 = 1\n  } else if (strand === '-') {\n    strand2 = -1\n  } else if (strand === '.') {\n    strand2 = 0\n  }\n\n  const defaultFields = new Set([\n    'start',\n    'end',\n    'seq_id',\n    'score',\n    'type',\n    'source',\n    'phase',\n    'strand',\n  ])\n  const dataAttributes = attributes || {}\n  const resultAttributes = {} as Record<string, unknown>\n  for (const a of Object.keys(dataAttributes)) {\n    let b = a.toLowerCase()\n    if (defaultFields.has(b)) {\n      // add \"suffix\" to tag name if it already exists\n      // reproduces behavior of NCList\n      b += '2'\n    }\n    if (dataAttributes[a] && a !== '_lineHash') {\n      let attr: string | string[] | undefined = dataAttributes[a]\n      if (Array.isArray(attr) && attr.length === 1) {\n        ;[attr] = attr\n      }\n      resultAttributes[b] = attr\n    }\n  }\n\n  return {\n    ...resultAttributes,\n    start: start! - 1,\n    end: end!,\n    strand: strand2,\n    type,\n    source,\n    refName: seq_id!,\n    derived_features,\n    phase: phase === null ? undefined : Number(phase),\n    score: score === null ? undefined : score,\n    subfeatures: child_features.flatMap(childLocs =>\n      childLocs.map(childLoc => featureData(childLoc)),\n    ),\n  }\n}\n"],"names":["Gff3TabixAdapter","BaseFeatureDataAdapter","constructor","config","getSubAdapter","pluginManager","super","gffGzLocation","readConfObject","indexType","location","dontRedispatch","this","gff","TabixIndexedFile","filehandle","openLocation","csiFilehandle","undefined","tbiFilehandle","chunkCacheSize","renameRefSeqs","n","getRefNames","opts","getReferenceSequenceNames","getHeader","getFeatures","query","ObservableCreate","async","metadata","getMetadata","getFeaturesHelper","observer","signal","allowRedispatch","originalQuery","lines","getLines","refName","start","end","line","fileOffset","push","parseLine","columnNumbers","length","minStart","Number","POSITIVE_INFINITY","maxEnd","NEGATIVE_INFINITY","featureType","fields","includes","gff3","map","lineRecord","lineHash","join","featureLocs","parseStringSync","featureLoc","f","SimpleFeature","data","featureData","id","attributes","_lineHash","doesIntersect2","get","next","complete","e","error","split","freeResources","child_features","derived_features","type","source","phase","seq_id","score","strand","strand2","defaultFields","Set","dataAttributes","resultAttributes","a","Object","keys","b","toLowerCase","has","attr","Array","isArray","subfeatures","flatMap","childLocs","childLoc"],"sourceRoot":""}