Code Monkey home page Code Monkey logo

kinship's Introduction

Few R functions to help to manage the pedigree records.
kinship.make.ped is function to convert the normal pedigree records to a format needed by Kinship2 package in R.
original pedigree records structure: 11 22 33 pedigree format of kinship2: 22 NA NA 33 NA NA 11 22 33

kinship.ancestor.standard is the function to extract the given generations of ancestors of the given individual.

kinship.descendant.standard is the function to extract the given number of generations descendants of a given individual.

kinship.sibling.standard is a function to find all the siblings and half-siblings of a given individual.

kinship.mate is a function to find all the individuals mated with a given individual.

By playing around with these functions, you can manage you pedigree and generate pedigrees of individuals you are interested in in a big pedigree which is not possible to plot out. For instance, if you would like to plot all the descendants of all sibling and half-sibling of a targeted individual, you could achieve it like this:
individual<-ped$individual
fa<-ped$sire
mo<-ped$dam
sibling<-kinship.sibling.standart(id,individual,fa,mo)

extract the descendants of all siblings

sibling_descent_all<-data.frame()
for (i in sibling[,1] ) {
sibling_descent<-kinship.descendant.standard(i,g=1,individual,fa,mo)
sibling_descent_all<-rbind(sibling_descent_all,sibling_descent)
}
sibling_descent_all<-unique(sibling_descent_all)

if you would like to add a few generation of ancestor as well, you could use kinship.ancestor.standard(g,id,individual,fa,mo) function

find founders

sibling_descent_all<-kinship.make.ped(indidvidual,fa,mo)

then add the sex, affection and other information. remove the duplicates, then it is ready for the pedigree() function of Kinship2 package.

kinship's People

Contributors

yu052 avatar

Watchers

 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.