Last updated: 2021-09-09

Checks: 6 1

Knit directory: ctwas_applied/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


The R Markdown file has unstaged changes. To know which version of the R Markdown file created these results, you’ll want to first commit it to the Git repo. If you’re still working on the analysis, you can ignore this warning. When you’re finished, you can run wflow_publish to commit the R Markdown file and build the HTML.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20210726) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 59e5f4d. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Unstaged changes:
    Modified:   analysis/ukb-d-30500_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30500_irnt_Whole_Blood.Rmd
    Modified:   analysis/ukb-d-30600_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30600_irnt_Whole_Blood.Rmd
    Modified:   analysis/ukb-d-30610_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30610_irnt_Whole_Blood.Rmd
    Modified:   analysis/ukb-d-30620_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30630_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30640_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30650_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30660_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30670_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30680_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30690_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30700_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30710_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30720_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30730_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30740_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30750_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30760_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30770_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30780_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30790_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30800_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30810_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30820_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30830_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30840_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30850_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30860_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30870_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30880_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30890_irnt_Liver.Rmd

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/ukb-d-30610_irnt_Whole_Blood.Rmd) and HTML (docs/ukb-d-30610_irnt_Whole_Blood.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd cbf7408 wesleycrouse 2021-09-08 adding enrichment to reports
html cbf7408 wesleycrouse 2021-09-08 adding enrichment to reports
Rmd 4970e3e wesleycrouse 2021-09-08 updating reports
html 4970e3e wesleycrouse 2021-09-08 updating reports
Rmd dfd2b5f wesleycrouse 2021-09-07 regenerating reports
html dfd2b5f wesleycrouse 2021-09-07 regenerating reports
Rmd 61b53b3 wesleycrouse 2021-09-06 updated PVE calculation
html 61b53b3 wesleycrouse 2021-09-06 updated PVE calculation
Rmd 837dd01 wesleycrouse 2021-09-01 adding additional fixedsigma report
Rmd d0a5417 wesleycrouse 2021-08-30 adding new reports to the index
Rmd 0922de7 wesleycrouse 2021-08-18 updating all reports with locus plots
html 0922de7 wesleycrouse 2021-08-18 updating all reports with locus plots
html 1c62980 wesleycrouse 2021-08-11 Updating reports
Rmd 5981e80 wesleycrouse 2021-08-11 Adding more reports
html 5981e80 wesleycrouse 2021-08-11 Adding more reports
Rmd 05a98b7 wesleycrouse 2021-08-07 adding additional results
html 05a98b7 wesleycrouse 2021-08-07 adding additional results
html 03e541c wesleycrouse 2021-07-29 Cleaning up report generation
Rmd 276893d wesleycrouse 2021-07-29 Updating reports
html 276893d wesleycrouse 2021-07-29 Updating reports

Overview

These are the results of a ctwas analysis of the UK Biobank trait Alkaline phosphatase (quantile) using Whole_Blood gene weights.

The GWAS was conducted by the Neale Lab, and the biomarker traits we analyzed are discussed here. Summary statistics were obtained from IEU OpenGWAS using GWAS ID: ukb-d-30610_irnt. Results were obtained from from IEU rather than Neale Lab because they are in a standardard format (GWAS VCF). Note that 3 of the 34 biomarker traits were not available from IEU and were excluded from analysis.

The weights are mashr GTEx v8 models on Whole_Blood eQTL obtained from PredictDB. We performed a full harmonization of the variants, including recovering strand ambiguous variants. This procedure is discussed in a separate document. (TO-DO: add report that describes harmonization)

LD matrices were computed from a 10% subset of Neale lab subjects. Subjects were matched using the plate and well information from genotyping. We included only biallelic variants with MAF>0.01 in the original Neale Lab GWAS. (TO-DO: add more details [number of subjects, variants, etc])

Weight QC

TO-DO: add enhanced QC reporting (total number of weights, why each variant was missing for all genes)

qclist_all <- list()

qc_files <- paste0(results_dir, "/", list.files(results_dir, pattern="exprqc.Rd"))

for (i in 1:length(qc_files)){
  load(qc_files[i])
  chr <- unlist(strsplit(rev(unlist(strsplit(qc_files[i], "_")))[1], "[.]"))[1]
  qclist_all[[chr]] <- cbind(do.call(rbind, lapply(qclist,unlist)), as.numeric(substring(chr,4)))
}

qclist_all <- data.frame(do.call(rbind, qclist_all))
colnames(qclist_all)[ncol(qclist_all)] <- "chr"

rm(qclist, wgtlist, z_gene_chr)

#number of imputed weights
nrow(qclist_all)
[1] 11095
#number of imputed weights by chromosome
table(qclist_all$chr)

   1    2    3    4    5    6    7    8    9   10   11   12   13   14   15 
1129  747  624  400  479  621  560  383  404  430  682  652  192  362  331 
  16   17   18   19   20   21   22 
 551  725  159  911  313  130  310 
#proportion of imputed weights without missing variants
mean(qclist_all$nmiss==0)
[1] 0.762776

Load ctwas results

#load ctwas results
ctwas_res <- data.table::fread(paste0(results_dir, "/", analysis_id, "_ctwas.susieIrss.txt"))

#make unique identifier for regions
ctwas_res$region_tag <- paste(ctwas_res$region_tag1, ctwas_res$region_tag2, sep="_")

#compute PVE for each gene/SNP
ctwas_res$PVE = ctwas_res$susie_pip*ctwas_res$mu2/sample_size #check PVE calculation

#separate gene and SNP results
ctwas_gene_res <- ctwas_res[ctwas_res$type == "gene", ]
ctwas_gene_res <- data.frame(ctwas_gene_res)
ctwas_snp_res <- ctwas_res[ctwas_res$type == "SNP", ]
ctwas_snp_res <- data.frame(ctwas_snp_res)

#add gene information to results
sqlite <- RSQLite::dbDriver("SQLite")
db = RSQLite::dbConnect(sqlite, paste0("/project2/compbio/predictdb/mashr_models/mashr_", weight, ".db"))
query <- function(...) RSQLite::dbGetQuery(db, ...)
gene_info <- query("select gene, genename from extra")
gene_info <- query("select gene, genename, gene_type from extra")
RSQLite::dbDisconnect(db)

ctwas_gene_res <- cbind(ctwas_gene_res, gene_info[sapply(ctwas_gene_res$id, match, gene_info$gene), c("genename", "gene_type")])

#add z score to results
load(paste0(results_dir, "/", analysis_id, "_expr_z_gene.Rd"))
ctwas_gene_res$z <- z_gene[ctwas_gene_res$id,]$z

#load(paste0(results_dir, "/", analysis_id, "_expr_z_snp.Rd")) #for new version, stored after harmonization
z_snp <- readRDS(paste0(results_dir, "/", trait_id, ".RDS")) #for old version, unharmonized

z_snp <- z_snp[z_snp$id %in% ctwas_snp_res$id,] #subset snps to those included in analysis, note some are duplicated, need to match which allele was used
ctwas_snp_res$z <- z_snp$z[match(ctwas_snp_res$id, z_snp$id)] #for duplicated snps, this arbitrarily uses the first allele
ctwas_snp_res$z_flag <- as.numeric(ctwas_snp_res$id %in% z_snp$id[duplicated(z_snp$id)]) #mark the unclear z scores, flag=1

#formatting and rounding for tables
ctwas_gene_res$z <- round(ctwas_gene_res$z,2)
ctwas_snp_res$z <- round(ctwas_snp_res$z,2)
ctwas_gene_res$susie_pip <- round(ctwas_gene_res$susie_pip,3)
ctwas_snp_res$susie_pip <- round(ctwas_snp_res$susie_pip,3)
ctwas_gene_res$mu2 <- round(ctwas_gene_res$mu2,2)
ctwas_snp_res$mu2 <- round(ctwas_snp_res$mu2,2)
ctwas_gene_res$PVE <- signif(ctwas_gene_res$PVE, 2)
ctwas_snp_res$PVE <- signif(ctwas_snp_res$PVE, 2)

#merge gene and snp results with added information
ctwas_gene_res$z_flag=NA
ctwas_snp_res$genename=NA
ctwas_snp_res$gene_type=NA

ctwas_res <- rbind(ctwas_gene_res,
                   ctwas_snp_res[,colnames(ctwas_gene_res)])

#store columns to report
report_cols <- colnames(ctwas_gene_res)[!(colnames(ctwas_gene_res) %in% c("type", "region_tag1", "region_tag2", "cs_index", "gene_type", "z_flag", "id", "chrom", "pos"))]
first_cols <- c("genename", "region_tag")
report_cols <- c(first_cols, report_cols[!(report_cols %in% first_cols)])

report_cols_snps <- c("id", report_cols[-1])

#get number of SNPs from s1 results; adjust for thin
ctwas_res_s1 <- data.table::fread(paste0(results_dir, "/", analysis_id, "_ctwas.s1.susieIrss.txt"))
n_snps <- sum(ctwas_res_s1$type=="SNP")/thin
rm(ctwas_res_s1)

Check convergence of parameters

library(ggplot2)
library(cowplot)

********************************************************
Note: As of version 1.0.0, cowplot does not change the
  default ggplot2 theme anymore. To recover the previous
  behavior, execute:
  theme_set(theme_cowplot())
********************************************************
load(paste0(results_dir, "/", analysis_id, "_ctwas.s2.susieIrssres.Rd"))
  
df <- data.frame(niter = rep(1:ncol(group_prior_rec), 2),
                 value = c(group_prior_rec[1,], group_prior_rec[2,]),
                 group = rep(c("Gene", "SNP"), each = ncol(group_prior_rec)))
df$group <- as.factor(df$group)

df$value[df$group=="SNP"] <- df$value[df$group=="SNP"]*thin #adjust parameter to account for thin argument

p_pi <- ggplot(df, aes(x=niter, y=value, group=group)) +
  geom_line(aes(color=group)) +
  geom_point(aes(color=group)) +
  xlab("Iteration") + ylab(bquote(pi)) +
  ggtitle("Prior mean") +
  theme_cowplot()

df <- data.frame(niter = rep(1:ncol(group_prior_var_rec), 2),
                 value = c(group_prior_var_rec[1,], group_prior_var_rec[2,]),
                 group = rep(c("Gene", "SNP"), each = ncol(group_prior_var_rec)))
df$group <- as.factor(df$group)
p_sigma2 <- ggplot(df, aes(x=niter, y=value, group=group)) +
  geom_line(aes(color=group)) +
  geom_point(aes(color=group)) +
  xlab("Iteration") + ylab(bquote(sigma^2)) +
  ggtitle("Prior variance") +
  theme_cowplot()

plot_grid(p_pi, p_sigma2)

Version Author Date
dfd2b5f wesleycrouse 2021-09-07
#estimated group prior
estimated_group_prior <- group_prior_rec[,ncol(group_prior_rec)]
names(estimated_group_prior) <- c("gene", "snp")
estimated_group_prior["snp"] <- estimated_group_prior["snp"]*thin #adjust parameter to account for thin argument
print(estimated_group_prior)
        gene          snp 
0.0104984229 0.0001911337 
#estimated group prior variance
estimated_group_prior_var <- group_prior_var_rec[,ncol(group_prior_var_rec)]
names(estimated_group_prior_var) <- c("gene", "snp")
print(estimated_group_prior_var)
    gene      snp 
94.47464 23.67386 
#report sample size
print(sample_size)
[1] 344292
#report group size
group_size <- c(nrow(ctwas_gene_res), n_snps)
print(group_size)
[1]   11095 8697330
#estimated group PVE
estimated_group_pve <- estimated_group_prior_var*estimated_group_prior*group_size/sample_size #check PVE calculation
names(estimated_group_pve) <- c("gene", "snp")
print(estimated_group_pve)
      gene        snp 
0.03196242 0.11430507 
#compare sum(PIP*mu2/sample_size) with above PVE calculation
c(sum(ctwas_gene_res$PVE),sum(ctwas_snp_res$PVE))
[1] 0.02168881 0.55700002

Genes with highest PIPs

#distribution of PIPs
hist(ctwas_gene_res$susie_pip, xlim=c(0,1), main="Distribution of Gene PIPs")

Version Author Date
dfd2b5f wesleycrouse 2021-09-07
#genes with PIP>0.8 or 20 highest PIPs
head(ctwas_gene_res[order(-ctwas_gene_res$susie_pip),report_cols], max(sum(ctwas_gene_res$susie_pip>0.8), 20))
      genename region_tag susie_pip    mu2     PVE      z
7258     ICA1L      2_120     1.000  95.49 2.8e-04 -10.69
6089     FADS1      11_34     0.999 425.10 1.2e-03  19.90
1652     PCIF1      20_28     0.999  79.38 2.3e-04  -8.55
5665     CNIH4      1_114     0.997  38.13 1.1e-04  -5.74
5095   DNAJC13       3_82     0.996  57.66 1.7e-04  -8.71
1185      TGDS      13_47     0.996 223.19 6.5e-04  16.68
10100     SELL       1_83     0.991  35.02 1.0e-04   6.09
10757     MAFB      20_24     0.991  94.16 2.7e-04 -10.36
1822     AXIN1       16_1     0.978  36.11 1.0e-04   5.03
9863     LAMP1      13_62     0.977  33.91 9.6e-05  -5.67
4360     TRIM5       11_4     0.970 143.93 4.1e-04 -10.36
10765  ZDHHC18       1_18     0.960  45.93 1.3e-04  -6.99
10954   NYNRIN       14_3     0.959  46.86 1.3e-04  -5.27
1778     KPNA3      13_21     0.956  27.35 7.6e-05   4.90
8329    GPRC5C      17_41     0.946  56.13 1.5e-04   7.19
2312      LIPA      10_57     0.934  33.07 9.0e-05   5.59
7483    CHMP4C       8_58     0.923  26.88 7.2e-05   4.77
10682     CES1      16_29     0.921  36.78 9.8e-05  -3.69
925      NFKB2      10_65     0.898 213.35 5.6e-04 -16.02
3223     CENPF      1_109     0.892  23.15 6.0e-05   4.41
11815  MPV17L2      19_14     0.886  52.17 1.3e-04  -7.46
5851     MYLK4        6_3     0.884  36.07 9.3e-05  -5.43
1224    KIF16B      20_12     0.882  44.24 1.1e-04   6.31
3323      NEK6       9_64     0.849  31.64 7.8e-05   5.05
9223    ZBTB7A       19_4     0.845  48.65 1.2e-04  -6.49
8590      CTSW      11_36     0.802  29.61 6.9e-05   4.65

Genes with largest effect sizes

#plot PIP vs effect size
plot(ctwas_gene_res$susie_pip, ctwas_gene_res$mu2, xlab="PIP", ylab="mu^2", main="Gene PIPs vs Effect Size")

Version Author Date
dfd2b5f wesleycrouse 2021-09-07
#genes with 20 largest effect sizes
head(ctwas_gene_res[order(-ctwas_gene_res$mu2),report_cols],20)
          genename region_tag susie_pip     mu2     PVE      z
5543         NBPF3       1_15     0.000 2519.31 0.0e+00  54.75
2723       ALDH5A1       6_18     0.000 1523.60 0.0e+00  38.11
6652          RER1        1_2     0.000 1387.32 6.4e-07   6.37
8866           ABO       9_70     0.001 1298.17 2.9e-06  25.25
5934        MFHAS1       8_11     0.000 1037.74 0.0e+00   8.64
3725          MRS2       6_18     0.000  692.00 1.1e-18 -15.10
11790       CLDN23       8_11     0.000  661.59 0.0e+00   8.63
9034        MAMSTR      19_33     0.000  603.84 7.8e-07  32.47
11701 RP11-10A14.5       8_11     0.000  597.04 0.0e+00   9.79
1948          ERI1       8_11     0.000  542.25 0.0e+00  -9.89
2097        RASIP1      19_33     0.000  529.35 1.5e-07 -31.45
4403       CLEC10A       17_6     0.000  488.33 1.3e-16 -12.49
6089         FADS1      11_34     0.999  425.10 1.2e-03  19.90
11160    LINC00339       1_15     0.000  385.07 0.0e+00 -11.61
12434 RP5-965G21.4      20_18     0.005  363.95 4.9e-06  19.00
1656          PYGB      20_18     0.011  342.04 1.1e-05 -18.39
4137          MAU2      19_15     0.000  299.08 1.0e-07  16.00
9448         CLDN7       17_6     0.000  293.26 0.0e+00   9.57
6876      ADAMTS13       9_70     0.000  289.47 1.9e-07 -25.72
4636         FADS2      11_34     0.003  278.43 2.5e-06  15.57

Genes with highest PVE

#genes with 20 highest pve
head(ctwas_gene_res[order(-ctwas_gene_res$PVE),report_cols],20)
      genename region_tag susie_pip    mu2     PVE      z
6089     FADS1      11_34     0.999 425.10 0.00120  19.90
1185      TGDS      13_47     0.996 223.19 0.00065  16.68
925      NFKB2      10_65     0.898 213.35 0.00056 -16.02
4360     TRIM5       11_4     0.970 143.93 0.00041 -10.36
7258     ICA1L      2_120     1.000  95.49 0.00028 -10.69
10757     MAFB      20_24     0.991  94.16 0.00027 -10.36
1652     PCIF1      20_28     0.999  79.38 0.00023  -8.55
7786  CATSPER2      15_16     0.778  78.18 0.00018  -8.61
5095   DNAJC13       3_82     0.996  57.66 0.00017  -8.71
8329    GPRC5C      17_41     0.946  56.13 0.00015   7.19
6912      IL6R       1_75     0.325 143.79 0.00014   8.12
10765  ZDHHC18       1_18     0.960  45.93 0.00013  -6.99
10505  UGT2B17       4_48     0.641  67.70 0.00013 -10.60
10954   NYNRIN       14_3     0.959  46.86 0.00013  -5.27
11815  MPV17L2      19_14     0.886  52.17 0.00013  -7.46
9297    GPBAR1      2_129     0.602  68.27 0.00012   7.95
9223    ZBTB7A       19_4     0.845  48.65 0.00012  -6.49
4712     AMHR2      12_33     0.789  47.43 0.00011   8.37
5665     CNIH4      1_114     0.997  38.13 0.00011  -5.74
1145      ACHE       7_62     0.594  60.98 0.00011   7.90

Genes with largest z scores

#genes with 20 largest z scores
head(ctwas_gene_res[order(-abs(ctwas_gene_res$z)),report_cols],20)
          genename region_tag susie_pip     mu2     PVE      z
5543         NBPF3       1_15     0.000 2519.31 0.0e+00  54.75
2723       ALDH5A1       6_18     0.000 1523.60 0.0e+00  38.11
9034        MAMSTR      19_33     0.000  603.84 7.8e-07  32.47
2097        RASIP1      19_33     0.000  529.35 1.5e-07 -31.45
6876      ADAMTS13       9_70     0.000  289.47 1.9e-07 -25.72
8866           ABO       9_70     0.001 1298.17 2.9e-06  25.25
6089         FADS1      11_34     0.999  425.10 1.2e-03  19.90
2517       ST3GAL4      11_77     0.000  239.99 1.7e-10  19.50
5995         GBGT1       9_70     0.000  137.25 6.3e-08  19.12
12434 RP5-965G21.4      20_18     0.005  363.95 4.9e-06  19.00
5996         SURF1       9_70     0.000  123.69 5.3e-08  18.55
1656          PYGB      20_18     0.011  342.04 1.1e-05 -18.39
1185          TGDS      13_47     0.996  223.19 6.5e-04  16.68
6000         REXO4       9_70     0.000   71.23 4.6e-08  16.29
6302        GPR180      13_47     0.005  212.06 3.4e-06  16.22
925          NFKB2      10_65     0.898  213.35 5.6e-04 -16.02
4137          MAU2      19_15     0.000  299.08 1.0e-07  16.00
7930          TMC4      19_37     0.001  226.16 8.1e-07 -15.97
5503          NTN5      19_33     0.001  173.30 2.9e-07  15.77
4636         FADS2      11_34     0.003  278.43 2.5e-06  15.57

Comparing z scores and PIPs

#set nominal signifiance threshold for z scores
alpha <- 0.05

#bonferroni adjusted threshold for z scores
sig_thresh <- qnorm(1-(alpha/nrow(ctwas_gene_res)/2), lower=T)

#Q-Q plot for z scores
obs_z <- ctwas_gene_res$z[order(ctwas_gene_res$z)]
exp_z <- qnorm((1:nrow(ctwas_gene_res))/nrow(ctwas_gene_res))

plot(exp_z, obs_z, xlab="Expected z", ylab="Observed z", main="Gene z score Q-Q plot")
abline(a=0,b=1)

Version Author Date
dfd2b5f wesleycrouse 2021-09-07
#plot z score vs PIP
plot(abs(ctwas_gene_res$z), ctwas_gene_res$susie_pip, xlab="abs(z)", ylab="PIP")
abline(v=sig_thresh, col="red", lty=2)

Version Author Date
dfd2b5f wesleycrouse 2021-09-07
#proportion of significant z scores
mean(abs(ctwas_gene_res$z) > sig_thresh)
[1] 0.0408292
#genes with most significant z scores
head(ctwas_gene_res[order(-abs(ctwas_gene_res$z)),report_cols],20)
          genename region_tag susie_pip     mu2     PVE      z
5543         NBPF3       1_15     0.000 2519.31 0.0e+00  54.75
2723       ALDH5A1       6_18     0.000 1523.60 0.0e+00  38.11
9034        MAMSTR      19_33     0.000  603.84 7.8e-07  32.47
2097        RASIP1      19_33     0.000  529.35 1.5e-07 -31.45
6876      ADAMTS13       9_70     0.000  289.47 1.9e-07 -25.72
8866           ABO       9_70     0.001 1298.17 2.9e-06  25.25
6089         FADS1      11_34     0.999  425.10 1.2e-03  19.90
2517       ST3GAL4      11_77     0.000  239.99 1.7e-10  19.50
5995         GBGT1       9_70     0.000  137.25 6.3e-08  19.12
12434 RP5-965G21.4      20_18     0.005  363.95 4.9e-06  19.00
5996         SURF1       9_70     0.000  123.69 5.3e-08  18.55
1656          PYGB      20_18     0.011  342.04 1.1e-05 -18.39
1185          TGDS      13_47     0.996  223.19 6.5e-04  16.68
6000         REXO4       9_70     0.000   71.23 4.6e-08  16.29
6302        GPR180      13_47     0.005  212.06 3.4e-06  16.22
925          NFKB2      10_65     0.898  213.35 5.6e-04 -16.02
4137          MAU2      19_15     0.000  299.08 1.0e-07  16.00
7930          TMC4      19_37     0.001  226.16 8.1e-07 -15.97
5503          NTN5      19_33     0.001  173.30 2.9e-07  15.77
4636         FADS2      11_34     0.003  278.43 2.5e-06  15.57

Locus plots for genes and SNPs

ctwas_gene_res_sortz <- ctwas_gene_res[order(-abs(ctwas_gene_res$z)),]

n_plots <- 5
for (region_tag_plot in head(unique(ctwas_gene_res_sortz$region_tag), n_plots)){
  ctwas_res_region <-  ctwas_res[ctwas_res$region_tag==region_tag_plot,]
  start <- min(ctwas_res_region$pos)
  end <- max(ctwas_res_region$pos)
  
  ctwas_res_region <- ctwas_res_region[order(ctwas_res_region$pos),]
  ctwas_res_region_gene <- ctwas_res_region[ctwas_res_region$type=="gene",]
  ctwas_res_region_snp <- ctwas_res_region[ctwas_res_region$type=="SNP",]
  
  #region name
  print(paste0("Region: ", region_tag_plot))
  
  #table of genes in region
  print(ctwas_res_region_gene[,report_cols])
  
  par(mfrow=c(4,1))
  
  #gene z scores
  plot(ctwas_res_region_gene$pos, abs(ctwas_res_region_gene$z), xlab="Position", ylab="abs(gene_z)", xlim=c(start,end),
   ylim=c(0,max(sig_thresh, abs(ctwas_res_region_gene$z))),
   main=paste0("Region: ", region_tag_plot))
  abline(h=sig_thresh,col="red",lty=2)
  
  #significance threshold for SNPs
  alpha_snp <- 5*10^(-8)
  sig_thresh_snp <- qnorm(1-alpha_snp/2, lower=T)
  
  #snp z scores
  plot(ctwas_res_region_snp$pos, abs(ctwas_res_region_snp$z), xlab="Position", ylab="abs(snp_z)",xlim=c(start,end),
   ylim=c(0,max(sig_thresh_snp, max(abs(ctwas_res_region_snp$z)))))
  abline(h=sig_thresh_snp,col="purple",lty=2)
  
  #gene pips
  plot(ctwas_res_region_gene$pos, ctwas_res_region_gene$susie_pip, xlab="Position", ylab="Gene PIP", xlim=c(start,end), ylim=c(0,1))
  abline(h=0.8,col="blue",lty=2)
  
  #snp pips
  plot(ctwas_res_region_snp$pos, ctwas_res_region_snp$susie_pip, xlab="Position", ylab="SNP PIP", xlim=c(start,end), ylim=c(0,1))
  abline(h=0.8,col="blue",lty=2)
}
[1] "Region: 1_15"
       genename region_tag susie_pip     mu2 PVE      z
5543      NBPF3       1_15         0 2519.31   0  54.75
917     RAP1GAP       1_15         0  269.55   0   3.57
1270      USP48       1_15         0   33.61   0  -0.20
10051   LDLRAD2       1_15         0   76.87   0  -3.01
5544      HSPG2       1_15         0   46.93   0  -8.09
5542     CELA3A       1_15         0   14.59   0   0.49
11160 LINC00339       1_15         0  385.07   0 -11.61
769       CDC42       1_15         0   45.18   0  -3.96
7080       WNT4       1_15         0   61.55   0  -2.23
9720     ZBTB40       1_15         0   10.28   0  -2.56

Version Author Date
dfd2b5f wesleycrouse 2021-09-07
[1] "Region: 6_18"
      genename region_tag susie_pip     mu2     PVE      z
3725      MRS2       6_18         0  692.00 1.1e-18 -15.10
2723   ALDH5A1       6_18         0 1523.60 0.0e+00  38.11
4959  KIAA0319       6_18         0   88.79 0.0e+00   2.98
2670      TDP2       6_18         0   54.38 0.0e+00   1.22
2727    ACOT13       6_18         0   12.91 0.0e+00  -5.83
2730   C6orf62       6_18         0  125.59 0.0e+00  11.76
2732      GMNN       6_18         0   21.36 0.0e+00  -4.28
2690    FAM65B       6_18         0   54.43 0.0e+00  -6.96
11977 C6orf229       6_18         0  185.49 0.0e+00 -11.15

Version Author Date
dfd2b5f wesleycrouse 2021-09-07
[1] "Region: 19_33"
      genename region_tag susie_pip    mu2     PVE      z
2050     PRKD2      19_33     0.000  10.02 3.7e-09   1.09
1257     STRN4      19_33     0.000   5.71 1.4e-09  -0.37
9389      FKRP      19_33     0.001  28.39 6.8e-08   2.14
400      AP2S1      19_33     0.000   5.13 1.2e-09   0.36
6825  ARHGAP35      19_33     0.000   5.03 1.1e-09   0.34
5502      SAE1      19_33     0.006  27.86 5.1e-07   3.94
2055      BBC3      19_33     0.226  59.61 3.9e-05   4.92
2053     CCDC9      19_33     0.000  19.03 1.8e-08   2.41
11894   INAFM1      19_33     0.000   5.62 1.3e-09   0.08
4639     C5AR2      19_33     0.000  12.42 6.0e-09  -1.28
4635     DHX34      19_33     0.000   7.13 2.0e-09  -0.22
2077     MEIS3      19_33     0.000   5.27 1.2e-09  -0.41
2074      NAPA      19_33     0.000  11.46 4.6e-09   0.79
3238    ZNF541      19_33     0.000   6.05 1.4e-09  -0.71
572    GLTSCR1      19_33     0.000   6.36 1.6e-09   0.27
294       EHD2      19_33     0.000   5.07 1.1e-09   0.20
2066   GLTSCR2      19_33     0.000   9.15 3.7e-09  -1.21
2073   SULT2A1      19_33     0.741  47.22 1.0e-04  -7.90
2089   PLA2G4C      19_33     0.000   6.04 1.3e-09   1.83
2086      LIG1      19_33     0.000   5.01 1.1e-09  -0.53
9808  C19orf68      19_33     0.000   7.13 1.9e-09  -0.79
2091     CABP5      19_33     0.000   5.39 1.2e-09   1.20
2085     CARD8      19_33     0.000  14.95 8.3e-09   1.86
5501      EMP3      19_33     0.000   9.76 2.6e-09   3.36
2084   CCDC114      19_33     0.000  13.26 3.1e-09  -4.36
2081     GRWD1      19_33     0.000  12.81 3.1e-09   3.24
2080     CYTH2      19_33     0.000  12.75 3.0e-09  -3.46
9493    KCNJ14      19_33     0.000  16.10 4.6e-09  -3.75
5504     LMTK3      19_33     0.000   7.01 1.6e-09  -2.47
1173   SULT2B1      19_33     0.000   6.63 1.5e-09   1.73
573      SPHK2      19_33     0.000  83.49 1.9e-08  12.91
574       CA11      19_33     0.000  28.09 3.1e-08   6.62
5503      NTN5      19_33     0.001 173.30 2.9e-07  15.77
9034    MAMSTR      19_33     0.000 603.84 7.8e-07  32.47
2097    RASIP1      19_33     0.000 529.35 1.5e-07 -31.45

Version Author Date
dfd2b5f wesleycrouse 2021-09-07
[1] "Region: 9_70"
       genename region_tag susie_pip     mu2     PVE      z
3800      DDX31       9_70     0.001   43.93 1.1e-07  -3.34
7622     SPACA9       9_70     0.002   32.76 1.7e-07  -2.91
7623       TSC1       9_70     0.000    5.90 2.6e-09  -0.52
7624      GFI1B       9_70     0.000   11.15 8.6e-09   0.98
6002     GTF3C5       9_70     0.001   20.16 4.0e-08   1.63
5995      GBGT1       9_70     0.000  137.25 6.3e-08  19.12
8866        ABO       9_70     0.001 1298.17 2.9e-06  25.25
5998      SURF6       9_70     0.000  167.09 1.3e-07  -2.57
6001      RPL7A       9_70     0.001   77.06 1.4e-07 -11.01
5996      SURF1       9_70     0.000  123.69 5.3e-08  18.55
5997      SURF2       9_70     0.000   46.92 3.9e-08  -7.21
5994      SURF4       9_70     0.001  118.27 3.7e-07  13.85
10687    STKLD1       9_70     0.000   45.85 3.6e-08   7.16
6876   ADAMTS13       9_70     0.000  289.47 1.9e-07 -25.72
6000      REXO4       9_70     0.000   71.23 4.6e-08  16.29
3633        DBH       9_70     0.000    5.54 2.7e-09   0.59
3632      SARDH       9_70     0.000    9.84 8.0e-09   0.13
6868       VAV2       9_70     0.000    5.73 2.8e-09  -0.65
11444 LINC00094       9_70     0.000   19.28 2.7e-08  -2.38
8258       BRD3       9_70     0.000    8.37 4.5e-09  -1.48
10249      WDR5       9_70     0.000    4.98 2.1e-09  -0.13

Version Author Date
dfd2b5f wesleycrouse 2021-09-07
[1] "Region: 11_34"
           genename region_tag susie_pip    mu2     PVE     z
10165       FAM111B      11_34     0.010  19.29 5.5e-07 -1.88
7794        FAM111A      11_34     0.003   7.46 6.3e-08 -0.60
2506           DTX4      11_34     0.003   6.44 4.7e-08 -0.74
10468         MPEG1      11_34     0.002   5.04 3.3e-08  0.27
2515         MS4A6A      11_34     0.033  30.23 2.9e-06  2.76
7815          PATL1      11_34     0.002   5.10 3.3e-08 -0.28
7817           STX3      11_34     0.004   9.60 9.8e-08  1.10
7818         MRPL16      11_34     0.003   8.06 7.1e-08 -0.87
4634            GIF      11_34     0.002   5.43 3.7e-08 -0.09
4638           TCN1      11_34     0.003   6.25 4.8e-08 -0.15
6096          MS4A2      11_34     0.006  14.04 2.4e-07 -1.82
11819    AP001257.1      11_34     0.003   6.27 4.7e-08  0.76
11116        MS4A4E      11_34     0.023  27.08 1.8e-06  2.92
2516         MS4A4A      11_34     0.003   7.45 6.6e-08  0.86
7825         MS4A6E      11_34     0.003   9.33 9.1e-08 -1.23
7826          MS4A7      11_34     0.015  24.25 1.1e-06  2.57
7827         MS4A14      11_34     0.003   6.84 5.1e-08 -0.98
2519         CCDC86      11_34     0.005  11.22 1.5e-07  0.86
9570         PTGDR2      11_34     0.005  12.20 1.6e-07  1.59
6093            ZP1      11_34     0.002   6.58 4.7e-08 -1.00
2520         PRPF19      11_34     0.015  24.77 1.1e-06 -2.50
2521        TMEM109      11_34     0.007  15.59 3.0e-07 -1.73
2546        SLC15A3      11_34     0.003  10.58 9.5e-08 -1.89
2547            CD5      11_34     0.017  31.12 1.5e-06  3.37
8008         VPS37C      11_34     0.004  13.75 1.8e-07 -1.99
11874          PGA5      11_34     0.008  15.28 3.6e-07 -0.31
11340          PGA3      11_34     0.005  11.40 1.7e-07  0.00
8009           VWCE      11_34     0.004  10.31 1.2e-07  0.07
6088        TMEM138      11_34     0.004  16.56 1.9e-07  2.43
7030       CYB561A3      11_34     0.004  16.56 1.9e-07  2.43
9981        TMEM216      11_34     0.005  11.74 1.8e-07 -0.67
11871 RP11-286N22.8      11_34     0.010  18.22 5.3e-07 -1.44
4631          DAGLA      11_34     0.002  26.90 1.8e-07 -4.83
3765           MYRF      11_34     0.002  45.92 3.0e-07  6.64
4636          FADS2      11_34     0.003 278.43 2.5e-06 15.57
4637        TMEM258      11_34     0.003 106.68 8.3e-07  9.77
6089          FADS1      11_34     0.999 425.10 1.2e-03 19.90
11190         FADS3      11_34     0.003  12.34 1.2e-07 -2.12
8011          BEST1      11_34     0.003  23.34 2.4e-07  3.54
6092         INCENP      11_34     0.027  35.77 2.8e-06  3.55
7032         ASRGL1      11_34     0.015  20.27 8.9e-07 -1.09

Version Author Date
dfd2b5f wesleycrouse 2021-09-07

SNPs with highest PIPs

#snps with PIP>0.8 or 20 highest PIPs
head(ctwas_snp_res[order(-ctwas_snp_res$susie_pip),report_cols_snps],
max(sum(ctwas_snp_res$susie_pip>0.8), 20))
                 id region_tag susie_pip     mu2     PVE       z
5824     rs77025042       1_14     1.000  200.61 5.8e-04  -13.03
5840    rs148717955       1_14     1.000  511.69 1.5e-03    5.52
5846     rs72657133       1_14     1.000 1196.52 3.5e-03  -23.99
31706     rs6679677       1_70     1.000   80.70 2.3e-04   -7.89
52468     rs1223802      1_108     1.000  111.25 3.2e-04  -10.30
62455    rs12239046      1_131     1.000   88.39 2.6e-04    9.72
64420    rs10183939        2_2     1.000   38.28 1.1e-04   -6.00
72181      rs780093       2_16     1.000  420.75 1.2e-03  -21.28
92448     rs2860399       2_55     1.000   63.39 1.8e-04   -5.70
92461     rs2176569       2_55     1.000   45.13 1.3e-04    3.49
103726    rs2277882       2_79     1.000   79.51 2.3e-04   -7.09
103779    rs1257220       2_79     1.000  131.75 3.8e-04  -10.61
113652    rs1862069      2_102     1.000  136.80 4.0e-04  -16.41
122168    rs2041080      2_117     1.000   50.59 1.5e-04   10.17
222201    rs6811535       4_52     1.000   52.06 1.5e-04    7.67
272743    rs1428967       5_25     1.000  112.21 3.3e-04   11.11
324123  rs151189505       6_17     1.000  129.03 3.7e-04   10.73
324360    rs9393530       6_18     1.000  204.37 5.9e-04    0.12
324472   rs10946700       6_18     1.000 2001.13 5.8e-03   44.85
324653  rs114584234       6_19     1.000  148.77 4.3e-04   13.26
324657    rs7738816       6_19     1.000   58.38 1.7e-04    9.22
324664    rs9461081       6_19     1.000  134.57 3.9e-04  -13.60
325143  rs115740542       6_20     1.000  122.32 3.6e-04   11.58
370554   rs12208357      6_103     1.000   72.74 2.1e-04    6.41
430773       rs2428       8_11     1.000 2786.21 8.1e-03   15.16
430778  rs758184196       8_11     1.000 2897.15 8.4e-03   -3.89
431030     rs330096       8_12     1.000  337.58 9.8e-04   19.73
431246    rs2048656       8_13     1.000  160.71 4.7e-04   13.82
431932   rs10105588       8_14     1.000  178.64 5.2e-04   -4.87
431940   rs10092177       8_14     1.000  265.14 7.7e-04  -12.10
431942  rs779417490       8_14     1.000  253.95 7.4e-04   -4.17
464202   rs10505348       8_79     1.000  200.43 5.8e-04   19.99
466255   rs13252684       8_83     1.000  374.46 1.1e-03   16.92
466256    rs6987702       8_83     1.000  345.17 1.0e-03   15.28
475419    rs4471106        9_6     1.000  146.50 4.3e-04   14.15
486714   rs11791806       9_27     1.000   37.23 1.1e-04   -5.43
498402    rs2183745       9_50     1.000  363.42 1.1e-03  -21.03
498419  rs146562086       9_50     1.000   76.17 2.2e-04   -8.01
498433   rs35381859       9_50     1.000  173.91 5.1e-04    7.49
498490   rs10448294       9_50     1.000  115.33 3.3e-04   -0.68
508103  rs115478735       9_70     1.000 3945.43 1.1e-02 -108.55
535646    rs2186235      10_51     1.000   48.47 1.4e-04    7.07
551536   rs72636980       11_1     1.000  142.20 4.1e-04   13.97
551576   rs55642248       11_1     1.000  205.73 6.0e-04  -13.11
589125  rs116891075      11_77     1.000   45.83 1.3e-04   -8.07
589173     rs240536      11_77     1.000   89.54 2.6e-04  -14.18
589181   rs10893498      11_77     1.000  317.88 9.2e-04  -18.84
589190   rs10790802      11_77     1.000  394.43 1.1e-03   25.30
589193  rs112282958      11_77     1.000   80.76 2.3e-04  -11.11
592482    rs2191159       12_1     1.000  238.35 6.9e-04   15.88
592483    rs6489532       12_1     1.000   56.07 1.6e-04    5.60
593832   rs61909253       12_5     1.000   44.74 1.3e-04   -5.67
623448  rs117615171      12_59     1.000   35.75 1.0e-04    5.58
658466  rs139406059      13_48     1.000   78.54 2.3e-04    3.68
687960   rs11439803      14_49     1.000  207.46 6.0e-04    0.83
687967    rs1243165      14_49     1.000  223.99 6.5e-04    4.28
691095     rs729183      14_54     1.000   39.30 1.1e-04    5.51
702513   rs62000868      15_27     1.000   76.26 2.2e-04   -9.31
702519    rs2070895      15_27     1.000  161.18 4.7e-04  -12.96
730495    rs1512627      16_37     1.000   49.27 1.4e-04    6.30
734589    rs2255451      16_49     1.000   59.36 1.7e-04   -8.23
738387   rs11078597       17_2     1.000  121.44 3.5e-04  -12.61
739960  rs144129583       17_7     1.000  180.69 5.2e-04   13.93
749641     rs755736      17_29     1.000  122.65 3.6e-04   -7.79
785543    rs2163856       19_9     1.000   64.72 1.9e-04   -7.07
794085   rs11671669      19_30     1.000  100.70 2.9e-04   11.96
794091   rs10853742      19_30     1.000  300.90 8.7e-04  -18.79
795189     rs814573      19_31     1.000  132.44 3.8e-04  -12.40
795190  rs117664574      19_31     1.000   47.72 1.4e-04    7.98
796435     rs601338      19_33     1.000 1305.55 3.8e-03  -50.96
796481  rs116922356      19_34     1.000   48.82 1.4e-04    9.13
796483   rs55975925      19_34     1.000  152.81 4.4e-04  -12.91
833991   rs16996442      22_14     1.000   45.01 1.3e-04    7.43
844401  rs199779538        1_2     1.000 2381.97 6.9e-03   -3.23
849666  rs149344982       1_15     1.000 5614.82 1.6e-02  -75.15
849771   rs72659192       1_15     1.000 1621.02 4.7e-03   52.94
891483  rs201939100       4_48     1.000   63.76 1.9e-04   -2.32
930808   rs45516493      10_65     1.000   97.11 2.8e-04  -13.44
930919   rs72845815      10_66     1.000  151.60 4.4e-04  -13.00
942064   rs11601507       11_4     1.000  282.00 8.2e-04   16.49
988261   rs11621792       14_3     1.000  193.60 5.6e-04  -13.84
1029018 rs201685059      16_29     1.000  842.61 2.4e-03    4.82
1032501   rs9302635      16_38     1.000  376.09 1.1e-03   17.64
1051742  rs55714927       17_6     1.000 1517.78 4.4e-03   36.59
1051924      rs5409       17_6     1.000  327.14 9.5e-04    9.00
1052012  rs78173576       17_6     1.000  188.18 5.5e-04   15.28
1053846 rs201963278      17_23     1.000  444.84 1.3e-03    3.44
29706     rs1730862       1_66     0.999   32.86 9.5e-05   -5.52
36746    rs61804205       1_79     0.999   47.60 1.4e-04    7.48
193099   rs56328339      3_115     0.999   35.28 1.0e-04   -5.73
232519    rs4698813       4_71     0.999   33.22 9.6e-05    4.04
245758   rs72727873       4_98     0.999   40.25 1.2e-04   -4.44
321243   rs10456776       6_13     0.999   57.47 1.7e-04   -7.65
367363    rs6557156       6_99     0.999   33.02 9.6e-05    6.08
384481   rs11983782       7_20     0.999   41.12 1.2e-04   -6.32
486718    rs2812357       9_27     0.999   42.12 1.2e-04    6.36
625306    rs1215606      12_64     0.999   33.95 9.9e-05    5.68
738687    rs2240731       17_3     0.999   38.49 1.1e-04   -6.17
775917   rs62098355      18_34     0.999   42.01 1.2e-04    8.78
787136   rs10405035      19_12     0.999   34.55 1.0e-04   -5.70
849148    rs4654745       1_15     0.999 2671.16 7.7e-03  -51.71
30305      rs507482       1_67     0.998   68.87 2.0e-04   -8.07
122180    rs7595923      2_118     0.998   34.63 1.0e-04    6.90
407141    rs1207731       7_59     0.998   31.80 9.2e-05   -5.32
430972    rs2929451       8_11     0.998 1743.87 5.1e-03  -16.29
431043   rs13265179       8_12     0.998  389.88 1.1e-03   28.39
541247    rs7069475      10_64     0.998   46.90 1.4e-04   -8.16
753777    rs1801689      17_38     0.998   31.15 9.0e-05   -4.95
771404    rs2878889      18_27     0.998   36.04 1.0e-04   -6.11
782913   rs35254404       19_2     0.998   32.50 9.4e-05   -4.43
844408    rs7519807        1_2     0.998 2376.34 6.9e-03   -3.16
5783      rs3026894       1_14     0.997  223.40 6.5e-04    4.48
110381   rs13383985       2_94     0.997   43.50 1.3e-04   -6.42
301128    rs4705986       5_80     0.997   37.91 1.1e-04   -6.01
389739    rs6974574       7_28     0.997   33.00 9.6e-05   -4.93
610310    rs7397189      12_36     0.997   40.61 1.2e-04   -6.46
1127026   rs1800961      20_28     0.997   37.34 1.1e-04   -5.76
41285     rs6682862       1_87     0.996   58.80 1.7e-04    7.68
609390     rs930900      12_33     0.996   87.94 2.5e-04   11.32
687388   rs11624512      14_46     0.996   62.55 1.8e-04   -7.98
734580   rs74032329      16_49     0.996   34.97 1.0e-04   -5.33
749651   rs73987397      17_29     0.996   79.37 2.3e-04   -0.64
775922   rs56051253      18_34     0.996   59.60 1.7e-04   -8.96
308772   rs13167291       5_93     0.995   59.83 1.7e-04    7.57
415764    rs3757387       7_79     0.995   41.98 1.2e-04    6.42
572592     rs695110      11_42     0.995   50.57 1.5e-04   -6.76
822679   rs12482821      21_15     0.995   29.93 8.6e-05   -4.85
51618    rs74704885      1_107     0.994   41.83 1.2e-04   -5.25
57741      rs564212      1_122     0.994   44.43 1.3e-04    7.15
613859  rs113479946      12_42     0.994   35.33 1.0e-04   -5.71
702442    rs1318175      15_27     0.994   69.43 2.0e-04   10.19
725683   rs17616063      16_27     0.994   30.73 8.9e-05    5.32
140290   rs56395424        3_9     0.993   40.44 1.2e-04   -6.28
172337     rs189174       3_74     0.993   61.38 1.8e-04    7.69
225276   rs13134099       4_58     0.993   29.24 8.4e-05    4.99
283766    rs4133339       5_45     0.992   44.85 1.3e-04    6.71
509351    rs1886296       9_73     0.992   30.12 8.7e-05    4.68
53870      rs884127      1_112     0.991   41.34 1.2e-04    6.44
333211   rs78470916       6_32     0.991   31.31 9.0e-05    4.84
422774    rs7807051       7_94     0.991   31.40 9.0e-05    5.34
707030    rs2472297      15_35     0.991   29.12 8.4e-05   -4.95
82081    rs12611996       2_36     0.990   57.42 1.7e-04   -7.71
592484    rs7137297       12_1     0.990   81.00 2.3e-04   -9.53
5878     rs34957055       1_16     0.989   31.25 9.0e-05   -5.42
34631    rs35717427       1_75     0.988   34.61 9.9e-05    0.64
629845    rs2393775      12_74     0.988  396.72 1.1e-03  -24.49
635824    rs9552620       13_3     0.988   26.80 7.7e-05    4.84
276396    rs1499279       5_31     0.986   54.94 1.6e-04   -7.57
329453    rs9272364       6_26     0.985   82.54 2.4e-04    8.97
331174   rs78945013       6_29     0.985   27.65 7.9e-05   -5.07
702423   rs12594571      15_27     0.985   46.20 1.3e-04   -7.06
431517   rs11777976       8_13     0.984  167.75 4.8e-04  -15.73
610246    rs1874888      12_35     0.984   28.35 8.1e-05    5.24
135023   rs12619647      2_144     0.981   36.21 1.0e-04   -6.85
754693  rs113408695      17_39     0.981   30.16 8.6e-05    5.21
754497    rs8072180      17_39     0.980   46.68 1.3e-04   -9.11
795192   rs77719426      19_31     0.980   39.21 1.1e-04    6.57
837334     rs135577      22_21     0.980   31.86 9.1e-05    4.48
415307   rs17864212       7_79     0.979   30.97 8.8e-05    4.75
432235    rs4841659       8_15     0.979  102.82 2.9e-04   15.90
824400    rs2836882      21_18     0.978   47.08 1.3e-04   -6.71
59883    rs12044944      1_126     0.976   26.29 7.5e-05   -4.78
295330   rs12521324       5_69     0.976   29.25 8.3e-05    5.03
445823  rs140753685       8_42     0.975   28.69 8.1e-05    4.94
244971   rs59435073       4_98     0.974   52.48 1.5e-04   -7.43
436333   rs11986461       8_21     0.974   31.21 8.8e-05   -5.93
592492   rs11513717       12_1     0.974   44.07 1.2e-04    1.23
430214    rs2928619       8_10     0.973   43.94 1.2e-04    6.51
324961   rs75080831       6_19     0.972   53.42 1.5e-04    8.29
480985     rs776756       9_14     0.972   27.26 7.7e-05   -4.45
739321  rs140384878       17_4     0.971   25.75 7.3e-05    4.77
276422   rs67715745       5_31     0.970   27.54 7.8e-05    4.93
801643    rs6140010       20_5     0.970   39.96 1.1e-04   -6.12
324228   rs34350323       6_17     0.969   43.72 1.2e-04    5.16
486601   rs11557154       9_27     0.969   46.46 1.3e-04   -6.99
589209  rs113120553      11_78     0.967   32.63 9.2e-05    4.51
775930    rs2957132      18_34     0.967   28.43 8.0e-05   -5.10
639893   rs11424749      13_10     0.966   31.12 8.7e-05    5.35
774080    rs1217565      18_30     0.966   35.05 9.8e-05   -5.56
73766    rs17820747       2_20     0.965   38.19 1.1e-04   -5.66
507273    rs8181197       9_68     0.965   63.91 1.8e-04    8.09
796856   rs34122194      19_34     0.964   27.65 7.7e-05    4.98
97079    rs10170168       2_66     0.963   39.92 1.1e-04   -3.38
43400   rs146203975       1_92     0.962   45.28 1.3e-04   -6.84
383352    rs7796210       7_18     0.962   32.83 9.2e-05    5.51
441905   rs11997272       8_34     0.962   25.60 7.2e-05   -4.47
589196    rs3802821      11_78     0.962   27.26 7.6e-05    3.60
324197  rs554542699       6_17     0.959   33.31 9.3e-05    4.54
331297    rs9470183       6_29     0.959   25.61 7.1e-05    4.10
509499     rs914738       9_74     0.959   26.13 7.3e-05    4.74
318469    rs6597256        6_7     0.958   40.03 1.1e-04   -5.57
87209     rs3796098       2_47     0.957   28.14 7.8e-05    4.88
756695   rs11658216      17_44     0.957   26.18 7.3e-05    4.75
530718    rs9414798      10_42     0.956  101.53 2.8e-04  -14.18
791632   rs17841839      19_23     0.956   72.36 2.0e-04   10.03
324694   rs34888581       6_19     0.953   34.80 9.6e-05   -5.03
795261   rs77332277      19_31     0.952   45.50 1.3e-04    7.13
1050754 rs185342176       17_6     0.952  192.02 5.3e-04   13.69
592152   rs12277680      11_84     0.951   29.60 8.2e-05   -4.91
774471   rs12373325      18_31     0.950   70.69 2.0e-04   -9.66
325213    rs1155207       6_20     0.949   39.26 1.1e-04   -4.57
232518   rs34254189       4_71     0.948   26.48 7.3e-05    3.06
642991  rs116944862      13_17     0.948   30.12 8.3e-05   -2.20
754962     rs189323      17_40     0.946   25.10 6.9e-05    3.87
776174    rs7242402      18_35     0.943   24.96 6.8e-05    4.60
135001   rs61747382      2_144     0.942   34.60 9.5e-05    6.60
730450   rs79829970      16_37     0.942   25.91 7.1e-05    4.55
687365   rs67868394      14_46     0.941   28.21 7.7e-05    5.32
324500   rs78808915       6_18     0.940 1560.87 4.3e-03  -35.32
363185   rs62432712       6_92     0.939   25.90 7.1e-05    4.68
736935    rs7206699      16_54     0.938   41.33 1.1e-04    6.27
499893    rs2900388       9_53     0.935   40.47 1.1e-04   -2.86
596932    rs2417261      12_12     0.935   26.56 7.2e-05   -4.81
691094  rs149136706      14_54     0.934   51.41 1.4e-04    6.56
499919   rs10991458       9_53     0.932   50.31 1.4e-04    4.42
301009    rs6894249       5_79     0.931   27.27 7.4e-05   -4.87
540081   rs10786262      10_61     0.927   31.57 8.5e-05    5.22
570634   rs72917317      11_38     0.927   29.50 7.9e-05    5.31
464256    rs7017788       8_79     0.926   43.81 1.2e-04    8.60
318397    rs2765359        6_7     0.925   35.74 9.6e-05    4.79
586797    rs7104819      11_71     0.925   28.61 7.7e-05    3.32
72378     rs7606480       2_19     0.923   44.00 1.2e-04   -6.65
73763   rs564066844       2_20     0.920   24.94 6.7e-05   -4.40
430794   rs13265731       8_11     0.919 2656.89 7.1e-03   13.94
173386   rs72964564       3_76     0.918   32.59 8.7e-05    5.40
812622    rs2585441      20_32     0.917   24.85 6.6e-05   -4.63
263843  rs112622661        5_9     0.915   23.77 6.3e-05   -4.43
823118     rs928287      21_16     0.915   46.33 1.2e-04   -6.52
20432   rs145366123       1_48     0.913   29.74 7.9e-05    5.41
324558    rs9358773       6_18     0.911  175.07 4.6e-04   18.18
732097  rs557791532      16_41     0.911   25.12 6.6e-05    4.51
540088    rs2039616      10_62     0.910   29.08 7.7e-05    5.09
601631  rs146970907      12_18     0.908   29.48 7.8e-05    5.27
71638   rs368027631       2_15     0.905   30.52 8.0e-05   -5.39
148933    rs2844400       3_27     0.904   23.63 6.2e-05   -4.23
555057    rs7102759       11_8     0.903   27.04 7.1e-05   -4.83
199777  rs113840252        4_9     0.902   26.08 6.8e-05   -4.82
54148    rs61830291      1_112     0.900   34.87 9.1e-05    5.60
489880   rs11144105       9_35     0.899   24.81 6.5e-05    4.53
994866  rs113154361      15_25     0.899   29.59 7.7e-05    5.02
280608     rs253232       5_40     0.898   25.13 6.6e-05   -4.54
390921   rs12155027       7_30     0.897   24.60 6.4e-05   -4.59
823473     rs219783      21_16     0.897   42.31 1.1e-04   -6.43
735342   rs60239983      16_50     0.896   25.40 6.6e-05   -4.64
10319   rs368949592       1_25     0.885   25.47 6.5e-05   -4.05
81354    rs75536720       2_34     0.884   24.50 6.3e-05   -4.46
151850  rs116643069       3_35     0.884   29.94 7.7e-05   -4.67
755371    rs2384955      17_42     0.880   25.71 6.6e-05    4.76
857804    rs2993063       1_18     0.879   42.90 1.1e-04    7.23
996300  rs371481929      15_43     0.879   34.91 8.9e-05   -4.60
752880   rs12452590      17_36     0.877   23.70 6.0e-05   -4.28
795178    rs3729640      19_31     0.876   43.99 1.1e-04   -6.69
750165   rs16950448      17_29     0.873   26.05 6.6e-05   -4.57
218673  rs186589299       4_45     0.871   24.21 6.1e-05   -4.35
435511    rs2015440       8_20     0.870   26.93 6.8e-05   -4.81
1053805     rs16532      17_23     0.869  341.26 8.6e-04    6.07
326263    rs6456964       6_23     0.866   26.58 6.7e-05   -4.79
601171   rs10842642      12_18     0.866   26.80 6.7e-05   -4.69
51564     rs1962918      1_107     0.863   29.01 7.3e-05   -5.64
597384    rs4764086      12_12     0.863   46.63 1.2e-04    6.80
652126    rs9592980      13_36     0.862   62.81 1.6e-04    7.94
198950  rs115976359        4_7     0.861   24.31 6.1e-05   -4.45
137558   rs12497013        3_4     0.858   27.40 6.8e-05   -4.78
203026   rs10034719       4_16     0.855   26.67 6.6e-05    4.72
539522   rs10509670      10_60     0.854   39.38 9.8e-05   -6.08
431467    rs2975676       8_13     0.852   38.71 9.6e-05   -1.41
496392  rs150962029       9_48     0.852   24.64 6.1e-05   -4.49
380111  rs115412782       7_13     0.851   24.01 5.9e-05    4.15
1029198  rs12600137      16_29     0.851  817.89 2.0e-03    1.54
770240   rs73425984      18_24     0.848   27.39 6.7e-05    4.84
733568   rs17689455      16_44     0.845  329.63 8.1e-04   18.92
480969   rs71506880       9_14     0.844   32.73 8.0e-05    5.00
8028     rs75339626       1_21     0.842   24.00 5.9e-05    4.30
99585     rs6724056       2_70     0.838   32.02 7.8e-05    5.40
535215    rs1248889      10_50     0.837   55.76 1.4e-04    9.01
642973   rs34001253      13_16     0.837   48.12 1.2e-04   -8.90
756724    rs9900494      17_44     0.837   26.29 6.4e-05   -4.68
24793    rs34303579       1_55     0.835   24.93 6.0e-05   -3.66
608225   rs12300763      12_31     0.834   26.40 6.4e-05    4.61
827689    rs7290147       22_1     0.831   25.54 6.2e-05   -4.49
375053   rs78894484        7_3     0.825   30.37 7.3e-05    6.04
749632   rs34759387      17_29     0.820   36.90 8.8e-05    7.42
54530    rs12132342      1_115     0.814   25.19 6.0e-05    4.78
210774   rs17578029       4_31     0.813   26.39 6.2e-05    5.10
97413    rs12467534       2_67     0.810   27.08 6.4e-05   -5.12
413414    rs3801387       7_72     0.808   24.20 5.7e-05   -4.18
47049     rs2994256       1_98     0.807   28.68 6.7e-05   -4.93
373821    rs2880362      6_110     0.801   25.93 6.0e-05    4.58

SNPs with largest effect sizes

#plot PIP vs effect size
plot(ctwas_snp_res$susie_pip, ctwas_snp_res$mu2, xlab="PIP", ylab="mu^2", main="SNP PIPs vs Effect Size")

Version Author Date
dfd2b5f wesleycrouse 2021-09-07
#SNPs with 50 largest effect sizes
head(ctwas_snp_res[order(-ctwas_snp_res$mu2),report_cols_snps],50)
                id region_tag susie_pip     mu2     PVE       z
849666 rs149344982       1_15     1.000 5614.82 1.6e-02  -75.15
508099    rs677355       9_70     0.499 4427.98 6.4e-03 -102.39
508098  rs34357864       9_70     0.800 4425.89 1.0e-02 -102.31
508102    rs674302       9_70     0.172 4423.27 2.2e-03 -102.40
508100    rs676457       9_70     0.161 4423.11 2.1e-03 -102.40
849830 rs141957574       1_15     0.000 4396.98 0.0e+00  -66.61
508101 rs782455289       9_70     0.003 4392.91 3.9e-05 -101.92
849788  rs72659199       1_15     0.000 4167.10 0.0e+00  -50.20
849819 rs144999112       1_15     0.000 4150.18 0.0e+00  -49.86
849836  rs72660309       1_15     0.000 4091.98 0.0e+00  -49.53
849866 rs148785605       1_15     0.000 4082.65 0.0e+00  -49.46
849888  rs72660315       1_15     0.000 4011.25 0.0e+00  -49.04
849889 rs115051087       1_15     0.000 3996.42 0.0e+00  -48.95
508103 rs115478735       9_70     1.000 3945.43 1.1e-02 -108.55
849931  rs72660324       1_15     0.000 3757.20 0.0e+00  -47.32
849957  rs72660333       1_15     0.000 3733.80 0.0e+00  -47.08
849959 rs182287953       1_15     0.000 3707.35 0.0e+00  -46.77
849963  rs72660334       1_15     0.000 3706.13 0.0e+00  -46.87
508107    rs495828       9_70     0.000 3326.20 2.0e-06  -99.78
849969   rs1130564       1_15     0.000 3258.54 0.0e+00  -39.05
849991 rs199787255       1_15     0.000 3162.23 0.0e+00  -39.47
849901  rs72660319       1_15     0.000 3027.37 0.0e+00  -43.20
430778 rs758184196       8_11     1.000 2897.15 8.4e-03   -3.89
430773      rs2428       8_11     1.000 2786.21 8.1e-03   15.16
849369  rs12132412       1_15     0.000 2697.80 0.0e+00  -42.82
849148   rs4654745       1_15     0.999 2671.16 7.7e-03  -51.71
849144   rs1566523       1_15     0.001 2658.03 1.0e-05  -51.61
430794  rs13265731       8_11     0.919 2656.89 7.1e-03   13.94
430790   rs6993494       8_11     0.081 2645.82 6.2e-04   13.92
849210   rs4654748       1_15     0.000 2613.30 0.0e+00  -51.25
849384   rs1697421       1_15     0.000 2581.53 0.0e+00  -47.71
849319 rs199855186       1_15     0.000 2510.90 0.0e+00  -49.32
849312  rs56414407       1_15     0.000 2497.97 0.0e+00  -48.18
849253   rs6687836       1_15     0.000 2494.60 0.0e+00  -49.42
849287   rs6426713       1_15     0.000 2494.06 0.0e+00  -49.42
849246   rs1827293       1_15     0.000 2487.25 0.0e+00  -49.36
849306   rs3820293       1_15     0.000 2487.18 0.0e+00  -49.28
849302   rs3820296       1_15     0.000 2484.56 0.0e+00  -49.26
849258   rs2004380       1_15     0.000 2484.45 0.0e+00  -49.26
849150  rs12047493       1_15     0.000 2478.12 0.0e+00  -49.86
849153  rs10916993       1_15     0.000 2474.81 0.0e+00  -49.90
849123  rs12734589       1_15     0.000 2471.11 0.0e+00  -49.80
849122  rs12759170       1_15     0.000 2459.05 0.0e+00  -49.71
849715 rs115257434       1_15     0.000 2451.88 0.0e+00  -46.05
849155   rs3820597       1_15     0.000 2411.10 0.0e+00  -48.86
430752   rs1703982       8_11     0.000 2410.76 5.5e-15  -14.16
849305   rs3820294       1_15     0.000 2404.66 0.0e+00  -48.74
849631 rs181708801       1_15     0.000 2389.26 0.0e+00  -45.95
849307   rs3820292       1_15     0.000 2387.93 0.0e+00  -48.26
844401 rs199779538        1_2     1.000 2381.97 6.9e-03   -3.23

SNPs with highest PVE

#SNPs with 50 highest pve
head(ctwas_snp_res[order(-ctwas_snp_res$PVE),report_cols_snps],50)
                 id region_tag susie_pip     mu2     PVE       z
849666  rs149344982       1_15     1.000 5614.82 0.01600  -75.15
508103  rs115478735       9_70     1.000 3945.43 0.01100 -108.55
508098   rs34357864       9_70     0.800 4425.89 0.01000 -102.31
430778  rs758184196       8_11     1.000 2897.15 0.00840   -3.89
430773       rs2428       8_11     1.000 2786.21 0.00810   15.16
849148    rs4654745       1_15     0.999 2671.16 0.00770  -51.71
430794   rs13265731       8_11     0.919 2656.89 0.00710   13.94
844401  rs199779538        1_2     1.000 2381.97 0.00690   -3.23
844408    rs7519807        1_2     0.998 2376.34 0.00690   -3.16
508099     rs677355       9_70     0.499 4427.98 0.00640 -102.39
324472   rs10946700       6_18     1.000 2001.13 0.00580   44.85
430972    rs2929451       8_11     0.998 1743.87 0.00510  -16.29
849771   rs72659192       1_15     1.000 1621.02 0.00470   52.94
1051742  rs55714927       17_6     1.000 1517.78 0.00440   36.59
324500   rs78808915       6_18     0.940 1560.87 0.00430  -35.32
796435     rs601338      19_33     1.000 1305.55 0.00380  -50.96
5846     rs72657133       1_14     1.000 1196.52 0.00350  -23.99
508077   rs10793962       9_70     0.657 1465.47 0.00280    9.89
796437    rs1688264      19_33     0.771 1224.91 0.00270  -50.10
1029018 rs201685059      16_29     1.000  842.61 0.00240    4.82
508102     rs674302       9_70     0.172 4423.27 0.00220 -102.40
849561   rs56222534       1_15     0.432 1759.06 0.00220  -43.49
508100     rs676457       9_70     0.161 4423.11 0.00210 -102.40
1029198  rs12600137      16_29     0.851  817.89 0.00200    1.54
5840    rs148717955       1_14     1.000  511.69 0.00150    5.52
508079    rs8176759       9_70     0.343 1465.22 0.00150    9.85
530731   rs10640079      10_42     0.423 1211.27 0.00150   37.62
849563   rs11586977       1_15     0.300 1758.25 0.00150  -43.48
849799    rs1772710       1_15     0.514  858.36 0.00130  -22.96
1053846 rs201963278      17_23     1.000  444.84 0.00130    3.44
72181      rs780093       2_16     1.000  420.75 0.00120  -21.28
466254    rs2980858       8_83     0.724  573.74 0.00120  -17.16
431043   rs13265179       8_12     0.998  389.88 0.00110   28.39
466255   rs13252684       8_83     1.000  374.46 0.00110   16.92
498402    rs2183745       9_50     1.000  363.42 0.00110  -21.03
589190   rs10790802      11_77     1.000  394.43 0.00110   25.30
629845    rs2393775      12_74     0.988  396.72 0.00110  -24.49
1032501   rs9302635      16_38     1.000  376.09 0.00110   17.64
466256    rs6987702       8_83     1.000  345.17 0.00100   15.28
431030     rs330096       8_12     1.000  337.58 0.00098   19.73
1051924      rs5409       17_6     1.000  327.14 0.00095    9.00
849556  rs145377039       1_15     0.183 1757.13 0.00094  -43.46
589181   rs10893498      11_77     1.000  317.88 0.00092  -18.84
849794    rs1313341       1_15     0.360  857.74 0.00090  -22.94
794091   rs10853742      19_30     1.000  300.90 0.00087  -18.79
1053805     rs16532      17_23     0.869  341.26 0.00086    6.07
796436     rs571689      19_33     0.229 1228.29 0.00082  -50.15
942064   rs11601507       11_4     1.000  282.00 0.00082   16.49
733568   rs17689455      16_44     0.845  329.63 0.00081   18.92
431940   rs10092177       8_14     1.000  265.14 0.00077  -12.10

SNPs with largest z scores

#SNPs with 50 largest z scores
head(ctwas_snp_res[order(-abs(ctwas_snp_res$z)),report_cols_snps],50)
                id region_tag susie_pip     mu2     PVE       z
508103 rs115478735       9_70     1.000 3945.43 1.1e-02 -108.55
508100    rs676457       9_70     0.161 4423.11 2.1e-03 -102.40
508102    rs674302       9_70     0.172 4423.27 2.2e-03 -102.40
508099    rs677355       9_70     0.499 4427.98 6.4e-03 -102.39
508098  rs34357864       9_70     0.800 4425.89 1.0e-02 -102.31
508101 rs782455289       9_70     0.003 4392.91 3.9e-05 -101.92
508107    rs495828       9_70     0.000 3326.20 2.0e-06  -99.78
849666 rs149344982       1_15     1.000 5614.82 1.6e-02  -75.15
508149   rs3758348       9_70     0.000 1464.33 9.2e-07  -69.56
508158  rs17474001       9_70     0.000 1370.99 8.2e-07  -67.32
849830 rs141957574       1_15     0.000 4396.98 0.0e+00  -66.61
508104    rs559723       9_70     0.000 1876.80 3.0e-07  -66.38
508088   rs2073828       9_70     0.001 1522.96 3.0e-06   62.33
849143   rs1976403       1_15     0.000 2350.43 0.0e+00   61.06
849119  rs10916988       1_15     0.000 2299.07 0.0e+00  -60.58
508097   rs7036642       9_70     0.000 1335.79 1.0e-06   59.55
849313   rs2800936       1_15     0.000 2308.24 0.0e+00  -57.18
849379  rs10799702       1_15     0.000 1992.25 0.0e+00   53.88
849771  rs72659192       1_15     1.000 1621.02 4.7e-03   52.94
849148   rs4654745       1_15     0.999 2671.16 7.7e-03  -51.71
849144   rs1566523       1_15     0.001 2658.03 1.0e-05  -51.61
849210   rs4654748       1_15     0.000 2613.30 0.0e+00  -51.25
796435    rs601338      19_33     1.000 1305.55 3.8e-03  -50.96
849788  rs72659199       1_15     0.000 4167.10 0.0e+00  -50.20
796436    rs571689      19_33     0.229 1228.29 8.2e-04  -50.15
796437   rs1688264      19_33     0.771 1224.91 2.7e-03  -50.10
849132  rs10916990       1_15     0.000 2364.33 0.0e+00  -49.95
849153  rs10916993       1_15     0.000 2474.81 0.0e+00  -49.90
849150  rs12047493       1_15     0.000 2478.12 0.0e+00  -49.86
849819 rs144999112       1_15     0.000 4150.18 0.0e+00  -49.86
849123  rs12734589       1_15     0.000 2471.11 0.0e+00  -49.80
849158   rs4654746       1_15     0.000 2357.25 0.0e+00  -49.76
849122  rs12759170       1_15     0.000 2459.05 0.0e+00  -49.71
849836  rs72660309       1_15     0.000 4091.98 0.0e+00  -49.53
849866 rs148785605       1_15     0.000 4082.65 0.0e+00  -49.46
849253   rs6687836       1_15     0.000 2494.60 0.0e+00  -49.42
849287   rs6426713       1_15     0.000 2494.06 0.0e+00  -49.42
849160  rs10799691       1_15     0.000 1657.36 0.0e+00  -49.40
849246   rs1827293       1_15     0.000 2487.25 0.0e+00  -49.36
849319 rs199855186       1_15     0.000 2510.90 0.0e+00  -49.32
849306   rs3820293       1_15     0.000 2487.18 0.0e+00  -49.28
849258   rs2004380       1_15     0.000 2484.45 0.0e+00  -49.26
849302   rs3820296       1_15     0.000 2484.56 0.0e+00  -49.26
849888  rs72660315       1_15     0.000 4011.25 0.0e+00  -49.04
849889 rs115051087       1_15     0.000 3996.42 0.0e+00  -48.95
849169 rs150401191       1_15     0.000 1590.79 0.0e+00   48.89
849155   rs3820597       1_15     0.000 2411.10 0.0e+00  -48.86
849305   rs3820294       1_15     0.000 2404.66 0.0e+00  -48.74
849307   rs3820292       1_15     0.000 2387.93 0.0e+00  -48.26
849312  rs56414407       1_15     0.000 2497.97 0.0e+00  -48.18

Gene set enrichment for genes with PIP>0.8

#GO enrichment analysis
library(enrichR)
Welcome to enrichR
Checking connection ... 
Enrichr ... Connection is Live!
FlyEnrichr ... Connection is available!
WormEnrichr ... Connection is available!
YeastEnrichr ... Connection is available!
FishEnrichr ... Connection is available!
dbs <- c("GO_Biological_Process_2021", "GO_Cellular_Component_2021", "GO_Molecular_Function_2021")
genes <- ctwas_gene_res$genename[ctwas_gene_res$susie_pip>0.8]

#number of genes for gene set enrichment
length(genes)
[1] 26
if (length(genes)>0){
  GO_enrichment <- enrichr(genes, dbs)

  for (db in dbs){
    print(db)
    df <- GO_enrichment[[db]]
    df <- df[df$Adjusted.P.value<0.05,c("Term", "Overlap", "Adjusted.P.value", "Genes")]
    print(df)
  }
  
  #DisGeNET enrichment
  
  # devtools::install_bitbucket("ibi_group/disgenet2r")
  library(disgenet2r)
  
  disgenet_api_key <- get_disgenet_api_key(
                    email = "wesleycrouse@gmail.com", 
                    password = "uchicago1" )
  
  Sys.setenv(DISGENET_API_KEY= disgenet_api_key)
  
  res_enrich <-disease_enrichment(entities=genes, vocabulary = "HGNC",
                               database = "CURATED" )
  
  df <- res_enrich@qresult[1:10, c("Description", "FDR", "Ratio",  "BgRatio")]
  print(df)
  
  #WebGestalt enrichment
  library(WebGestaltR)
  
  background <- ctwas_gene_res$genename
  
  #listGeneSet()
  databases <- c("pathway_KEGG", "disease_GLAD4U", "disease_OMIM")
  
  enrichResult <- WebGestaltR(enrichMethod="ORA", organism="hsapiens",
                              interestGene=genes, referenceGene=background,
                              enrichDatabase=databases, interestGeneType="genesymbol",
                              referenceGeneType="genesymbol", isOutput=F)
  print(enrichResult[,c("description", "size", "overlap", "FDR", "database", "userId")])
}
Uploading data to Enrichr... Done.
  Querying GO_Biological_Process_2021... Done.
  Querying GO_Cellular_Component_2021... Done.
  Querying GO_Molecular_Function_2021... Done.
Parsing results... Done.
[1] "GO_Biological_Process_2021"
[1] Term             Overlap          Adjusted.P.value Genes           
<0 rows> (or 0-length row.names)
[1] "GO_Cellular_Component_2021"
                                     Term Overlap Adjusted.P.value
1 azurophil granule membrane (GO:0035577)    2/58        0.0472403
2              lytic vacuole (GO:0000323)   3/219        0.0472403
3                   lysosome (GO:0005764)   4/477        0.0472403
                    Genes
1           LAMP1;DNAJC13
2         LAMP1;CTSW;LIPA
3 LAMP1;CTSW;DNAJC13;LIPA
[1] "GO_Molecular_Function_2021"
                                            Term Overlap Adjusted.P.value
1 transcription corepressor binding (GO:0001222)    2/29       0.04584271
        Genes
1 NEK6;ZBTB7A
LAMP1 gene(s) from the input list not found in DisGeNET CURATEDCTSW gene(s) from the input list not found in DisGeNET CURATEDICA1L gene(s) from the input list not found in DisGeNET CURATEDZDHHC18 gene(s) from the input list not found in DisGeNET CURATEDMPV17L2 gene(s) from the input list not found in DisGeNET CURATEDPCIF1 gene(s) from the input list not found in DisGeNET CURATEDNYNRIN gene(s) from the input list not found in DisGeNET CURATEDCNIH4 gene(s) from the input list not found in DisGeNET CURATEDGPRC5C gene(s) from the input list not found in DisGeNET CURATED
                                                           Description
7                                    Cholesterol Ester Storage Disease
37                                                      Wolman Disease
61                                     Secondary Adrenal Insufficiency
74                                          Caudal Duplication Anomaly
76                                               Catel Manzke syndrome
77              Jejunal Atresia with Microcephaly and Ocular Anomalies
81 Osteolysis, Hereditary, Of Carpal Bones With Or Without Nephropathy
84                 Acid cholesteryl ester hydrolase deficiency, type 2
89                               IMMUNODEFICIENCY, COMMON VARIABLE, 10
92                DUANE RETRACTION SYNDROME 3 WITH OR WITHOUT DEAFNESS
          FDR Ratio BgRatio
7  0.01664605  1/17  1/9703
37 0.01664605  1/17  1/9703
61 0.01664605  1/17  1/9703
74 0.01664605  1/17  1/9703
76 0.01664605  1/17  1/9703
77 0.01664605  1/17  1/9703
81 0.01664605  1/17  1/9703
84 0.01664605  1/17  1/9703
89 0.01664605  1/17  1/9703
92 0.01664605  1/17  1/9703
******************************************

*                                        *

*          Welcome to WebGestaltR !      *

*                                        *

******************************************
Loading the functional categories...
Loading the ID list...
Loading the reference list...
Performing the enrichment analysis...
Warning in oraEnrichment(interestGeneList, referenceGeneList, geneSet,
minNum = minNum, : No significant gene set is identified based on FDR 0.05!
NULL

sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Scientific Linux 7.4 (Nitrogen)

Matrix products: default
BLAS/LAPACK: /software/openblas-0.2.19-el7-x86_64/lib/libopenblas_haswellp-r0.2.19.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] WebGestaltR_0.4.4 disgenet2r_0.99.2 enrichR_3.0       cowplot_1.0.0    
[5] ggplot2_3.3.3    

loaded via a namespace (and not attached):
  [1] bitops_1.0-6                matrixStats_0.57.0         
  [3] fs_1.3.1                    bit64_4.0.5                
  [5] doParallel_1.0.16           progress_1.2.2             
  [7] httr_1.4.1                  rprojroot_2.0.2            
  [9] GenomeInfoDb_1.20.0         doRNG_1.8.2                
 [11] tools_3.6.1                 utf8_1.2.1                 
 [13] R6_2.5.0                    DBI_1.1.1                  
 [15] BiocGenerics_0.30.0         colorspace_1.4-1           
 [17] withr_2.4.1                 tidyselect_1.1.0           
 [19] prettyunits_1.0.2           bit_4.0.4                  
 [21] curl_3.3                    compiler_3.6.1             
 [23] git2r_0.26.1                Biobase_2.44.0             
 [25] DelayedArray_0.10.0         rtracklayer_1.44.0         
 [27] labeling_0.3                scales_1.1.0               
 [29] readr_1.4.0                 apcluster_1.4.8            
 [31] stringr_1.4.0               digest_0.6.20              
 [33] Rsamtools_2.0.0             svglite_1.2.2              
 [35] rmarkdown_1.13              XVector_0.24.0             
 [37] pkgconfig_2.0.3             htmltools_0.3.6            
 [39] fastmap_1.1.0               BSgenome_1.52.0            
 [41] rlang_0.4.11                RSQLite_2.2.7              
 [43] generics_0.0.2              farver_2.1.0               
 [45] jsonlite_1.6                BiocParallel_1.18.0        
 [47] dplyr_1.0.7                 VariantAnnotation_1.30.1   
 [49] RCurl_1.98-1.1              magrittr_2.0.1             
 [51] GenomeInfoDbData_1.2.1      Matrix_1.2-18              
 [53] Rcpp_1.0.6                  munsell_0.5.0              
 [55] S4Vectors_0.22.1            fansi_0.5.0                
 [57] gdtools_0.1.9               lifecycle_1.0.0            
 [59] stringi_1.4.3               whisker_0.3-2              
 [61] yaml_2.2.0                  SummarizedExperiment_1.14.1
 [63] zlibbioc_1.30.0             plyr_1.8.4                 
 [65] grid_3.6.1                  blob_1.2.1                 
 [67] parallel_3.6.1              promises_1.0.1             
 [69] crayon_1.4.1                lattice_0.20-38            
 [71] Biostrings_2.52.0           GenomicFeatures_1.36.3     
 [73] hms_1.1.0                   knitr_1.23                 
 [75] pillar_1.6.1                igraph_1.2.4.1             
 [77] GenomicRanges_1.36.0        rjson_0.2.20               
 [79] rngtools_1.5                codetools_0.2-16           
 [81] reshape2_1.4.3              biomaRt_2.40.1             
 [83] stats4_3.6.1                XML_3.98-1.20              
 [85] glue_1.4.2                  evaluate_0.14              
 [87] data.table_1.14.0           foreach_1.5.1              
 [89] vctrs_0.3.8                 httpuv_1.5.1               
 [91] gtable_0.3.0                purrr_0.3.4                
 [93] assertthat_0.2.1            cachem_1.0.5               
 [95] xfun_0.8                    later_0.8.0                
 [97] tibble_3.1.2                iterators_1.0.13           
 [99] GenomicAlignments_1.20.1    AnnotationDbi_1.46.0       
[101] memoise_2.0.0               IRanges_2.18.1             
[103] workflowr_1.6.2             ellipsis_0.3.2