blastinutils-ts
TypeScript icon, indicating that this package has built-in type declarations

0.2.1-0 • Public • Published

blastinutils-ts

npm License: CC0-1.0 pipeline status coverage report

Super simple helper library to BLAST software from NCBI

Install

npm install blastinutils-ts

Support

blastp makeblastdb

Usage

CommandToolKit

This is super simple, just build the parameters following the interfaces and ask to build the command.

import { CommandToolKit, interfaces } from 'blastinutils-ts'

const params: IBlastPParameters = {
  db: 'mydb',
  evalue: 1,
  num_threads: 4,
  out: 'myoutputFile.dat',
  outfmt: {
    format: 6,
    parameters: [
      'qseqid',
      'sseqid',
      'bitscore',
      'pident',
      'evalue',
      'length',
    ]
  },
  query: 'myquery'
}

const program: interfaces.supportedProgramsType = 'blastp'
const command = commandTk.build(program, params)
console.log(command)
// blastp -db mydb -evalue 1 -num_threads 4 -out myoutputFile.dat -outfmt "6 qseqid sseqid bitscore pident evalue length" -query myquery

NodesAndLinksStream

This is an experimental parser of BLAST results in output format 6. Because these tend to be long, we implemented as a write stream. After reading the stream, the class has a method: getData() which returns an object { nodes: [ ... ], links: [ ... ] } with the data.

import { NodesAndLinksStream } from 'blastinutils-ts'

const params = {
  format: 6,
  parameters: [
    'qseqid',
    'sseqid',
    'bitscore',
    'pident',
    'evalue',
    'length',
  ]
}

const nodesNlinks = new NodesAndLinksStream.ParseBlastResults(params)
  const blastResultsStream = fs.createReadStream('tabularBlastResults.fmt6.tab')
  blastResultsStream
    .pipe(nodesNlinks)
    .on('finish',() => {
      const data = nodesNlinks.getData()
      /* data.nodes = [
        'seq1',
        'seq2',
        ...
      ]
      // data.links = [
        {
          s: 0, // index of source in data.nodes
          t: 1, // index of target in data.nodes
          e: 20
        },
        {
          s: 0,
          t: 2,
          e: 10
        }
      ]

      */
    })

Documentation

Developer's documentation

...to be continued.

Written with in Typescript.

Readme

Keywords

Package Sidebar

Install

npm i blastinutils-ts

Weekly Downloads

7

Version

0.2.1-0

License

CC0-1.0

Unpacked Size

29.2 kB

Total Files

14

Last publish

Collaborators

  • daviortega