GithubHelp home page GithubHelp logo

dna2json's Introduction

Build Status

NPM version

Information

Packagedna2json
Description Formats your DNA file as JSON
Node Version >= 0.4

Terminology

SNP

A SNP (single-nucleotide polymorphism - pronounced "snip") is a mutation in your genome. SNPs can tell you a lot about yourself (hair color, height, muscle type, allergies, response to disease, response to pharmaceuticals, heritage, etc.).

Your DNA file from any vendor will be a big list of these SNPs. Think of it like a diff against a reference human genome. Most vendors will compare your genome against GRCh Build 37

autosome

Vendors

Name Supported Price Sample Autosomal SNPs Y SNPs X SNPs MT SNPs Raw Data
23andMe Yes 99 USD Saliva 967,000 3,089 26,087 2,737 Yes
ancestryDNA Yes 99 USD Saliva 682,549 885 17,604 0 Yes
FamilyTree Yes 99 USD Cheek Swab 708,092 0 18,091 0 Yes

tl;dr use 23andMe they provide more data and are the cheapest

CLI Usage

Use this if you just want to convert your data to the correct format so you can start querying your genome.

$ npm install dna2json -g
$ dna2json
Usage: dna2json <input file> <output file>
$ dna2json dna.txt dna.json
This will take a while...

It will stream the SNPs to disk as JSON - pretty easy.

Module Usage

var dna = require('dna2json');
var JSONStream = require('JSONStream');
var fs = require('fs');

// dna.createParser() returns a duplex stream
// input = text from your dna file
// output = SNPs as JSON
// to write to disk just pipe it to JSONStream then to fs

fs.createReadStream("dna.txt")
  .pipe(dna.createParser())
  .pipe(JSONStream.stringify())
  .pipe(fs.createWriteStream("dna.json"));

SNP-JSON

Every vendor has their own format for your DNA. I decided to make a standard format called SNP-JSON. This library will convert custom formats to this standard.

SNP-JSON looks like this

[
{"id":"rs10749813","c":1,"pos":73557945,"g":null},
{"id":"rs4128552","c":1,"pos":73560811,"g":"GT"},
{"id":"rs12033354","c":1,"pos":73573941,"g":"AG"},
{"id":"rs4603080","c":1,"pos":73579237,"g":"AG"},
{"id":"rs4582739","c":1,"pos":73602381,"g":"CT"},
{"id":"rs4452995","c":1,"pos":73613560,"g":"CT"}
]

Explanation:

Key Description
id RSID or vendor ID
c Chromosome (1-22, X, Y, or MT)
pos GRCh position
g Genotype

Using your SNP-JSON

Once you have your data in the right format you can use the library of genosets by genomejs.

You can view a list of these at this npm search

You can also make your own tools that analyze your DNA however you want. It's yours! Here is a tool that will help query your DNA GQL

LICENSE

(MIT License)

Copyright (c) 2013 Fractal [email protected]

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.

dna2json's People

Contributors

yocontra avatar johnstonian avatar pangratz avatar paulirish avatar

Stargazers

Matt Rose avatar Angus H. avatar Gabriel Guerreiro avatar Brian Ray avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

modulexcite

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.