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-30620_irnt_Whole_Blood.Rmd
    Modified:   analysis/ukb-d-30630_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30630_irnt_Whole_Blood.Rmd
    Modified:   analysis/ukb-d-30640_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30640_irnt_Whole_Blood.Rmd
    Modified:   analysis/ukb-d-30650_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30650_irnt_Whole_Blood.Rmd
    Modified:   analysis/ukb-d-30660_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30660_irnt_Whole_Blood.Rmd
    Modified:   analysis/ukb-d-30670_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30670_irnt_Whole_Blood.Rmd
    Modified:   analysis/ukb-d-30680_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30690_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30690_irnt_Whole_Blood.Rmd
    Modified:   analysis/ukb-d-30700_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30700_irnt_Whole_Blood.Rmd
    Modified:   analysis/ukb-d-30710_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30710_irnt_Whole_Blood.Rmd
    Modified:   analysis/ukb-d-30720_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30720_irnt_Whole_Blood.Rmd
    Modified:   analysis/ukb-d-30730_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30740_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30740_irnt_Whole_Blood.Rmd
    Modified:   analysis/ukb-d-30750_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30750_irnt_Whole_Blood.Rmd
    Modified:   analysis/ukb-d-30760_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30760_irnt_Whole_Blood.Rmd
    Modified:   analysis/ukb-d-30770_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30770_irnt_Whole_Blood.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-30770_irnt_Whole_Blood.Rmd) and HTML (docs/ukb-d-30770_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 IGF-1 (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-30770_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.010966355 0.000211134 
#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 
39.44803 25.06010 
#report sample size
print(sample_size)
[1] 342439
#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.01401625 0.13438277 
#compare sum(PIP*mu2/sample_size) with above PVE calculation
c(sum(ctwas_gene_res$PVE),sum(ctwas_snp_res$PVE))
[1] 0.2333435 2.3431922

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
10765  ZDHHC18       1_18     1.000   188.41 5.5e-04 -14.65
7372    RNF123       3_35     1.000 71676.96 2.1e-01   4.33
3804     OPRL1      20_38     0.989   127.46 3.7e-04 -10.80
8739    STAT5B      17_25     0.981    25.79 7.4e-05   3.88
4732     NHSL1       6_92     0.978    28.21 8.1e-05   4.95
8641     OXSR1       3_27     0.975    27.42 7.8e-05  -4.94
9181     BEND3       6_71     0.946    32.41 9.0e-05  -5.38
2565    GTF2H1      11_13     0.938    66.55 1.8e-04  -8.64
2252    TGFBR1       9_50     0.935    32.61 8.9e-05   5.79
2002       AES       19_4     0.914    25.85 6.9e-05   4.73
8201      NPR1       1_75     0.901    23.01 6.1e-05  -5.13
5012    TRIM29      11_72     0.899    26.27 6.9e-05   5.34
2919    ZBTB47       3_31     0.893    41.44 1.1e-04  -6.08
1533    TTLL12      22_18     0.884    21.15 5.5e-05   3.90
2073   SULT2A1      19_33     0.851    57.20 1.4e-04  -7.73
8036      VASN       16_4     0.849    35.33 8.8e-05   6.06
7786  CATSPER2      15_16     0.848   359.54 8.9e-04 -19.25
9247     FUCA1       1_17     0.839    26.92 6.6e-05   4.86
361       CUL3      2_132     0.831    40.49 9.8e-05   6.44
8177     THBS3       1_77     0.825    26.84 6.5e-05  -4.92
2936    ACTR1B       2_57     0.821    21.78 5.2e-05  -4.13

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
7372    RNF123       3_35         1 71676.96 0.21  4.33
38        RBM6       3_35         0 42297.95 0.00 -3.66
7375     MON1A       3_35         0 42297.54 0.00 -3.67
9642     TRAIP       3_35         0 34485.00 0.00 -5.51
7376     MST1R       3_35         0 27983.98 0.00 -2.07
8603     ZMAT3      3_110         0 19345.62 0.00  1.29
8697      DAG1       3_35         0 16230.39 0.00 -4.25
11405     GPX1       3_35         0 14734.77 0.00  1.16
417       MAP4       3_34         0 12860.13 0.00  4.52
8713     GMPPB       3_35         0 10916.60 0.00 -2.13
8416    KCNMB3      3_110         0  8750.25 0.00 -3.68
168      SPRTN      1_118         0  5752.13 0.00 -2.05
11610     NAT6       3_35         0  5590.77 0.00 -2.46
9957     HYAL3       3_35         0  5336.78 0.00  2.54
7371      APEH       3_35         0  4543.54 0.00 -3.11
7365    ZNF589       3_34         0  4421.46 0.00 -3.40
881     ZNF37A      10_28         0  4162.37 0.00  1.49
3138     EXOC8      1_118         0  4153.00 0.00 -2.95
9608     PSMG1      21_19         0  3991.36 0.00 -7.05
123   CACNA2D2       3_35         0  3964.63 0.00  3.58

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
7372         RNF123       3_35     1.000 71676.96 2.1e-01   4.33
7786       CATSPER2      15_16     0.848   359.54 8.9e-04 -19.25
10765       ZDHHC18       1_18     1.000   188.41 5.5e-04 -14.65
3804          OPRL1      20_38     0.989   127.46 3.7e-04 -10.80
9322             F2      11_28     0.743   111.26 2.4e-04 -10.26
4564          PSRC1       1_67     0.643   124.18 2.3e-04  10.44
6089          FADS1      11_34     0.745    87.84 1.9e-04  -8.53
2565         GTF2H1      11_13     0.938    66.55 1.8e-04  -8.64
5092          EXOC6      10_59     0.686    67.78 1.4e-04   7.43
2073        SULT2A1      19_33     0.851    57.20 1.4e-04  -7.73
6366           CMIP      16_46     0.733    59.08 1.3e-04  -8.28
12004 RP11-196G11.2      16_24     0.225   162.03 1.1e-04 -13.12
6766           CBR1      21_16     0.311   119.67 1.1e-04  -8.61
2919         ZBTB47       3_31     0.893    41.44 1.1e-04  -6.08
10021       ZKSCAN4       6_22     0.331   104.65 1.0e-04  -9.17
5464           PNMT      17_23     0.769    44.10 9.9e-05  -7.23
361            CUL3      2_132     0.831    40.49 9.8e-05   6.44
7130         PM20D1      1_104     0.787    41.60 9.6e-05   6.86
5299          BAHD1      15_14     0.659    48.43 9.3e-05   6.52
8875         CTDSP2      12_36     0.724    43.19 9.1e-05  -3.68

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
10733         CENPW       6_84     0.012 720.28 2.5e-05 -26.87
7786       CATSPER2      15_16     0.848 359.54 8.9e-04 -19.25
3448         WASHC3      12_61     0.000 327.28 3.9e-14 -16.33
7782          CASC4      15_17     0.023 252.81 1.7e-05  16.16
10765       ZDHHC18       1_18     1.000 188.41 5.5e-04 -14.65
2737         TRIM38       6_20     0.000  96.19 8.3e-08  14.49
6765          RUNX1      21_16     0.011 115.78 3.7e-06  14.24
2072           TYK2       19_9     0.000 132.65 2.7e-15 -14.09
5692          ASXL2       2_15     0.002 190.15 1.0e-06  13.95
6235          FBXO4       5_28     0.000 158.28 1.8e-10  13.27
12004 RP11-196G11.2      16_24     0.225 162.03 1.1e-04 -13.12
6064          PTPRJ      11_29     0.002  82.93 5.0e-07  12.76
7653       SLC39A13      11_29     0.003 101.48 1.0e-06 -12.75
1418         IGFALS       16_2     0.000 137.95 1.5e-08  12.31
2068          ICAM5       19_9     0.000 109.96 1.6e-12 -12.28
10508          ADH5       4_66     0.015 140.45 6.1e-06 -12.26
10486          EME2       16_2     0.000 131.73 1.4e-08 -12.26
913           ICAM3       19_9     0.008 271.94 6.4e-06  11.98
4610           ACP2      11_29     0.008  67.55 1.6e-06 -11.88
2953          NRBP1       2_16     0.010 224.18 6.5e-06 -11.84

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.04118973
#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
10733         CENPW       6_84     0.012 720.28 2.5e-05 -26.87
7786       CATSPER2      15_16     0.848 359.54 8.9e-04 -19.25
3448         WASHC3      12_61     0.000 327.28 3.9e-14 -16.33
7782          CASC4      15_17     0.023 252.81 1.7e-05  16.16
10765       ZDHHC18       1_18     1.000 188.41 5.5e-04 -14.65
2737         TRIM38       6_20     0.000  96.19 8.3e-08  14.49
6765          RUNX1      21_16     0.011 115.78 3.7e-06  14.24
2072           TYK2       19_9     0.000 132.65 2.7e-15 -14.09
5692          ASXL2       2_15     0.002 190.15 1.0e-06  13.95
6235          FBXO4       5_28     0.000 158.28 1.8e-10  13.27
12004 RP11-196G11.2      16_24     0.225 162.03 1.1e-04 -13.12
6064          PTPRJ      11_29     0.002  82.93 5.0e-07  12.76
7653       SLC39A13      11_29     0.003 101.48 1.0e-06 -12.75
1418         IGFALS       16_2     0.000 137.95 1.5e-08  12.31
2068          ICAM5       19_9     0.000 109.96 1.6e-12 -12.28
10508          ADH5       4_66     0.015 140.45 6.1e-06 -12.26
10486          EME2       16_2     0.000 131.73 1.4e-08 -12.26
913           ICAM3       19_9     0.008 271.94 6.4e-06  11.98
4610           ACP2      11_29     0.008  67.55 1.6e-06 -11.88
2953          NRBP1       2_16     0.010 224.18 6.5e-06 -11.84

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: 6_84"
      genename region_tag susie_pip    mu2     PVE      z
2687     HDDC2       6_84     0.009   4.99 1.3e-07  -0.46
2689     NCOA7       6_84     0.011  12.26 4.0e-07  -2.71
2688     HINT3       6_84     0.020  11.85 7.0e-07  -0.67
10733    CENPW       6_84     0.012 720.28 2.5e-05 -26.87

Version Author Date
dfd2b5f wesleycrouse 2021-09-07
[1] "Region: 15_16"
     genename region_tag susie_pip    mu2     PVE      z
1325   SNAP23      15_16     0.015  14.10 6.2e-07   1.82
9382   LRRC57      15_16     0.015  13.88 5.9e-07   1.92
5030    HAUS2      15_16     0.007  13.17 2.6e-07  -3.01
6785   STARD9      15_16     0.062  29.65 5.4e-06   2.87
5300    CDAN1      15_16     0.010   8.35 2.5e-07   0.73
4064    TTBK2      15_16     0.103  39.58 1.2e-05  -5.26
7829  CCNDBP1      15_16     0.088  37.34 9.6e-06   5.50
1905     TGM5      15_16     0.019  23.02 1.3e-06  -1.44
8115     ADAL      15_16     0.007  61.95 1.2e-06   7.05
8116    LCMT2      15_16     0.007  61.95 1.2e-06   7.05
5034  TUBGCP4      15_16     0.011   9.66 3.0e-07  -1.65
5295  ZSCAN29      15_16     0.239  33.40 2.3e-05  -1.48
7831    MAP1A      15_16     0.037  27.36 2.9e-06  -1.18
7786 CATSPER2      15_16     0.848 359.54 8.9e-04 -19.25
7839    PDIA3      15_16     0.036  18.10 1.9e-06  -1.20
4065     ELL3      15_16     0.040  26.20 3.1e-06  -4.24
5294    SERF2      15_16     0.040  26.20 3.1e-06  -4.24
5291    MFAP1      15_16     0.008  74.88 1.8e-06  -7.79
1323    WDR76      15_16     0.181  34.23 1.8e-05  -3.08

Version Author Date
dfd2b5f wesleycrouse 2021-09-07
[1] "Region: 12_61"
      genename region_tag susie_pip    mu2     PVE      z
10207   MYBPC1      12_61     0.000   7.67 6.9e-17  -1.30
2647     CHPT1      12_61     0.000   6.96 5.5e-17  -1.01
2648    GNPTAB      12_61     0.000   6.53 5.2e-17  -1.30
4801     DRAM1      12_61     0.000   7.74 6.4e-17   1.51
3448    WASHC3      12_61     0.000 327.28 3.9e-14 -16.33
870      NUP37      12_61     0.001 217.41 9.1e-07  11.14
9811    PARPBP      12_61     0.000  67.37 1.2e-11   7.21

Version Author Date
dfd2b5f wesleycrouse 2021-09-07
[1] "Region: 15_17"
           genename region_tag susie_pip    mu2     PVE     z
7782          CASC4      15_17     0.023 252.81 1.7e-05 16.16
11335         PATL2      15_17     0.103  23.52 7.1e-06  1.83
7780            B2M      15_17     0.019   9.72 5.4e-07 -0.87
9861         TRIM69      15_17     0.019  10.77 5.8e-07 -1.46
5293           SORD      15_17     0.070  23.47 4.8e-06 -2.27
5042          DUOX1      15_17     0.011   5.04 1.6e-07 -0.17
8498           GATM      15_17     0.011   5.34 1.8e-07 -0.48
8497       SPATA5L1      15_17     0.013   7.00 2.7e-07  1.07
12481  RP11-96O20.5      15_17     0.016   8.50 3.9e-07  0.94
5023          SQRDL      15_17     0.011   5.25 1.7e-07 -0.03
12408 CTD-2306A12.1      15_17     0.011   5.01 1.6e-07  0.40

Version Author Date
dfd2b5f wesleycrouse 2021-09-07
[1] "Region: 1_18"
          genename region_tag susie_pip    mu2     PVE      z
3213          SYF2       1_18     0.007   6.09 1.2e-07   0.42
3214         RSRP1       1_18     0.028  20.27 1.7e-06   2.34
9637       TMEM50A       1_18     0.028  20.27 1.7e-06   2.34
9978           RHD       1_18     0.028  20.27 1.7e-06   2.34
10768       TMEM57       1_18     0.016  14.65 6.7e-07  -1.64
10121         RHCE       1_18     0.010  11.57 3.4e-07  -2.15
11243 RP11-70P17.1       1_18     0.007   6.78 1.4e-07  -1.00
3217        MAN1C1       1_18     0.007   6.21 1.2e-07   0.66
7057       SELENON       1_18     0.029  28.71 2.4e-06  -4.03
6659        PAFAH2       1_18     0.006  13.42 2.4e-07  -3.86
6661        TRIM63       1_18     0.021  68.15 4.2e-06  -9.57
8858        PDIK1L       1_18     0.401  75.65 8.9e-05  -9.99
10401      FAM110D       1_18     0.006  10.09 1.8e-07  -2.00
5531        CNKSR1       1_18     0.006   9.87 1.7e-07   1.69
4215         CEP85       1_18     0.006   6.81 1.3e-07  -1.92
6665        UBXN11       1_18     0.009   8.45 2.3e-07   0.39
8205          CD52       1_18     0.010   7.96 2.3e-07   2.18
8964         AIM1L       1_18     0.006   9.49 1.7e-07  -1.23
3219         DHDDS       1_18     0.365  29.71 3.2e-05  -7.49
10674        HMGN2       1_18     0.010   8.17 2.4e-07  -0.41
3222        ARID1A       1_18     0.016  12.48 5.7e-07  -0.73
546           PIGV       1_18     0.006  81.05 1.5e-06   9.82
10765      ZDHHC18       1_18     1.000 188.41 5.5e-04 -14.65
5539          GPN2       1_18     0.324  57.93 5.5e-05   6.54
1254          NUDC       1_18     0.023  36.66 2.4e-06   5.45

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
25176      rs164877       1_55     1.000   310.93 9.1e-04  14.93
35085    rs77369503       1_80     1.000    44.18 1.3e-04  -6.59
50792     rs7548045      1_108     1.000    55.79 1.6e-04  -4.14
55217      rs287613      1_116     1.000   472.02 1.4e-03   3.46
55223    rs71180790      1_116     1.000   468.09 1.4e-03   2.98
56183   rs766167074      1_118     1.000  5959.98 1.7e-02   2.75
57456      rs822928      1_122     1.000    52.27 1.5e-04   7.74
71862      rs780093       2_16     1.000   450.72 1.3e-03  24.69
71863     rs6744393       2_16     1.000   128.18 3.7e-04  16.13
86558    rs35641591       2_46     1.000    57.82 1.7e-04  -7.78
146614    rs9854123       3_24     1.000    40.76 1.2e-04   6.29
160874   rs56320121       3_58     1.000   792.88 2.3e-03  -3.10
160890  rs768688512       3_58     1.000   982.88 2.9e-03  -3.54
186021     rs519352      3_105     1.000    84.77 2.5e-04  12.46
186039    rs6445061      3_105     1.000   154.90 4.5e-04 -14.75
188281  rs146797780      3_110     1.000 95146.91 2.8e-01  -5.92
188282    rs7636471      3_110     1.000 95048.89 2.8e-01  -5.66
190098    rs6778003      3_114     1.000    43.22 1.3e-04  -6.08
190131    rs6773553      3_114     1.000    35.51 1.0e-04   4.88
195583  rs114524202        4_4     1.000    37.77 1.1e-04  -6.94
209237   rs12639940       4_32     1.000    83.09 2.4e-04   7.30
209326   rs58932203       4_32     1.000   138.08 4.0e-04 -10.74
211287  rs116419948       4_35     1.000    75.81 2.2e-04   5.68
218275    rs7696472       4_48     1.000   113.22 3.3e-04 -10.48
273263   rs55681913       5_28     1.000   246.47 7.2e-04  15.62
300038     rs329123       5_80     1.000    56.37 1.6e-04   7.99
323857    rs1980449       6_19     1.000    57.71 1.7e-04   8.94
324498    rs6908155       6_21     1.000    38.27 1.1e-04   1.41
350315     rs657536       6_67     1.000    43.24 1.3e-04  -6.95
352546    rs3800231       6_73     1.000   316.00 9.2e-04  18.75
367335   rs12208357      6_103     1.000   144.49 4.2e-04   9.39
367438   rs60425481      6_104     1.000   299.85 8.8e-04 -13.20
369536    rs2323036      6_108     1.000   164.32 4.8e-04  14.90
383999   rs11761979       7_24     1.000    53.00 1.5e-04  -7.18
388934  rs185529878       7_33     1.000    83.25 2.4e-04   7.39
388963    rs1542820       7_34     1.000   227.90 6.7e-04 -17.00
389188    rs2107787       7_34     1.000   238.94 7.0e-04  17.50
389284     rs700752       7_34     1.000  2231.42 6.5e-03  47.41
389382   rs79306382       7_35     1.000    37.20 1.1e-04  -6.34
412812     rs125124       7_80     1.000   474.82 1.4e-03  22.58
421124   rs78609178       7_98     1.000    35.62 1.0e-04  -4.52
432040    rs1495743       8_20     1.000    79.37 2.3e-04  -9.05
443709    rs4738679       8_45     1.000    84.20 2.5e-04  -9.59
472292   rs79531507        9_5     1.000    42.08 1.2e-04  -6.61
472312   rs12552790        9_5     1.000    67.64 2.0e-04  -8.04
472356   rs41303235        9_6     1.000   107.69 3.1e-04   9.73
520025   rs71007692      10_28     1.000  9761.30 2.9e-02   2.95
537043   rs35443777      10_60     1.000    62.75 1.8e-04  -6.24
538918   rs10883563      10_64     1.000   115.24 3.4e-04  10.79
550767   rs11042594       11_2     1.000   399.71 1.2e-03  17.70
550776    rs7481173       11_2     1.000   176.39 5.2e-04  -0.73
550777   rs17885785       11_2     1.000   361.01 1.1e-03  24.68
550778    rs2239681       11_2     1.000   233.48 6.8e-04 -25.38
550779    rs3842762       11_2     1.000   329.70 9.6e-04 -19.28
593936    rs2856322      12_11     1.000   103.37 3.0e-04 -10.04
600924    rs7302975      12_21     1.000   139.46 4.1e-04  12.91
600947    rs7967974      12_22     1.000    46.18 1.3e-04  -8.27
627326   rs80019595      12_74     1.000   302.01 8.8e-04  19.61
627540  rs140184587      12_75     1.000    48.40 1.4e-04   6.47
644315    rs7999449      13_25     1.000 38777.65 1.1e-01  -4.29
644317  rs775834524      13_25     1.000 38857.03 1.1e-01  -4.23
665704    rs2332328       14_3     1.000    49.93 1.5e-04  -6.82
681515   rs13379043      14_34     1.000    75.28 2.2e-04  -8.81
689670   rs12147987      14_52     1.000    66.01 1.9e-04  -4.57
689678   rs12885370      14_52     1.000    69.38 2.0e-04  -4.81
703358    rs4474658      15_28     1.000    67.03 2.0e-04 -11.20
706571     rs876383      15_35     1.000    59.08 1.7e-04   8.12
714429   rs72767924      15_47     1.000    74.13 2.2e-04   5.08
714431    rs9672558      15_47     1.000    79.51 2.3e-04   5.56
714512    rs3743250      15_48     1.000    55.60 1.6e-04  -6.91
716110  rs117544769       16_1     1.000    86.28 2.5e-04 -10.97
716121   rs11248852       16_1     1.000   142.59 4.2e-04 -16.99
716129    rs2076421       16_1     1.000   119.96 3.5e-04  15.41
716421   rs28469124       16_2     1.000   322.97 9.4e-04  19.72
716423    rs9923699       16_2     1.000   320.40 9.4e-04  19.60
736940    rs9931108      16_46     1.000   103.62 3.0e-04   5.65
738348    rs2255451      16_49     1.000    82.44 2.4e-04  -9.42
757332    rs1801689      17_38     1.000   130.48 3.8e-04  11.78
780295   rs77728352      18_32     1.000    41.56 1.2e-04  -6.23
786833   rs77169818      18_46     1.000    77.72 2.3e-04  -8.89
796733   rs73924758      19_22     1.000    46.33 1.4e-04  -5.31
800314     rs814573      19_31     1.000    36.09 1.1e-04   5.88
808117  rs200167482       20_8     1.000    35.29 1.0e-04  -5.77
811528    rs6112780      20_14     1.000    77.99 2.3e-04 -10.08
811604   rs10470054      20_14     1.000    55.99 1.6e-04   8.31
821540   rs79723704      20_34     1.000    42.04 1.2e-04  -6.38
823321    rs6122476      20_37     1.000    35.35 1.0e-04  -5.50
895735    rs4973409      2_136     1.000  1787.93 5.2e-03  -3.46
895736  rs142215640      2_136     1.000  1788.17 5.2e-03  -3.60
910825    rs2307874       3_34     1.000 13619.92 4.0e-02  -4.40
910925   rs56123512       3_34     1.000 13645.97 4.0e-02  -4.16
913570  rs142955295       3_35     1.000 69798.02 2.0e-01   4.29
918774    rs7728690       5_52     1.000 37346.18 1.1e-01  -9.41
918776  rs150854935       5_52     1.000 37784.37 1.1e-01  -9.28
999722  rs773484935      14_36     1.000  5386.07 1.6e-02  -3.04
1028517      rs5388      17_37     1.000   434.58 1.3e-03  22.63
1028943  rs76708468      17_37     1.000    91.88 2.7e-04  13.72
1054836 rs142998071      19_33     1.000    44.04 1.3e-04   6.85
1071298  rs34079499      21_19     1.000 13144.50 3.8e-02  -6.20
1071456  rs55740356      21_19     1.000 11564.95 3.4e-02  -6.65
7369      rs1042114       1_19     0.999    54.68 1.6e-04  -7.84
18208    rs11209239       1_43     0.999    34.85 1.0e-04   5.63
95987     rs3789066       2_66     0.999    35.08 1.0e-04   5.93
218220  rs146674238       4_48     0.999    38.71 1.1e-04  -7.67
275566  rs113088001       5_31     0.999    47.99 1.4e-04   7.38
300176   rs11242237       5_80     0.999    88.90 2.6e-04  -8.00
302190     rs853161       5_84     0.999    45.24 1.3e-04  -6.61
312047    rs2340010      5_104     0.999    33.66 9.8e-05   5.60
372227    rs4719415        7_4     0.999    60.69 1.8e-04   7.92
466154   rs12674961       8_88     0.999    50.89 1.5e-04  -8.89
529532   rs10823504      10_46     0.999    34.14 1.0e-04   5.62
621561     rs882409      12_61     0.999   120.90 3.5e-04  16.43
624322   rs75622376      12_67     0.999    61.61 1.8e-04   7.66
755117   rs11079157      17_32     0.999    40.45 1.2e-04   6.51
800957   rs55975925      19_34     0.999    39.43 1.2e-04  -6.16
1043806  rs12720356       19_9     0.999   147.12 4.3e-04 -14.75
60758   rs150491879      1_129     0.998    34.12 9.9e-05   5.60
175363   rs12489068       3_85     0.998    92.49 2.7e-04 -10.65
326379    rs2524082       6_26     0.998    50.24 1.5e-04  -6.71
371859   rs13226659        7_3     0.998    71.45 2.1e-04   8.62
377950   rs34124255       7_15     0.998    38.24 1.1e-04  -4.46
388955    rs9658238       7_33     0.998    66.32 1.9e-04   9.39
389415    rs7791050       7_35     0.998    36.94 1.1e-04  -6.88
511496   rs60100723      10_12     0.998    38.55 1.1e-04   6.26
564832   rs12797220      11_30     0.998    41.81 1.2e-04   4.67
621493  rs186877434      12_61     0.998    69.84 2.0e-04 -11.39
621618    rs1580715      12_62     0.998   113.80 3.3e-04  -9.65
844249    rs5765672      22_20     0.998    31.94 9.3e-05  -5.23
50840     rs1223802      1_108     0.997    55.90 1.6e-04  -6.76
53047     rs2642420      1_112     0.997    51.21 1.5e-04   9.83
364697    rs9479504      6_100     0.997    78.42 2.3e-04   9.02
1043788  rs34536443       19_9     0.997    95.90 2.8e-04  -8.42
186038   rs28507699      3_105     0.996   150.88 4.4e-04 -10.47
324107    rs9467715       6_20     0.996    46.36 1.3e-04  -2.60
420881    rs7810268       7_98     0.996    36.17 1.1e-04   5.54
800666    rs7249509      19_32     0.996    29.26 8.5e-05  -4.98
842249     rs138703      22_16     0.996   129.16 3.8e-04 -11.01
377953    rs6954572       7_15     0.995    76.63 2.2e-04  -7.97
559007   rs56133711      11_19     0.995    38.84 1.1e-04  -6.15
73491    rs72787520       2_20     0.994    37.76 1.1e-04  -5.31
302256    rs6894302       5_84     0.994    40.90 1.2e-04   5.82
310226    rs2974438      5_100     0.994   260.49 7.6e-04 -17.69
350380    rs7763983       6_67     0.994    33.36 9.7e-05   6.37
374318  rs186587982        7_9     0.994   148.00 4.3e-04 -13.53
762487   rs36000545      17_46     0.994    33.73 9.8e-05  -5.70
39344    rs10913276       1_86     0.993   118.99 3.5e-04  16.90
65142    rs13018091        2_4     0.993    42.94 1.2e-04  -6.64
149522    rs1605068       3_36     0.993    29.73 8.6e-05   5.00
367348    rs1443844      6_103     0.993   116.50 3.4e-04  -6.29
537044    rs3740365      10_60     0.993    56.69 1.6e-04  -5.74
472351    rs7032169        9_6     0.992    36.36 1.1e-04   3.67
529147    rs2305196      10_46     0.992    38.60 1.1e-04  -5.79
656015   rs57684439      13_45     0.992    30.41 8.8e-05   4.33
726971   rs17616063      16_27     0.992    29.75 8.6e-05  -5.05
83936     rs1621048       2_40     0.991    33.64 9.7e-05  -4.94
310234    rs6885027      5_100     0.991    45.52 1.3e-04   8.79
606318  rs117564283      12_33     0.991    33.49 9.7e-05   5.83
621768    rs4764939      12_62     0.991    40.44 1.2e-04   6.25
139356  rs139232179        3_9     0.990    36.51 1.1e-04   5.90
435131   rs11780047       8_26     0.990    35.94 1.0e-04  -5.84
367340    rs4646275      6_103     0.988    38.49 1.1e-04  -5.21
600851  rs113987763      12_21     0.987   158.28 4.6e-04  10.27
705028  rs143717852      15_31     0.987    82.73 2.4e-04  -8.48
811490    rs6136911      20_14     0.987    56.53 1.6e-04  -9.34
71492    rs62127724       2_15     0.985   286.94 8.2e-04  17.32
139977    rs2227998       3_10     0.985    43.54 1.3e-04   6.10
218222   rs34168560       4_48     0.985   122.15 3.5e-04 -13.59
974568   rs10838681      11_29     0.985    84.96 2.4e-04  12.59
559644     rs521371      11_21     0.982    31.86 9.1e-05  -3.50
567901    rs1203614      11_37     0.982    27.34 7.8e-05   4.20
529244   rs11597602      10_46     0.981    31.34 9.0e-05  -4.85
250062   rs17540470      4_109     0.979    33.75 9.7e-05   5.79
536835   rs12355020      10_59     0.979    30.74 8.8e-05  -6.10
409      rs10910028        1_2     0.978    37.79 1.1e-04   5.73
300148   rs35914524       5_80     0.977    32.91 9.4e-05   4.56
367277  rs554987322      6_103     0.977    35.38 1.0e-04   6.28
796732    rs7249790      19_22     0.976    30.68 8.7e-05  -2.65
358125  rs142620810       6_85     0.975    28.70 8.2e-05   5.13
737014  rs112290554      16_46     0.975    68.73 2.0e-04  -9.40
282413   rs77561962       5_45     0.974    33.12 9.4e-05   5.78
621632    rs1874872      12_62     0.974    46.98 1.3e-04  -1.20
415003   rs12155147       7_84     0.973    30.54 8.7e-05   5.40
811607    rs3827963      20_14     0.973    34.53 9.8e-05  -6.07
50797     rs3754140      1_108     0.972    66.31 1.9e-04   6.87
542475   rs12244851      10_70     0.972    33.53 9.5e-05   5.60
741558  rs558760274       17_1     0.972    25.51 7.2e-05   4.74
163623    rs4928057       3_64     0.970    32.05 9.1e-05  -7.36
430739   rs75886735       8_17     0.970    27.79 7.9e-05   4.94
910828   rs55721964       3_34     0.970 13639.42 3.9e-02  -4.25
714515   rs58060839      15_48     0.968    37.32 1.1e-04  -5.24
786959   rs62104512      18_46     0.967    48.55 1.4e-04  -6.88
450410     rs445036       8_57     0.966    56.41 1.6e-04  -7.48
468860   rs13253652       8_92     0.966    28.04 7.9e-05   2.53
576681   rs12795994      11_53     0.966    26.60 7.5e-05  -5.31
716420   rs80253441       16_2     0.964   170.62 4.8e-04 -12.35
555120   rs61885960      11_11     0.960    29.84 8.4e-05   5.10
324285  rs140967207       6_21     0.959    30.57 8.6e-05   5.10
367369   rs75885118      6_104     0.957    29.95 8.4e-05   3.02
369580   rs76523601      6_108     0.957    49.09 1.4e-04  -3.70
30170     rs1730862       1_66     0.956    25.53 7.1e-05  -4.69
377874    rs7802610       7_15     0.956    26.62 7.4e-05   5.19
408194    rs1868757       7_70     0.953    27.12 7.5e-05   5.35
816487    rs6103338      20_27     0.953    31.77 8.8e-05   5.45
195599    rs3748034        4_4     0.952    30.85 8.6e-05  -6.03
779920    rs9953884      18_31     0.952    55.67 1.5e-04   6.80
636740    rs7999704       13_9     0.951    29.55 8.2e-05  -5.10
831653    rs9974208      21_17     0.951    25.15 7.0e-05   4.29
755790   rs12947269      17_34     0.950    27.48 7.6e-05  -5.71
389535   rs13230267       7_35     0.946    31.06 8.6e-05   5.19
721126   rs34967165      16_12     0.946    32.40 8.9e-05   5.36
176062   rs58020426       3_87     0.945    24.82 6.8e-05  -4.30
817216  rs577036133      20_28     0.945    25.94 7.2e-05   4.55
460431    rs2737205       8_78     0.944   136.95 3.8e-04  -9.91
600979   rs11051788      12_22     0.944    32.76 9.0e-05  -6.27
674833   rs10136844      14_21     0.944    27.37 7.5e-05  -4.95
697187    rs3803361      15_13     0.943    25.67 7.1e-05  -4.74
50793      rs340835      1_108     0.942    42.98 1.2e-04  -6.14
703242    rs2414752      15_28     0.942    30.61 8.4e-05  -4.32
747041   rs28489441      17_15     0.942    25.59 7.0e-05   4.35
658859     rs892252      13_51     0.940    25.21 6.9e-05   4.66
428215   rs77304020       8_14     0.939    40.11 1.1e-04  -5.57
536864   rs78382982      10_59     0.939    26.37 7.2e-05   5.10
53039    rs72472375      1_112     0.938    31.85 8.7e-05   6.37
823934    rs2823025       21_2     0.936    25.01 6.8e-05  -4.70
122578   rs10622618      2_120     0.933    32.30 8.8e-05  -5.71
312766   rs62389092      5_105     0.932    24.48 6.7e-05  -4.55
397306   rs11762191       7_47     0.931    57.09 1.6e-04   8.71
514627  rs750689165      10_16     0.931    39.02 1.1e-04  -7.35
736966   rs12934751      16_46     0.931   133.59 3.6e-04  11.08
775573     rs991014      18_24     0.931    34.77 9.5e-05   5.69
895730    rs7592098      2_136     0.931  1736.24 4.7e-03  -3.71
699558   rs12050772      15_20     0.929    56.27 1.5e-04  -7.07
519768    rs2505692      10_27     0.928    24.87 6.7e-05   3.78
176010    rs4683606       3_86     0.927   195.05 5.3e-04 -13.36
999731    rs9989201      14_36     0.927  5388.42 1.5e-02  -3.43
755783    rs8074463      17_34     0.925    29.10 7.9e-05  -5.88
96063     rs2166862       2_66     0.924    30.02 8.1e-05   5.18
329065   rs72880536       6_28     0.923    26.78 7.2e-05  -4.75
576725     rs509723      11_54     0.920    31.80 8.5e-05  -5.29
679975   rs34489253      14_33     0.920    46.34 1.2e-04  -7.04
280781   rs10062008       5_43     0.918    25.58 6.9e-05   4.34
468851   rs56114972       8_92     0.918    24.18 6.5e-05  -3.81
751924   rs17614452      17_26     0.915    27.53 7.4e-05   5.04
815079    rs2246443      20_23     0.915    24.91 6.7e-05   4.15
190061    rs6782470      3_114     0.910    25.75 6.8e-05   4.51
626345  rs149837779      12_73     0.910    24.76 6.6e-05  -4.56
40041     rs4442334       1_89     0.907    44.13 1.2e-04  -6.82
53061    rs10863568      1_112     0.907   152.07 4.0e-04 -14.82
593916   rs12824533      12_11     0.906    26.35 7.0e-05   3.80
185586   rs10653660      3_104     0.903    58.64 1.5e-04   7.76
479557   rs10965488       9_17     0.903    28.80 7.6e-05   4.98
227877    rs1813867       4_66     0.902    32.19 8.5e-05  -6.79
367387     rs315996      6_104     0.902    29.23 7.7e-05   1.15
197315   rs12152650        4_8     0.901   263.30 6.9e-04  13.54
680026    rs3784139      14_33     0.901    31.30 8.2e-05  -6.39
708445   rs72734182      15_38     0.901    25.64 6.7e-05   4.39
796680   rs73019624      19_21     0.899    38.45 1.0e-04  -6.29
464260    rs2648832       8_84     0.898    24.53 6.4e-05  -4.50
769240    rs8093352      18_11     0.897    24.66 6.5e-05   4.28
185440    rs4955590      3_104     0.895    26.70 7.0e-05  -5.25
412591    rs4507692       7_79     0.893    34.98 9.1e-05  -5.67
1043416   rs8105174       19_9     0.893   229.01 6.0e-04 -15.80
352033    rs4515420       6_70     0.888    32.25 8.4e-05   5.30
815708   rs62209440      20_24     0.887    25.30 6.6e-05  -4.64
943179   rs35887778       7_61     0.887    38.46 1.0e-04   6.85
598006   rs74842514      12_18     0.886    32.58 8.4e-05  -5.42
632802    rs4294650       13_2     0.886    54.16 1.4e-04  -7.29
78188     rs2121564       2_28     0.885    26.51 6.9e-05  -4.80
442853   rs71519448       8_44     0.885    50.20 1.3e-04   2.30
231753   rs77893550       4_72     0.881    24.55 6.3e-05  -4.49
167665  rs148695018       3_70     0.880    25.57 6.6e-05   4.53
329272    rs1187117       6_28     0.880    59.74 1.5e-04   7.74
529961     rs780662      10_48     0.880    26.13 6.7e-05   4.65
713605    rs1464445      15_46     0.880    49.51 1.3e-04  -6.81
14621    rs55869368       1_35     0.879    25.07 6.4e-05  -4.48
421803   rs12698259       7_99     0.879    26.20 6.7e-05   3.95
368643  rs777679051      6_106     0.877    30.16 7.7e-05  -5.19
803220   rs11556769      19_37     0.875    27.80 7.1e-05  -4.95
25175   rs146501986       1_55     0.874   259.03 6.6e-04  16.90
723098    rs6497339      16_18     0.872    34.42 8.8e-05  -5.53
7068    rs138012132       1_19     0.871    51.00 1.3e-04  -6.21
96552     rs4849177       2_67     0.870    57.28 1.5e-04   7.63
418746    rs5888418       7_94     0.870    28.59 7.3e-05   5.00
722112   rs35512524      16_15     0.870    27.11 6.9e-05   5.24
704704   rs36120854      15_30     0.868    24.54 6.2e-05   4.28
714567   rs35477848      15_48     0.868    25.49 6.5e-05  -4.01
115565  rs141607132      2_107     0.863    24.77 6.2e-05   4.41
317286    rs2765359        6_7     0.862    36.19 9.1e-05  -4.63
582900   rs75794878      11_67     0.861    33.74 8.5e-05  -5.55
732758   rs71403855      16_38     0.859    26.04 6.5e-05   4.98
369513  rs118014721      6_108     0.853    85.88 2.1e-04   4.80
761061    rs8065893      17_43     0.852    25.34 6.3e-05   4.44
277392   rs12656462       5_35     0.851    38.31 9.5e-05  -5.81
48932    rs12048709      1_106     0.849    27.99 6.9e-05   4.90
317335     rs545632        6_7     0.849    27.60 6.8e-05  -5.66
918780    rs9293511       5_52     0.849 37258.57 9.2e-02  -9.44
359701  rs765215967       6_89     0.848    24.87 6.2e-05  -4.40
139149   rs11128570        3_9     0.847    27.38 6.8e-05   5.33
488583    rs7847368       9_38     0.847    25.17 6.2e-05  -4.49
607640    rs2657880      12_35     0.847    36.41 9.0e-05  -5.97
98744     rs2311597       2_70     0.845    57.75 1.4e-04   7.64
109246     rs834837       2_93     0.845    25.54 6.3e-05   4.57
382511    rs2249325       7_23     0.845    25.64 6.3e-05   4.49
175349     rs940191       3_85     0.844    38.16 9.4e-05  -6.92
352452    rs9400205       6_73     0.844    32.40 8.0e-05  -6.22
585206   rs10892819      11_74     0.842    28.71 7.1e-05  -5.26
788812   rs10408455       19_5     0.842    46.30 1.1e-04  -6.30
67292     rs5829382        2_8     0.841    25.65 6.3e-05   4.62
843711     rs136908      22_20     0.840    28.57 7.0e-05   5.05
989988  rs117104648      11_36     0.840    51.01 1.3e-04   7.19
188411    rs6793063      3_111     0.839    28.19 6.9e-05   4.88
317359    rs9379083        6_7     0.838    50.06 1.2e-04   5.84
639789   rs61630147      13_15     0.838   159.42 3.9e-04  12.88
150673   rs79987842       3_38     0.837    31.28 7.6e-05  -4.74
677441    rs6573307      14_27     0.837    93.03 2.3e-04  10.00
143013   rs17400314       3_17     0.836    26.17 6.4e-05   5.14
438058   rs10087804       8_33     0.832    28.59 6.9e-05   4.98
389220   rs11773764       7_34     0.830    86.99 2.1e-04  12.06
627330    rs2393775      12_74     0.830    73.89 1.8e-04 -12.43
501278  rs569990989       9_63     0.829    24.37 5.9e-05   4.45
820517    rs6127693      20_33     0.829    30.13 7.3e-05   5.95
586666   rs10893498      11_77     0.827    34.07 8.2e-05  -5.75
838959    rs9608723       22_9     0.827    36.39 8.8e-05  -6.39
759471    rs7216472      17_41     0.822    35.63 8.6e-05  -5.77
802824    rs7256521      19_37     0.822    38.54 9.3e-05  -6.01
388915   rs10246245       7_33     0.821    88.11 2.1e-04   7.96
841355    rs5755943      22_14     0.819    56.90 1.4e-04   7.67
956734   rs78509281       9_54     0.818    53.89 1.3e-04   9.52
60692    rs61833239      1_128     0.817    25.71 6.1e-05  -2.13
314657   rs77507057      5_110     0.817    44.58 1.1e-04   6.48
491887    rs1360200       9_45     0.817    28.96 6.9e-05  -5.47
717500   rs76814483       16_6     0.816    88.05 2.1e-04  -9.51
140069    rs1038300       3_10     0.814    25.82 6.1e-05  -4.30
325905    rs1264357       6_26     0.814    80.19 1.9e-04  -8.91
697607  rs138570705      15_17     0.814   287.73 6.8e-04 -17.66
662276    rs1079971      13_59     0.812    25.36 6.0e-05   4.33
864412  rs140604451       1_67     0.812    62.98 1.5e-04  -6.89
466609    rs2315839       8_88     0.810    54.47 1.3e-04   7.50
478454   rs13284903       9_15     0.807    34.19 8.1e-05   5.52
1082434 rs779656515      22_24     0.807    34.85 8.2e-05  -5.70
357920    rs2184968       6_84     0.804   750.12 1.8e-03  27.80
760509    rs2665984      17_42     0.804    24.96 5.9e-05  -4.35
663898  rs143614549      13_62     0.801    36.86 8.6e-05   6.02

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
188281 rs146797780      3_110         1 95146.91 0.28 -5.92
188282   rs7636471      3_110         1 95048.89 0.28 -5.66
188284   rs6769162      3_110         0 92312.24 0.00 -5.56
188265   rs6807293      3_110         0 84673.08 0.00 -5.50
188253   rs6794252      3_110         0 84575.78 0.00 -5.52
188285   rs9838117      3_110         0 73292.14 0.00 -4.83
913570 rs142955295       3_35         1 69798.02 0.20  4.29
913536   rs9853458       3_35         0 69697.62 0.00 -4.31
913534   rs9876508       3_35         0 69697.49 0.00 -4.31
913535   rs9815766       3_35         0 69696.80 0.00 -4.32
913504   rs7634902       3_35         0 69695.78 0.00 -4.30
913507   rs1049256       3_35         0 69695.71 0.00 -4.30
913501   rs3811696       3_35         0 69695.06 0.00 -4.32
913502   rs3811695       3_35         0 69694.80 0.00 -4.31
913500   rs4855850       3_35         0 69693.41 0.00 -4.32
913486   rs3749240       3_35         0 69692.72 0.00 -4.31
913493  rs34614773       3_35         0 69692.26 0.00 -4.32
913460   rs1491986       3_35         0 69690.88 0.00 -4.32
913492  rs11130219       3_35         0 69688.60 0.00 -4.33
913624   rs9871654       3_35         0 69687.16 0.00  4.30
913615  rs13063621       3_35         0 69687.09 0.00  4.29
913608   rs9814765       3_35         0 69687.08 0.00  4.29
913609  rs11130221       3_35         0 69687.08 0.00  4.29
913595  rs34451146       3_35         0 69687.04 0.00  4.29
913563   rs7634886       3_35         0 69686.37 0.00  4.30
913596  rs57648519       3_35         0 69686.34 0.00  4.31
913537   rs7374277       3_35         0 69686.05 0.00 -4.31
913538   rs7374183       3_35         0 69685.33 0.00 -4.33
913455   rs6785549       3_35         0 69684.72 0.00 -4.33
913586   rs6446295       3_35         0 69684.39 0.00  4.30
913491  rs11130218       3_35         0 69684.29 0.00 -4.31
913581   rs7431106       3_35         0 69683.70 0.00  4.31
913567   rs9865480       3_35         0 69679.73 0.00  4.30
913477  rs12381242       3_35         0 69679.00 0.00 -4.31
913568  rs60205400       3_35         0 69678.69 0.00  4.29
913572   rs6809431       3_35         0 69678.51 0.00  4.29
913575   rs9859153       3_35         0 69678.38 0.00  4.30
913590   rs6766836       3_35         0 69678.37 0.00  4.30
913565   rs9882639       3_35         0 69677.84 0.00  4.29
913468  rs11716575       3_35         0 69675.68 0.00 -4.32
913469  rs11709680       3_35         0 69675.67 0.00 -4.32
913480   rs4855862       3_35         0 69675.16 0.00 -4.32
913510  rs10632976       3_35         0 69672.98 0.00 -4.34
913467   rs3749241       3_35         0 69667.91 0.00 -4.32
913553   rs9855505       3_35         0 69665.05 0.00 -4.31
913549   rs7372730       3_35         0 69664.86 0.00 -4.31
913548   rs7372725       3_35         0 69664.16 0.00 -4.32
913544   rs7429353       3_35         0 69663.98 0.00 -4.32
913472   rs4855841       3_35         0 69663.59 0.00 -4.32
913551   rs9872864       3_35         0 69655.08 0.00 -4.32

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
188281  rs146797780      3_110     1.000 95146.91 0.2800 -5.92
188282    rs7636471      3_110     1.000 95048.89 0.2800 -5.66
913570  rs142955295       3_35     1.000 69798.02 0.2000  4.29
644315    rs7999449      13_25     1.000 38777.65 0.1100 -4.29
644317  rs775834524      13_25     1.000 38857.03 0.1100 -4.23
918774    rs7728690       5_52     1.000 37346.18 0.1100 -9.41
918776  rs150854935       5_52     1.000 37784.37 0.1100 -9.28
918780    rs9293511       5_52     0.849 37258.57 0.0920 -9.44
918762   rs13167261       5_52     0.489 37248.08 0.0530 -9.50
918763   rs13167262       5_52     0.489 37248.08 0.0530 -9.50
910825    rs2307874       3_34     1.000 13619.92 0.0400 -4.40
910925   rs56123512       3_34     1.000 13645.97 0.0400 -4.16
910828   rs55721964       3_34     0.970 13639.42 0.0390 -4.25
1071298  rs34079499      21_19     1.000 13144.50 0.0380 -6.20
1071456  rs55740356      21_19     1.000 11564.95 0.0340 -6.65
520025   rs71007692      10_28     1.000  9761.30 0.0290  2.95
1071262   rs2836974      21_19     0.742 12992.25 0.0280 -6.12
56183   rs766167074      1_118     1.000  5959.98 0.0170  2.75
999722  rs773484935      14_36     1.000  5386.07 0.0160 -3.04
999731    rs9989201      14_36     0.927  5388.42 0.0150 -3.43
520022    rs9299760      10_28     0.504  9741.00 0.0140  2.94
520031    rs2472183      10_28     0.500  9745.42 0.0140  2.91
644312    rs9537143      13_25     0.126 38625.81 0.0140  4.38
1071316  rs35560196      21_19     0.372 12993.02 0.0140 -6.10
520034   rs11011452      10_28     0.395  9745.76 0.0110  2.89
1071299  rs34578707      21_19     0.271 12989.70 0.0100 -6.09
520024    rs2474565      10_28     0.342  9745.18 0.0097  2.90
1071312  rs77090950      21_19     0.226 12992.71 0.0086 -6.09
389284     rs700752       7_34     1.000  2231.42 0.0065 47.41
56181     rs2486737      1_118     0.298  5992.99 0.0052  2.27
895735    rs4973409      2_136     1.000  1787.93 0.0052 -3.46
895736  rs142215640      2_136     1.000  1788.17 0.0052 -3.60
999739   rs12589638      14_36     0.324  5371.85 0.0051 -3.48
56182      rs971534      1_118     0.282  5992.96 0.0049  2.27
895730    rs7592098      2_136     0.931  1736.24 0.0047 -3.71
644308    rs9527399      13_25     0.036 38621.74 0.0041  4.38
56189     rs2248646      1_118     0.208  5990.93 0.0036  2.28
644307    rs7337153      13_25     0.032 38741.77 0.0036 -4.27
644310    rs9527401      13_25     0.029 38621.92 0.0032  4.38
644311    rs9597193      13_25     0.029 38622.15 0.0032  4.38
56190     rs2211176      1_118     0.169  5991.06 0.0030  2.27
56191     rs2790882      1_118     0.169  5991.06 0.0030  2.27
56177     rs2790891      1_118     0.167  5992.38 0.0029  2.26
56178     rs2491405      1_118     0.167  5992.38 0.0029  2.26
160890  rs768688512       3_58     1.000   982.88 0.0029 -3.54
999720   rs61990327      14_36     0.178  5379.55 0.0028 -3.34
56180    rs10489611      1_118     0.141  5992.65 0.0025  2.26
160874   rs56320121       3_58     1.000   792.88 0.0023 -3.10
644303    rs9537123      13_25     0.021 38592.69 0.0023  4.39
56174     rs2256908      1_118     0.123  5992.25 0.0022  2.26

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
389284    rs700752       7_34     1.000 2231.42 6.5e-03  47.41
389283   rs1917609       7_34     0.000 1617.86 1.6e-17 -39.95
389273   rs7801650       7_34     0.000 1541.61 1.2e-17 -39.07
389276   rs7782135       7_34     0.000 1540.42 1.2e-17 -39.06
389274   rs7788438       7_34     0.000 1538.45 1.2e-17 -39.03
389267  rs35692095       7_34     0.000 1518.73 9.8e-18 -38.79
389269   rs4724488       7_34     0.000 1519.47 1.0e-17 -38.78
621545   rs5742678      12_61     0.531  536.29 8.3e-04 -29.02
621537   rs1520222      12_61     0.469  535.73 7.3e-04 -28.95
357920   rs2184968       6_84     0.804  750.12 1.8e-03  27.80
357918   rs4897179       6_84     0.190  747.93 4.1e-04  27.76
357921   rs1361109       6_84     0.009  739.85 1.9e-05  27.64
357923   rs4895808       6_84     0.007  738.77 1.4e-05  27.62
357924   rs1844594       6_84     0.006  737.69 1.2e-05  27.60
357928   rs9398810       6_84     0.005  736.20 9.9e-06  27.57
357929   rs9401885       6_84     0.005  736.86 1.1e-05  27.57
357926   rs9372839       6_84     0.004  732.19 8.0e-06  27.50
357912   rs2326387       6_84     0.003  715.00 6.6e-06  27.14
357915   rs1361262       6_84     0.003  715.18 6.7e-06  27.14
357911   rs9375435       6_84     0.003  706.14 6.5e-06  26.97
357934   rs6921183       6_84     0.011  636.04 2.1e-05  25.91
357935   rs9401890       6_84     0.011  634.84 2.0e-05  25.89
357936   rs9375448       6_84     0.011  632.88 2.0e-05  25.85
357942   rs9491653       6_84     0.008  615.94 1.4e-05  25.55
357941   rs4629707       6_84     0.007  614.13 1.2e-05  25.53
357940   rs7738836       6_84     0.007  613.90 1.2e-05  25.52
357944   rs9375449       6_84     0.007  614.30 1.3e-05  25.52
357946   rs4895813       6_84     0.007  613.83 1.3e-05  25.51
357949  rs11154367       6_84     0.007  614.07 1.3e-05  25.51
357950    rs853987       6_84     0.007  609.77 1.2e-05 -25.44
550778   rs2239681       11_2     1.000  233.48 6.8e-04 -25.38
621539   rs6539035      12_61     0.000  472.52 4.2e-15 -25.18
621546   rs6539036      12_61     0.000  471.52 3.5e-15 -25.16
621543   rs4764696      12_61     0.000  471.02 3.2e-15 -25.14
357932   rs6925689       6_84     0.007  591.70 1.2e-05  25.05
389285    rs856541       7_34     0.000  717.33 1.7e-12  24.79
71862     rs780093       2_16     1.000  450.72 1.3e-03  24.69
550777  rs17885785       11_2     1.000  361.01 1.1e-03  24.68
357951   rs1101563       6_84     0.006  571.38 9.2e-06 -24.62
357954    rs979197       6_84     0.005  569.64 8.9e-06 -24.58
357955   rs1015446       6_84     0.005  566.14 8.6e-06 -24.51
389278    rs856586       7_34     0.000  652.44 3.4e-15  24.07
1028517     rs5388      17_37     1.000  434.58 1.3e-03  22.63
412812    rs125124       7_80     1.000  474.82 1.4e-03  22.58
389287   rs2204413       7_34     0.000  536.23 3.5e-13 -21.53
389292   rs1357901       7_34     0.000  536.20 3.6e-13 -21.53
39271    rs1506779       1_86     0.331  247.95 2.4e-04  21.26
39269   rs10913207       1_86     0.387  248.31 2.8e-04  21.25
39265    rs6671048       1_86     0.174  246.07 1.3e-04  21.20
39263   rs11806613       1_86     0.108  244.82 7.8e-05  21.14

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] 21
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"
[1] Term             Overlap          Adjusted.P.value Genes           
<0 rows> (or 0-length row.names)
[1] "GO_Molecular_Function_2021"
                                                  Term Overlap
1 transforming growth factor beta binding (GO:0050431)    2/24
  Adjusted.P.value       Genes
1       0.01371817 TGFBR1;VASN
ACTR1B gene(s) from the input list not found in DisGeNET CURATEDZBTB47 gene(s) from the input list not found in DisGeNET CURATEDBEND3 gene(s) from the input list not found in DisGeNET CURATEDTTLL12 gene(s) from the input list not found in DisGeNET CURATEDGTF2H1 gene(s) from the input list not found in DisGeNET CURATEDZDHHC18 gene(s) from the input list not found in DisGeNET CURATEDNHSL1 gene(s) from the input list not found in DisGeNET CURATEDAES gene(s) from the input list not found in DisGeNET CURATED
                                                Description        FDR
14                            Fucosidase Deficiency Disease 0.01030715
24                                Leukemia, T-Cell, Chronic 0.01030715
52                                       Fucosidosis Type I 0.01030715
53                                      Fucosidosis Type II 0.01030715
56      Multiple self-healing epithelioma of Ferguson-Smith 0.01030715
60                   Enteropathy-Associated T-Cell Lymphoma 0.01030715
64               Multiple self-healing squamous epithelioma 0.01030715
73                     Leukemia, Large Granular Lymphocytic 0.01030715
77                                    Laron syndrome type 2 0.01030715
78 Leukemia, Natural Killer Cell Large Granular Lymphocytic 0.01030715
   Ratio BgRatio
14  1/13  1/9703
24  1/13  1/9703
52  1/13  1/9703
53  1/13  1/9703
56  1/13  1/9703
60  1/13  1/9703
64  1/13  1/9703
73  1/13  1/9703
77  1/13  1/9703
78  1/13  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