Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fasta-js

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fasta-js

A general purpose module for parsing FASTA files

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

fasta-js

This module provides simple yet flexible FASTA parsing functionality.

Installation

npm install fasta-js --save

Usage

var fastaParser = require('fasta-js');

var options = {
  'definition': 'gi|accession|description',
  'delimiter': '|'
};

var fasta = new fastaParser(options);

var sequenceData = `>gi|123456|Sequence A
ATCGATCGATCG
>gi|567890|Sequence B
CATCATCATGGG`

console.log(fasta.parse(sequenceData));

Output

[ 
  { 
    gi: 'gi',
    accession: '123456',
    description: 'Sequence A',
    sequence: 'ATCGATCGATCG'
  },
  {
      gi: 'gi',
      accession: '567890',
      description: 'Sequence B',
      sequence: 'CATCATCATGGG' 
  } 
]

The options are of course optional. The default values are

{
  'definition': 'id',
  'delimiter': ''
}

In this case, the entire definition line for the sequence will be saved as the ID for the sequence and no delimiting will take place. If you do decide to pass in the options, then the definition will be the title of each field separated by the delimiter that you specify as the other option.

The parse function does not care whether or not you are giving it DNA/RNA/protein/whatever, but the string of fasta data must have line separations (\n). Sequences can span multiple lines.

Tests

You can run npm test to run the tests after installing the development dependencies.

Future functionality

No future functionality is planned.

License

This software is released under the MIT license.

Support this project!

Support this project on Patreon!

Keywords

FAQs

Package last updated on 21 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc