Buffer Stream parser from FASTA to JSON.
Install fasta-parser with npm:
$ npm install fasta-parserAlternatively, just include fasta-parser.min.js via a <script/> in your page.
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.
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 testTo 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.jsonPlease also check for code coverage:
$ npm run coverageTo rebuild and minify the module for the browser:
$ npm run build-browserTo rebuild the documentation using the comments in the code:
$ npm run build-docsCheck the issues for ways to contribute.
Bruno Vieira <mail@bmpvieira.com> @bmpvieira
fasta-parser is licensed under the MIT license.
Check ChooseALicense.com for details.
