Title: | Weighted Inbred Strain Association Mapping |
---|---|
Description: | In the course of a genome-wide association study, the situation often arises that some phenotypes are known with greater precision than others. It could be that some individuals are known to harbor more micro-environmental variance than others. In the case of inbred strains of model organisms, it could be the case that more organisms were observed from some strains than others, so the strains with more organisms have better-estimated means. Package 'wISAM' handles this situation by allowing for weighting of each observation according to residual variance. Specifically, the 'weight' parameter to the function conduct_scan() takes the precision of each observation (one over the variance). |
Authors: | Robert W. Cort <[email protected]> |
Maintainer: | Robert W. Cort <[email protected]> |
License: | GPL-3 |
Version: | 0.2.8 |
Built: | 2024-11-21 03:34:10 UTC |
Source: | https://github.com/rcorty/wisam |
Grabbed from MASS. Useful to sparsify matrices when some eigenvalues are essentially zero.
check_eigen_decomposition(e, tol = 1e-06)
check_eigen_decomposition(e, tol = 1e-06)
e |
the eigen decomposition to check |
tol |
the threshold below which a number is said to be effectively zero, defaults to 1e-6 |
The eigen values with any values with absolute value less than tol zeroed.
Example covariate matrix
covariate_mat
covariate_mat
A matrix with 200 rows and 4 variables
Compute a multiplier (aka rotation) matrix. Details in in h2lmm_math_RWC.Rmd.
an object of class GenomeScan
Conducts the GenomeScan.
an object of class GenomeScan
TODO: allow user to specify subset of chromosomes or loci
library(wISAM) wgs <- GenomeScan$new(y = phenotype, X = covariate_mat, G = locus_list, K = kinship_mat, w = 1/se_mean_per_strain) result <- wgs$prep_scan()$conduct_scan()
library(wISAM) wgs <- GenomeScan$new(y = phenotype, X = covariate_mat, G = locus_list, K = kinship_mat, w = 1/se_mean_per_strain) result <- wgs$prep_scan()$conduct_scan()
Fit one locus of a GenomeScan. Should not typically be called by a user.
an object of class GenomeScan
Fit one locus at a specified value of h2. Should not typically be called by a user.
an object of class GenomeScan
Initialize a GenomeScan
y |
vector of length n - the phenotype of each of n genomes (individuals or strains) |
X |
matrix of dimension n-by-c - the covariate value of each individual for c covariates |
G |
a list where each element is of length n - the genotype of each individual at p loci |
K |
matrix of dimension n-by-n - the covariance of the phenotype |
w |
matrix of dimension n-by-n - the inverse variance of the phenotype |
an object of class GenomeScan
library(wISAM) wgs <- GenomeScan$new(y = phenotype, X = covariate_mat, G = locus_list, K = kinship_mat, w = 1/se_mean_per_strain)
library(wISAM) wgs <- GenomeScan$new(y = phenotype, X = covariate_mat, G = locus_list, K = kinship_mat, w = 1/se_mean_per_strain)
Prepare a GenomeScan for running. Does all the computations that need to be done exactly once per genome scan.
an object of class GenomeScan
library(wISAM) wgs <- GenomeScan$new(y = phenotype, X = covariate_mat, G = locus_list, K = kinship_mat, w = 1/se_mean_per_strain) result <- wgs$prep_scan()
library(wISAM) wgs <- GenomeScan$new(y = phenotype, X = covariate_mat, G = locus_list, K = kinship_mat, w = 1/se_mean_per_strain) result <- wgs$prep_scan()
A Reference Class implementing a Genome Scan
Options
these are options
Data
Things the user inputs. They have interpretable meaning and define the GenomeScan. Currently: y, X, G, K, weights (inverse variances), and variances.
Intermediates_per_scan
Things the GenomeScan will compute once per scan. They are mathetmatical tools that can't really be interpreted. Currently: L, eigen_L, and LL_null.
Intermediates_per_locus
Things the GenomeScan will compute once per locus. They are mathematical tools that can't really be interpreted. Currently: XG
Intermediates_per_fit
Things the GenomeScan will compute many times per locus (once per trial fit on that locus). These are interpretable but rapidly changing and not guaranteed to be finalized or optimal. Currently: M, LDV, and h2
Results
The results of the GenomeScan. Currently: The h2 that maximizes the LL at each locus and the LR as compared with the no-locus (null) model.
Example kinship matrix
kinship_mat
kinship_mat
A matrix with 200 rows and 200 columns
Example locus list
locus_list
locus_list
A list of matrices, where each matrix has 200 rows and 1 column
Example phenotype
phenotype
phenotype
A vector of length 200
Example standard error of the mean per strain
se_mean_per_strain
se_mean_per_strain
A vector of length 200