Coder Social home page Coder Social logo

genomology's Introduction

Genomic genealogy library in R

R code for analysis of family genome-wide DNA data (e.g. AncestryDNA and 23andme raw DNA data).

Visit the R homepage to learn more about the R statistical programming language. R is a popular system for doing professional DNA data analysis with Bioconductor packages.

This R package, genomology, is for doing genetic geneology and is a bit "hobby-ish" compared to what bioinformatics professionals would typically do with R and Bioconductor.

An example usage of this packge could be determining what percentage of genes a grand-child has received from grand-parents. This can be done with raw DNA data from AncestryDNA or 23andme for a grandparent, a "middle" parent and a grandchild.

Help

You can get package and function documentation from within R by doing:

library(genomology)
help(package="genomology")

Example

In this example:

  • three family members DNA data is read (grandma, dad, girl) from different DNA services
  • DNA data is merged together with extra information like genes and basepair ranges
  • genotypes for lactase persistance (lactose tolerance) regulating gene MCM6 is printed
  • estimation of which chromosome regions of girl are descended from grandma
  • bar plot by chromosome of how much of girls DNA is inherited from dad's mom (grandma) vs dad's dad
library(genomology)
set.genomology.loci(read.csv("http://ref.castedo.com/dna/loci.csv", comment.char="#"))

grandma <- read.ancestrydna.web("http://example.com/dna-data-grandma.zip")
dad <- read.23andme.web("http://example.com/dna-data-dad.zip")
girl <- read.ancestrydna.web("http://example.com/dna-data-kid.zip")

dna <- grandma[, 1:3]
dna$zone <- chromozone(dna$chromosome, dna$position)
dna$gene <- locus.at(dna$chromosome, dna$position)
dna$gma <- grandma$genotype
dna$dad <- dad$genotype[match(dna$rsid, dad$rsid)]
dna$girl <- girl$genotype

dna <- dna[chromorder23(dna$chromosome, dna$position),]
dna$range <- chromorange(dna$chromosome, dna$position)

subset(dna, gene == 'LCT')

attach(dna)

kidNuc <- allele.assigned(assign.parent(dad, girl), girl)
dadMa <- assign.parent(gma, dad)
kidGrandSign <- assign.grandparents(dadMa, assign.passage(dad, kidNuc))
kidGrandSign[chromosome == 23] <- 1 # dad passes grandma's X to girl
gma.prob <- assign.descent(chromordinate(chromosome, position), kidGrandSign)

tab <- tapply(range/sum(range), list(call=prob.triage(gma.prob), zone=zone), sum)
tab[is.na(tab)] <- 0

barplot(tab, horiz=TRUE, las=1, ylab="Chromosome")

MATH

The core mathematical functions used in this package are idescent.prob and recombination.prob. Documentation is in the package help, but only the PDF (LaTeX) versions have the mathematical derivations. For convenience, the PDF versions are also online:

INSTALL

Clone this repository and from inside do

R CMD INSTALL package

Please email [email protected] if you install this package or want a built R package online (which would be easier to install).

genomology's People

Contributors

castedo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.