Skip to content

bionode/fasta-parser

Repository files navigation

fasta-parser

Buffer Stream parser from FASTA to JSON.

NPM version Build Status Coveralls Status Dependency Status Gitter chat DOI

Browser

Install

Install fasta-parser with npm:

$ npm install fasta-parser

Alternatively, just include fasta-parser.min.js via a <script/> in your page.

Usage

var fasta = require('fasta-parser')

var fastaData = new Buffer ('>sequence1\n\
ATGCACGTCACGTCAGTACTCGTCAGTAC\n\
>sequence2\n\
CAGTCCTACTGCATGCATGCATGCATGCATCGATGCATGTCGACTGCATGCATGC\n')

var parser = fasta()
parser.on('data', function(data) { console.log(JSON.parse(data.toString())) })
parser.write(fastaData)
parser.end()
//=>   { id: 'sequence1',
//       seq: 'ATGCACGTCACGTCAGTACTCGTCAGTAC' }
//     { id: 'sequence2',
//       seq: 'CAGTCCTACTGCATGCATGCATGCATGCATCGATGCATGTCGACTGCATGCATGC' }

For a more useful API, check the dependent module bionode-fasta.

Contributing

To contribute, clone this repo locally and commit your code on a separate branch.

Please write unit tests for your code, and check that everything works by running the following before opening a pull-request:

$ npm test

To test on the browser:

$ npm run test-browser
# if you get "No headless browser found" do:
$ npm install -g phantomjs
$ rm ~/.config/browser-launcher/config.json

Please also check for code coverage:

$ npm run coverage

To rebuild and minify the module for the browser:

$ npm run build-browser

To rebuild the documentation using the comments in the code:

$ npm run build-docs

Check the issues for ways to contribute.

Contacts

Bruno Vieira <[email protected]> @bmpvieira

License

fasta-parser is licensed under the MIT license.
Check ChooseALicense.com for details.