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-30600_irnt_Liver.Rmd
    Modified:   analysis/ukb-d-30610_irnt_Liver.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

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_Liver.Rmd) and HTML (docs/ukb-d-30770_irnt_Liver.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 627a4e1 wesleycrouse 2021-09-07 adding heritability
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 Liver 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 Liver 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] 10901
#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 
1070  768  652  417  494  611  548  408  405  434  634  629  195  365  354 
  16   17   18   19   20   21   22 
 526  663  160  859  306  114  289 
#proportion of imputed weights without missing variants
mean(qclist_all$nmiss==0)
[1] 0.8366205

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.0189019301 0.0002085686 
#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 
27.64842 24.74043 
#report sample size
print(sample_size)
[1] 342439
#report group size
group_size <- c(nrow(ctwas_gene_res), n_snps)
print(group_size)
[1]   10901 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.01663641 0.13105665 
#compare sum(PIP*mu2/sample_size) with above PVE calculation
c(sum(ctwas_gene_res$PVE),sum(ctwas_snp_res$PVE))
[1] 0.05253737 1.56608472

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
12135        S1PR2       19_9     1.000  149.54 4.4e-04 -15.92
8579        STAT5B      17_25     0.998   32.01 9.3e-05   3.39
9816      C11orf96      11_27     0.993   27.83 8.1e-05   5.47
2173      TMEM176B       7_93     0.991   47.72 1.4e-04   7.28
9017          ERN1      17_37     0.990   93.86 2.7e-04  13.72
1372        IGFALS       16_2     0.989 4778.29 1.4e-02  19.66
10856       ZNF845      19_36     0.988   40.43 1.2e-04  -6.16
8493         OXSR1       3_27     0.987   27.15 7.8e-05   4.94
9390          GAS6      13_62     0.984   55.22 1.6e-04  -7.63
10303      UGT2B17       4_48     0.983  137.64 4.0e-04 -14.40
7905          VASN       16_4     0.981   37.59 1.1e-04   6.23
7651         CASC4      15_17     0.980   97.82 2.8e-04  13.39
1894         TRPS1       8_78     0.973  138.53 3.9e-04   9.81
1954           AES       19_4     0.971   25.72 7.3e-05   4.81
112          SCN4A      17_37     0.970   55.84 1.6e-04  -9.25
247         ZNF582      19_38     0.970   24.64 7.0e-05  -4.59
10927   AC004540.5       7_23     0.962   24.16 6.8e-05   4.49
8040         THBS3       1_76     0.953   27.69 7.7e-05  -4.92
12516 RP11-442O1.3      16_50     0.951   30.29 8.4e-05  -5.40
8060          NPR1       1_75     0.948   22.70 6.3e-05  -5.13
7300        RICTOR       5_26     0.945   85.72 2.4e-04   9.38
906          UBE2K       4_32     0.942  140.90 3.9e-04 -10.77
5972       HIKESHI      11_47     0.937   40.77 1.1e-04   6.49
886           IL4R      16_22     0.937   40.55 1.1e-04  -6.18
4350         KMT5C      19_38     0.933   27.39 7.5e-05  -5.00
625         MPPED2      11_21     0.926  196.51 5.3e-04   3.77
10185        IGF2R      6_103     0.925   79.15 2.1e-04   8.92
6411         LRGUK       7_81     0.922   30.59 8.2e-05  -5.72
1779      CRISPLD2      16_49     0.915   20.36 5.4e-05  -4.15
3133         DHDDS       1_18     0.912   31.95 8.5e-05  -8.25
9855         PALM3      19_11     0.912   24.50 6.5e-05  -4.66
6636        ZNF276      16_54     0.908   21.36 5.7e-05  -4.41
5415         SYTL1       1_19     0.904   61.47 1.6e-04   7.28
3832        MAP2K2       19_4     0.901   25.30 6.7e-05   3.04
2021       SULT2A1      19_33     0.901   56.20 1.5e-04  -7.73
5358        CCDC97      19_28     0.894   34.65 9.0e-05   5.83
6951        FAAP20        1_2     0.888   31.60 8.2e-05  -5.92
4435         PSRC1       1_67     0.875  125.11 3.2e-04  10.55
9121        B3GNT3      19_14     0.874   22.30 5.7e-05   4.24
7040         INHBB       2_70     0.850   80.01 2.0e-04  -8.97
2497        GTF2H1      11_13     0.848   62.28 1.5e-04  -8.37
7682         VPS39      15_15     0.847   20.07 5.0e-05  -3.47
3267         TGFB3      14_35     0.846   20.64 5.1e-05   3.99
10446         LDB1      10_65     0.840   30.71 7.5e-05  -5.24
9635         TLCD2       17_2     0.837   37.12 9.1e-05  -6.24
9102         ZFPM1      16_53     0.831   30.40 7.4e-05  -5.29
4835       RNF144B       6_14     0.830   23.67 5.7e-05  -4.71
3150         KMT2A      11_71     0.823   33.35 8.0e-05   3.88
2870        ACTR1B       2_57     0.820   19.98 4.8e-05  -3.77
10205      TBC1D9B      5_108     0.817   19.57 4.7e-05  -3.70
8996          GEN1       2_10     0.816   46.33 1.1e-04  -6.69
2042         BCAT2      19_34     0.813   39.87 9.5e-05  -6.16
7546         HTRA1      10_77     0.812   21.38 5.1e-05  -4.07

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
8460          ZMAT3      3_110     0.000 26727.87 0.000 -4.39
8275         KCNMB3      3_110     0.000 20674.34 0.000 -3.10
3429         PIK3CA      3_110     0.000 16378.32 0.000  0.44
555            HAGH       16_2     0.000  8558.89 0.000 -8.93
4634          EGLN1      1_118     0.000  5393.85 0.000  2.31
6890          SPSB3       16_2     0.000  5034.67 0.000 10.12
6891          MEIOB       16_2     0.000  4789.74 0.000  2.67
1372         IGFALS       16_2     0.989  4778.29 0.014 19.66
3058          EXOC8      1_118     0.000  4519.66 0.000 -3.21
839          ZNF37A      10_28     0.000  2956.89 0.000 -2.26
8272           MFN1      3_110     0.000  2516.73 0.000 -1.35
11963 RP11-255C15.3      3_110     0.000  1451.59 0.000 -0.41
5256           RPS2       16_2     0.000  1327.95 0.000 -2.01
10766          HN1L       16_2     0.000   955.31 0.000 -2.80
9995         ZNF33A      10_28     0.000   929.05 0.000  4.30
10284          EME2       16_2     0.000   578.22 0.000 -2.93
8736          ZNF25      10_28     0.000   541.74 0.000  1.91
10449         MSRB1       16_2     0.000   533.00 0.000 -2.19
7863         ZNF598       16_2     0.000   497.70 0.000 -1.15
2822           GNB4      3_110     0.000   405.62 0.000  0.12

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
1372       IGFALS       16_2     0.989 4778.29 0.01400  19.66
7656     CATSPER2      15_16     0.693  337.29 0.00068 -19.25
625        MPPED2      11_21     0.926  196.51 0.00053   3.77
12135       S1PR2       19_9     1.000  149.54 0.00044 -15.92
10303     UGT2B17       4_48     0.983  137.64 0.00040 -14.40
906         UBE2K       4_32     0.942  140.90 0.00039 -10.77
1894        TRPS1       8_78     0.973  138.53 0.00039   9.81
4435        PSRC1       1_67     0.875  125.11 0.00032  10.55
7651        CASC4      15_17     0.980   97.82 0.00028  13.39
9017         ERN1      17_37     0.990   93.86 0.00027  13.72
9626       PARPBP      12_61     0.783  103.79 0.00024 -10.53
7300       RICTOR       5_26     0.945   85.72 0.00024   9.38
10185       IGF2R      6_103     0.925   79.15 0.00021   8.92
760          AFF4       5_80     0.414  162.49 0.00020 -12.90
7040        INHBB       2_70     0.850   80.01 0.00020  -8.97
5427        PTPRF       1_27     0.765   86.41 0.00019  10.47
6792         ADAR       1_75     0.755   85.42 0.00019   9.55
12687 RP4-781K5.7      1_121     0.771   86.15 0.00019  -8.91
10981       ZGLP1       19_9     0.776   76.91 0.00017 -12.08
5415        SYTL1       1_19     0.904   61.47 0.00016   7.28

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
1372        IGFALS       16_2     0.989 4778.29 1.4e-02  19.66
7656      CATSPER2      15_16     0.693  337.29 6.8e-04 -19.25
12694 RP11-210L7.3      12_61     0.000  358.24 7.9e-14 -18.02
1328         NUBP2       16_2     0.000  244.71 1.0e-08 -17.99
1058          GCKR       2_16     0.354  132.72 1.4e-04  16.85
10987      C2orf16       2_16     0.354  132.72 1.4e-04  16.85
12135        S1PR2       19_9     1.000  149.54 4.4e-04 -15.92
10425       AKR1C4       10_6     0.009  278.09 7.2e-06  15.70
7985         LCMT2      15_16     0.108  222.02 7.0e-05  14.68
10303      UGT2B17       4_48     0.983  137.64 4.0e-04 -14.40
5799       SLC22A3      6_104     0.681   74.98 1.5e-04 -14.17
9017          ERN1      17_37     0.990   93.86 2.7e-04  13.72
11256  AP000688.29      21_17     0.000  120.19 1.2e-08 -13.50
9569        SORCS2        4_8     0.010  212.24 6.3e-06 -13.41
7651         CASC4      15_17     0.980   97.82 2.8e-04  13.39
2662        TRIM38       6_20     0.000   91.41 6.3e-08  13.35
4736           HLX      1_112     0.081  120.57 2.8e-05  13.13
1367         STX1B      16_24     0.099  153.76 4.5e-05 -13.03
2891         SNX17       2_16     0.044  160.39 2.1e-05  12.91
760           AFF4       5_80     0.414  162.49 2.0e-04 -12.90

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.03843684
#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
1372        IGFALS       16_2     0.989 4778.29 1.4e-02  19.66
7656      CATSPER2      15_16     0.693  337.29 6.8e-04 -19.25
12694 RP11-210L7.3      12_61     0.000  358.24 7.9e-14 -18.02
1328         NUBP2       16_2     0.000  244.71 1.0e-08 -17.99
1058          GCKR       2_16     0.354  132.72 1.4e-04  16.85
10987      C2orf16       2_16     0.354  132.72 1.4e-04  16.85
12135        S1PR2       19_9     1.000  149.54 4.4e-04 -15.92
10425       AKR1C4       10_6     0.009  278.09 7.2e-06  15.70
7985         LCMT2      15_16     0.108  222.02 7.0e-05  14.68
10303      UGT2B17       4_48     0.983  137.64 4.0e-04 -14.40
5799       SLC22A3      6_104     0.681   74.98 1.5e-04 -14.17
9017          ERN1      17_37     0.990   93.86 2.7e-04  13.72
11256  AP000688.29      21_17     0.000  120.19 1.2e-08 -13.50
9569        SORCS2        4_8     0.010  212.24 6.3e-06 -13.41
7651         CASC4      15_17     0.980   97.82 2.8e-04  13.39
2662        TRIM38       6_20     0.000   91.41 6.3e-08  13.35
4736           HLX      1_112     0.081  120.57 2.8e-05  13.13
1367         STX1B      16_24     0.099  153.76 4.5e-05 -13.03
2891         SNX17       2_16     0.044  160.39 2.1e-05  12.91
760           AFF4       5_80     0.414  162.49 2.0e-04 -12.90

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: 16_2"
            genename region_tag susie_pip     mu2     PVE      z
10103        CACNA1H       16_2     0.000   41.46 0.0e+00   4.38
2996           TPSG1       16_2     0.000   67.38 0.0e+00   1.28
10208          TPSB2       16_2     0.000   48.88 0.0e+00  -2.49
1329           TPSD1       16_2     0.000   56.07 0.0e+00  -0.50
11962  RP11-616M22.7       16_2     0.000   75.00 0.0e+00   2.18
1798           UBE2I       16_2     0.000   52.99 0.0e+00  -1.02
118           BAIAP3       16_2     0.000   98.02 0.0e+00  -1.80
119             TSR3       16_2     0.000   31.70 0.0e+00   1.12
1228           GNPTG       16_2     0.000   31.70 0.0e+00   1.12
10263        CCDC154       16_2     0.000   95.54 0.0e+00   2.08
1789           CLCN7       16_2     0.000   85.46 0.0e+00  -3.87
1564           TELO2       16_2     0.000   35.21 0.0e+00  -5.54
11958  LA16c-385E7.1       16_2     0.000  118.10 0.0e+00  -0.81
4194         TMEM204       16_2     0.000   35.27 0.0e+00   7.14
120           CRAMP1       16_2     0.000  266.53 0.0e+00   1.90
10766           HN1L       16_2     0.000  955.31 0.0e+00  -2.80
5056        MAPK8IP3       16_2     0.000  328.72 0.0e+00  -4.59
1756            NME3       16_2     0.000  112.58 0.0e+00  -1.68
10284           EME2       16_2     0.000  578.22 0.0e+00  -2.93
1328           NUBP2       16_2     0.000  244.71 1.0e-08 -17.99
6890           SPSB3       16_2     0.000 5034.67 0.0e+00  10.12
1372          IGFALS       16_2     0.989 4778.29 1.4e-02  19.66
555             HAGH       16_2     0.000 8558.89 0.0e+00  -8.93
6891           MEIOB       16_2     0.000 4789.74 0.0e+00   2.67
10449          MSRB1       16_2     0.000  533.00 0.0e+00  -2.19
5255           RPL3L       16_2     0.000   10.66 0.0e+00  -2.01
5257         NDUFB10       16_2     0.000  211.68 0.0e+00  -1.08
5256            RPS2       16_2     0.000 1327.95 0.0e+00  -2.01
11769          SNHG9       16_2     0.000  289.34 0.0e+00   1.41
3868            GFER       16_2     0.000   81.63 0.0e+00  -4.00
3869          SYNGR3       16_2     0.000  264.88 0.0e+00  -0.89
7863          ZNF598       16_2     0.000  497.70 0.0e+00  -1.15
584         SLC9A3R2       16_2     0.000   13.63 0.0e+00  -0.01
1780            TSC2       16_2     0.000   83.39 0.0e+00   2.19
585            NTHL1       16_2     0.000   54.15 0.0e+00   2.84
139             PKD1       16_2     0.000    6.21 0.0e+00   0.82
7864           RAB26       16_2     0.000    6.51 0.0e+00   0.63
7865           MLST8       16_2     0.000   39.17 0.0e+00  -4.10
9349          BRICD5       16_2     0.000   82.84 0.0e+00   1.20
9499             PGP       16_2     0.000   90.88 0.0e+00  -1.09
7866            E4F1       16_2     0.000  102.73 0.0e+00  -2.77
7867        DNASE1L2       16_2     0.000   58.10 0.0e+00   2.69
7868            ECI1       16_2     0.000   10.76 0.0e+00   1.96
10761          RNPS1       16_2     0.000   33.60 0.0e+00  -1.23
11965 RP11-304L19.13       16_2     0.000   26.93 0.0e+00   0.38
6893            CCNF       16_2     0.000   25.83 0.0e+00   0.67
6892        C16orf59       16_2     0.000   23.70 0.0e+00  -1.50

Version Author Date
dfd2b5f wesleycrouse 2021-09-07
[1] "Region: 15_16"
     genename region_tag susie_pip    mu2     PVE      z
1853   ZNF106      15_16     0.038  35.12 3.9e-06   5.21
9202   LRRC57      15_16     0.024  10.97 7.8e-07   2.02
6691   STARD9      15_16     0.018   7.08 3.8e-07  -1.37
5189    CDAN1      15_16     0.021   7.32 4.5e-07   0.73
3962    TTBK2      15_16     0.083  22.84 5.5e-06  -5.26
4903   TMEM62      15_16     0.677  29.04 5.7e-05  -6.28
7984     ADAL      15_16     0.018  61.78 3.2e-06   7.05
7985    LCMT2      15_16     0.108 222.02 7.0e-05  14.68
4898  TUBGCP4      15_16     0.017  68.55 3.5e-06  -7.30
5180  ZSCAN29      15_16     0.170  27.32 1.4e-05  -0.42
7702    MAP1A      15_16     0.017  99.27 4.8e-06  -9.60
7656 CATSPER2      15_16     0.693 337.29 6.8e-04 -19.25
7709    PDIA3      15_16     0.046  23.94 3.2e-06  -1.42
5178    MFAP1      15_16     0.017  72.71 3.6e-06  -7.79
1286    WDR76      15_16     0.018  62.49 3.3e-06  -7.24

Version Author Date
dfd2b5f wesleycrouse 2021-09-07
[1] "Region: 12_61"
           genename region_tag susie_pip    mu2     PVE      z
7576           SPIC      12_61     0.000  17.33 9.7e-16   1.31
10018        MYBPC1      12_61     0.000   7.55 1.3e-16  -1.30
2575          CHPT1      12_61     0.000   9.47 1.9e-16   0.08
12495 RP11-285E23.2      12_61     0.000   9.54 1.9e-16   0.97
2577         GNPTAB      12_61     0.000   6.45 1.0e-16  -1.30
4674          DRAM1      12_61     0.000   6.50 1.0e-16   1.10
3366         WASHC3      12_61     0.000 115.01 5.0e-12  -0.64
9626         PARPBP      12_61     0.783 103.79 2.4e-04 -10.53
12694  RP11-210L7.3      12_61     0.000 358.24 7.9e-14 -18.02

Version Author Date
dfd2b5f wesleycrouse 2021-09-07
[1] "Region: 2_16"
      genename region_tag susie_pip    mu2     PVE      z
2881     CENPA       2_16     0.662  25.01 4.8e-05  -5.90
11149     OST4       2_16     0.004   8.94 1.1e-07  -2.74
4939   EMILIN1       2_16     0.004  22.70 2.7e-07   7.90
4927       KHK       2_16     0.005   8.79 1.3e-07  -3.47
4935      PREB       2_16     0.009  41.90 1.1e-06  -7.67
4941    ATRAID       2_16     0.019 104.75 5.8e-06   7.80
4936    SLC5A6       2_16     0.019 106.18 5.8e-06  -7.87
1060       CAD       2_16     0.009  67.00 1.7e-06  -5.23
2885   SLC30A3       2_16     0.013  77.76 3.1e-06  -9.66
7169       UCN       2_16     0.005  18.32 2.4e-07  -3.54
2891     SNX17       2_16     0.044 160.39 2.1e-05  12.91
7170    ZNF513       2_16     0.327  46.66 4.5e-05  -1.21
2887     NRBP1       2_16     0.004 212.73 2.6e-06 -12.22
4925    IFT172       2_16     0.004  20.01 2.4e-07  -3.60
1058      GCKR       2_16     0.354 132.72 1.4e-04  16.85
10987  C2orf16       2_16     0.354 132.72 1.4e-04  16.85
10407     GPN1       2_16     0.005  57.35 8.6e-07  -4.38
8847   CCDC121       2_16     0.013  16.20 6.2e-07   1.47
6575       BRE       2_16     0.005  18.60 2.6e-07   3.96
8284      RBKS       2_16     0.008 111.05 2.8e-06 -12.26

Version Author Date
dfd2b5f wesleycrouse 2021-09-07
[1] "Region: 19_9"
           genename region_tag susie_pip    mu2     PVE      z
4124         ZNF317       19_9     0.000   4.84 3.5e-17  -0.07
10020        ZNF699       19_9     0.000  26.93 2.2e-15   2.04
9901         ZNF559       19_9     0.000  12.28 1.9e-16  -1.09
9933         ZNF177       19_9     0.000  14.49 3.0e-16  -1.11
8657         ZNF266       19_9     0.000  13.40 2.5e-16   1.27
10320        ZNF121       19_9     0.000  12.37 2.7e-16   1.14
8317         ZNF561       19_9     0.000   5.46 4.1e-17  -0.48
12616 CTD-3116E22.8       19_9     0.000   5.51 4.2e-17  -0.57
12140 CTD-3116E22.7       19_9     0.000   6.10 5.0e-17  -0.80
10113        ZNF846       19_9     0.000   7.48 7.0e-17   0.90
3858         FBXL12       19_9     0.000   8.08 8.2e-17  -1.02
3857           PIN1       19_9     0.000  48.10 3.6e-14   3.33
1972          OLFM2       19_9     0.000  15.96 4.4e-16   1.84
964          COL5A3       19_9     0.000   5.24 3.9e-17   1.58
4125           PPAN       19_9     0.000  14.19 1.6e-16  -2.21
11524        P2RY11       19_9     0.000   7.07 6.0e-17   1.35
12135         S1PR2       19_9     1.000 149.54 4.4e-04 -15.92
2010          MRPL4       19_9     0.000  62.08 3.7e-12  -1.88
1218          ICAM1       19_9     0.000  46.57 3.3e-16 -11.67
10981         ZGLP1       19_9     0.776  76.91 1.7e-04 -12.08
12143          FDX2       19_9     0.000   8.47 2.3e-16   1.72
2020           TYK2       19_9     0.000  28.82 2.7e-16  -8.20
612           PDE4A       19_9     0.000  56.33 2.1e-13  -3.90
952           KEAP1       19_9     0.000  21.20 1.5e-15  -1.89
9178          S1PR5       19_9     0.000   6.97 5.5e-17   1.25
4113          ATG4D       19_9     0.000  14.28 2.5e-16  -2.40
3997           KRI1       19_9     0.000   9.25 6.6e-17   2.12
4000          AP1M2       19_9     0.000  35.02 6.9e-14   1.21
3999        SLC44A2       19_9     0.000   9.00 7.2e-17   3.99
12108      ILF3-AS1       19_9     0.000   6.40 4.9e-17  -0.60
3998           ILF3       19_9     0.726  67.52 1.4e-04  10.41
10818         QTRT1       19_9     0.008  73.06 1.7e-06 -12.59
1353          TMED1       19_9     0.000  13.35 1.3e-16  -2.58
10897      C19orf38       19_9     0.000  13.35 1.3e-16   2.58
5383          CARM1       19_9     0.000   7.24 6.7e-17  -1.65
4112          YIPF2       19_9     0.000  32.11 1.6e-14   6.15
3874        SMARCA4       19_9     0.000  18.91 1.8e-15   5.36
6872          SPC24       19_9     0.000  47.09 6.6e-14  -4.25

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
23245      rs164877       1_55     1.000   310.87 9.1e-04  14.93
33940    rs77369503       1_80     1.000    44.22 1.3e-04  -6.59
48907     rs7548045      1_108     1.000    55.67 1.6e-04  -4.14
52633      rs287613      1_116     1.000   468.58 1.4e-03   3.46
52639    rs71180790      1_116     1.000   464.95 1.4e-03   2.98
53599   rs766167074      1_118     1.000  5864.16 1.7e-02   2.75
82472    rs35641591       2_46     1.000    57.92 1.7e-04  -7.78
125912  rs142215640      2_136     1.000   166.91 4.9e-04  -3.60
142123    rs9854123       3_24     1.000    40.66 1.2e-04   6.29
157616   rs56320121       3_58     1.000   787.64 2.3e-03  -3.10
157632  rs768688512       3_58     1.000   976.27 2.9e-03  -3.54
182763     rs519352      3_105     1.000    84.71 2.5e-04  12.46
182781    rs6445061      3_105     1.000   154.77 4.5e-04 -14.75
185023  rs146797780      3_110     1.000 92556.81 2.7e-01  -5.92
185024    rs7636471      3_110     1.000 92458.89 2.7e-01  -5.66
186840    rs6778003      3_114     1.000    42.84 1.3e-04  -6.08
186873    rs6773553      3_114     1.000    35.35 1.0e-04   4.88
192325  rs114524202        4_4     1.000    37.72 1.1e-04  -6.94
206744  rs116419948       4_35     1.000    75.58 2.2e-04   5.68
266802   rs55681913       5_28     1.000   246.15 7.2e-04  15.62
293834     rs329123       5_80     1.000    56.26 1.6e-04   7.99
316552    rs1980449       6_19     1.000    57.66 1.7e-04   8.94
317193    rs6908155       6_21     1.000    38.25 1.1e-04   1.41
343412     rs657536       6_67     1.000    43.17 1.3e-04  -6.95
346177    rs3800231       6_73     1.000   317.54 9.3e-04  18.75
360849   rs60425481      6_104     1.000   184.30 5.4e-04 -13.20
362947    rs2323036      6_108     1.000   164.19 4.8e-04  14.90
376665   rs11761979       7_24     1.000    52.86 1.5e-04  -7.18
381600  rs185529878       7_33     1.000    83.30 2.4e-04   7.39
381629    rs1542820       7_34     1.000   227.76 6.7e-04 -17.00
381854    rs2107787       7_34     1.000   238.77 7.0e-04  17.50
381950     rs700752       7_34     1.000  2229.11 6.5e-03  47.41
382048   rs79306382       7_35     1.000    37.17 1.1e-04  -6.34
405874     rs125124       7_80     1.000   474.47 1.4e-03  22.58
413494   rs78609178       7_98     1.000    35.45 1.0e-04  -4.52
424410    rs1495743       8_20     1.000    77.81 2.3e-04  -9.05
436079    rs4738679       8_45     1.000    83.50 2.4e-04  -9.59
463772   rs79531507        9_5     1.000    42.00 1.2e-04  -6.61
463792   rs12552790        9_5     1.000    67.51 2.0e-04  -8.04
463836   rs41303235        9_6     1.000   107.38 3.1e-04   9.73
489090  rs143474127       9_54     1.000    47.47 1.4e-04   9.05
512782   rs71007692      10_28     1.000  9582.85 2.8e-02   2.95
529104   rs35443777      10_60     1.000    62.74 1.8e-04  -6.24
530979   rs10883563      10_64     1.000   115.03 3.4e-04  10.79
541789   rs11042594       11_2     1.000   399.03 1.2e-03  17.70
541798    rs7481173       11_2     1.000   176.00 5.1e-04  -0.73
541799   rs17885785       11_2     1.000   360.79 1.1e-03  24.68
541800    rs2239681       11_2     1.000   233.35 6.8e-04 -25.38
541801    rs3842762       11_2     1.000   329.30 9.6e-04 -19.28
584323    rs2856322      12_11     1.000   103.27 3.0e-04 -10.04
591311    rs7302975      12_21     1.000   139.33 4.1e-04  12.91
611880  rs186877434      12_61     1.000    69.84 2.0e-04 -11.39
617713   rs80019595      12_74     1.000   301.85 8.8e-04  19.61
617927  rs140184587      12_75     1.000    48.72 1.4e-04   6.47
634702    rs7999449      13_25     1.000 37832.08 1.1e-01  -4.29
634704  rs775834524      13_25     1.000 37910.53 1.1e-01  -4.23
670829   rs13379043      14_34     1.000    76.31 2.2e-04  -8.81
679479   rs12147987      14_52     1.000    65.77 1.9e-04  -4.57
679487   rs12885370      14_52     1.000    69.05 2.0e-04  -4.81
692403    rs4474658      15_28     1.000    66.89 2.0e-04 -11.20
695616     rs876383      15_35     1.000    58.95 1.7e-04   8.12
703474   rs72767924      15_47     1.000    73.97 2.2e-04   5.08
703476    rs9672558      15_47     1.000    79.34 2.3e-04   5.56
703557    rs3743250      15_48     1.000    55.58 1.6e-04  -6.91
705155  rs117544769       16_1     1.000    86.22 2.5e-04 -10.97
705166   rs11248852       16_1     1.000   142.55 4.2e-04 -16.99
705174    rs2076421       16_1     1.000   119.91 3.5e-04  15.41
725459    rs9931108      16_45     1.000    96.52 2.8e-04   5.65
742289    rs1801689      17_38     1.000   128.63 3.8e-04  11.78
765252   rs77728352      18_32     1.000    41.53 1.2e-04  -6.23
771790   rs77169818      18_46     1.000    77.68 2.3e-04  -8.89
781059   rs73924758      19_22     1.000    46.15 1.3e-04  -5.31
785051     rs814573      19_32     1.000    36.67 1.1e-04   5.88
791220  rs200167482       20_8     1.000    35.33 1.0e-04  -5.77
794631    rs6112780      20_14     1.000    77.94 2.3e-04 -10.08
794707   rs10470054      20_14     1.000    55.95 1.6e-04   8.31
804643   rs79723704      20_34     1.000    42.12 1.2e-04  -6.38
806424    rs6122476      20_37     1.000    35.27 1.0e-04  -5.50
855823   rs35130213       1_19     1.000  2596.49 7.6e-03  -3.96
855825    rs2236854       1_19     1.000  2595.88 7.6e-03  -3.85
892941  rs145990041      1_112     1.000    70.82 2.1e-04   8.95
909185    rs1260326       2_16     1.000   477.84 1.4e-03  25.55
1044750 rs145982925      11_21     1.000  7176.60 2.1e-02   3.22
1044751  rs35827570      11_21     1.000  7167.73 2.1e-02   1.83
1105207 rs112720618       16_2     1.000 19426.13 5.7e-02  -7.54
1105208  rs56404919       16_2     1.000 19267.26 5.6e-02  -7.54
1163159      rs5388      17_37     1.000   434.31 1.3e-03  22.63
1191823 rs142998071      19_33     1.000    44.05 1.3e-04   6.85
1227156   rs1005694      21_17     1.000    84.23 2.5e-04  -1.93
269105  rs113088001       5_31     0.999    47.96 1.4e-04   7.38
293972   rs11242237       5_80     0.999    88.78 2.6e-04  -8.00
295986     rs853161       5_84     0.999    45.34 1.3e-04  -6.61
305843    rs2340010      5_104     0.999    33.62 9.8e-05   5.60
365270   rs13226659        7_2     0.999    67.40 2.0e-04   8.62
365638    rs4719415        7_4     0.999    60.38 1.8e-04   7.92
457634   rs12674961       8_88     0.999    50.88 1.5e-04  -8.89
522289   rs10823504      10_46     0.999    34.09 9.9e-05   5.62
591334    rs7967974      12_22     0.999    46.07 1.3e-04  -8.27
611948     rs882409      12_61     0.999   120.92 3.5e-04  16.43
614709   rs75622376      12_67     0.999    62.04 1.8e-04   7.66
740074   rs11079157      17_32     0.999    40.58 1.2e-04   6.51
991162     rs662138      6_103     0.999    94.04 2.7e-04   9.66
16277    rs11209239       1_43     0.998    33.84 9.9e-05   5.63
57793   rs150491879      1_129     0.998    34.09 9.9e-05   5.60
91901     rs3789066       2_66     0.998    35.14 1.0e-04   5.93
172105   rs12489068       3_85     0.998    92.10 2.7e-04 -10.65
371361   rs34124255       7_15     0.998    38.19 1.1e-04  -4.46
381621    rs9658238       7_33     0.998    66.35 1.9e-04   9.39
382081    rs7791050       7_35     0.998    36.93 1.1e-04  -6.88
555905   rs12797220      11_30     0.998    41.75 1.2e-04   4.67
612005    rs1580715      12_62     0.998   113.50 3.3e-04  -9.65
827382    rs5765672      22_20     0.998    31.66 9.2e-05  -5.23
48955     rs1223802      1_108     0.997    55.99 1.6e-04  -6.76
359066    rs9479504      6_100     0.997    78.39 2.3e-04   9.02
504253   rs60100723      10_12     0.997    38.06 1.1e-04   6.26
1174269  rs34536443       19_9     0.997    86.58 2.5e-04  -8.42
182780   rs28507699      3_105     0.996   150.70 4.4e-04 -10.47
316802    rs9467715       6_20     0.996    45.85 1.3e-04  -2.60
413251    rs7810268       7_98     0.996    36.12 1.1e-04   5.54
69405    rs72787520       2_20     0.995    38.19 1.1e-04  -5.31
371364    rs6954572       7_15     0.995    76.55 2.2e-04  -7.97
550533   rs56133711      11_19     0.995    38.71 1.1e-04  -6.15
296052    rs6894302       5_84     0.994    40.87 1.2e-04   5.82
304022    rs2974438      5_100     0.994   260.35 7.6e-04 -17.69
38199    rs10913276       1_86     0.993   118.95 3.5e-04  16.90
62177    rs13018091        2_4     0.993    42.94 1.2e-04  -6.64
343477    rs7763983       6_67     0.993    33.28 9.7e-05   6.37
367729  rs186587982        7_9     0.993   150.24 4.4e-04 -13.53
521904    rs2305196      10_46     0.993    38.68 1.1e-04  -5.79
529105    rs3740365      10_60     0.993    56.66 1.6e-04  -5.74
134865  rs139232179        3_9     0.992    36.58 1.1e-04   5.90
747444   rs36000545      17_46     0.992    33.72 9.8e-05  -5.70
304030    rs6885027      5_100     0.991    45.48 1.3e-04   8.79
463831    rs7032169        9_6     0.991    36.30 1.1e-04   3.67
646402   rs57684439      13_45     0.991    30.20 8.7e-05   4.33
715490   rs17616063      16_27     0.991    29.68 8.6e-05  -5.05
146264    rs1605068       3_36     0.989    29.43 8.5e-05   5.00
79850     rs1621048       2_40     0.988    32.88 9.5e-05  -4.94
123608    rs4674919      2_132     0.988    38.03 1.1e-04   6.33
596705  rs117564283      12_32     0.988    32.54 9.4e-05   5.83
694073  rs143717852      15_31     0.988    84.19 2.4e-04  -8.48
725533  rs112290554      16_45     0.988    84.92 2.4e-04  -9.40
1189830  rs75621460      19_28     0.988    32.71 9.4e-05  -5.82
528896   rs12355020      10_59     0.987    30.68 8.8e-05  -6.10
591238  rs113987763      12_21     0.987   158.06 4.6e-04  10.27
794593    rs6136911      20_14     0.987    56.52 1.6e-04  -9.34
67760    rs62127724       2_15     0.984   286.23 8.2e-04  17.32
319476    rs2524082       6_25     0.984    43.24 1.2e-04  -6.71
725676   rs72823102      16_46     0.982    28.38 8.1e-05   5.44
522001   rs11597602      10_46     0.981    31.15 8.9e-05  -4.85
550482    rs3741407      11_19     0.981    27.92 8.0e-05  -3.87
612155    rs4764939      12_62     0.979    40.68 1.2e-04   6.25
427501   rs11780047       8_27     0.977    36.12 1.0e-04  -5.84
293944   rs35914524       5_80     0.976    32.78 9.3e-05   4.56
781058    rs7249790      19_22     0.976    30.58 8.7e-05  -2.65
824959     rs138703      22_15     0.976   129.00 3.7e-04 -11.01
275952   rs77561962       5_45     0.975    33.95 9.7e-05   5.78
407697   rs12155147       7_84     0.975    30.71 8.7e-05   5.40
244621   rs17540470      4_109     0.974    33.25 9.5e-05   5.79
351756  rs142620810       6_85     0.974    28.69 8.2e-05   5.13
794710    rs3827963      20_14     0.973    34.52 9.8e-05  -6.07
48912     rs3754140      1_108     0.972    66.15 1.9e-04   6.87
534220   rs12244851      10_70     0.972    33.52 9.5e-05   5.60
160365    rs4928057       3_64     0.970    32.06 9.1e-05  -7.36
423109   rs75886735       8_17     0.970    27.77 7.9e-05   4.94
558974    rs1203614      11_37     0.970    26.92 7.6e-05   4.20
612019    rs1874872      12_62     0.969    46.20 1.3e-04  -1.20
677131   rs17090693      14_48     0.969    33.44 9.5e-05   4.21
727386  rs558760274       17_1     0.969    25.49 7.2e-05   4.74
703560   rs58060839      15_48     0.968    37.30 1.1e-04  -5.24
725485   rs12934751      16_45     0.967   130.75 3.7e-04  11.08
771916   rs62104512      18_46     0.967    48.51 1.4e-04  -6.88
567000   rs12795994      11_53     0.965    26.55 7.5e-05  -5.31
460340   rs13253652       8_92     0.964    27.99 7.9e-05   2.53
1174287  rs12720356       19_9     0.964   123.22 3.5e-04 -14.75
1119519   rs4782568      16_48     0.963   122.73 3.5e-04 -11.28
546646   rs61885960      11_11     0.960    29.87 8.4e-05   5.10
316980  rs140967207       6_21     0.959    30.54 8.6e-05   5.10
785403    rs7249509      19_32     0.958    28.96 8.1e-05  -4.98
362991   rs76523601      6_108     0.957    49.01 1.4e-04  -3.70
371285    rs7802610       7_15     0.955    26.60 7.4e-05   5.19
799590    rs6103338      20_27     0.955    31.71 8.8e-05   5.45
192341    rs3748034        4_4     0.954    30.84 8.6e-05  -6.03
764877    rs9953884      18_31     0.951    55.23 1.5e-04   6.80
401256    rs1868757       7_70     0.950    27.17 7.5e-05   5.35
627127    rs7999704       13_9     0.950    29.44 8.2e-05  -5.10
125911   rs12478406      2_136     0.949    85.53 2.4e-04  -2.12
740747   rs12947269      17_34     0.948    27.54 7.6e-05  -5.71
382201   rs13230267       7_35     0.945    31.04 8.6e-05   5.19
389972   rs11762191       7_47     0.944    58.63 1.6e-04   8.71
554918   rs11039134      11_29     0.944    55.04 1.5e-04 -10.08
664147   rs10136844      14_21     0.944    27.38 7.6e-05  -4.95
686996    rs3803361      15_13     0.943    25.73 7.1e-05  -4.74
692287    rs2414752      15_28     0.943    30.77 8.5e-05  -4.32
709645   rs34967165      16_12     0.943    33.04 9.1e-05   5.36
48908      rs340835      1_108     0.942    42.95 1.2e-04  -6.14
591366   rs11051788      12_22     0.941    32.70 9.0e-05  -6.27
578390     rs765386      11_80     0.939    26.62 7.3e-05  -4.73
649246     rs892252      13_51     0.938    25.28 6.9e-05   4.66
1000975  rs35887778       7_61     0.938    39.18 1.1e-04   6.85
420585   rs77304020       8_14     0.937    40.01 1.1e-04  -5.57
135486    rs2227998       3_10     0.936    43.32 1.2e-04   6.10
528925   rs78382982      10_59     0.936    26.42 7.2e-05   5.10
172804   rs58020426       3_87     0.935    24.67 6.7e-05  -4.30
807037    rs2823025       21_2     0.934    25.03 6.8e-05  -4.70
279359  rs557184468       5_52     0.933    38.51 1.0e-04  -7.51
317897    rs3130253       6_23     0.931    41.22 1.1e-04   3.99
688603   rs12050772      15_20     0.931    56.29 1.5e-04  -7.07
760530     rs991014      18_24     0.931    34.74 9.4e-05   5.69
306562   rs62389092      5_105     0.929    24.49 6.6e-05  -4.55
507384  rs750689165      10_16     0.929    38.91 1.1e-04  -7.35
322162   rs72880536       6_28     0.928    26.81 7.3e-05  -4.75
172752    rs4683606       3_86     0.927   194.72 5.3e-04 -13.36
512525    rs2505692      10_27     0.926    24.86 6.7e-05   3.78
91977     rs2166862       2_66     0.924    30.08 8.1e-05   5.18
740740    rs8074463      17_34     0.924    29.15 7.9e-05  -5.88
736881   rs17614452      17_26     0.923    28.11 7.6e-05   5.04
798182    rs2246443      20_23     0.921    25.08 6.7e-05   4.15
460331   rs56114972       8_92     0.919    24.24 6.5e-05  -3.81
522718     rs780662      10_47     0.918    25.23 6.8e-05   4.65
274320   rs10062008       5_43     0.914    25.60 6.8e-05   4.34
567044     rs509723      11_54     0.914    31.78 8.5e-05  -5.29
669289   rs34489253      14_32     0.911    46.32 1.2e-04  -7.04
489217     rs817854       9_54     0.909    27.50 7.3e-05   3.66
222436    rs1813867       4_66     0.908    32.23 8.5e-05  -6.79
800319  rs577036133      20_28     0.908    25.93 6.9e-05   4.55
38896     rs4442334       1_89     0.907    43.67 1.2e-04  -6.82
669340    rs3784139      14_32     0.907    29.63 7.9e-05  -6.39
186803    rs6782470      3_114     0.906    25.68 6.8e-05   4.51
182328   rs10653660      3_104     0.905    58.02 1.5e-04   7.76
584303   rs12824533      12_11     0.905    26.32 7.0e-05   3.80
616732  rs149837779      12_73     0.905    24.82 6.6e-05  -4.56
345813    rs2354558       6_71     0.903    24.01 6.3e-05   4.36
669880    rs4902841      14_33     0.903    25.61 6.8e-05   4.62
781006   rs73019624      19_21     0.899    38.40 1.0e-04  -6.29
455740    rs2648832       8_84     0.897    24.53 6.4e-05  -4.50
182182    rs4955590      3_104     0.894    26.95 7.0e-05  -5.25
57727    rs61833239      1_128     0.892    26.14 6.8e-05  -2.13
54893     rs4006577      1_122     0.890    24.83 6.5e-05   4.51
798811   rs62209440      20_24     0.889    25.27 6.6e-05  -4.64
345130    rs4515420       6_70     0.888    32.12 8.3e-05   5.30
164407  rs148695018       3_70     0.886    25.50 6.6e-05   4.53
754197    rs8093352      18_11     0.886    24.70 6.4e-05   4.28
623189    rs4294650       13_2     0.885    53.93 1.4e-04  -7.29
471037   rs10965488       9_17     0.883    28.58 7.4e-05   4.98
362054  rs777679051      6_106     0.881    30.19 7.8e-05  -5.19
110939  rs141607132      2_107     0.880    24.55 6.3e-05   4.41
702650    rs1464445      15_46     0.880    49.47 1.3e-04  -6.81
588393   rs74842514      12_17     0.879    32.42 8.3e-05  -5.42
697490   rs72734182      15_38     0.879    25.23 6.5e-05   4.39
92466     rs4849177       2_67     0.878    57.18 1.5e-04   7.63
414173   rs12698259       7_99     0.878    26.26 6.7e-05   3.95
12690    rs55869368       1_35     0.875    25.09 6.4e-05  -4.48
74102     rs2121564       2_28     0.875    26.57 6.8e-05  -4.80
23244   rs146501986       1_55     0.874   259.25 6.6e-04  16.90
483367    rs1360200       9_45     0.872    27.70 7.1e-05  -5.47
711617    rs6497339      16_18     0.871    34.43 8.8e-05  -5.53
1086977  rs11620783       14_3     0.870    67.08 1.7e-04  -7.45
397467   rs75082775       7_62     0.869    24.25 6.1e-05   4.27
435223   rs71519448       8_44     0.866    46.84 1.2e-04   2.30
573219   rs75794878      11_67     0.863    33.52 8.5e-05  -5.55
310709    rs2765359        6_7     0.861    36.13 9.1e-05  -4.63
1231463  rs62223645      21_17     0.859    37.77 9.5e-05   5.69
703612   rs35477848      15_48     0.857    25.68 6.4e-05  -4.01
693749   rs36120854      15_30     0.855    24.77 6.2e-05   4.28
526694    rs2607863      10_55     0.854    24.36 6.1e-05  -4.38
710631   rs35512524      16_15     0.854    27.03 6.7e-05   5.24
362924  rs118014721      6_108     0.853    85.75 2.1e-04   4.80
270931   rs12656462       5_35     0.851    38.27 9.5e-05  -5.81
746018    rs8065893      17_43     0.851    25.38 6.3e-05   4.44
789414   rs74273659       20_5     0.849    24.55 6.1e-05  -4.38
310758     rs545632        6_7     0.848    27.61 6.8e-05  -5.66
721277   rs71403855      16_38     0.847    26.22 6.5e-05   4.98
64327     rs5829382        2_8     0.844    25.69 6.3e-05   4.62
104620     rs834837       2_93     0.844    25.55 6.3e-05   4.57
575593   rs10892819      11_74     0.842    28.77 7.1e-05  -5.26
774171   rs10408455       19_5     0.842    46.20 1.1e-04  -6.30
577053   rs10893498      11_77     0.841    34.18 8.4e-05  -5.75
826844     rs136908      22_20     0.841    28.55 7.0e-05   5.05
134658   rs11128570        3_9     0.840    27.59 6.8e-05   5.33
185153    rs6793063      3_111     0.838    28.18 6.9e-05   4.88
630176   rs61630147      13_15     0.838   159.29 3.9e-04  12.88
147415   rs79987842       3_38     0.837    31.24 7.6e-05  -4.74
353332  rs765215967       6_89     0.837    25.08 6.1e-05  -4.40
666755    rs6573307      14_27     0.836    92.87 2.3e-04  10.00
138522   rs17400314       3_17     0.835    26.15 6.4e-05   5.14
310782    rs9379083        6_7     0.835    49.95 1.2e-04   5.84
825934    rs2267452      22_18     0.835    26.65 6.5e-05   4.72
172091     rs940191       3_85     0.832    38.48 9.4e-05  -6.92
430428   rs10087804       8_33     0.831    28.57 6.9e-05   4.98
803620    rs6127693      20_33     0.831    30.15 7.3e-05   5.95
381886   rs11773764       7_34     0.828    86.99 2.1e-04  12.06
574860   rs56246162      11_72     0.828    24.60 6.0e-05  -4.42
776977  rs146213062      19_12     0.828    24.74 6.0e-05  -4.44
308080   rs77507057      5_110     0.825    44.55 1.1e-04   6.48
744428    rs7216472      17_41     0.825    35.52 8.6e-05  -5.77
381581   rs10246245       7_33     0.822    87.38 2.1e-04   7.96
775198   rs10401485       19_7     0.822    36.41 8.7e-05   6.15
1227176 rs113455659      21_17     0.822   168.47 4.0e-04  15.87
821669    rs9608723       22_9     0.820    37.00 8.9e-05  -6.39
405653    rs4507692       7_79     0.819    35.54 8.5e-05  -5.67
494035  rs569990989       9_63     0.818    24.48 5.8e-05   4.45
824065    rs5755943      22_14     0.818    56.89 1.4e-04   7.67
322369    rs1187117       6_28     0.816    55.86 1.3e-04   7.74
706019   rs76814483       16_6     0.816    87.98 2.1e-04  -9.51
146233   rs34789050       3_35     0.811    37.38 8.8e-05   5.74
555293    rs5791853      11_29     0.811   140.11 3.3e-04  14.63
598027    rs2657880      12_35     0.810    35.25 8.3e-05  -5.97
458089    rs2315839       8_88     0.809    54.47 1.3e-04   7.50
1226914 rs149331216      21_17     0.808    60.12 1.4e-04   8.75
135578    rs1038300       3_10     0.807    25.94 6.1e-05  -4.30
677141   rs10151359      14_48     0.806    25.18 5.9e-05  -2.51
351551    rs2184968       6_84     0.801   746.96 1.7e-03  27.80
652663    rs1079971      13_59     0.801    25.64 6.0e-05   4.33

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
185023 rs146797780      3_110     1.000 92556.81 0.2700 -5.92
185024   rs7636471      3_110     1.000 92458.89 0.2700 -5.66
185026   rs6769162      3_110     0.000 89796.79 0.0000 -5.56
185007   rs6807293      3_110     0.000 82366.01 0.0000 -5.50
184995   rs6794252      3_110     0.000 82271.39 0.0000 -5.52
185027   rs9838117      3_110     0.000 71294.88 0.0000 -4.83
185001   rs9844482      3_110     0.000 57802.40 0.0000 -5.15
185005  rs34435186      3_110     0.000 45724.25 0.0000 -3.87
634704 rs775834524      13_25     1.000 37910.53 0.1100 -4.23
634702   rs7999449      13_25     1.000 37832.08 0.1100 -4.29
634694   rs7337153      13_25     0.032 37797.15 0.0036 -4.27
634699   rs9537143      13_25     0.142 37685.46 0.0160  4.38
634698   rs9597193      13_25     0.033 37681.88 0.0036  4.38
634697   rs9527401      13_25     0.033 37681.66 0.0037  4.38
634695   rs9527399      13_25     0.042 37681.49 0.0046  4.38
634693   rs9537125      13_25     0.012 37655.70 0.0013  4.37
634692   rs9527398      13_25     0.012 37655.54 0.0013  4.37
634690   rs9537123      13_25     0.024 37653.21 0.0027  4.39
634684   rs2937326      13_25     0.000 36976.23 0.0000 -4.31
634683   rs3013347      13_25     0.000 36976.08 0.0000 -4.30
634685   rs9597179      13_25     0.000 36855.00 0.0000  4.38
634709   rs9537159      13_25     0.000 36210.34 0.0000 -4.46
634715    rs539380      13_25     0.000 36166.27 0.0000 -4.45
634686   rs9537116      13_25     0.000 36155.29 0.0000  4.30
634708  rs35800055      13_25     0.000 36079.30 0.0000  4.56
634705   rs4536353      13_25     0.000 36076.43 0.0000  4.57
634707  rs67100646      13_25     0.000 36076.22 0.0000  4.58
634706   rs4296148      13_25     0.000 36075.00 0.0000  4.57
634712   rs7994036      13_25     0.000 36066.22 0.0000  4.56
634710   rs9597201      13_25     0.000 36064.82 0.0000  4.57
634714   rs9537174      13_25     0.000 36063.45 0.0000  4.55
634681   rs3105089      13_25     0.000 34300.16 0.0000 -4.31
634680   rs3124374      13_25     0.000 34092.70 0.0000 -4.40
634679   rs2315886      13_25     0.000 34081.88 0.0000 -4.42
634678   rs2315887      13_25     0.000 34081.80 0.0000 -4.42
634670   rs2315898      13_25     0.000 34043.08 0.0000 -4.40
634672   rs3105045      13_25     0.000 34035.60 0.0000 -4.44
634673   rs2315895      13_25     0.000 34035.50 0.0000 -4.43
634674   rs3124405      13_25     0.000 34035.07 0.0000 -4.44
634668   rs7317475      13_25     0.000 33998.21 0.0000 -4.34
634676   rs3124402      13_25     0.000 33983.83 0.0000 -4.37
634660   rs4635225      13_25     0.000 33919.33 0.0000 -4.32
634662    rs616312      13_25     0.000 33919.10 0.0000 -4.31
634665    rs520268      13_25     0.000 33919.10 0.0000 -4.31
634657   rs1960704      13_25     0.000 33917.24 0.0000 -4.32
634721   rs9569325      13_25     0.000 33607.09 0.0000 -3.92
634726   rs2095219      13_25     0.000 33481.64 0.0000 -3.81
634718    rs480215      13_25     0.000 33457.57 0.0000 -3.84
634725   rs4885924      13_25     0.000 33409.39 0.0000 -3.82
634724   rs4885918      13_25     0.000 33320.21 0.0000 -3.81

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
185023  rs146797780      3_110     1.000 92556.81 0.27000  -5.92
185024    rs7636471      3_110     1.000 92458.89 0.27000  -5.66
634702    rs7999449      13_25     1.000 37832.08 0.11000  -4.29
634704  rs775834524      13_25     1.000 37910.53 0.11000  -4.23
1105207 rs112720618       16_2     1.000 19426.13 0.05700  -7.54
1105208  rs56404919       16_2     1.000 19267.26 0.05600  -7.54
512782   rs71007692      10_28     1.000  9582.85 0.02800   2.95
1044750 rs145982925      11_21     1.000  7176.60 0.02100   3.22
1044751  rs35827570      11_21     1.000  7167.73 0.02100   1.83
53599   rs766167074      1_118     1.000  5864.16 0.01700   2.75
634699    rs9537143      13_25     0.142 37685.46 0.01600   4.38
512779    rs9299760      10_28     0.506  9562.78 0.01400   2.94
512788    rs2472183      10_28     0.499  9567.10 0.01400   2.91
512791   rs11011452      10_28     0.394  9567.43 0.01100   2.89
512781    rs2474565      10_28     0.343  9566.86 0.00960   2.90
855823   rs35130213       1_19     1.000  2596.49 0.00760  -3.96
855825    rs2236854       1_19     1.000  2595.88 0.00760  -3.85
381950     rs700752       7_34     1.000  2229.11 0.00650  47.41
53597     rs2486737      1_118     0.296  5896.79 0.00510   2.27
53598      rs971534      1_118     0.281  5896.77 0.00480   2.27
634695    rs9527399      13_25     0.042 37681.49 0.00460   4.38
634697    rs9527401      13_25     0.033 37681.66 0.00370   4.38
53605     rs2248646      1_118     0.208  5894.78 0.00360   2.28
634694    rs7337153      13_25     0.032 37797.15 0.00360  -4.27
634698    rs9597193      13_25     0.033 37681.88 0.00360   4.38
53593     rs2790891      1_118     0.166  5896.19 0.00290   2.26
53594     rs2491405      1_118     0.166  5896.19 0.00290   2.26
53606     rs2211176      1_118     0.169  5894.90 0.00290   2.27
53607     rs2790882      1_118     0.169  5894.90 0.00290   2.27
157632  rs768688512       3_58     1.000   976.27 0.00290  -3.54
634690    rs9537123      13_25     0.024 37653.21 0.00270   4.39
53596    rs10489611      1_118     0.141  5896.45 0.00240   2.26
157616   rs56320121       3_58     1.000   787.64 0.00230  -3.10
53590     rs2256908      1_118     0.123  5896.07 0.00210   2.26
351551    rs2184968       6_84     0.801   746.96 0.00170  27.80
512986  rs199841839      10_28     0.129  3904.31 0.00150   5.64
1104191  rs80253441       16_2     0.719   691.87 0.00150 -12.35
52633      rs287613      1_116     1.000   468.58 0.00140   3.46
52639    rs71180790      1_116     1.000   464.95 0.00140   2.98
405874     rs125124       7_80     1.000   474.47 0.00140  22.58
909185    rs1260326       2_16     1.000   477.84 0.00140  25.55
157631    rs6765538       3_58     0.467   970.48 0.00130  -3.39
634692    rs9527398      13_25     0.012 37655.54 0.00130   4.37
634693    rs9537125      13_25     0.012 37655.70 0.00130   4.37
1163159      rs5388      17_37     1.000   434.31 0.00130  22.63
512990  rs141987073      10_28     0.105  3905.54 0.00120   5.62
541789   rs11042594       11_2     1.000   399.03 0.00120  17.70
541799   rs17885785       11_2     1.000   360.79 0.00110  24.68
53611     rs2790874      1_118     0.060  5887.45 0.00100   2.28
541801    rs3842762       11_2     1.000   329.30 0.00096 -19.28

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
381950   rs700752       7_34     1.000 2229.11 6.5e-03  47.41
381949  rs1917609       7_34     0.000 1616.43 1.7e-17 -39.95
381939  rs7801650       7_34     0.000 1540.26 1.3e-17 -39.07
381942  rs7782135       7_34     0.000 1539.07 1.3e-17 -39.06
381940  rs7788438       7_34     0.000 1537.10 1.2e-17 -39.03
381933 rs35692095       7_34     0.000 1517.39 1.0e-17 -38.79
381935  rs4724488       7_34     0.000 1518.13 1.1e-17 -38.78
611932  rs5742678      12_61     0.531  535.69 8.3e-04 -29.02
611924  rs1520222      12_61     0.469  535.13 7.3e-04 -28.95
351551  rs2184968       6_84     0.801  746.96 1.7e-03  27.80
351549  rs4897179       6_84     0.192  744.80 4.2e-04  27.76
351552  rs1361109       6_84     0.009  736.72 1.9e-05  27.64
351554  rs4895808       6_84     0.007  735.64 1.5e-05  27.62
351555  rs1844594       6_84     0.006  734.55 1.2e-05  27.60
351559  rs9398810       6_84     0.005  733.05 1.0e-05  27.57
351560  rs9401885       6_84     0.005  733.72 1.1e-05  27.57
351557  rs9372839       6_84     0.004  729.06 8.1e-06  27.50
351543  rs2326387       6_84     0.003  712.19 6.7e-06  27.14
351546  rs1361262       6_84     0.003  712.38 6.8e-06  27.14
351542  rs9375435       6_84     0.003  703.38 6.6e-06  26.97
351565  rs6921183       6_84     0.011  633.18 2.1e-05  25.91
351566  rs9401890       6_84     0.011  631.98 2.0e-05  25.89
351567  rs9375448       6_84     0.011  630.02 2.0e-05  25.85
351573  rs9491653       6_84     0.008  613.08 1.4e-05  25.55
909185  rs1260326       2_16     1.000  477.84 1.4e-03  25.55
351572  rs4629707       6_84     0.007  611.29 1.3e-05  25.53
351571  rs7738836       6_84     0.007  611.06 1.3e-05  25.52
351575  rs9375449       6_84     0.007  611.46 1.3e-05  25.52
351577  rs4895813       6_84     0.007  611.00 1.3e-05  25.51
351580 rs11154367       6_84     0.008  611.24 1.4e-05  25.51
351581   rs853987       6_84     0.007  606.94 1.2e-05 -25.44
541800  rs2239681       11_2     1.000  233.35 6.8e-04 -25.38
611926  rs6539035      12_61     0.000  471.85 4.1e-15 -25.18
611933  rs6539036      12_61     0.000  470.85 3.4e-15 -25.16
611930  rs4764696      12_61     0.000  470.35 3.1e-15 -25.14
351563  rs6925689       6_84     0.007  589.09 1.2e-05  25.05
381951   rs856541       7_34     0.000  716.93 1.8e-12  24.79
909205   rs780094       2_16     0.000  437.98 1.1e-07  24.70
909207   rs780093       2_16     0.000  438.02 1.1e-07  24.69
541799 rs17885785       11_2     1.000  360.79 1.1e-03  24.68
908972  rs4665972       2_16     0.000  450.56 1.3e-07  24.67
351582  rs1101563       6_84     0.006  568.61 9.3e-06 -24.62
351585   rs979197       6_84     0.005  566.88 8.9e-06 -24.58
351586  rs1015446       6_84     0.005  563.38 8.7e-06 -24.51
381944   rs856586       7_34     0.000  652.03 3.5e-15  24.07
909236 rs11127048       2_16     0.000  421.88 1.4e-07  23.98
909192  rs6547692       2_16     0.000  367.07 6.6e-08  22.87
909203   rs780096       2_16     0.000  364.85 9.4e-08  22.75
909204   rs780095       2_16     0.000  364.62 9.3e-08  22.75
909221  rs1260334       2_16     0.000  361.24 9.0e-08  22.66

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] 53
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 Adjusted.P.value
1  protein kinase activator activity (GO:0030295)    3/63       0.04245936
2 insulin-like growth factor binding (GO:0005520)    2/15       0.04245936
               Genes
1 MAP2K2;RICTOR;GAS6
2       IGFALS;IGF2R
ZFPM1 gene(s) from the input list not found in DisGeNET CURATEDZNF276 gene(s) from the input list not found in DisGeNET CURATEDKMT5C gene(s) from the input list not found in DisGeNET CURATEDTMEM176B gene(s) from the input list not found in DisGeNET CURATEDTLCD2 gene(s) from the input list not found in DisGeNET CURATEDGTF2H1 gene(s) from the input list not found in DisGeNET CURATEDUBE2K gene(s) from the input list not found in DisGeNET CURATEDRP11-442O1.3 gene(s) from the input list not found in DisGeNET CURATEDCCDC97 gene(s) from the input list not found in DisGeNET CURATEDPALM3 gene(s) from the input list not found in DisGeNET CURATEDB3GNT3 gene(s) from the input list not found in DisGeNET CURATEDACTR1B gene(s) from the input list not found in DisGeNET CURATEDZNF845 gene(s) from the input list not found in DisGeNET CURATEDLRGUK gene(s) from the input list not found in DisGeNET CURATEDAC004540.5 gene(s) from the input list not found in DisGeNET CURATEDC11orf96 gene(s) from the input list not found in DisGeNET CURATEDAES gene(s) from the input list not found in DisGeNET CURATEDZNF582 gene(s) from the input list not found in DisGeNET CURATEDSYTL1 gene(s) from the input list not found in DisGeNET CURATEDMPPED2 gene(s) from the input list not found in DisGeNET CURATEDFAAP20 gene(s) from the input list not found in DisGeNET CURATEDPSRC1 gene(s) from the input list not found in DisGeNET CURATED
                                    Description        FDR Ratio BgRatio
54                    Leukemia, T-Cell, Chronic 0.02721088  1/31  1/9703
109           Paramyotonia Congenita (disorder) 0.02721088  1/31  1/9703
136             Acute Undifferentiated Leukemia 0.02721088  1/31  1/9703
147      Trichorhinophalangeal dysplasia type I 0.02721088  1/31  1/9703
148      Enteropathy-Associated T-Cell Lymphoma 0.02721088  1/31  1/9703
157                          Myotonic Disorders 0.02721088  1/31  1/9703
178               Myotonia Fluctuans (disorder) 0.02721088  1/31  1/9703
179        Undifferentiated type acute leukemia 0.02721088  1/31  1/9703
192 Acute myeloid leukemia, 11q23 abnormalities 0.02721088  1/31  1/9703
198        Leukemia, Large Granular Lymphocytic 0.02721088  1/31  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