{"_id":"@apr144/higlass-tabix-datafetcher","name":"@apr144/higlass-tabix-datafetcher","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@apr144/higlass-tabix-datafetcher","version":"0.1.0","description":"Tabix Data Fetcher for HiGlass","private":false,"author":{"name":"Alex Reynolds"},"license":"MIT","contributors":[{"name":"Alex Reynolds","url":"http://github.com/alexpreynolds"}],"type":"module","main":"dist/index.js","module":"dist/index.js","exports":{".":{"import":"./dist/index.js"}},"repository":{"type":"git","url":"git://github.com/alexpreynolds/higlass-tabix-datafetcher.git"},"devDependencies":{"@esbuild-plugins/node-globals-polyfill":"^0.1.1","@esbuild-plugins/node-modules-polyfill":"^0.1.4","cross-env":"^7.0.0","esbuild":"^0.14.42","jsdom":"^20.0.0","npm-run-all":"^4.1.5","rimraf":"^3.0.2","vite":"^4.3.0","vitest":"^0.23.4"},"scripts":{"clean":"rm -rf node_modules && rm -f package-lock.json && rm -rf dist && rm -rf build","build":"rimraf ./dist/ && npm run build-lib","build-lib":"npm run build-lib:prod && npm run build-lib:dev","build-lib:prod":"cross-env APP_ENV=production ESBUILD_MODE=build node ./bundle.mjs","build-lib:dev":"cross-env APP_ENV=development ESBUILD_MODE=build node ./bundle.mjs","start-lib":"cross-env ESBUILD_MODE=watch node ./bundle.mjs","start-app":"vite --config vite-demo.config.js --port 3000","start":"npm-run-all --parallel start-lib start-app","prerelease":"rm -rf dist/*; npm run build; zip -r dist.zip dist","test-watch":"vitest --config vite-test.config.js --watch","test":"vitest --config vite-test.config.js --run"},"dependencies":{"@gmod/tabix":"^1.5.13","d3-dsv":"^3.0.1","d3-request":"^1.0.6","d3-scale":"^1.0.7","apr144-generic-filehandle":"3.1.1-042624-003","higlass-register":"^0.3.0","slugid":"^3.0.0"},"gitHead":"4c75d549aa5733331a1561da93dc676eba1de9a3","bugs":{"url":"https://github.com/alexpreynolds/higlass-tabix-datafetcher/issues"},"homepage":"https://github.com/alexpreynolds/higlass-tabix-datafetcher#readme","_id":"@apr144/higlass-tabix-datafetcher@0.1.0","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"integrity":"sha512-tVtVV0/XoNDGR+zGtY6dNsn1xSxa+gEwCKxxuGJYYnyw3mBfA9NgLUg9i27aIxsAzy095EAGWg79Db/ztAC/hA==","shasum":"04beb07370b4d4f5bd85ff91dd772ea4f4d22a5a","tarball":"https://registry.npmjs.org/@apr144/higlass-tabix-datafetcher/-/higlass-tabix-datafetcher-0.1.0.tgz","fileCount":9,"unpackedSize":2041719,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICSHagjnnjgfUNPXeb7KClCR6gKxJSZZYweogyX7ZMTiAiEAxl3OzEM9aIEyfKAijxZ734IhzNbcSm4WrtJ18PIOMqo="}]},"_npmUser":{"name":"apr144","email":"alexpreynolds@gmail.com"},"directories":{},"maintainers":[{"name":"apr144","email":"alexpreynolds@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/higlass-tabix-datafetcher_0.1.0_1738883317962_0.9876763133629518"},"_hasShrinkwrap":false}},"time":{"created":"2025-02-06T23:08:37.835Z","0.1.0":"2025-02-06T23:08:38.166Z","modified":"2025-02-06T23:08:38.449Z"},"maintainers":[{"name":"apr144","email":"alexpreynolds@gmail.com"}],"description":"Tabix Data Fetcher for HiGlass","homepage":"https://github.com/alexpreynolds/higlass-tabix-datafetcher#readme","repository":{"type":"git","url":"git://github.com/alexpreynolds/higlass-tabix-datafetcher.git"},"contributors":[{"name":"Alex Reynolds","url":"http://github.com/alexpreynolds"}],"author":{"name":"Alex Reynolds"},"bugs":{"url":"https://github.com/alexpreynolds/higlass-tabix-datafetcher/issues"},"license":"MIT","readme":"# higlass-tabix-datafetcher\nProvide remote access to remotely-hosted tabix files to HiGlass client applications\n\n## Usage\n\nThis enables access to a web-hosted tabix file for use with the `higlass-transcripts` (https://github.com/higlass/higlass-transcripts) plug-in.\n\nRegister the data fetcher in your HiGlass application:\n\n```\nimport register from \"higlass-register\";\nimport { TabixDataFetcher } from \"higlass-tabix-datafetcher\";\n\nregister (\n  { \n    dataFetcher: TabixDataFetcher, \n    config: TabixDataFetcher.config,\n  },\n  { \n    pluginType: \"dataFetcher\",\n  }\n);\n```\n\nConfigure the HiGlass view configuration's `horizontal-transcripts` object with `data` attributes pointing to the web-hosted tabix file, along with an appropriate chromSizes file, e.g.:\n\n```\n{\n  \"name\": \"My Transcripts\",\n  \"type\": \"horizontal-transcripts\",\n  \"uid\": \"my_transcripts_uid\",\n  \"options\": {\n    \"fontSize\": 9, // font size for labels and amino acids (if available)\n    \"fontFamily\": \"Helvetica\",\n    \"labelFontColor\": \"#333333\",\n    \"labelBackgroundPlusStrandColor\": \"#ffffff\",\n    \"labelBackgroundMinusStrandColor\": \"#ffffff\",\n    \"labelStrokePlusStrandColor\": \"#999999\",\n    \"labelStrokeMinusStrandColor\": \"#999999\",\n    \"plusStrandColor\": \"#bdbfff\", // color of coding parts of the exon on the plus strand\n    \"minusStrandColor\": \"#fabec2\", // color of coding parts of the exon on the negative strand\n    \"utrColor\": \"#C0EAAF\", // color of untranslated regions of the exons\n    \"backgroundColor\": \"#ffffff\", // color of track background\n    \"transcriptHeight\": 12, // height of the transcripts\n    \"transcriptSpacing\": 2, // space in between the transcripts\n    \"name\": \"Gene transcripts\",\n    \"maxTexts\": 50, // Maximum number of labels shown on the screen\n    \"showToggleTranscriptsButton\": true, // If the \"Show fewer transcripts\"/\"Show more transcripts\" is shown\n    \"trackHeightAdjustment\": \"automatic\", // if \"automatic\", the height of the track is adjusted to the number of visible transcripts.\n    \"startCollapsed\": false, // if true, only one transcript is shown\n  },\n  \"data\" : {\n    \"type\": \"tabix\",\n    \"url\": \"https://example.com/tabix/my_transcripts.gz\",\n    \"chromSizesUrl\": \"https://example.com/tabix/hg38.chromSizes.gz\",\n  },\n}\n```\n\nThere should be an associated index file hosted at `https://example.com/tabix/my_transcripts.gz.tbi`.\n\nThe file `https://example.com/tabix/my_transcripts.gz` is compressed with `bgzip` and indexed with `tabix`. For example:\n\n```\n$ gunzip -c my_transcripts.gz | more\nchr1\t11869\t14409\tDDX11L1-001\t101\t+\tENSG00000223972.5\tENST00000456328.2\ttranscribed_unprocessed_pseudogene\t11869,12613,13221\t12227,12721,14409\t.\t.\nchr1\t12010\t13670\tDDX11L1-002\t90\t+\tENSG00000223972.5\tENST00000450305.2\ttranscribed_unprocessed_pseudogene\t12010,12179,12613,12975,13221,13453\t12057,12227,12697,13052,13374,13670\t.\t.\nchr1\t14404\t29570\tWASH7P-001\t101\t-\tENSG00000227232.5\tENST00000488147.1\tunprocessed_pseudogene\t14404,15005,15796,16607,16858,17233,17606,17915,18268,24738,29534\t14501,15038,15947,16765,17055,17368,17742,18061,18366,24891,29570\t.\t.\nchr1\t17369\t17436\tMIR6859-1-001\t101\t-\tENSG00000278267.1\tENST00000619216.1\tmiRNA\t17369\t17436\t.\t.\nchr1\t29554\t31097\tMIR1302-2HG-001\t101\t+\tENSG00000243485.5\tENST00000473358.1\tlncRNA\t29554,30564,30976\t30039,30667,31097\t.\t.\n...\n```\n\nThe format of data is currently driven by the `formatTranscriptData` function in `higlass-transcripts`, where transcript metadata are stored in thirteen columns:\n\n```\nformatTranscriptData(ts) {\n  const strand = ts[5];\n  const stopCodonPos = ts[12] === \".\" ? \".\" : (strand === \"+\" ? +ts[12] + 2 : +ts[12] - 1);\n  const startCodonPos = ts[11] === \".\" ? \".\" : (strand === \"+\" ? +ts[11] - 1 : +ts[11] + 2);\n  const exonStarts = ts[9].split(\",\").map((x) => +x - 1);\n  const exonEnds = ts[10].split(\",\").map((x) => +x);\n  const txStart = +ts[1] - 1;\n  const txEnd = +ts[2] - 1;\n\n  const result = {\n    transcriptId: this.transcriptId(ts),\n    transcriptName: ts[3],\n    txStart: txStart,\n    txEnd: txEnd,\n    strand: strand,\n    chromName: ts[0],\n    codingType: ts[8],\n    exonStarts: exonStarts,\n    exonEnds: exonEnds,\n    startCodonPos: startCodonPos,\n    stopCodonPos: stopCodonPos,\n    importance: +ts[4],\n  };\n  return result;\n}\n```\n\nThe convenience script `scripts/gencode_gff3_to_tabix.py` makes a bgzipped tabix file and its index that can be consumed by this data fetcher, e.g.:\n\n```\n$ wget -qO- \"https://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_19/gencode.v19.annotation.gff3.gz\" | gunzip -c > gencode.v19.annotation.gff3\n$ scripts/gencode_gff3_to_tabix.py gencode.v19.annotation.gff3 gencode.v19.annotation.hg19.gz\n$ ls -l gencode.v19.annotation.hg19.gz*\n-rw-r--r--  1 areynolds  staff   7700441 Nov  9 17:43 gencode.v19.annotation.hg19.gz\n-rw-r--r--  1 areynolds  staff    197319 Nov  9 17:43 gencode.v19.annotation.hg19.gz.tbi\n```","readmeFilename":"README.md"}