Mercurial > repos > fubar > jbrowse2
view x/static/js/9314.3e43d34c.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/9314.3e43d34c.chunk.js","mappings":"4NAGO,SAASA,EAAeC,GAC7B,OAAO,IAAIC,YAAY,OAAQ,CAAEC,OAAO,IAAQC,OAAOH,EACzD,CAEAI,eAAeC,EAAUL,EAAgBM,EAAU,CAAC,GAElD,aADkB,qCAAoBC,MAAKC,GAAUA,EAAOC,WACjD,CAAEC,UAAU,EAAMC,OAAQ,SAAUL,IAAWM,WACxDb,EAAeC,GAEnB,CAgCA,SAASa,EACPC,EACAC,EACAC,GAEA,MAAMC,EAAOH,EAAOI,KAAK,GAAIC,MAAMJ,GAAeE,MAAQ,GAE1D,IAEIG,EAFAC,EAAc,OAGlB,IACED,GAAYE,EAAAA,EAAAA,gBAAeL,EAAMD,EACnC,CAAE,MAAOO,GACP,CAWF,OATIH,GAAWI,SAAsC,iBAApBJ,EAAUK,MACzCJ,EAAc,YACL,gBAAgBK,KAAKT,KAC9BI,EAAc,UAMTA,CACT,CAEA,SAASM,EACPT,EACAZ,EAAwB,CAAC,GAEzB,MAAM,kBACJsB,GAAoB,EAAK,qBACzBC,EAAuB,EAAC,eACxBb,EAAiBA,KAAM,EAAK,qBAC5Bc,GACExB,EAGJ,IAAIyB,EAAU,EACd,MAAMjB,EAAiB,CACrBkB,UAAU,EACVd,KAAMA,EAAKe,KAAI,CAACC,EAAKC,KACnB,MAAMC,EAAKD,GAAaP,EAAoB,EAAI,GAIhD,OAHIM,EAAIG,OAASN,IACfA,EAAUG,EAAIG,QAET,CACLD,GAAIE,OAAOF,GACXjB,MAAOe,EAAID,KAAI,CAAChB,EAAMF,KACb,CAAEA,eAAcE,WA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EC,KAAM,QAEtB,CAYA,OAVAL,EAAmBC,KAAKD,EAAmBT,QAC3CQ,EAAQmC,QAAQ,CACd/B,KAAM,WACNC,SAAU,CAAEC,KAAM,aAClB8B,WAAW,EACXC,uBAAwB,uRAKnB,CACLpE,SACAgC,qBACAM,gBAAgB,EAChBP,UACAQ,aAAcvB,EAElB,CAEO,SAAS+B,EAA0BsB,GAExC,IACIC,EADAC,EAAiB,EAErB,KAAOA,EAAiBF,EAAU9C,OAAQgD,GAAkB,EAAG,CAC7D,MAAMC,EAAIH,EAAUE,GACpB,GAAiB,OAAbD,GAA2B,MAANE,EACvB,MAEFF,EAAWE,CACb,CAEA,MAAO,CACL3B,OAAQwB,EAAUI,MAAM,EAAGC,KAAKC,IAAI,EAAGJ,IACvCzB,KAAMuB,EAAUI,MAAMF,GAE1B,C","sources":["../../../plugins/spreadsheet-view/src/SpreadsheetView/importAdapters/ImportUtils.ts","../../../plugins/spreadsheet-view/src/SpreadsheetView/importAdapters/VcfImport.ts"],"sourcesContent":["import { ParsedLocString, parseLocString } from '@jbrowse/core/util'\nimport type { Buffer } from 'buffer'\n\nexport function bufferToString(buffer: Buffer) {\n return new TextDecoder('utf8', { fatal: true }).decode(buffer)\n}\n\nasync function parseWith(buffer: Buffer, options = {}) {\n const csv = await import('csvtojson').then(module => module.default)\n return csv({ noheader: true, output: 'csv', ...options }).fromString(\n bufferToString(buffer),\n )\n}\n\nexport interface Row {\n id: string\n\n extendedData?: any\n cells: {\n text: string\n\n extendedData?: any\n }[]\n}\n\nexport interface RowSet {\n isLoaded: boolean\n rows: Row[]\n}\n\nexport interface ParseOptions {\n hasColumnNameLine?: boolean\n columnNameLineNumber?: number\n selectedAssemblyName?: string\n isValidRefName?: (refName: string, assemblyName?: string) => boolean\n}\n\nexport interface Column {\n name: string\n dataType: { type: string }\n isDerived?: boolean\n derivationFunctionText?: string\n}\n\nfunction guessColumnType(\n rowSet: RowSet,\n columnNumber: number,\n isValidRefName: (refName: string, assemblyName?: string) => boolean,\n) {\n const text = rowSet.rows[0]!.cells[columnNumber]!.text || ''\n\n let guessedType = 'Text'\n\n let parsedLoc: ParsedLocString | undefined\n try {\n parsedLoc = parseLocString(text, isValidRefName)\n } catch (error) {\n //\n }\n if (parsedLoc?.refName && typeof parsedLoc.start === 'number') {\n guessedType = 'LocString'\n } else if (/^\\d+(\\.\\d+)?$/.test(text)) {\n guessedType = 'Number'\n }\n\n // MAYBE TODO: iterate over the rest of the rows to confirm\n // the type for all the rows\n\n return guessedType\n}\n\nfunction dataToSpreadsheetSnapshot(\n rows: string[][],\n options: ParseOptions = {},\n) {\n const {\n hasColumnNameLine = false,\n columnNameLineNumber = 1,\n isValidRefName = () => false,\n selectedAssemblyName,\n } = options\n // rows is an array of row objects and columnNames\n // is an array of column names (in import order)\n let maxCols = 0\n const rowSet: RowSet = {\n isLoaded: true,\n rows: rows.map((row, rowNumber) => {\n const id = rowNumber + (hasColumnNameLine ? 0 : 1)\n if (row.length > maxCols) {\n maxCols = row.length\n }\n return {\n id: String(id),\n cells: row.map((text, columnNumber) => {\n return { columnNumber, text }\n }),\n }\n }),\n }\n\n // process the column names row if present\n const columnNames: Record<string, string> = {}\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (hasColumnNameLine && columnNameLineNumber !== undefined) {\n const [colNamesRow] = rowSet.rows.splice(columnNameLineNumber - 1, 1)\n\n if (colNamesRow) {\n colNamesRow.cells.forEach((cell, columnNumber) => {\n columnNames[columnNumber] = cell.text || ''\n })\n }\n }\n\n // make our column definitions\n const columns: Column[] = []\n const columnDisplayOrder = []\n for (let columnNumber = 0; columnNumber < maxCols; columnNumber += 1) {\n columnDisplayOrder.push(columnNumber)\n const guessedType = guessColumnType(rowSet, columnNumber, isValidRefName)\n\n // store extendeddata for LocString column\n if (guessedType === 'LocString') {\n for (const row of rowSet.rows) {\n const cell = row.cells[columnNumber]!\n cell.extendedData = parseLocString(cell.text, isValidRefName)\n }\n }\n\n columns[columnNumber] = {\n name: columnNames[columnNumber]!,\n dataType: {\n type: guessedType,\n },\n }\n }\n\n return {\n rowSet,\n columnDisplayOrder,\n hasColumnNames: !!hasColumnNameLine,\n columns,\n assemblyName: selectedAssemblyName,\n }\n}\n\nexport async function parseCsvBuffer(buffer: Buffer, options?: ParseOptions) {\n const rows = await parseWith(buffer)\n return dataToSpreadsheetSnapshot(rows, options)\n}\n\nexport async function parseTsvBuffer(buffer: Buffer, options?: ParseOptions) {\n const rows = await parseWith(buffer, { delimiter: '\\t' })\n return dataToSpreadsheetSnapshot(rows, options)\n}\n","import VCF from '@gmod/vcf'\nimport { VcfFeature } from '@jbrowse/plugin-variants'\nimport {\n bufferToString,\n Row,\n RowSet,\n Column,\n ParseOptions,\n} from './ImportUtils'\nimport type { Buffer } from 'buffer'\n\nconst vcfCoreColumns: { name: string; type: string }[] = [\n { name: 'CHROM', type: 'Text' }, // 0\n { name: 'POS', type: 'Number' }, // 1\n { name: 'ID', type: 'Text' }, // 2\n { name: 'REF', type: 'Text' }, // 3\n { name: 'ALT', type: 'Text' }, // 4\n { name: 'QUAL', type: 'Number' }, // 5\n { name: 'FILTER', type: 'Text' }, // 6\n { name: 'INFO', type: 'Text' }, // 7\n { name: 'FORMAT', type: 'Text' }, // 8\n]\n\nfunction vcfRecordToRow(vcfParser: any, line: string, lineNumber: number): Row {\n const vcfVariant = vcfParser.parseLine(line)\n const vcfFeature = new VcfFeature({\n variant: vcfVariant,\n parser: vcfParser,\n id: `vcf-${lineNumber}`,\n })\n\n const data = line.split('\\t').map(d => (d === '.' ? '' : d))\n // no format column, add blank\n if (data.length === 8) {\n data.push('')\n }\n const row: Row = {\n id: String(lineNumber + 1),\n extendedData: { vcfFeature: vcfFeature.toJSON() },\n cells: data.map((text, columnNumber) => {\n return {\n columnNumber,\n text,\n }\n }),\n }\n return row\n}\n\nexport function parseVcfBuffer(buffer: Buffer, options: ParseOptions = {}) {\n const { selectedAssemblyName } = options\n let { header, body } = splitVcfFileHeaderAndBody(bufferToString(buffer))\n const rows: Row[] = []\n const vcfParser = new VCF({ header })\n header = '' // garbage collect\n body.split(/\\n|\\r\\n|\\r/).forEach((line: string, lineNumber) => {\n if (/\\S/.test(line)) {\n rows.push(vcfRecordToRow(vcfParser, line, lineNumber))\n }\n })\n body = '' // garbage collect\n\n const rowSet: RowSet = {\n isLoaded: true,\n rows,\n }\n\n const columnDisplayOrder: number[] = []\n const columns: Column[] = []\n for (let i = 0; i < vcfCoreColumns.length; i += 1) {\n columnDisplayOrder.push(i)\n columns[i] = {\n name: vcfCoreColumns[i]!.name,\n dataType: { type: vcfCoreColumns[i]!.type },\n }\n }\n for (let i = 0; i < vcfParser.samples.length; i += 1) {\n const oi = vcfCoreColumns.length + i\n columnDisplayOrder.push(oi)\n columns[oi] = {\n name: vcfParser.samples[i]!,\n dataType: { type: 'Text' },\n }\n }\n\n columnDisplayOrder.push(columnDisplayOrder.length)\n columns.unshift({\n name: 'Location',\n dataType: { type: 'LocString' },\n isDerived: true,\n derivationFunctionText: `jexl:{text:row.extendedData.vcfFeature.refName+':'\\n\n +row.extendedData.vcfFeature.start+'..'+row.extendedData.vcfFeature.end, extendedData:\\n\n {refName:row.extendedData.vcfFeature.refName,start:row.extendedData.vcfFeature.start,end:row.extendedData.vcfFeature.end}}`,\n })\n\n return {\n rowSet,\n columnDisplayOrder,\n hasColumnNames: true,\n columns,\n assemblyName: selectedAssemblyName,\n }\n}\n\nexport function splitVcfFileHeaderAndBody(wholeFile: string) {\n // split into header and the rest of the file\n let headerEndIndex = 0\n let prevChar: string | undefined\n for (; headerEndIndex < wholeFile.length; headerEndIndex += 1) {\n const c = wholeFile[headerEndIndex]\n if (prevChar === '\\n' && c !== '#') {\n break\n }\n prevChar = c\n }\n\n return {\n header: wholeFile.slice(0, Math.max(0, headerEndIndex)),\n body: wholeFile.slice(headerEndIndex),\n }\n}\n"],"names":["bufferToString","buffer","TextDecoder","fatal","decode","async","parseWith","options","then","module","default","noheader","output","fromString","guessColumnType","rowSet","columnNumber","isValidRefName","text","rows","cells","parsedLoc","guessedType","parseLocString","error","refName","start","test","dataToSpreadsheetSnapshot","hasColumnNameLine","columnNameLineNumber","selectedAssemblyName","maxCols","isLoaded","map","row","rowNumber","id","length","String","columnNames","undefined","colNamesRow","splice","forEach","cell","columns","columnDisplayOrder","push","extendedData","name","dataType","type","hasColumnNames","assemblyName","parseCsvBuffer","parseTsvBuffer","delimiter","vcfCoreColumns","parseVcfBuffer","header","body","splitVcfFileHeaderAndBody","vcfParser","VCF","split","line","lineNumber","vcfVariant","parseLine","vcfFeature","VcfFeature","variant","parser","data","d","toJSON","vcfRecordToRow","i","samples","oi","unshift","isDerived","derivationFunctionText","wholeFile","prevChar","headerEndIndex","c","slice","Math","max"],"sourceRoot":""}