Title: | Adaptation of the Coloc Method for PheWAS |
Version: | 1.4.1 |
Maintainer: | Ichcha Manipur <im504@cam.ac.uk> |
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>. |
License: | GPL-3 |
Encoding: | UTF-8 |
LazyData: | true |
VignetteBuilder: | knitr |
RoxygenNote: | 7.2.3 |
Depends: | R (≥ 3.5.0) |
URL: | https://github.com/ichcha-m/cophescan, https://ichcha-m.github.io/cophescan/ |
BugReports: | https://github.com/ichcha-m/cophescan/issues |
Imports: | Rcpp (≥ 1.0.7), coloc, data.table, ggplot2, ggrepel, pheatmap, methods, viridis, stats, grDevices, magrittr, utils, matrixStats, dplyr |
Suggests: | knitr, testthat (≥ 3.0.0), rmarkdown, RColorBrewer, ggpubr |
Collate: | 'cophescan-package.R' 'singlevar.R' 'multivarsusie.R' 'multitrait.R' 'cophe_hyp_predict.R' 'copheplots.R' 'testdata.R' 'RcppExports.R' 'metrop_hier_priors.R' 'zzz.R' |
LinkingTo: | Rcpp, RcppArmadillo |
Config/testthat/edition: | 3 |
ByteCompile: | true |
NeedsCompilation: | yes |
Packaged: | 2024-06-11 14:52:08 UTC; ichcha |
Author: | Ichcha Manipur [aut, cre], Chris Wallace [aut] |
Repository: | CRAN |
Date/Publication: | 2024-06-11 15:20:20 UTC |
The 'cophescan' package.
Description
Coloc adapted Phenome-wide Scans
Estimate the Hc.cutoff for the required FDR
Description
Estimate the Hc.cutoff for the required FDR
Usage
Hc.cutoff.fdr(ppHc, fdr = 0.05, return_plot = TRUE)
Arguments
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 |
Value
the Hc.cutoff value for the specified FDR, if return_plot is True returns a plot showing the FDR calculated at different Hc thresholds
adjust_priors
Description
adjust fixed priors when nsnps in region is high
Usage
adjust_priors(
nsnps,
pa = 3.82e-05,
pc = 0.00182,
p1 = NULL,
p2 = NULL,
p12 = NULL
)
Arguments
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 |
Value
vector of pn, pa and pc adjusted prior probabilities
Average of priors: pnk, pak and pck
Description
Average of priors: pnk, pak and pck
Usage
average_piks(params, nsnps, covar_vec, nits, thin, covar = FALSE)
Arguments
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 |
Value
average pik matrix of priors: pnk, pak and pck
Average of priors: pnk, pak and pck from list (memory intensive)
Description
Average of priors: pnk, pak and pck from list (memory intensive)
Usage
average_piks_list(params, nsnps, covar_vec, nits, thin, covar = FALSE)
Arguments
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 |
Value
average pik matrix of priors: pnk, pak and pck
Average of posterior probabilities: Hn, Ha and Hc
Description
Average of posterior probabilities: Hn, Ha and Hc
Usage
average_posterior_prob(
params,
lbf_mat,
nsnps,
covar_vec,
nits,
thin,
covar = FALSE
)
Arguments
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 |
Value
matrix with average of all the posterior probabilities: Hn, Ha and Hc
Average of posterior probabilities: Hn, Ha and Hc from list (memory intensive)
Description
Average of posterior probabilities: Hn, Ha and Hc from list (memory intensive)
Usage
average_posterior_prob_list(
params,
lbf_mat,
nsnps,
covar_vec,
nits,
thin,
covar = FALSE
)
Arguments
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 |
Value
matrix with average of all the posterior probabilities: Hn, Ha and Hc
combine.bf
Description
Calculate posterior probabilities for all the configurations
Usage
combine.bf(lBF_df, pn, pa, pc)
Arguments
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 |
Value
named numeric vector of posterior probabilities and bayes factors
Author(s)
Ichcha Manipur
extract data through Bayes factors
Description
a dataset represented by Bayes factors from SuSIE
Usage
cophe.bf_bf(
sus_dat,
cred_set,
querysnpid,
querytrait,
pn = NULL,
pa = NULL,
pc = NULL,
ret_pp = TRUE
)
Arguments
sus_dat |
a list with the output of running susie |
cred_set |
credible set extracted from susie |
querysnpid |
Id of the query variant |
querytrait |
Query trait name |
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 |
Value
bayes factors of signals
See Also
Predict cophescan hypothesis for tested associations
Description
Predict cophescan hypothesis for tested associations
Usage
cophe.hyp.predict(
cophe.res,
grouping.vars = c("querysnp", "querytrait"),
Hc.cutoff = 0.6,
Hn.cutoff = 0.2
)
Arguments
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 |
Value
returns dataframe with posterior probabilties of Hn, Hc and Ha with the predicted hypothesis based on the provided cut.offs.
See Also
cophe.single
, cophe.susie
, cophe.multitrait
, , multitrait.simplify
Run cophescan on multiple traits at once
Description
Run cophescan on multiple traits at once
Usage
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,
...
)
Arguments
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 |
Value
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
Author(s)
Ichcha Manipur
Prepare data for cophe.single
Description
Prepare data for cophe.single
Usage
cophe.prepare.dat.single(dataset, querysnpid, MAF = NULL)
Arguments
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) |
Value
named list containing the per snp BFs (df) and position of the query variant (querypos)
Author(s)
Ichcha Manipur
Prepare data for cophe.susie
Description
Prepare data for cophe.susie
Usage
cophe.prepare.dat.susie(dataset, querysnpid, susie.args)
Arguments
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) |
susie.args |
a named list of additional arguments to be passed to runsusie |
Value
a list with the output of running susie
See Also
Bayesian cophescan analysis using Approximate Bayes Factors
Description
Bayesian cophescan analysis under single causal variant assumption
Usage
cophe.single(
dataset,
querysnpid,
querytrait,
MAF = NULL,
pa = 3.82e-05,
pc = 0.00182,
p1 = NULL,
p2 = NULL,
p12 = NULL
)
Arguments
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 |
Details
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
Value
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.
Author(s)
Ichcha Manipur
Examples
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)
cophe.single.lbf
Description
Calculate log bayes factors for each hypothesis (Single causal variant assumption)
Usage
cophe.single.lbf(dataset, querysnpid, querytrait, MAF = NULL)
Arguments
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 |
Value
data frame with log bayes factors for Hn and Ha hypotheses
Author(s)
Ichcha Manipur
See Also
Examples
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
run cophe.susie
using susie to detect separate signals
Description
Check if a variant causally associated in one trait might be causal in another trait
Usage
cophe.susie(
dataset,
querysnpid,
querytrait,
pa = 3.82e-05,
pc = 0.00182,
p1 = NULL,
p2 = NULL,
p12 = NULL,
susie.args = list()
)
Arguments
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 |
Value
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
Author(s)
Ichcha Manipur
Examples
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)
cophe.susie.lbf
Description
Calculate log bayes factors for each hypothesis (SuSIE - multiple causal variant assumption)
Usage
cophe.susie.lbf(
dataset,
querysnpid,
querytrait,
switch = TRUE,
susie.args = list(),
MAF = NULL
)
Arguments
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 |
Value
data frame with log bayes factors for Hn and Ha hypotheses
Author(s)
Ichcha Manipur
See Also
Examples
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
Heatmap of multi-trait cophescan results
Description
Heatmap of multi-trait cophescan results
Usage
cophe_heatmap(
multi.dat,
querysnpid,
query_trait_names,
thresh_Hc = 0.5,
thresh_Ha = 0.5,
...
)
Arguments
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 |
Value
heatmap of posterior probabilities of the phentypes above the set threshold
Simulated multi-trait data
Description
Simulated multi-trait data
Usage
data(cophe_multi_trait_data)
Format
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
Description
cophe_plots showing the Ha and Hc of all traits and labelled above the specified threshold
Usage
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
)
Arguments
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 |
Value
cophescan plots of Ha and Hc
See Also
cophe.single
, cophe.susie
, cophe.multitrait
, , multitrait.simplify
Extract beta and p-values of queried variant
Description
Extract beta and p-values of queried variant
Usage
get_beta(traits.dat, querysnpid, querytrait)
Arguments
traits.dat |
list of coloc structured dataset |
querysnpid |
vector of querysnpid |
querytrait |
vector of querytrait names |
Value
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
Description
Calculation of the posterior prob of Hn, Ha and Hc
Usage
get_posterior_prob(params, lbf_mat, nsnps, covar_vec, covar = FALSE)
Arguments
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 |
Value
posterior prob of Hn, Ha and Hc
hypothesis.priors
Description
Estimate priors for each hypothesis
Usage
hypothesis.priors(nsnps, pn, pa, pc)
Arguments
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 |
Value
hypotheses priors
Author(s)
Ichcha Manipur
dnorm for alpha
Description
dnorm for alpha
Usage
logd_alpha(a, alpha_mean = -10, alpha_sd = 0.5)
Arguments
a |
current alpha |
alpha_mean |
prior for the mean of alpha |
alpha_sd |
prior for the standard deviation of alpha |
Value
log dnorm
dgamma for beta
Description
dgamma for beta
Usage
logd_beta(b, beta_shape = 2, beta_scale = 2)
Arguments
b |
current beta |
beta_shape |
prior for the shape (gamma distibution) of beta |
beta_scale |
prior for the scale of beta |
Value
log dgamma
dgamma for gamma
Description
dgamma for gamma
Usage
logd_gamma(g, gamma_shape = 2, gamma_scale = 2)
Arguments
g |
current gamma |
gamma_shape |
prior for the shape (gamma distibution) of gamma |
gamma_scale |
prior for the scale of gamma |
Value
log dgamma
Log likelihood calculation
Description
Log likelihood calculation
Usage
loglik(params, lbf_mat, nsnps, covar_vec, covar = FALSE)
Arguments
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 |
Value
logpost flog of the posteriors
Log posterior calculation
Description
Log posterior calculation
Usage
logpost(params, lbf_mat, nsnps, covar_vec, covar = FALSE)
Arguments
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 |
Value
logpost flog of the posteriors
Calculate log priors
Description
Calculate log priors
Usage
logpriors(
params,
covar = FALSE,
alpha_mean = -10,
alpha_sd = 0.5,
beta_shape = 2,
beta_scale = 2,
gamma_shape = 2,
gamma_scale = 2
)
Arguments
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 |
Value
log priors
logsum
Description
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
Usage
logsum(x)
Arguments
x |
numeric vector |
Value
max(x) + log(sum(exp(x - max(x))))
Log sum
Description
Log sum
Usage
logsumexp(x)
Arguments
x |
vector of log scale values to be added |
Value
log sum of input
Run the hierarchical mcmc model to infer priors
Description
Run the hierarchical mcmc model to infer priors
Usage
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
)
Arguments
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 |
Value
named list of log likelihood (ll) and parameters: alpha, beta and gamma
Simplifying the output obtained from cophe.multitrait
, cophe.single
or cophe.susie
Description
Simplifying the output obtained from cophe.multitrait
, cophe.single
or cophe.susie
Usage
multitrait.simplify(multi.dat, only_BF = FALSE)
Arguments
multi.dat |
output obtained from |
only_BF |
return only bayes factors and not posterior probabilities (default=FALSE) |
Value
dataframe with posterior probabilties of Hn, Hc and Ha
Conversion of parameters alpha, beta and gamma to pnk, pak and pck
Description
Conversion of parameters alpha, beta and gamma to pnk, pak and pck
Usage
pars2pik(params, nsnps, covar_vec, covar = FALSE)
Arguments
params |
Vector of parameters: |
nsnps |
number of snps |
covar_vec |
Vector of the covariate |
covar |
logical: should the covariate information be used? default: False |
Value
pik matrix of priors: pnk, pak and pck
Initiate parameters alpha, beta and gamma
Description
Initiate parameters alpha, beta and gamma
Usage
pars_init(
covar = FALSE,
alpha_mean = -10,
alpha_sd = 0.5,
beta_shape = 2,
beta_scale = 2,
gamma_shape = 2,
gamma_scale = 2
)
Arguments
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 |
Value
params \alpha
, \beta
and \gamma
per.snp.priors
Description
Estimate per snp priors
Usage
per.snp.priors(
nsnps,
pa = 3.82e-05,
pc = 0.00182,
p1 = NULL,
p2 = NULL,
p12 = NULL
)
Arguments
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 |
Value
priors at the query variant
Author(s)
Ichcha Manipur
List of priors: pn, pa and pc over all iterations
Description
List of priors: pn, pa and pc over all iterations
Usage
piks(params, nsnps, covar_vec, covar = FALSE)
Arguments
params |
Vector of parameters: |
nsnps |
number of snps |
covar_vec |
Vector of the covariate |
covar |
logical: was the covariate inflormation used? default: False |
Value
List of priors (len: iterations): pnk, pak and pck
Plot region Manhattan for a trait highlighting the queried variant
Description
Plot region Manhattan for a trait highlighting the queried variant
Usage
plot_trait_manhat(trait.dat, querysnpid, alt.snpid = NULL)
Arguments
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 |
Value
regional manhattan plot
List of posterior probabilities: Hn, Ha and Hc over all iterations
Description
List of posterior probabilities: Hn, Ha and Hc over all iterations
Usage
posterior_prob(params, lbf_mat, nsnps, covar_vec, covar = FALSE)
Arguments
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 |
Value
List of posterior probabilties (len: iterations): Hn, Ha and Hc
Prepare data for plotting
Description
Prepare data for plotting
Usage
prepare_plot_data(
multi.dat,
querysnpid,
query_trait_names,
thresh_Ha = 0.5,
thresh_Hc = 0.5,
hmp = FALSE,
cophe.plot = TRUE
)
Arguments
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 |
Value
plot list
See Also
cophe_plot
, cophe.susie
, cophe.multitrait
, multitrait.simplify
default NULL
Proposal distribution
Description
Proposal distribution
Usage
propose(params, propsd = 0.5)
Arguments
params |
Vector of parameters: |
propsd |
Standard deviation for the proposal |
Value
vector : proposal
Run the hierarchical Metropolis Hastings model to infer priors
Description
Run the hierarchical Metropolis Hastings model to infer priors
Usage
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
)
Arguments
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 |
Value
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
Description
sample alpha
Usage
sample_alpha(alpha_mean = -10, alpha_sd = 0.5)
Arguments
alpha_mean |
prior for the mean of alpha |
alpha_sd |
prior for the standard deviation of alpha |
Value
sample from rnorm for \alpha
sample beta
Description
sample beta
Usage
sample_beta(beta_shape = 2, beta_scale = 2)
Arguments
beta_shape |
prior for the shape (gamma distibution) of beta |
beta_scale |
prior for the scale of beta |
Value
sample from rgamma for \beta
sample gamma
Description
sample gamma
Usage
sample_gamma(gamma_shape = 2, gamma_scale = 2)
Arguments
gamma_shape |
prior for the shape (gamma distibution) of gamma |
gamma_scale |
prior for the scale of gamma |
Value
sample from rgamma for \gamma
print the summary of results from cophescan single or susie
Description
print the summary of results from cophescan single or susie
Usage
## S3 method for class 'cophe'
summary(object, ...)
Arguments
object |
Result from either |
... |
additional arguments affecting the summary produced. |
Value
log bayes and posterior probabilities
See Also
Target distribution
Description
Target distribution
Usage
target(params, lbf_mat, nsnps, covar_vec, covar = FALSE)
Arguments
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 |
Value
target