Skip to content

OchoaLab/polygenr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

polygenr

The goal of polygenr is to experiment with raking variants in sparse/penalized regression approaches, particularly glmnet.

Installation

Install from this GitHub repository using:

library(devtools)
install_github('OchoaLab/polygenr')

Example

This is a basic example which shows you how to solve a common problem:

library(polygenr)

# expected data:
# X: genotype matrix, with loci along rows, individuals along columns
# y: trait vector, length equal to number of individals
# pcs: PC/eigenvector matrix, individuals along rows, dimensions along columns

# fit sparse model while controling for population structure using principal components
obj <- glmnet_pca(X, y, pcs)

# most important component is sparse coefficient matrix:
beta <- obj$beta

# one way of ranking variants, by order of apearance (as penalty factor lambda is decreased):
# returns a vector with length equal to the rows of `beta`
scores <- scores_glmnet( beta )

# another way to rank
# by refitting and calculating ANOVA type-II p-values for each submodel (each column of `beta`)
# returns a matrix of the same dimensions as `beta`
pvals <- anova_glmnet( beta, X, y, pcs )

About

Methods for polygenic models

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages