Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing genotype compatible #2

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

sinarueeger
Copy link

Hi @diptavo,

I have noticed that missing genotype data results in an error in a basic MultiSKAT model.

library(MultiSKAT)
#> Loading required package: SKAT
#> Loading required package: nlme
#> Warning: package 'nlme' was built under R version 3.5.2
#> Loading required package: copula
#> Warning: package 'copula' was built under R version 3.5.2
data(MultiSKAT.example.data)
attach(MultiSKAT.example.data)

## Introduce NAs in Genotypes
Genotypes[1,1] <- NA

obj_null <- MultiSKAT_NULL(Phenotypes, Cov)

MultiSKAT(obj_null, Genotypes, Sigma_p = cov(Phenotypes), verbose = FALSE)
#> Error in if (mf[i] > 0.5) mf[i] = 1 - mf[i]: missing value where TRUE/FALSE needed

detach(MultiSKAT.example.data)

Created on 2019-06-11 by the reprex package (v0.2.1)

Bug fix

I found that the error message stems from theMAF function stored in R/helpers.R. More specifically, MAF contains a sum function that will yield in NA, if the G matrix contains any NAs.
I have added an na.rm = TRUE to the sum function.

I have also added a unit test that will fail with the version you currently have on the master, but pass with my version.

I let you choose what kind of files you want to merge into your master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant