bionode-fastq
Advanced tools
Comparing version 0.1.0 to 2.1.0
@@ -1,1 +0,1 @@ | ||
module.exports = require('./lib/bionode-fastq') | ||
module.exports = require('./lib/bionode-fastq') |
@@ -1,46 +0,39 @@ | ||
var fs = require('fs'); | ||
var stream = require('stream'); | ||
var readline = require('readline'); | ||
var fs = require('fs') | ||
var Stream = require('stream') | ||
var readline = require('readline') | ||
var block = []; | ||
var events = require('events') | ||
var block = [] | ||
var toObject = function (block) { | ||
return { | ||
name: block[0], | ||
seq: block[1], | ||
name2: block[2], | ||
qual: block[3] | ||
} | ||
} | ||
return { | ||
name: block[0], | ||
seq: block[1], | ||
name2: block[2], | ||
qual: block[3] | ||
} | ||
var fastq = new events.EventEmitter() | ||
fastq.read = function (path) { | ||
var instream = fs.createReadStream(path) | ||
var outstream = new Stream() | ||
var rl = readline.createInterface(instream, outstream) | ||
}; | ||
var fastq = { | ||
toFastQ: function (path, onFeature, onEnd) { | ||
var instream = fs.createReadStream(path); | ||
var outstream = new stream(); | ||
var rl = readline.createInterface(instream, outstream); | ||
rl.on('line', function (line) { | ||
block.push(line); | ||
if (block.length == 4) { | ||
var obj = toObject(block); | ||
onFeature(obj); | ||
block = []; | ||
} | ||
}); | ||
rl.on('close', function () { | ||
if (onEnd) { | ||
onEnd(); | ||
} | ||
}); | ||
rl.on('line', function (line) { | ||
block.push(line) | ||
if (block.length === 4) { | ||
var obj = toObject(block) | ||
fastq.emit('data', obj) | ||
block = [] | ||
} | ||
}) | ||
}; | ||
rl.on('close', function () { | ||
fastq.emit('end') | ||
}) | ||
return this | ||
} | ||
module.exports = fastq; | ||
module.exports = fastq |
{ | ||
"name": "bionode-fastq", | ||
"version": "0.1.0", | ||
"version": "2.1.0", | ||
"homepage": "http://bionode.io", | ||
"description": "Streamable FASTQ parser", | ||
"scripts": { | ||
"test": "mocha" | ||
"test": "standard && mocha", | ||
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec", | ||
"coveralls": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage" | ||
}, | ||
@@ -28,4 +30,7 @@ "author": { | ||
"chai": "^2.2.0", | ||
"mocha": "^2.2.4" | ||
"mocha": "^2.2.4", | ||
"standard": "^3.5.0", | ||
"coveralls": "^2.11.2", | ||
"istanbul": "^0.3.13" | ||
} | ||
} |
@@ -9,4 +9,32 @@ <p align="center"> | ||
# bionode-fastq | ||
> Streamable FASTQ parser. | ||
> Streamable FASTQ parser. | ||
[![Build Status](https://travis-ci.org/bionode/bionode-fastq.svg?branch=master)](https://travis-ci.org/bionode/bionode-fastq) | ||
[![NPM][npm-stats-image]][npm-stats-url] | ||
[![NPM version][npm-image]][npm-url] | ||
[![Build Status][travis-image]][travis-url] | ||
[![Coveralls Status][coveralls-image]][coveralls-url] | ||
[![Dependency Status][depstat-image]][depstat-url] | ||
[![Standard style][js-standard-style-image]][js-standard-style-url] | ||
[![Gitter chat][gitter-image]][gitter-url] | ||
[![DOI][doi-image]][doi-url] | ||
[![Stories in Ready at waffle.io][waffle-image]][waffle-url] | ||
[npm-stats-url]: https://nodei.co/npm/bionode-fastq | ||
[npm-stats-image]: https://nodei.co/npm/bionode-fastq.png?downloads=true&downloadRank=true&stars=true | ||
[npm-url]: http://npmjs.org/package/bionode-fastq | ||
[npm-image]: http://img.shields.io/npm/v/bionode-fastq.svg?style=flat-square | ||
[travis-url]: http://travis-ci.org/bionode/bionode-fastq | ||
[travis-image]: http://img.shields.io/travis/bionode/bionode-fastq.svg?style=flat-square | ||
[coveralls-url]: http://coveralls.io/r/bionode/bionode-fastq | ||
[coveralls-image]: http://img.shields.io/coveralls/bionode/bionode-fastq.svg?style=flat-square | ||
[depstat-url]: http://david-dm.org/bionode/bionode-fastq | ||
[depstat-image]: http://img.shields.io/david/bionode/bionode-fastq.svg?style=flat-square | ||
[js-standard-style-url]: https://github.com/feross/standard | ||
[js-standard-style-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square | ||
[gitter-image]: http://img.shields.io/badge/gitter-bionode/bionode--fastq-brightgreen.svg?style=flat-square | ||
[gitter-url]: https://gitter.im/bionode/bionode-fastq | ||
[waffle-image]: https://badge.waffle.io/bionode/bionode-fastq.png?label=ready&title=issues%20ready | ||
[waffle-url]: https://waffle.io/bionode/bionode-fastq | ||
[doi-url]: http://dx.doi.org/? | ||
[doi-image]: http://img.shields.io/badge/doi-NA/NA-blue.svg?style=flat-square |
@@ -1,28 +0,28 @@ | ||
'use strict'; | ||
var should = require('chai').should(); | ||
var fastq = require('../index'); | ||
/* global describe, it */ | ||
'use strict' | ||
require('chai').should() | ||
var fastq = require('../index') | ||
describe('toFastQ', function () { | ||
this.timeout(4000) | ||
var output = [] | ||
this.timeout(4000); | ||
var output = []; | ||
it('should run without error', function (done) { | ||
var applyToEach = function (item) { | ||
output.push(item) | ||
} | ||
var onEnd = function (err) { | ||
if (err) { | ||
return done(err) | ||
} | ||
return done() | ||
} | ||
it('should run without error', function (done) { | ||
var applyToEach = function (item) { | ||
output.push(item); | ||
}; | ||
var onEnd = function (err) { | ||
if (err) { | ||
return done(err); | ||
} | ||
return done(); | ||
}; | ||
fastq.toFastQ('test/data/sample.fq', applyToEach, onEnd); | ||
}); | ||
fastq.read('test/data/sample.fq').on('data', applyToEach).on('end', onEnd) | ||
}) | ||
it('should process 100 objects', function (done) { | ||
output.length.should.equal(100); | ||
done(); | ||
}); | ||
}); | ||
it('should process 100 objects', function (done) { | ||
output.length.should.equal(100) | ||
done() | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
17731
57
0
40
5