0.1.17 • Published 8 years ago
biojs-io-fasta v0.1.17
biojs-io-fasta
npm install biojs-io-fasta
Use in your browser
<script src="http://wzrd.in/bundle/biojs-io-fasta@latest"></script>
- 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
});
If callback is undefined, read
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);
});
parse(str)
var seqs = Fasta.parse(str);
export(model)
var text = Fasta.export(seqs);
extend(customParser)
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
0.1.17
8 years ago
0.1.16
8 years ago
0.1.15
8 years ago
0.1.14
8 years ago
0.1.13
8 years ago
0.1.12
9 years ago
0.1.11
9 years ago
0.1.10
9 years ago
0.1.9
9 years ago
0.1.8
9 years ago
0.1.7
9 years ago
0.1.6
9 years ago
0.1.5
9 years ago
0.1.4
9 years ago
0.1.3
9 years ago
0.1.2
9 years ago
0.1.1
9 years ago
0.1.0
9 years ago
0.0.14
9 years ago
0.0.13
10 years ago
0.0.12
10 years ago
0.0.11
10 years ago
0.0.10
10 years ago
0.0.9
10 years ago
0.0.8
10 years ago
0.0.7
10 years ago
0.0.6
10 years ago
0.0.5
10 years ago
0.0.4
10 years ago
0.0.3
10 years ago
0.0.2
10 years ago
0.0.1
10 years ago