Code Monkey home page Code Monkey logo

fasta2json's Introduction

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.

fasta2json's People

Contributors

akashzcoder avatar jmjuanes avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.