Skip to content

Commit

Permalink
README.md edits, NodeJS v4 + v5 support (let not permitted outside of…
Browse files Browse the repository at this point in the history
… strict mode), package.json updates.
  • Loading branch information
MatthewRalston committed Jan 19, 2018
1 parent ba97f8b commit d01e6e6
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 37 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ language: node_js
node_js:
- "node"
- "lts/*"
- "iojs"
- "4"
- "5"
- "6"
Expand Down
File renamed without changes.
File renamed without changes.
37 changes: 32 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# README - Kmer.js
>A Javascript/NodeJS package for shredding strings into all possible substrings of length 'k'
[![NPM Version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]
[![Downloads Stats][npm-downloads]][npm-url]

[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Linux Build][travis-image]][travis-url]
[![Test Coverage][coveralls-image]][coveralls-url]

Kmer.js is a NodeJS package designed for data/science applications. It addresses the ['k-mer' problem](https://en.wikipedia.org/wiki/K-mer)(substrings of length from a string) in a simple and performant manner. This library produces all of the `n - k + 1` substrings of length `k` from a string of length `n`.

## Installation
Expand All @@ -17,6 +18,20 @@ npm install --save kmer.js

## Usage Example

```javascript
>var kmers = require('kmer.js');
>var fourmers = kmers("hello world!", 4)
[ 'hell',
'ello',
'llo ',
'lo w',
'o wo',
' wor',
'worl',
'orld',
'rld!' ]
```

## Develoment

```sh
Expand All @@ -34,8 +49,20 @@ Distributed under the GPL v3.0 license. See `LICENSE.txt` for the copy distribut

## Contributing

1. Fork it (<https://github.com/yourname/yourproject/fork>)
1. Fork it (<https://github.com/MatthewRlston/kmer.js/fork>)
2. Create your feature branch (`git checkout -b feature/fooBar`)
3. Commit your changes (`git commit -am 'Add some fooBar'`)
4. Push to the branch (`git push origin feature/fooBar`)
5. Create a new Pull Request




[npm-image]: https://img.shields.io/npm/v/kmer.js.svg
[npm-url]: https://npmjs.org/package/kmer.js
[downloads-image]: https://img.shields.io/npm/dm/kmer.js.svg
[downloads-url]: https://npmjs.org/package/kmer.js
[travis-image]: https://img.shields.io/travis/MatthewRalston/kmer.js/master.svg?label=linux
[travis-url]: https://travis-ci.org/MatthewRalston/kmer.js
[coveralls-image]: https://img.shields.io/coveralls/MatthewRalston/kmer.js/master.svg
[coveralls-url]: https://coveralls.io/r/MatthewRalston/kmer.js?branch=master
2 changes: 2 additions & 0 deletions kmer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const Type=require('type-of-is');


Expand Down
64 changes: 40 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,42 @@
{
"name": "kmers",
"version": "0.0.1",
"description": "A javascript module and CLI for shredding sequences into k-mers.",
"main": "./kmer.js",
"scripts": {
"test": "./node_modules/.bin/nyc --reporter=html --reporter=text ./node_modules/.bin/mocha test/*_spec.js",
"bench": "node ./test/kmer_perf.js",
"coverage": "./node_modules/.bin/nyc report --reporter=text-lcov | coveralls"
},
"keywords": [
"bio"
],
"author": "Matthew Ralston <mrals89@gmail.com>",
"license": "GPL-3.0",
"devDependencies": {
"chai": "^4.1.2",
"coveralls": "^3.0.0",
"mocha": "^4.1.0",
"nyc": "^11.4.1"
},
"dependencies": {
"benchmark": "^2.1.4",
"type-of-is": "^3.5.1"
}
"name": "kmer.js",
"version": "0.0.1",
"engines": {
"node": ">=6.10"
},
"description": "A javascript module and CLI for shredding sequences into k-mers.",
"main": "./kmer.js",
"scripts": {
"test": "./node_modules/.bin/nyc --reporter=html --reporter=text ./node_modules/.bin/mocha test/*_spec.js",
"bench": "node ./test/kmer_perf.js",
"coverage": "./node_modules/.bin/nyc report --reporter=text-lcov | coveralls"
},
"keywords": [
"bio",
"kmers",
"kmer",
"bioinformatics"
],
"author": "Matthew Ralston <mrals89@gmail.com>",
"license": "GPL-3.0",
"url": "https://www.npmjs.com/package/kmer.js",
"repository": {
"type": "git",
"url": "https://github.com/MatthewRalston/kmer.js"
},
"bugs": {
"url": "https://github.com/MatthewRalston/kmer.js/issues",
"email": "mrals89@gmail.com"
},
"devDependencies": {
"chai": "^4.1.2",
"coveralls": "^3.0.0",
"mocha": "^4.1.0",
"nyc": "^11.4.1",
"benchmark": "^2.1.4"
},
"dependencies": {
"type-of-is": "^3.5.1"
},
"os": ["darwin", "linux"]
}
10 changes: 5 additions & 5 deletions test/kmer_perf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/env node

'use strict';
const kmers = require('./../');
const Benchmark = require('benchmark');
var suite = new Benchmark.Suite
Expand All @@ -17,11 +17,11 @@ function constantN(k){
};

function constantK(){
let min = 10;
let max = 100;
var min = 10;
var max = 100;
for (i = min; i < max; i++){
let s = Array(i).fill(1).join('');
let k = Math.floor(i*0.45);
var s = Array(i).fill(1).join('');
var k = Math.floor(i*0.45);
suite.add(`kmers() with string '${s}' (length ${s.length}) and k = ${k}`, function(){
kmers(s, k);
});
Expand Down
4 changes: 2 additions & 2 deletions test/kmer_spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

'use-strict';
const expect = require("chai").expect;
kmers = require("./../");

Expand Down Expand Up @@ -94,7 +94,7 @@ describe("kmers()", function(){
it("returns the theoretical maximum (n!/(n-k)! = n-k+1) substrings", function(){
// Test all cases where 0 < k < n and prove that the theoretically correct number of substrings is calculated.
for (i=1; i < s.length; i++){
let maxLength = theoreticalMaximumSimple(s.length, i);
var maxLength = theoreticalMaximumSimple(s.length, i);
expect(kmers(s, i)).to.have.lengthOf(maxLength);
}
});
Expand Down

0 comments on commit d01e6e6

Please sign in to comment.