From 91ec5aaa227501b297a53d8323abd40faf58038a Mon Sep 17 00:00:00 2001
From: Nicholas Sunderland a numeric, the estimated correction factor a numeric, the y slope intercept a numeric, the standard error of the correction factor a character vector of collider bias method function names to run a string; a valid a numeric, range 0-1, the initial p-value by which to filter the incidence GWASCHR:POS to RSID mapping
library(genepi.utils)
-gwas <- data.table::fread(system.file("extdata", "example_gwas_sumstats.tsv", package="genepi.utils"))
+gwas <- data.table::fread(system.file("extdata", "example_gwas_sumstats.tsv", package="genepi.utils"))
head(gwas)
#> chromosome base_pair_location effect_allele other_allele
@@ -275,7 +275,7 @@
Allele specification / matching
-
gwas_id_coding <- data.table::fread(system.file("extdata", "example3_gwas_sumstats.tsv", package="genepi.utils"))
+
gwas_id_coding <- data.table::fread(system.file("extdata", "example3_gwas_sumstats.tsv", package="genepi.utils"))
gwas_with_rsids <- genepi.utils::chrpos_to_rsid(dt = gwas_id_coding,
chr_col = "chromosome",
@@ -330,7 +330,7 @@
Evaluation speedlibrary(ggplot2)
# some GWAS data
-dt <- data.table::fread( gwas_sumstats_4.3million_rows )
+dt <- data.table::fread( gwas_sumstats_4.3million_rows )
# benchmarking
mbm <- microbenchmark("chrpos_to_rsid: no alleles, no alt rsids" = {
diff --git a/docs/articles/clumping.html b/docs/articles/clumping.html
index ca6b492..906562b 100644
--- a/docs/articles/clumping.html
+++ b/docs/articles/clumping.html
@@ -146,7 +146,7 @@
Setup
library(genepi.utils)
# the gwas data
-gwas <- data.table::fread(system.file("extdata", "example2_gwas_sumstats.tsv", package="genepi.utils"))
+gwas <- data.table::fread(system.file("extdata", "example2_gwas_sumstats.tsv", package="genepi.utils"))
# ensure annotated with rsID
gwas <- standardise_gwas(gwas, input_format="ns_map", build="GRCh37", populate_rsid="b37_dbsnp156")
diff --git a/docs/articles/collider_bias.html b/docs/articles/collider_bias.html
index 5bc23d9..5dd4f93 100644
--- a/docs/articles/collider_bias.html
+++ b/docs/articles/collider_bias.html
@@ -109,8 +109,8 @@
Collider bias
library(genepi.utils)
# read in the data
-gwas_clumped_incidence <- data.table::fread(clumped_incidence_path)[index==TRUE, ] # take only the index SNPs
-gwas_progression <- data.table::fread(progression_path)
Slope-hunter
@@ -349,7 +349,7 @@ Applying the correction factor# calculate difference in raw and adjusted betas; and effect on genome wide significance
corrected_gwas[, beta_diff := BETA_progression - adjusted_beta]
sig_change_levels <- c("Dropped hit", "New hit", "No change")
-corrected_gwas[, sig_change:= data.table::fcase(P_progression < 5e-8 & adjusted_p >= 5e-8, factor("Dropped hit", levels=sig_change_levels),
+corrected_gwas[, sig_change:= data.table::fcase(P_progression < 5e-8 & adjusted_p >= 5e-8, factor("Dropped hit", levels=sig_change_levels),
P_progression >=5e-8 & adjusted_p < 5e-8, factor("New hit", levels=sig_change_levels),
default = factor("No change", levels=sig_change_levels))]
diff --git a/docs/articles/drug_target_proxy.html b/docs/articles/drug_target_proxy.html
index 61952b2..ea00630 100644
--- a/docs/articles/drug_target_proxy.html
+++ b/docs/articles/drug_target_proxy.html
@@ -228,11 +228,11 @@
Statins - an eQTL examplehmgcar_eqtl <- QTL("/Users/xx20081/Documents/local_data/gtex_v8/gtex_v8_chr5.tsv.gz",
p_val=0.05,
join_key="RSID_b37")
-data.table::setnames(hmgcar_eqtl$data, c("SNP_b38", "BP_b37"), c("SNP", "BP"))
+data.table::setnames(hmgcar_eqtl$data, c("SNP_b38", "BP_b37"), c("SNP", "BP"))
hmgcar_eqtl$data[, CHR := as.character(CHR)]
# set the concordance for beta effects in LDL and HMGCoAR
-concordance <- data.table::data.table("data_name_1" = c(""), data_name_2=c("hmgcoar_gtex"), concordant=c(TRUE))
+concordance <- data.table::data.table("data_name_1" = c(""), data_name_2=c("hmgcoar_gtex"), concordant=c(TRUE))
# extract the variants for the instrument
statin_instrument_dat <- drug_target_proxy(gwas_gene = gwas_ldl_hmgcoar,
@@ -320,11 +320,11 @@
GLP1R agonists
# create an eQTL object for the GTexV8 data
glp1r_eqtl <- QTL("/Users/xx20081/Documents/local_data/gtex_v8/gtex_v8_chr6.tsv.gz", p_val=1, join_key="RSID_b37")
-data.table::setnames(glp1r_eqtl$data, c("SNP_b38", "BP_b37"), c("SNP", "BP"))
+data.table::setnames(glp1r_eqtl$data, c("SNP_b38", "BP_b37"), c("SNP", "BP"))
glp1r_eqtl$data[, CHR := as.character(CHR)]
# set the concordance for beta effects in HbA1c and GLP1R - FALSE as high HbA1c should relate to less GLP1R expression
-concordance <- data.table::data.table("data_name_1" = c("hba1c_qtl"), data_name_2=c("glp1r_eqtl"), concordant=c(FALSE))
+concordance <- data.table::data.table("data_name_1" = c("hba1c_qtl"), data_name_2=c("glp1r_eqtl"), concordant=c(FALSE))
# extract the variants for the instrument
incretin_instrument_dat <- drug_target_proxy(gwas_gene = gwas_t2dm_glp1r,
diff --git a/docs/articles/harmonise.html b/docs/articles/harmonise.html
index a3afb3e..8550363 100644
--- a/docs/articles/harmonise.html
+++ b/docs/articles/harmonise.html
@@ -111,7 +111,7 @@
Run
library(genepi.utils)
# the gwas data
-gwas1 <- data.table::fread(system.file("extdata", "example2_gwas_sumstats.tsv", package="genepi.utils"))
+gwas1 <- data.table::fread(system.file("extdata", "example2_gwas_sumstats.tsv", package="genepi.utils"))
gwas2 <- gwas1
# ensure standard column names
@@ -236,7 +236,7 @@
Evaluation speedgwas_incidence_path <- "/Users/xx20081/Documents/local_data/hermes_incidence/standardised/hf_incidence_pheno1_eur.tsv.gz"
# some GWAS data
-gwas1 <- data.table::fread(gwas_incidence_path)[1:100000, ]
+gwas1 <- data.table::fread(gwas_incidence_path)[1:100000, ]
gwas2 <- gwas1
# Slopehunter read in
diff --git a/docs/articles/ld_matrix.html b/docs/articles/ld_matrix.html
index 858ff41..33d23e2 100644
--- a/docs/articles/ld_matrix.html
+++ b/docs/articles/ld_matrix.html
@@ -109,7 +109,7 @@
Setup
library(genepi.utils)
# the gwas data
-gwas <- data.table::fread(system.file("extdata", "example2_gwas_sumstats.tsv", package="genepi.utils"))
+gwas <- data.table::fread(system.file("extdata", "example2_gwas_sumstats.tsv", package="genepi.utils"))
# ensure annotated with rsID
gwas <- standardise_gwas(gwas, input_format="ns_map", build="GRCh37", populate_rsid="b37_dbsnp156")
@@ -159,7 +159,7 @@
LD matrix#> rs10786405 -0.596843 1.000000 -0.342968
#> rs11816998 -0.272363 -0.342968 1.000000
#> attr(,"log")
-#> [1] "PLINK v2.00a6 M1 (23 Nov 2023)\nOptions in effect:\n --extract /var/folders/62/n2yrhw752hn73nlbzp0r0_rr0000gq/T//RtmpMOBawz/file124e549dc95bd\n --out /Users/xx20081/Downloads/ld_mat\n --pfile /Users/xx20081/Documents/local_data/genome_reference/ref_1000GP_phase3_plink/all_phase3_nodup\n --r-phased square\n\nHostname: K3P0KGKVKT\nWorking directory: /Users/xx20081/git/genepi.utils/vignettes\nStart time: Tue Dec 5 20:08:58 2023\n\nRandom number seed: 1701806938\n98304 MiB RAM detected; reserving 49152 MiB for main workspace.\nUsing up to 12 threads (change this with --threads).\n2504 samples (1270 females, 1234 males; 2497 founders) loaded from\n/Users/xx20081/Documents/local_data/genome_reference/ref_1000GP_phase3_plink/all_phase3_nodup.psam.\n48493710 variants loaded from\n/Users/xx20081/Documents/local_data/genome_reference/ref_1000GP_phase3_plink/all_phase3_nodup.pvar.\n2 categorical phenotypes loaded.\n--extract: 9 variants remaining.\nCalculating allele frequencies... done.\n9 variants remaining after main filters.\n--r-phased: Variant IDs written to\n/Users/xx20081/Downloads/ld_mat.phased.vcor1.vars .\n--r-phased: Matrix written to /Users/xx20081/Downloads/ld_mat.phased.vcor1 .\n\nEnd time: Tue Dec 5 20:09:03 2023"
+#> [1] "PLINK v2.00a6 M1 (23 Nov 2023)\nOptions in effect:\n --extract /var/folders/62/n2yrhw752hn73nlbzp0r0_rr0000gq/T//RtmpMT7NKD/filef95ea5e1593\n --out /Users/xx20081/Downloads/ld_mat\n --pfile /Users/xx20081/Documents/local_data/genome_reference/ref_1000GP_phase3_plink/all_phase3_nodup\n --r-phased square\n\nHostname: K3P0KGKVKT\nWorking directory: /Users/xx20081/git/genepi.utils/vignettes\nStart time: Wed Dec 13 20:45:51 2023\n\nRandom number seed: 1702500351\n98304 MiB RAM detected; reserving 49152 MiB for main workspace.\nUsing up to 12 threads (change this with --threads).\n2504 samples (1270 females, 1234 males; 2497 founders) loaded from\n/Users/xx20081/Documents/local_data/genome_reference/ref_1000GP_phase3_plink/all_phase3_nodup.psam.\n48493710 variants loaded from\n/Users/xx20081/Documents/local_data/genome_reference/ref_1000GP_phase3_plink/all_phase3_nodup.pvar.\n2 categorical phenotypes loaded.\n--extract: 9 variants remaining.\nCalculating allele frequencies... done.\n9 variants remaining after main filters.\n--r-phased: Variant IDs written to\n/Users/xx20081/Downloads/ld_mat.phased.vcor1.vars .\n--r-phased: Matrix written to /Users/xx20081/Downloads/ld_mat.phased.vcor1 .\n\nEnd time: Wed Dec 13 20:45:56 2023"
#> attr(,"allele_info")
#> RSID CHR BP REF ALT
#> 1 rs7899632 10 100000625 A G
@@ -177,7 +177,7 @@
Harmonise data against LD matr
# harmonised data
-harm <- harmonise(gwas, data.table::copy(gwas), gwas1_trait="exposure", gwas2_trait="outcome", merge=c("RSID"="RSID"))
+harm <- harmonise(gwas, data.table::copy(gwas), gwas1_trait="exposure", gwas2_trait="outcome", merge=c("RSID"="RSID"))
# mess up the alleles vs reference
harm <- harm[RSID_exposure=="rs7899632", c("EA_exposure","EA_outcome","OA_exposure","OA_outcome") := list("A","A","G","G")]
diff --git a/docs/articles/standardise_gwas.html b/docs/articles/standardise_gwas.html
index 298df78..2ee9b51 100644
--- a/docs/articles/standardise_gwas.html
+++ b/docs/articles/standardise_gwas.html
@@ -105,7 +105,7 @@
Standardise GWAS
library(genepi.utils)
-gwas <- data.table::fread(system.file("extdata", "example2_gwas_sumstats.tsv", package="genepi.utils"))
+gwas <- data.table::fread(system.file("extdata", "example2_gwas_sumstats.tsv", package="genepi.utils"))
gwas
#> MARKER CHR POS BETA SE P EAF A1 A2
diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml
index 421953a..7b1c1ca 100644
--- a/docs/pkgdown.yml
+++ b/docs/pkgdown.yml
@@ -10,5 +10,5 @@ articles:
ld_matrix: ld_matrix.html
plotting: plotting.html
standardise_gwas: standardise_gwas.html
-last_built: 2023-12-05T20:07Z
+last_built: 2023-12-13T20:44Z
diff --git a/docs/reference/ColliderBiasResult.html b/docs/reference/ColliderBiasResult.html
index 2443f8a..b605e8a 100644
--- a/docs/reference/ColliderBiasResult.html
+++ b/docs/reference/ColliderBiasResult.html
@@ -85,7 +85,7 @@
Collider bias result object
intercept = NA_real_,
bse = NA_real_,
entropy = NA_real_,
- fit = data.table::data.table()
+ fit = data.table::data.table()
)Arguments
Arguments
TwoSampleMR::mr()
method_list
parameterCreate a drug target proxy instrument
kb = 250,
join_key = "RSID",
QTL_list = list(),
- concordance = data.table::data.table(data_name_1 = character(), data_name_2 =
+ concordance = data.table::data.table(data_name_1 = character(), data_name_2 =
character(), concordant = logical())
)Plotting
Miami plot
QQ plot
generate_random_gwas_data()
Generate random GWAS data
Coloc probability plot
Functions for package configuration
diff --git a/docs/reference/plot_coloc_probabilities.html b/docs/reference/plot_coloc_probabilities.html new file mode 100644 index 0000000..fbcce8e --- /dev/null +++ b/docs/reference/plot_coloc_probabilities.html @@ -0,0 +1,135 @@ + +plot_coloc_probabilities.Rd
A plotting wrapper for the coloc
package. Produces a ggplot for either
+the prior or posterior probability sensitivity analyses. See the
+coloc
+package vignettes for details.
plot_coloc_probabilities(coloc, rule = "H4 > 0.5", type = "prior")
coloc object, output from coloc::coloc.abf()
a string, a valid rule indicating success e.g. "H4 > 0.5"
a string, either prior
or posterior
a ggplot
+qq_plot.Rd
QQ plot
+qq_plot(
+ gwas,
+ pval_col = "P",
+ colours = list(raw = "#2166AC", corrected = "#B2182B"),
+ title = NULL,
+ subtitle = NULL,
+ plot_corrected = FALSE,
+ facet_grid_row_col = NULL,
+ facet_grid_col_col = NULL,
+ facet_nrow = NULL,
+ facet_ncol = NULL
+)
a data.frame like object or valid file path
the P value column
a 2 element list of colour codes (1-the uncorrected points, 2-the GC corrected points)
a string, the title for the plot
a string, the subtitle for the plot
a logical, whether to apply and plot the lambda correction
a string, the column name in gwas
by which to facet the plot (rows)
a string, the column name in gwas
by which to facet the plot (cols)
an integer, passed to facet_wrap, the number of rows to facet by (if only facet_grid_row_col is provided)
an integer, passed to facet_wrap, the number of cols to facet by (if only facet_grid_col_col is provided)
a ggplot
+