npm install biojs-io-fastabiojs-io-fasta
----------------





```
npm install biojs-io-fasta
Use in your browser
-------------------
``
* You can find a JSBin to play around with it.
* Remember that you need CORS to download files from other servers on the web
Methods
------
``
var Fasta = require('biojs-io-fasta');
#### read(url)
Parses an url an calls your parse method with the returned body.
``
Fasta.read("https://raw.githubusercontent.com/biojs-io/biojs-io-fasta/master/test/foo.fasta", function(err, model) {
// model is the parsed url
});read
If callback is undefined, returns a promise.
``
var p = Fasta.read("https://raw.githubusercontent.com/biojs-io/biojs-io-fasta/master/test/foo.fasta");
// ...
p.then(function(model) {
// model is the parsed url
}, function(err){
console.error("err happened during downloading", err);
});
``
var seqs = Fasta.parse(str);
``
var text = Fasta.export(seqs);
Thanks to @sillitoe you can provide a custom parser
if your FASTA header is formatted "in weird and wonderful ways".
``
var customGetMeta = function(header) {
return {
id: "id",
name: "name",
// optional
details: {
foo: "bar"
},
// optional
ids: {
customId: "bar"
}
};
}
var altFasta = Fasta.extend(customGetMeta);
Take a look at tests
for a better example of such a parser;
Sequence object
---------------
``
{
seq: "ABC",
name: "awesome seq",
id: "unique id"
}
Develop
--------
Install dependencies and execute the tests:
``
npm install
npm script compile && npm test
To build a JS file for the browser, execute:
```
npm run build-browser
License
--------
Apache 2