{"_id":"@apr144/indexedfasta","name":"@apr144/indexedfasta","dist-tags":{"latest":"2.1.0"},"versions":{"2.1.0":{"name":"@apr144/indexedfasta","version":"2.1.0","description":"read indexed fasta and bgzipped fasta formats","license":"MIT","repository":{"type":"git","url":"git+https://github.com/GMOD/indexedfasta-js.git"},"main":"dist/index.js","module":"esm/index.js","author":{"name":"Colin Diesh","email":"colin.diesh@gmail.com","url":"https://github.com/cmdcolin"},"engines":{"node":">=12"},"scripts":{"test":"jest","coverage":"npm test -- --coverage","lint":"eslint src test","docs":"documentation readme src --section=API","clean":"rimraf dist esm","prebuild":"npm run clean","build:esm":"tsc --target es2018 --outDir esm","build:es5":"tsc --target es5 --outDir dist","build":"npm run build:esm && npm run build:es5","version":"standard-changelog && git add CHANGELOG.md","prepublishOnly":"npm test && npm run build","postversion":"git push --follow-tags"},"keywords":["fasta","genomics","biojs","bionode"],"publishConfig":{"access":"public"},"dependencies":{"@gmod/bgzf-filehandle":"^1.4.0","buffer":"^6.0.3","generic-filehandle":"^3.0.0"},"devDependencies":{"@types/jest":"^29.5.0","@types/object.fromentries":"^2.0.1","@typescript-eslint/eslint-plugin":"^6.7.4","@typescript-eslint/parser":"^6.7.4","cross-fetch":"^4.0.0","documentation":"^14.0.1","eslint":"^8.36.0","eslint-config-prettier":"^9.0.0","eslint-plugin-import":"^2.27.5","eslint-plugin-prettier":"^5.0.0","jest":"^29.5.0","prettier":"^3.0.3","rimraf":"^5.0.5","standard-changelog":"^5.0.0","ts-jest":"^29.0.5","typescript":"^5.0.2"},"_id":"@apr144/indexedfasta@2.1.0","gitHead":"f2836e7423bdb2ddf7b8a10109638de62187ee9f","types":"./dist/index.d.ts","bugs":{"url":"https://github.com/GMOD/indexedfasta-js/issues"},"homepage":"https://github.com/GMOD/indexedfasta-js#readme","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-wd7xH/g0RWOmO5mr0KkjC5S+99y9nl+EFeH87iqI+cdgKdW3VSBTO5GjWD/O7tDJoh55fmx3gqLtzFLTi3KHJg==","shasum":"2d666a8468a2ab5b40d34ae4441f991ee88d4ad9","tarball":"https://registry.npmjs.org/@apr144/indexedfasta/-/indexedfasta-2.1.0.tgz","fileCount":25,"unpackedSize":65989,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCsaKnurfcyx6DVEm0EO0zmyu0SR87Y2GgxMFBMOQ17IAIgOgY8IAuWCGk/Cg1kLRvWucAGZNoHBIxE2554bSlUxMo="}]},"_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/indexedfasta_2.1.0_1740008419769_0.10873969330336597"},"_hasShrinkwrap":false}},"time":{"created":"2025-02-19T23:40:19.668Z","2.1.0":"2025-02-19T23:40:19.957Z","modified":"2025-02-19T23:40:20.218Z"},"maintainers":[{"name":"apr144","email":"alexpreynolds@gmail.com"}],"description":"read indexed fasta and bgzipped fasta formats","homepage":"https://github.com/GMOD/indexedfasta-js#readme","keywords":["fasta","genomics","biojs","bionode"],"repository":{"type":"git","url":"git+https://github.com/GMOD/indexedfasta-js.git"},"author":{"name":"Colin Diesh","email":"colin.diesh@gmail.com","url":"https://github.com/cmdcolin"},"bugs":{"url":"https://github.com/GMOD/indexedfasta-js/issues"},"license":"MIT","readme":"[![NPM version](https://img.shields.io/npm/v/@gmod/indexedfasta.svg?style=flat-square)](https://npmjs.org/package/@gmod/indexedfasta)\n[![Coverage Status](https://img.shields.io/codecov/c/github/GMOD/indexedfasta-js/master.svg?style=flat-square)](https://codecov.io/gh/GMOD/indexedfasta-js/branch/master)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/GMOD/indexedfasta-js/push.yml?branch=master)](https://github.com/GMOD/indexedfasta-js/actions)\n\n## Install\n\n    $ npm install --save @gmod/indexedfasta\n\n## Usage\n\n```typescript\nconst { IndexedFasta, BgzipIndexedFasta } = require('@gmod/indexedfasta')\n\nconst t = new IndexedFasta({\n  path: 'test.fa',\n  faiPath: 'test.fa.fai',\n})\n// or\nconst t = new BgzipIndexedFasta({\n  path: 'test.fa.gz',\n  faiPath: 'test.fa.gz.fai',\n  gziPath: 'test.fa.gz.gzi',\n})\n\n// get the first 10 bases of a sequence from the file.\n// coordinates are UCSC standard 0-based half-open\n//\nconst chr1Region = await t.getSequence('chr1', 0, 10)\n// chr1Region is now a string of bases, 'ACTG...'\n\n// get a whole sequence from the file\nconst chr1Bases = await t.getSequence('chr1')\n\n// get object with all seq lengths as { seqName => length, ... }\nconst allSequenceSizes = await t.getSequenceSizes()\n\n// get the size of a single sequence\nconst chr1Size = await t.getSequenceSize('chr1')\n\n// get an array of all sequence names in the file\nconst seqNames = await t.getSequenceNames()\n```\n\nIf you are using in the browser, you may use the generic-filehandle package and\ninitialize like this\n\n```typescript\nimport { IndexedFasta, BgzipIndexedFasta } from '@gmod/indexedfasta'\nimport { RemoteFile } from 'generic-filehandle'\n\nconst t = new IndexedFasta({\n  fasta: new RemoteFile('http://yoursite.com/test.fa'),\n  fai: new RemoteFile('http://yoursite.com/test.fa.fai'),\n})\nconst t = new BgzipIndexedFasta({\n  fasta: new RemoteFile('http://yoursite.com/test.fa.gz'),\n  fai: new RemoteFile('http://yoursite.com/test.fa.gz.fai'),\n  gzi: new RemoteFile('http://yoursite.com/test.fa.gz.gzi'),\n})\n```\n\nIn node.js you can also access remote files with generic-filehandle, but you\nwould supply a fetch function e.g.\n\n```typescript\nimport { IndexedFasta, BgzipIndexedFasta } from '@gmod/indexedfasta'\nimport { RemoteFile } from 'generic-filehandle'\nimport fetch from 'cross-fetch'\n\nconst t = new IndexedFasta({\n  fasta: new RemoteFile('http://yoursite.com/test.fa', { fetch }),\n  fai: new RemoteFile('http://yoursite.com/test.fa.fai', { fetch }),\n})\n```\n\n## Academic Use\n\nThis package was written with funding from the [NHGRI](http://genome.gov) as\npart of the [JBrowse](http://jbrowse.org) project. If you use it in an academic\nproject that you publish, please cite the most recent JBrowse paper, which will\nbe linked from [jbrowse.org](http://jbrowse.org).\n\n## License\n\nMIT © [Colin Diesh](https://github.com/cmdcolin)\n","readmeFilename":"README.md"}