GithubHelp home page GithubHelp logo

matthewwolak / nadiv Goto Github PK

View Code? Open in Web Editor NEW
16.0 3.0 7.0 2.47 MB

R package that constructs (non)additive genetic relationship matrices, and their inverses, from a pedigree to be used in linear mixed effect models (A.K.A. the 'animal model').

R 74.74% C++ 20.18% C 5.08%

nadiv's Introduction

nadiv

DOI

R package that constructs (non)additive genetic relationship matrices, and their inverses, from a pedigree to be used in linear mixed effect models (A.K.A. the 'animal model'). Also includes other functions to facilitate the use of animal models. Some functions have been created to be used in conjunction with the R package for ASReml software.

See the latest developments:

Overview of main branches:

  • master branch is the most recent production version (typically the same as what is available from the R CRAN mirrors)

  • devel branch is a preview of the next release which should be functional and error/bug free, but proceed with caution

To obtain nadiv:

  • From R:
    • see the package page for the latest release of nadiv on CRAN where you can download the source.
    • install the latest release of the package directly in R:
   install.packages("nadiv")
- then select your favorite [CRAN mirror](https://CRAN.R-project.org/)
  • From GitHub:
    • clone or download the latest development version here
    • install the latest development version directly in R using the remotes package https://github.com/r-lib/remotes:
   library(remotes); install_github("matthewwolak/nadiv", ref = "devel")

nadiv's People

Contributors

matthewwolak avatar

Stargazers

Roy Storey avatar Jacky avatar Robert Z. Shrote avatar  avatar Hsiao-Yi Hung avatar Kevin Wright avatar YIGUIz avatar shuo1029 avatar  avatar Yunrui Lu avatar Paul L. Maurizio avatar 邓飞 avatar Ian Dewan avatar  avatar Facundo Muñoz avatar Claas Heuer avatar

Watchers

 avatar Neville Jackson avatar 邓飞 avatar

nadiv's Issues

minv use of =-

Clang throws a warning here:

j =- 1;

From a read through the papers describing the algorithms (specifically https://www.genetics.org/content/genetics/early/2008/07/27/genetics.108.088070.full.pdf p24) it seems to me it is a correct warning, i.e. should be -= in order to iterate through j properly.

In looking for that I also came across this other =-:

AN[k]=-1; // set AN to zero

which is meant to be, though again spacing would help, and though I haven't yet delved into that part of the maths, just noting that the code (-I) differs from the comment (0).

@lmmazur @esscargot

LRTest & ASReml-R positive log-likelihoods

Sometimes the ASReml-R package (asreml) produces positive log-likelihoods. How should these be handled particularly when doing anything based on the log-likelihood ratio tests (e.g., LRTest(), proLik(), and constrainFun())?

The assumption normally is that the log-likelihood values are negative. Then the model with the greater log-likelihood (closer to zero) has a better fit to the data.

@matthewwolak needs to construct a reproducible example and then fix the functions

dimname compliance with Matrix v1.2-1

With the update of the Matrix package, I need to ensure that slot @Dimnames for 'Matrix' objects consist of character vectors. Issue is explained in an e-mail to [email protected] from Martin Maechler 05/30/2015.

Additionally, assign the list for slot @Dimnames using the 'dimnames' argument to Matrix() or sparseMatrix() instead of @Dimnames.

issue with prepPed

Hello,

I have been trying to run prepPed with my pedigree
ped <- prepPed(am_pedigree_red)
and I get this error:
Error in numPed(ped_fixed_ord[, 1:3]) :
Offspring appearing before their dams: first use the 'prepPed' function

The pedigree is formed by 3 columns ID, Dam and Sire, and I've checked that all the ones in the columns Dam and Sire are also in the column ID. Plus I thought the prepPed function was made for taking care of this.

What could cause the problem?

Thank you very much!

Best wishes,

Giulia Masoero

Upgrade to 2.17 gives error

Using this lib via OptiSel

Upgrading to 2.17.0 gives this warning loading the Pedigree

Warning messages:
1: In nPed_fixed[] <- numPed(ped_fixed_ord, check = FALSE) :
  number of items to replace is not a multiple of replacement length
2: In nPed_fixed[] <- numPed(ped_fixed_ord, check = FALSE) :
  number of items to replace is not a multiple of replacement length

Wrong makeA results with Matrix v1.6-1

Hi Matthew,

I am a very happy user of nadiv, but running into some mysterious issues. After updating some packages, my workstation install of nadiv creates obviously incorrect A matrices. E.g.:

> makeA(Mrode2)
6 x 6 sparse Matrix of class "dsCMatrix"
          1         2         3         4         5         6
1 1.8125000 0.5312500 0.5745243 0.7036456 0.4419417 0.1711633
2 0.5312500 1.7031250 0.5524272 0.2435696 0.3977476 0.4279082
3 0.5745243 0.5524272 0.6562500 0.1913664 0.3125000 0.1210307
4 0.7036456 0.2435696 0.1913664 0.9843750 0.3827328 0.1482318
5 0.4419417 0.3977476 0.3125000 0.3827328 0.6250000 0.2420615
6 0.1711633 0.4279082 0.1210307 0.1482318 0.2420615 0.4687500

(In my own data, full siblings have relatedness coefficients of 0.)

Compare with a version running on our cluster:

>  makeA(Mrode2)
6 x 6 sparse Matrix of class "dsCMatrix"
     1     2      3      4      5      6
1 1.00 .     0.5000 0.5000 0.5000 0.2500
2 .    1.000 0.5000 .      0.2500 0.6250
3 0.50 0.500 1.0000 0.2500 0.6250 0.5625
4 0.50 .     0.2500 1.0000 0.6250 0.3125
5 0.50 0.250 0.6250 0.6250 1.1250 0.6875
6 0.25 0.625 0.5625 0.3125 0.6875 1.1250

Both machines are running nadiv_2.17.2. However my workstation is using Matrix_1.6-1, while the cluster uses Matrix_1.5-3. Could that be the issue?

Any help much appreciated!

Issue in heritability estimation using nadiv

Hi, I am fairly new to R. I am using your alfalfa dataset to learn about computing heritability. I got this error, could you please tell me why I am getting this error and how to fix this. Thank you.

H2 <- nadiv:::pin(model1, tmp ~ V1 / (V1 + V2))
Error in names(pframe) <- paste("V", seq(1, length(pframe)), sep = "") :
'names' attribute [2] must be the same length as the vector [0]

likelihood ratio test signs

constrainFun.R, proLik.R and plot.proLik.R all need to be checked so that consistency of calculations from log-likelihood ratio tests is upheld when log-likelihoods are both negative as well as both positive.

May require some idiosyncracies with asreml-R

plot.proLik.R currently does not display a red line for the 1-alpha CI, because the sign of output from pchisq() does not match the sign of the outcome of the LRT. Reproducible example is in the plot.proLik.Rd examples!

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.