This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

fasta2json

0.1.1 • Public • Published

Release notes v0.1.1

fasta2json

Converts fasta file/string to a json object.

NPM Version NPM Downloads

Installation

You can install fasta2json using NPM or Bower:

  • npm: npm install fasta2json
  • Bower: bower install fasta2json

Reference

fasta2json.ReadFasta(path)

Read a FASTA file and returns and JSON object.

var json = fasta2json.ReadFasta('file.fasta');

fasta2json.ParseFasta(string)

Returns a JSON object from a string containing a fasta file.

//Fasta in string format
var fasta_str = '>seq1\nACCTAAGCTTAGCCAAAGTCCAGAACCACAGT';

//Get the JSON
var json = fasta2json.ParseFasta(fasta_str);

/* Output:
json = [{ "head": "seq1", "seq": "ACCTAAGCTTAGCCAAAGTCCAGAACCACAGT"} ] 
*/

fasta2json.Export(json)

Returns a string with the fasta format from an JSON object.

//JSON object
var json = [
{ "head": "seq1", "seq": "ACCTAAGCTTAGCCAAAGTCCAGAACCACAGT"}
{ "head": "seq2", "seq": "AACTTTGGTTAAACACATGGATCCAGTTTGAC"}
];

//Get a string
var string = fasta2json.Export(json);

/* Output:
string = '>seq1\nACCTAAGCTTAGCCAAAGTCCAGAACCACAGT\n>seq2\nAACTTTGGTTAAACACATGGATCCAGTTTGAC\n'
*/

fasta2json.ExportToFile(json, file)

Generates a fasta file from the json object.

fasta2json.ExportToFile(json, 'new.fasta');

License

fasta2json is under the MIT license.

Package Sidebar

Install

npm i fasta2json

Weekly Downloads

1

Version

0.1.1

License

MIT

Last publish

Collaborators

  • jmjuanes