blastinutils-ts
v0.2.1-0
Published
Super simple helper library to BLAST software from NCBI
Downloads
4
Readme
blastinutils-ts
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
...to be continued.
Written with ❤ in Typescript.