Skip to content

Instantly share code, notes, and snippets.

@maxogden

maxogden/index.js

Created Feb 27, 2018
Embed
What would you like to do?
read NCBI Blast seqdb sequence database .nin file metadata
// $ node read.js nt.00.nin
var fs = require('fs')
var int53 = require('int53')
f = process.argv[2]
function read (fd, start, end, cb) {
var len = end - start + 1
var buf = new Buffer(len)
fs.read(fd, buf, 0, len, start, function (err) {
cb(err, buf)
})
}
fs.open(f, 'r', function (err, fd) {
read(fd, 0, 1024, function (err, buf) {
var offset = 8
var titlen = buf.readUInt32BE(offset)
offset += 4
var title = buf.slice(offset, offset + titlen)
offset = offset + titlen
var datelen = buf.readUInt32BE(offset)
offset += 4
var date = buf.slice(offset, offset + datelen)
offset = offset + datelen
var oidlen = buf.readUInt32BE(offset)
offset += 4
var baselen = buf.slice(offset, offset + 8)
baselen = int53.readUInt64LE(baselen)
console.log(oidlen)
// console.log(baselen)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.