Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasbynens committed May 17, 2015
0 parents commit 8e849de
Show file tree
Hide file tree
Showing 13 changed files with 264 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Test DNA
dna.json

# Coverage report
coverage

# Installed npm modules
node_modules

# Folder view configuration files
.DS_Store
Desktop.ini

# Thumbnail cache files
._*
Thumbs.db

# Files that might appear on external disks
.Spotlight-V100
.Trashes
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
sudo: false
language: node_js
node_js:
- '0.12'
- 'iojs'
after_script:
- 'istanbul cover --verbose --dir coverage node_modules/.bin/_mocha tests/index.js -- -u exports -R spec && cat coverage/lcov.info | coveralls; rm -rf coverage/lcov*'
20 changes: 20 additions & 0 deletions LICENSE-MIT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright Mathias Bynens <https://mathiasbynens.be/>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# genoset-122 [![Build status](https://travis-ci.org/mathiasbynens/genoset-122.svg?branch=master)](https://travis-ci.org/mathiasbynens/genoset-122) [![Code coverage status](https://coveralls.io/repos/mathiasbynens/genoset-122/badge.svg)](https://coveralls.io/r/mathiasbynens/genoset-122) [![Dependency status](https://gemnasium.com/mathiasbynens/genoset-122.svg)](https://gemnasium.com/mathiasbynens/genoset-122)

This script determines if a genome has an increased risk of baldness as per [gs122](http://www.snpedia.com/index.php/Gs122).

## Compatibility

This genoset is to be used with DNA-JSON. See [the _dna2json_ repository](https://github.com/genomejs/dna2json) for more information.

## Usage

```js
var isLikelyToGoBald = require('genoset-122');
var dna = require('./my-dna.json');

console.log(isLikelyToGoBald(dna));
// → `true` or `false`
```

## Author

| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |
|---|
| [Mathias Bynens](https://mathiasbynens.be/) |

## License

_genoset-122_ is available under the [MIT](https://mths.be/mit) license.
20 changes: 20 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var gql = require('gql');
var isMale = require('genoset-male');

module.exports = function(dna) {
if (!isMale(dna)) { // This is equivalent to gs145.
return false;
}
var query = gql.and([
gql.only('rs6625163', 'A'),
gql.or([
gql.only('rs1160312', 'A'),
gql.exact('rs1160312', 'AG'),
gql.and([
gql.only('rs201571', 'T'),
gql.only('rs6036025', 'G')
])
])
]);
return query(dna);
};
44 changes: 44 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "genoset-122",
"version": "0.0.0",
"description": "Determines if a genome has an increased risk of baldness (gs122).",
"homepage": "https://mths.be/gs122",
"main": "index.js",
"keywords": [
"bald",
"baldness",
"dna",
"genes",
"genetics",
"genome",
"genoset",
"gs122"
],
"license": "MIT",
"author": {
"name": "Mathias Bynens",
"url": "https://mathiasbynens.be/"
},
"repository": {
"type": "git",
"url": "https://github.com/mathiasbynens/genoset-122.git"
},
"bugs": "https://github.com/mathiasbynens/genoset-122/issues",
"files": [
"LICENSE-MIT.txt",
"index.js"
],
"scripts": {
"test": "mocha tests"
},
"dependencies": {
"genoset-male": "^1.0.0",
"gql": "^1.1.0"
},
"devDependencies": {
"coveralls": "^2.11.2",
"istanbul": "^0.3.11",
"mocha": "^2.2.5",
"should": "^6.0.1"
}
}
10 changes: 10 additions & 0 deletions tests/fixtures/female-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"rs6625163": {
"chromosome": "X",
"genotype": "AA"
},
"rs1160312": {
"chromosome": 20,
"genotype": "AA"
}
}
14 changes: 14 additions & 0 deletions tests/fixtures/female-2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"rs6625163": {
"chromosome": "X",
"genotype": "AA"
},
"rs201571": {
"chromosome": 20,
"genotype": "TT"
},
"rs6036025": {
"chromosome": 20,
"genotype": "GG"
}
}
19 changes: 19 additions & 0 deletions tests/fixtures/male-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"rs2032651": {
"chromosome": "Y",
"genotype": "D"
},
"rs9341296": {
"chromosome": "Y",
"genotype": "C"
},

"rs6625163": {
"chromosome": "X",
"genotype": "AA"
},
"rs1160312": {
"chromosome": 20,
"genotype": "AA"
}
}
23 changes: 23 additions & 0 deletions tests/fixtures/male-2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"rs2032651": {
"chromosome": "Y",
"genotype": "D"
},
"rs9341296": {
"chromosome": "Y",
"genotype": "C"
},

"rs6625163": {
"chromosome": "X",
"genotype": "AA"
},
"rs201571": {
"chromosome": 20,
"genotype": "TT"
},
"rs6036025": {
"chromosome": 20,
"genotype": "GG"
}
}
19 changes: 19 additions & 0 deletions tests/fixtures/male-3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"rs2032651": {
"chromosome": "Y",
"genotype": "D"
},
"rs9341296": {
"chromosome": "Y",
"genotype": "C"
},

"rs6625163": {
"chromosome": "X",
"genotype": "AT"
},
"rs1160312": {
"chromosome": 20,
"genotype": "AA"
}
}
23 changes: 23 additions & 0 deletions tests/fixtures/male-4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"rs2032651": {
"chromosome": "Y",
"genotype": "D"
},
"rs9341296": {
"chromosome": "Y",
"genotype": "C"
},

"rs6625163": {
"chromosome": "X",
"genotype": "AA"
},
"rs201571": {
"chromosome": 20,
"genotype": "TT"
},
"rs6036025": {
"chromosome": 20,
"genotype": "AA"
}
}
18 changes: 18 additions & 0 deletions tests/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var isLikelyToGoBald = require('../index.js');
var assert = require('assert');
require('mocha');

describe('genoset-122', function() {
it('should match male genomes that fulfill the criteria', function() {
assert.equal(isLikelyToGoBald(require('./fixtures/male-1.json')), true);
assert.equal(isLikelyToGoBald(require('./fixtures/male-2.json')), true);
});
it('should not match a male genome that doesn’t fulfill the criteria', function() {
assert.equal(isLikelyToGoBald(require('./fixtures/male-3.json')), false);
assert.equal(isLikelyToGoBald(require('./fixtures/male-4.json')), false);
});
it('should not match a female genome, even if it fulfills all other criteria', function() {
assert.equal(isLikelyToGoBald(require('./fixtures/female-1.json')), false);
assert.equal(isLikelyToGoBald(require('./fixtures/female-2.json')), false);
});
});

0 comments on commit 8e849de

Please sign in to comment.