Title: | Adaptation of the Coloc Method for PheWAS |
---|---|
Description: | A Bayesian method for Phenome-wide association studies (PheWAS) that identifies causal associations between genetic variants and traits, while simultaneously addressing confounding due to linkage disequilibrium. For details see Manipur et al (2023) <doi:10.1101/2023.06.29.546856>. |
Authors: | Ichcha Manipur [aut, cre], Chris Wallace [aut] |
Maintainer: | Ichcha Manipur <[email protected]> |
License: | GPL-3 |
Version: | 1.4.1 |
Built: | 2024-11-09 06:38:37 UTC |
Source: | CRAN |
adjust fixed priors when nsnps in region is high
adjust_priors( nsnps, pa = 3.82e-05, pc = 0.00182, p1 = NULL, p2 = NULL, p12 = NULL )
adjust_priors( nsnps, pa = 3.82e-05, pc = 0.00182, p1 = NULL, p2 = NULL, p12 = NULL )
nsnps |
number of SNPs |
pa |
prior probability that a non-query variant is causally associated with the query trait (cophescan prior), default 3.82e-5 |
pc |
prior probability that the query variant is causally associated with the query trait (cophescan prior), default 1.82e-3 (cophescan prior) |
p1 |
prior probability a SNP is associated with trait 1, (coloc prior), pc derived by using |
p2 |
prior probability a SNP is associated with trait 2, (coloc prior), pa derived by using |
p12 |
prior probability a SNP is associated with both traits, (coloc prior), pc derived by using |
vector of pn, pa and pc adjusted prior probabilities
Average of priors: pnk, pak and pck
average_piks(params, nsnps, covar_vec, nits, thin, covar = FALSE)
average_piks(params, nsnps, covar_vec, nits, thin, covar = FALSE)
params |
Vector of parameters: |
nsnps |
number of snps |
covar_vec |
Vector of the covariate |
nits |
Number of iterations run in mcmc |
thin |
thinning |
covar |
logical: was the covariate inflormation used? default: False |
average pik matrix of priors: pnk, pak and pck
Average of priors: pnk, pak and pck from list (memory intensive)
average_piks_list(params, nsnps, covar_vec, nits, thin, covar = FALSE)
average_piks_list(params, nsnps, covar_vec, nits, thin, covar = FALSE)
params |
Vector of parameters: |
nsnps |
number of snps |
covar_vec |
Vector of the covariate |
nits |
Number of iterations run in mcmc |
thin |
thinning |
covar |
logical: was the covariate inflormation used? default: False |
average pik matrix of priors: pnk, pak and pck
Average of posterior probabilities: Hn, Ha and Hc
average_posterior_prob( params, lbf_mat, nsnps, covar_vec, nits, thin, covar = FALSE )
average_posterior_prob( params, lbf_mat, nsnps, covar_vec, nits, thin, covar = FALSE )
params |
Vector of parameters: |
lbf_mat |
matrix of log bayes factors: lBF.Ha and lBF.Hc |
nsnps |
number of snps |
covar_vec |
Vector of the covariate |
nits |
Number of iterations run in mcmc |
thin |
thinning |
covar |
logical: was the covariate inflormation used? default: False |
matrix with average of all the posterior probabilities: Hn, Ha and Hc
Average of posterior probabilities: Hn, Ha and Hc from list (memory intensive)
average_posterior_prob_list( params, lbf_mat, nsnps, covar_vec, nits, thin, covar = FALSE )
average_posterior_prob_list( params, lbf_mat, nsnps, covar_vec, nits, thin, covar = FALSE )
params |
Vector of parameters: |
lbf_mat |
matrix of log bayes factors: lBF.Ha and lBF.Hc |
nsnps |
number of snps |
covar_vec |
Vector of the covariate |
nits |
Number of iterations run in mcmc |
thin |
thinning |
covar |
logical: was the covariate inflormation used? default: False |
matrix with average of all the posterior probabilities: Hn, Ha and Hc
Calculate posterior probabilities for all the configurations
combine.bf(lBF_df, pn, pa, pc)
combine.bf(lBF_df, pn, pa, pc)
lBF_df |
dataframe with log bayes factors of hypothesis Ha and Hn: column names should be lBF.Ha and lBF.Hc |
pn |
prior probability that none of the SNPs/variants in the region are associated with the query trait |
pa |
prior probability that a non-query variant is causally associated with the query trait |
pc |
prior probability that the query variant is causally associated with the query trait |
named numeric vector of posterior probabilities and bayes factors
Ichcha Manipur
Heatmap of multi-trait cophescan results
cophe_heatmap( multi.dat, querysnpid, query_trait_names, thresh_Hc = 0.5, thresh_Ha = 0.5, ... )
cophe_heatmap( multi.dat, querysnpid, query_trait_names, thresh_Hc = 0.5, thresh_Ha = 0.5, ... )
multi.dat |
multi trait cophescan results returned from |
querysnpid |
query variant |
query_trait_names |
names of phenotypes corresponding to the multi.dat results |
thresh_Hc |
Hc threshold to be displayed |
thresh_Ha |
Ha threshold to be displayed |
... |
additional arguments to be passed to pheatmap |
heatmap of posterior probabilities of the phentypes above the set threshold
Simulated multi-trait data
data(cophe_multi_trait_data)
data(cophe_multi_trait_data)
list of coloc structred datasets for 24 traits (cophe_multi_trait_data$summ_stat), LD matrix (cophe_multi_trait_data$LD) and the id of the query snp (cophe_multi_trait_data$querysnpid). #' The trait dataset are simulated summary statistics (1000 SNPs) for 10 Hn, 10 Ha and 10 Hc.
cophe_plots showing the Ha and Hc of all traits and labelled above the specified threshold
cophe_plot( multi.dat, querysnpid, query_trait_names, thresh_Hc = 0.5, thresh_Ha = 0.5, beta_p = NULL, traits.dat = NULL, group_pheno = NULL )
cophe_plot( multi.dat, querysnpid, query_trait_names, thresh_Hc = 0.5, thresh_Ha = 0.5, beta_p = NULL, traits.dat = NULL, group_pheno = NULL )
multi.dat |
multi trait cophescan results returned from cophe.multitrait or multitrait.simplify |
querysnpid |
query variant (only a single variant for PheWAS plots) |
query_trait_names |
list of phenotype names |
thresh_Hc |
Hc threshold to be displayed |
thresh_Ha |
Ha threshold to be displayed |
beta_p |
data.frame (from the |
traits.dat |
list of multi-trait coloc structured datasets |
group_pheno |
Vector with additional grouping of phenotypes |
cophescan plots of Ha and Hc
cophe.single
, cophe.susie
, cophe.multitrait
, , multitrait.simplify
Predict cophescan hypothesis for tested associations
cophe.hyp.predict( cophe.res, grouping.vars = c("querysnp", "querytrait"), Hc.cutoff = 0.6, Hn.cutoff = 0.2 )
cophe.hyp.predict( cophe.res, grouping.vars = c("querysnp", "querytrait"), Hc.cutoff = 0.6, Hn.cutoff = 0.2 )
cophe.res |
results obtained from |
grouping.vars |
This is important for results from |
Hc.cutoff |
threshold for PP.Hc above which the associations are called Hc |
Hn.cutoff |
threshold for PP.Hn above which the associations are called Hn |
returns dataframe with posterior probabilties of Hn, Hc and Ha with the predicted hypothesis based on the provided cut.offs.
cophe.single
, cophe.susie
, cophe.multitrait
, , multitrait.simplify
Run cophescan on multiple traits at once
cophe.multitrait( trait.dat, querysnpid, querytrait.names, LDmat = NULL, method = "single", simplify = FALSE, predict.hyp = TRUE, Hn.cutoff = 0.2, Hc.cutoff = 0.6, est.fdr.based.cutoff = FALSE, fdr = 0.05, ... )
cophe.multitrait( trait.dat, querysnpid, querytrait.names, LDmat = NULL, method = "single", simplify = FALSE, predict.hyp = TRUE, Hn.cutoff = 0.2, Hc.cutoff = 0.6, est.fdr.based.cutoff = FALSE, fdr = 0.05, ... )
trait.dat |
Named(traits) list of coloc structured data for k traits (Total number of traits) |
querysnpid |
vector of query variant ids = length(trait.dat), if the same variant |
querytrait.names |
vector of names for the query traits, if the names of the multi.dat list contain the trait names please pass querytrait.names=names(multi.dat) |
LDmat |
LD matrix |
method |
either 'single' for |
simplify |
if TRUE removes intermediate results from output using 'multitrait.simplify' |
predict.hyp |
if TRUE predicts the hypothesis based on the provided thresholds for pp.Hc and pp.Hn (overrides simplify) using |
Hn.cutoff |
threshold for PP.Hc above which the associations are called Hc |
Hc.cutoff |
threshold for PP.Hc above which the associations are called Hn |
est.fdr.based.cutoff |
if True calculates the Hc.cutoff using 1-mean(PP.Hc)|PP.Hc > cutoff |
fdr |
fdr threshold to estimate Hc.cutoff |
... |
additional arguments of priors for |
if simplify is False returns multi-trait list of lists, each with:
a summary data.frame of the cophescan results
priors used
querysnp
querytrait
if simplify is TRUE only returns dataframe with posterior probabilties of Hn, Hc and Ha with no intermediate results if predict.hyp is TRUE returns a dataframe with output of simplify and the predicted hypotheses for all associations
Ichcha Manipur
Bayesian cophescan analysis under single causal variant assumption
cophe.single( dataset, querysnpid, querytrait, MAF = NULL, pa = 3.82e-05, pc = 0.00182, p1 = NULL, p2 = NULL, p12 = NULL )
cophe.single( dataset, querysnpid, querytrait, MAF = NULL, pa = 3.82e-05, pc = 0.00182, p1 = NULL, p2 = NULL, p12 = NULL )
dataset |
a list with specifically named elements defining the query trait dataset to be analysed. |
querysnpid |
Id of the query variant, (id in dataset$snp) |
querytrait |
Query trait name |
MAF |
Minor allele frequency vector |
pa |
prior probability that a non-query variant is causally associated with the query trait (cophescan prior), default 3.82e-5 |
pc |
prior probability that the query variant is causally associated with the query trait (cophescan prior), default 1.82e-3 (cophescan prior) |
p1 |
prior probability a SNP is associated with trait 1, (coloc prior), pc derived by using |
p2 |
prior probability a SNP is associated with trait 2, (coloc prior), pa derived by using |
p12 |
prior probability a SNP is associated with both traits, (coloc prior), pc derived by using |
This function calculates posterior probabilities of different causal variant configurations under the assumption of a single causal variant for each trait.
If regression coefficients and variances are available, it calculates Bayes factors for association at each SNP. If only p values are available, it uses an approximation that depends on the SNP's MAF and ignores any uncertainty in imputation. Regression coefficients should be used if available. Find more input data structure details in the coloc package
a list of two data.frame
s:
summary is a vector giving the number of SNPs analysed, and the posterior probabilities of Hn (no shared causal variant), Ha (two distinct causal variants) and Hc (one common causal variant)
results is an annotated version of the input data containing log Approximate Bayes Factors and intermediate calculations, and the posterior probability SNP.PP.Hc of the SNP being causal for the shared signal if Hc is true. This is only relevant if the posterior support for Hc in summary is convincing.
Ichcha Manipur
library(cophescan) data(cophe_multi_trait_data) query_trait_1 <- cophe_multi_trait_data$summ_stat[['Trait_1']] querysnpid <- cophe_multi_trait_data$querysnpid res.single <- cophe.single(query_trait_1, querysnpid = querysnpid, querytrait='Trait_1') summary(res.single)
library(cophescan) data(cophe_multi_trait_data) query_trait_1 <- cophe_multi_trait_data$summ_stat[['Trait_1']] querysnpid <- cophe_multi_trait_data$querysnpid res.single <- cophe.single(query_trait_1, querysnpid = querysnpid, querytrait='Trait_1') summary(res.single)
Calculate log bayes factors for each hypothesis (Single causal variant assumption)
cophe.single.lbf(dataset, querysnpid, querytrait, MAF = NULL)
cophe.single.lbf(dataset, querysnpid, querytrait, MAF = NULL)
dataset |
a list with specifically named elements defining the query trait dataset to be analysed. |
querysnpid |
Id of the query variant, (id in dataset$snp) |
querytrait |
Query trait name |
MAF |
Minor allele frequency vector |
data frame with log bayes factors for Hn and Ha hypotheses
Ichcha Manipur
library(cophescan) data(cophe_multi_trait_data) query_trait_1 <- cophe_multi_trait_data$summ_stat[['Trait_1']] querysnpid <- cophe_multi_trait_data$querysnpid res.single.lbf <- cophe.single.lbf(query_trait_1, querysnpid = querysnpid, querytrait='Trait_1') res.single.lbf
library(cophescan) data(cophe_multi_trait_data) query_trait_1 <- cophe_multi_trait_data$summ_stat[['Trait_1']] querysnpid <- cophe_multi_trait_data$querysnpid res.single.lbf <- cophe.single.lbf(query_trait_1, querysnpid = querysnpid, querytrait='Trait_1') res.single.lbf
cophe.susie
using susie to detect separate signalsCheck if a variant causally associated in one trait might be causal in another trait
cophe.susie( dataset, querysnpid, querytrait, pa = 3.82e-05, pc = 0.00182, p1 = NULL, p2 = NULL, p12 = NULL, susie.args = list() )
cophe.susie( dataset, querysnpid, querytrait, pa = 3.82e-05, pc = 0.00182, p1 = NULL, p2 = NULL, p12 = NULL, susie.args = list() )
dataset |
either a list with specifically named elements defining the dataset to be analysed. (see check_dataset) |
querysnpid |
Id of the query variant |
querytrait |
Query trait name |
pa |
prior probability that a non-query variant is causally associated with the query trait (cophescan prior), default 3.82e-5 |
pc |
prior probability that the query variant is causally associated with the query trait (cophescan prior), default 1.82e-3 |
p1 |
prior probability a SNP is associated with trait 1, (coloc prior), pc derived by using |
p2 |
prior probability a SNP is associated with trait 2, (coloc prior), pa derived by using |
p12 |
prior probability a SNP is associated with both traits, (coloc prior), pc derived by using |
susie.args |
a named list of additional arguments to be passed to runsusie |
a list, containing elements
summary a data.table of posterior probabilities of each global hypothesis, one row per pairwise comparison of signals from the two traits
results a data.table of detailed results giving the posterior probability for each snp to be jointly causal for both traits assuming Hc is true. Please ignore this column if the corresponding posterior support for H4 is not high.
priors a vector of the priors used for the analysis
Ichcha Manipur
library(cophescan) data(cophe_multi_trait_data) query_trait_1 <- cophe_multi_trait_data$summ_stat[['Trait_1']] querysnpid <- cophe_multi_trait_data$querysnpid query_trait_1$LD <- cophe_multi_trait_data$LD res.susie <- cophe.susie(query_trait_1, querysnpid = querysnpid, querytrait='Trait_1') summary(res.susie)
library(cophescan) data(cophe_multi_trait_data) query_trait_1 <- cophe_multi_trait_data$summ_stat[['Trait_1']] querysnpid <- cophe_multi_trait_data$querysnpid query_trait_1$LD <- cophe_multi_trait_data$LD res.susie <- cophe.susie(query_trait_1, querysnpid = querysnpid, querytrait='Trait_1') summary(res.susie)
Calculate log bayes factors for each hypothesis (SuSIE - multiple causal variant assumption)
cophe.susie.lbf( dataset, querysnpid, querytrait, switch = TRUE, susie.args = list(), MAF = NULL )
cophe.susie.lbf( dataset, querysnpid, querytrait, switch = TRUE, susie.args = list(), MAF = NULL )
dataset |
a list with specifically named elements defining the query trait dataset to be analysed. |
querysnpid |
Id of the query variant, (id in dataset$snp) |
querytrait |
Query trait name |
switch |
Set switch=TRUE to obtain single BF when credible sets not found with SuSIE |
susie.args |
a named list of additional arguments to be passed to runsusie |
MAF |
Minor allele frequency vector |
data frame with log bayes factors for Hn and Ha hypotheses
Ichcha Manipur
library(cophescan) data(cophe_multi_trait_data) query_trait_1 <- cophe_multi_trait_data$summ_stat[['Trait_1']] query_trait_1$LD <- cophe_multi_trait_data$LD querysnpid <- cophe_multi_trait_data$querysnpid res.susie.lbf <- cophe.susie.lbf(query_trait_1, querysnpid = querysnpid, querytrait='Trait_1', switch=T) res.susie.lbf
library(cophescan) data(cophe_multi_trait_data) query_trait_1 <- cophe_multi_trait_data$summ_stat[['Trait_1']] query_trait_1$LD <- cophe_multi_trait_data$LD querysnpid <- cophe_multi_trait_data$querysnpid res.susie.lbf <- cophe.susie.lbf(query_trait_1, querysnpid = querysnpid, querytrait='Trait_1', switch=T) res.susie.lbf
Extract beta and p-values of queried variant
get_beta(traits.dat, querysnpid, querytrait)
get_beta(traits.dat, querysnpid, querytrait)
traits.dat |
list of coloc structured dataset |
querysnpid |
vector of querysnpid |
querytrait |
vector of querytrait names |
data.frame with one column named beta_plot: indicating beta direction (n/p) and another column named pval_plot with -log10(pval) of the queried variant
Calculation of the posterior prob of Hn, Ha and Hc
get_posterior_prob(params, lbf_mat, nsnps, covar_vec, covar = FALSE)
get_posterior_prob(params, lbf_mat, nsnps, covar_vec, covar = FALSE)
params |
Vector of parameters: |
lbf_mat |
matrix of log bayes factors: lBF.Ha and lBF.Hc |
nsnps |
number of snps |
covar_vec |
Vector of the covariate |
covar |
logical: should the covariate inflormation be used? default: False |
posterior prob of Hn, Ha and Hc
Estimate the Hc.cutoff for the required FDR
Hc.cutoff.fdr(ppHc, fdr = 0.05, return_plot = TRUE)
Hc.cutoff.fdr(ppHc, fdr = 0.05, return_plot = TRUE)
ppHc |
a vector containing the PP.Hc (the posterior probability of causal association) of all tests |
fdr |
FDR default: 0.05 |
return_plot |
default: TRUE, plot the fdr estimated at the different Hc.cutoff |
the Hc.cutoff value for the specified FDR, if return_plot is True returns a plot showing the FDR calculated at different Hc thresholds
Estimate priors for each hypothesis
hypothesis.priors(nsnps, pn, pa, pc)
hypothesis.priors(nsnps, pn, pa, pc)
nsnps |
number of SNPs |
pn |
prior probability that none of the SNPs/variants in the region are associated with the query trait |
pa |
prior probability that a non-query variant is causally associated with the query trait |
pc |
prior probability that the query variant is causally associated with the query trait |
hypotheses priors
Ichcha Manipur
dnorm for alpha
logd_alpha(a, alpha_mean = -10, alpha_sd = 0.5)
logd_alpha(a, alpha_mean = -10, alpha_sd = 0.5)
a |
current alpha |
alpha_mean |
prior for the mean of alpha |
alpha_sd |
prior for the standard deviation of alpha |
log dnorm
dgamma for beta
logd_beta(b, beta_shape = 2, beta_scale = 2)
logd_beta(b, beta_shape = 2, beta_scale = 2)
b |
current beta |
beta_shape |
prior for the shape (gamma distibution) of beta |
beta_scale |
prior for the scale of beta |
log dgamma
dgamma for gamma
logd_gamma(g, gamma_shape = 2, gamma_scale = 2)
logd_gamma(g, gamma_shape = 2, gamma_scale = 2)
g |
current gamma |
gamma_shape |
prior for the shape (gamma distibution) of gamma |
gamma_scale |
prior for the scale of gamma |
log dgamma
Log likelihood calculation
loglik(params, lbf_mat, nsnps, covar_vec, covar = FALSE)
loglik(params, lbf_mat, nsnps, covar_vec, covar = FALSE)
params |
Vector of parameters: |
lbf_mat |
matrix of log bayes factors: lBF.Ha and lBF.Hc |
nsnps |
number of snps |
covar_vec |
Vector of the covariate |
covar |
logical: should the covariate inflormation be used? default: False |
logpost flog of the posteriors
Log posterior calculation
logpost(params, lbf_mat, nsnps, covar_vec, covar = FALSE)
logpost(params, lbf_mat, nsnps, covar_vec, covar = FALSE)
params |
Vector of parameters: |
lbf_mat |
matrix of log bayes factors: lBF.Ha and lBF.Hc |
nsnps |
number of snps |
covar_vec |
Vector of the covariate |
covar |
logical: should the covariate inflormation be used? default: False |
logpost flog of the posteriors
Calculate log priors
logpriors( params, covar = FALSE, alpha_mean = -10, alpha_sd = 0.5, beta_shape = 2, beta_scale = 2, gamma_shape = 2, gamma_scale = 2 )
logpriors( params, covar = FALSE, alpha_mean = -10, alpha_sd = 0.5, beta_shape = 2, beta_scale = 2, gamma_shape = 2, gamma_scale = 2 )
params |
Vector of parameters: |
covar |
logical: Should the covariate inflormation be used? default: False |
alpha_mean |
prior for the mean of alpha |
alpha_sd |
prior for the standard deviation of alpha |
beta_shape |
prior for the shape (gamma distibution) of beta |
beta_scale |
prior for the scale of beta |
gamma_shape |
prior for the shape (gamma distibution) of gamma |
gamma_scale |
prior for the scale of gamma |
log priors
Internal function, logsum Function directly taken from coloc This function calculates the log of the sum of the exponentiated logs taking out the max, i.e. insuring that the sum is not Inf
logsum(x)
logsum(x)
x |
numeric vector |
max(x) + log(sum(exp(x - max(x))))
Log sum
logsumexp(x)
logsumexp(x)
x |
vector of log scale values to be added |
log sum of input
Run the hierarchical mcmc model to infer priors
metrop_run( lbf_mat, nsnps, covar_vec, covar = FALSE, nits = 10000L, thin = 1L, alpha_mean = -10, alpha_sd = 0.5, beta_shape = 2, beta_scale = 2, gamma_shape = 2, gamma_scale = 2 )
metrop_run( lbf_mat, nsnps, covar_vec, covar = FALSE, nits = 10000L, thin = 1L, alpha_mean = -10, alpha_sd = 0.5, beta_shape = 2, beta_scale = 2, gamma_shape = 2, gamma_scale = 2 )
lbf_mat |
matrix of log bayes factors: lBF.Ha and lBF.Hc |
nsnps |
number of snps |
covar_vec |
Vector of the covariate |
covar |
logical: Should the covariate inflormation be used? default: False |
nits |
Number of iterations run in mcmc |
thin |
thinning |
alpha_mean |
prior for the mean of alpha |
alpha_sd |
prior for the standard deviation of alpha |
beta_shape |
prior for the shape (gamma distibution) of beta |
beta_scale |
prior for the scale of beta |
gamma_shape |
prior for the shape (gamma distibution) of gamma |
gamma_scale |
prior for the scale of gamma |
named list of log likelihood (ll) and parameters: alpha, beta and gamma
cophe.multitrait
, cophe.single
or cophe.susie
Simplifying the output obtained from cophe.multitrait
, cophe.single
or cophe.susie
multitrait.simplify(multi.dat, only_BF = FALSE)
multitrait.simplify(multi.dat, only_BF = FALSE)
multi.dat |
output obtained from |
only_BF |
return only bayes factors and not posterior probabilities (default=FALSE) |
dataframe with posterior probabilties of Hn, Hc and Ha
Initiate parameters alpha, beta and gamma
pars_init( covar = FALSE, alpha_mean = -10, alpha_sd = 0.5, beta_shape = 2, beta_scale = 2, gamma_shape = 2, gamma_scale = 2 )
pars_init( covar = FALSE, alpha_mean = -10, alpha_sd = 0.5, beta_shape = 2, beta_scale = 2, gamma_shape = 2, gamma_scale = 2 )
covar |
logical: Should the covariate inflormation be used? default: False |
alpha_mean |
prior for the mean of alpha |
alpha_sd |
prior for the standard deviation of alpha |
beta_shape |
prior for the shape (gamma distibution) of beta |
beta_scale |
prior for the scale of beta |
gamma_shape |
prior for the shape (gamma distibution) of gamma |
gamma_scale |
prior for the scale of gamma |
params ,
and
Conversion of parameters alpha, beta and gamma to pnk, pak and pck
pars2pik(params, nsnps, covar_vec, covar = FALSE)
pars2pik(params, nsnps, covar_vec, covar = FALSE)
params |
Vector of parameters: |
nsnps |
number of snps |
covar_vec |
Vector of the covariate |
covar |
logical: should the covariate information be used? default: False |
pik matrix of priors: pnk, pak and pck
Estimate per snp priors
per.snp.priors( nsnps, pa = 3.82e-05, pc = 0.00182, p1 = NULL, p2 = NULL, p12 = NULL )
per.snp.priors( nsnps, pa = 3.82e-05, pc = 0.00182, p1 = NULL, p2 = NULL, p12 = NULL )
nsnps |
number of SNPs |
pa |
prior probability that a non-query variant is causally associated with the query trait (cophescan prior), default 3.82e-5 |
pc |
prior probability that the query variant is causally associated with the query trait (cophescan prior), default 1.82e-3 (cophescan prior) |
p1 |
prior probability a SNP is associated with trait 1, (coloc prior), pc derived by using |
p2 |
prior probability a SNP is associated with trait 2, (coloc prior), pa derived by using |
p12 |
prior probability a SNP is associated with both traits, (coloc prior), pc derived by using |
priors at the query variant
Ichcha Manipur
List of priors: pn, pa and pc over all iterations
piks(params, nsnps, covar_vec, covar = FALSE)
piks(params, nsnps, covar_vec, covar = FALSE)
params |
Vector of parameters: |
nsnps |
number of snps |
covar_vec |
Vector of the covariate |
covar |
logical: was the covariate inflormation used? default: False |
List of priors (len: iterations): pnk, pak and pck
Plot region Manhattan for a trait highlighting the queried variant
plot_trait_manhat(trait.dat, querysnpid, alt.snpid = NULL)
plot_trait_manhat(trait.dat, querysnpid, alt.snpid = NULL)
trait.dat |
dataset used as input for running cophescan |
querysnpid |
the id of the causal variant as present in trait.dat$snp, plotted in red |
alt.snpid |
the id of the other variants as a vector to be plotted, plotted in blue |
regional manhattan plot
List of posterior probabilities: Hn, Ha and Hc over all iterations
posterior_prob(params, lbf_mat, nsnps, covar_vec, covar = FALSE)
posterior_prob(params, lbf_mat, nsnps, covar_vec, covar = FALSE)
params |
Vector of parameters: |
lbf_mat |
matrix of log bayes factors: lBF.Ha and lBF.Hc |
nsnps |
number of snps |
covar_vec |
Vector of the covariate |
covar |
logical: was the covariate inflormation used? default: False |
List of posterior probabilties (len: iterations): Hn, Ha and Hc
Prepare data for plotting
prepare_plot_data( multi.dat, querysnpid, query_trait_names, thresh_Ha = 0.5, thresh_Hc = 0.5, hmp = FALSE, cophe.plot = TRUE )
prepare_plot_data( multi.dat, querysnpid, query_trait_names, thresh_Ha = 0.5, thresh_Hc = 0.5, hmp = FALSE, cophe.plot = TRUE )
multi.dat |
multi trait cophescan results returned from cophe.multitrait or multitrait.simplify |
querysnpid |
query variant |
query_trait_names |
vector of names of the query traits |
thresh_Ha |
Ha threshold to be displayed |
thresh_Hc |
Hc threshold to be displayed |
hmp |
return for heatmap |
cophe.plot |
default: TRUE, return for |
plot list
cophe_plot
, cophe.susie
, cophe.multitrait
, multitrait.simplify
default NULL
Proposal distribution
propose(params, propsd = 0.5)
propose(params, propsd = 0.5)
params |
Vector of parameters: |
propsd |
Standard deviation for the proposal |
vector : proposal
Run the hierarchical Metropolis Hastings model to infer priors
run_metrop_priors( multi.dat, covar = FALSE, covar_vec = NULL, is_covar_categorical = FALSE, nits = 10000, thin = 1, posterior = FALSE, avg_pik = TRUE, avg_posterior = TRUE, pik = FALSE, alpha_mean = -10, alpha_sd = 0.5, beta_shape = 2, beta_scale = 2, gamma_shape = 2, gamma_scale = 2 )
run_metrop_priors( multi.dat, covar = FALSE, covar_vec = NULL, is_covar_categorical = FALSE, nits = 10000, thin = 1, posterior = FALSE, avg_pik = TRUE, avg_posterior = TRUE, pik = FALSE, alpha_mean = -10, alpha_sd = 0.5, beta_shape = 2, beta_scale = 2, gamma_shape = 2, gamma_scale = 2 )
multi.dat |
matrix of bf values, rows=traits, named columns=("lBF.Ha","lBF.Hc","nsnps") |
covar |
whether to include covariates |
covar_vec |
vector of covariates |
is_covar_categorical |
only two categories supported (default=FALSE) - Experimental |
nits |
number of iterations |
thin |
burnin |
posterior |
default: FALSE, estimate posterior probabilities of the hypotheses |
avg_pik |
default: FALSE, estimate the average of the pik |
avg_posterior |
default: FALSE, estimate the average of the posterior probabilities of the hypotheses |
pik |
default: FALSE, inferred prior probabilities |
alpha_mean |
prior for the mean of alpha |
alpha_sd |
prior for the standard deviation of alpha |
beta_shape |
prior for the shape (gamma distibution) of beta |
beta_scale |
prior for the scale of beta |
gamma_shape |
prior for the shape (gamma distibution) of gamma |
gamma_scale |
prior for the scale of gamma |
List containing the posterior distribution of the parameters alpha, beta, gamma (if covariate included) and the loglikelihood
if avg_posterior=TRUE matrix with average of all the posterior probabilities of Hn, Ha and Hc
if avg_pik=TRUE matrix with average of all the priors: pn, pa and pc
data, nits and thin contain the input data, number of iterations and burnin respectively specified for the hierarchical model
sample alpha
sample_alpha(alpha_mean = -10, alpha_sd = 0.5)
sample_alpha(alpha_mean = -10, alpha_sd = 0.5)
alpha_mean |
prior for the mean of alpha |
alpha_sd |
prior for the standard deviation of alpha |
sample from rnorm for
sample beta
sample_beta(beta_shape = 2, beta_scale = 2)
sample_beta(beta_shape = 2, beta_scale = 2)
beta_shape |
prior for the shape (gamma distibution) of beta |
beta_scale |
prior for the scale of beta |
sample from rgamma for
sample gamma
sample_gamma(gamma_shape = 2, gamma_scale = 2)
sample_gamma(gamma_shape = 2, gamma_scale = 2)
gamma_shape |
prior for the shape (gamma distibution) of gamma |
gamma_scale |
prior for the scale of gamma |
sample from rgamma for
print the summary of results from cophescan single or susie
## S3 method for class 'cophe' summary(object, ...)
## S3 method for class 'cophe' summary(object, ...)
object |
Result from either |
... |
additional arguments affecting the summary produced. |
log bayes and posterior probabilities
Target distribution
target(params, lbf_mat, nsnps, covar_vec, covar = FALSE)
target(params, lbf_mat, nsnps, covar_vec, covar = FALSE)
params |
Vector of parameters: |
lbf_mat |
matrix of log bayes factors: lBF.Ha and lBF.Hc |
nsnps |
number of snps |
covar_vec |
Vector of the covariate |
covar |
logical: Should the covariate inflormation be used? default: False |
target