Last updated: 2022-03-14

Checks: 5 2

Knit directory: cTWAS_analysis/

This reproducible R Markdown analysis was created with workflowr (version 1.7.0). 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 is untracked by Git. 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(20211220) 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.

Using absolute paths to the files within your workflowr project makes it difficult for you and others to run your code on a different machine. Change the absolute path(s) below to the suggested relative path(s) to make your code more reproducible.

absolute relative
/project2/xinhe/shengqian/cTWAS/cTWAS_analysis/data/ data
/project2/xinhe/shengqian/cTWAS/cTWAS_analysis/code/ctwas_config.R code/ctwas_config.R

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 4c71b11. 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:


Ignored files:
    Ignored:    .ipynb_checkpoints/
    Ignored:    data/AF/

Untracked files:
    Untracked:  Rplot.png
    Untracked:  analysis/.ipynb_checkpoints/
    Untracked:  analysis/SCZ_2014_EUR_Brain_Amygdala.Rmd
    Untracked:  analysis/SCZ_2014_EUR_Brain_Anterior_cingulate_cortex_BA24.Rmd
    Untracked:  analysis/SCZ_2014_EUR_Brain_Caudate_basal_ganglia.Rmd
    Untracked:  analysis/SCZ_2014_EUR_Brain_Cerebellar_Hemisphere.Rmd
    Untracked:  analysis/SCZ_2014_EUR_Brain_Cerebellum.Rmd
    Untracked:  analysis/SCZ_2014_EUR_Brain_Cortex.Rmd
    Untracked:  analysis/SCZ_2014_EUR_Brain_Frontal_Cortex_BA9.Rmd
    Untracked:  analysis/SCZ_2014_EUR_Brain_Hippocampus.Rmd
    Untracked:  analysis/SCZ_2014_EUR_Brain_Hypothalamus.Rmd
    Untracked:  analysis/SCZ_2014_EUR_Brain_Nucleus_accumbens_basal_ganglia.Rmd
    Untracked:  analysis/SCZ_2014_EUR_Brain_Putamen_basal_ganglia.Rmd
    Untracked:  analysis/SCZ_2014_EUR_Brain_Spinal_cord_cervical_c-1.Rmd
    Untracked:  analysis/SCZ_2014_EUR_Brain_Substantia_nigra.Rmd
    Untracked:  analysis/SCZ_2020_Brain_Cortex.Rmd
    Untracked:  analysis/SCZ_2020_Brain_Frontal_Cortex_BA9.Rmd
    Untracked:  analysis/SCZ_2020_Brain_Hypothalamus.Rmd
    Untracked:  analysis/SCZ_2020_Brain_Putamen_basal_ganglia.Rmd
    Untracked:  analysis/SCZ_Cross_Tissue_Analysis.Rmd
    Untracked:  code/.ipynb_checkpoints/
    Untracked:  code/AF_out/
    Untracked:  code/Autism_out/
    Untracked:  code/BMI_S_out/
    Untracked:  code/BMI_out/
    Untracked:  code/Glucose_out/
    Untracked:  code/LDL_S_out/
    Untracked:  code/SCZ_2014_EUR_out/
    Untracked:  code/SCZ_2020_out/
    Untracked:  code/SCZ_S_out/
    Untracked:  code/SCZ_out/
    Untracked:  code/T2D_out/
    Untracked:  code/ctwas_config.R
    Untracked:  code/mapping.R
    Untracked:  code/out/
    Untracked:  code/run_AF_analysis.sbatch
    Untracked:  code/run_AF_analysis.sh
    Untracked:  code/run_AF_ctwas_rss_LDR.R
    Untracked:  code/run_Autism_analysis.sbatch
    Untracked:  code/run_Autism_analysis.sh
    Untracked:  code/run_Autism_ctwas_rss_LDR.R
    Untracked:  code/run_BMI_analysis.sbatch
    Untracked:  code/run_BMI_analysis.sh
    Untracked:  code/run_BMI_analysis_S.sbatch
    Untracked:  code/run_BMI_analysis_S.sh
    Untracked:  code/run_BMI_ctwas_rss_LDR.R
    Untracked:  code/run_BMI_ctwas_rss_LDR_S.R
    Untracked:  code/run_Glucose_analysis.sbatch
    Untracked:  code/run_Glucose_analysis.sh
    Untracked:  code/run_Glucose_ctwas_rss_LDR.R
    Untracked:  code/run_LDL_analysis_S.sbatch
    Untracked:  code/run_LDL_analysis_S.sh
    Untracked:  code/run_LDL_ctwas_rss_LDR_S.R
    Untracked:  code/run_SCZ_2014_EUR_analysis.sbatch
    Untracked:  code/run_SCZ_2014_EUR_analysis.sh
    Untracked:  code/run_SCZ_2014_EUR_ctwas_rss_LDR.R
    Untracked:  code/run_SCZ_2020_analysis.sbatch
    Untracked:  code/run_SCZ_2020_analysis.sh
    Untracked:  code/run_SCZ_2020_ctwas_rss_LDR.R
    Untracked:  code/run_SCZ_analysis.sbatch
    Untracked:  code/run_SCZ_analysis.sh
    Untracked:  code/run_SCZ_analysis_S.sbatch
    Untracked:  code/run_SCZ_analysis_S.sh
    Untracked:  code/run_SCZ_ctwas_rss_LDR.R
    Untracked:  code/run_SCZ_ctwas_rss_LDR_S.R
    Untracked:  code/run_T2D_analysis.sbatch
    Untracked:  code/run_T2D_analysis.sh
    Untracked:  code/run_T2D_ctwas_rss_LDR.R
    Untracked:  code/wflow_build.R
    Untracked:  code/wflow_build.sbatch
    Untracked:  data/.ipynb_checkpoints/
    Untracked:  data/BMI/
    Untracked:  data/PGC3_SCZ_wave3_public.v2.tsv
    Untracked:  data/SCZ/
    Untracked:  data/SCZ_2014_EUR/
    Untracked:  data/SCZ_2020/
    Untracked:  data/SCZ_S/
    Untracked:  data/T2D/
    Untracked:  data/UKBB/
    Untracked:  data/UKBB_SNPs_Info.text
    Untracked:  data/gene_OMIM.txt
    Untracked:  data/gene_pip_0.8.txt
    Untracked:  data/mashr_Heart_Atrial_Appendage.db
    Untracked:  data/mashr_sqtl/
    Untracked:  data/summary_known_genes_annotations.xlsx
    Untracked:  data/untitled.txt

Unstaged changes:
    Modified:   analysis/SCZ_Brain_Amygdala.Rmd
    Modified:   analysis/SCZ_Brain_Anterior_cingulate_cortex_BA24.Rmd
    Modified:   analysis/SCZ_Brain_Caudate_basal_ganglia.Rmd
    Modified:   analysis/SCZ_Brain_Cerebellar_Hemisphere.Rmd
    Modified:   analysis/SCZ_Brain_Cerebellum.Rmd
    Modified:   analysis/SCZ_Brain_Cortex.Rmd
    Modified:   analysis/SCZ_Brain_Frontal_Cortex_BA9.Rmd
    Modified:   analysis/SCZ_Brain_Hippocampus.Rmd
    Modified:   analysis/SCZ_Brain_Hypothalamus.Rmd
    Modified:   analysis/SCZ_Brain_Nucleus_accumbens_basal_ganglia.Rmd
    Modified:   analysis/SCZ_Brain_Putamen_basal_ganglia.Rmd
    Modified:   analysis/SCZ_Brain_Spinal_cord_cervical_c-1.Rmd
    Modified:   analysis/SCZ_Brain_Substantia_nigra.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.


There are no past versions. Publish this analysis with wflow_publish() to start tracking its development.


Weight QC

#number of imputed weights
nrow(qclist_all)
[1] 10130
#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  16  17  18  19  20 
974 719 585 395 492 585 485 379 386 397 581 591 215 338 351 444 595 160 773 303 
 21  22 
121 261 
#number of imputed weights without missing variants
sum(qclist_all$nmiss==0)
[1] 7997
#proportion of imputed weights without missing variants
mean(qclist_all$nmiss==0)
[1] 0.7894

Check convergence of parameters

#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.0120866 0.0002603 
#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 
10.620  8.098 
#report sample size
print(sample_size)
[1] 77096
#report group size
group_size <- c(nrow(ctwas_gene_res), n_snps)
print(group_size)
[1]   10130 7352670
#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.01687 0.20105 
#compare sum(PIP*mu2/sample_size) with above PVE calculation
c(sum(ctwas_gene_res$PVE),sum(ctwas_snp_res$PVE))
[1] 0.07211 1.72482

Genes with highest PIPs

        genename region_tag susie_pip   mu2       PVE      z num_eqtl
10447     ZNF823      19_10    0.9812 29.69 0.0003779  5.485        1
5935     ARFGAP2      11_29    0.9426 25.52 0.0003120  4.839        1
3025      MAP7D1       1_22    0.9221 25.98 0.0003107  5.058        1
2890       SF3B1      2_117    0.9090 45.13 0.0005321  6.784        1
11504 AC012074.2       2_15    0.8675 21.80 0.0002452  4.457        2
8557     MAP3K11      11_36    0.8541 22.88 0.0002535 -4.409        1
104        ELAC2      17_11    0.8446 21.79 0.0002387  4.518        1
3216       HSDL2       9_57    0.7845 22.13 0.0002251  4.378        1
2823      LMAN2L       2_57    0.7344 23.58 0.0002246 -4.454        2
3886      SPECC1      17_16    0.7326 23.29 0.0002213 -4.591        1
2760      PDCD10      3_103    0.7122 20.41 0.0001886 -4.030        1
9840     TMEM222       1_19    0.7116 23.53 0.0002172  3.936        2
3391     TBC1D15      12_44    0.6959 22.66 0.0002045  4.461        2
2445         MDK      11_28    0.6770 38.32 0.0003365 -6.344        1
3741        KLC1      14_54    0.6618 41.08 0.0003526  6.933        1
8880      DIRAS1       19_3    0.6540 21.35 0.0001811  4.119        1
8068      INO80E      16_24    0.6482 38.30 0.0003220  6.230        1
1568    KIAA0391       14_9    0.6447 23.53 0.0001967 -4.788        2
8916        LY6H       8_94    0.6192 23.06 0.0001852  4.236        1
5581     FAM134A      2_129    0.5715 23.55 0.0001746 -4.682        2

Genes with largest effect sizes

       genename region_tag susie_pip     mu2       PVE      z num_eqtl
12858 HIST1H2BO       6_21 8.042e-11 1705.20 1.779e-12 -7.423        1
9594   HIST1H1B       6_21 1.743e-14 1148.25 2.596e-16 -8.699        1
11457 HIST1H2BN       6_21 1.414e-06  969.11 1.778e-08 10.773        1
6434      MMP16       8_63 0.000e+00  509.49 0.000e+00  3.645        1
11416  HLA-DQB2       6_26 5.551e-16  242.45 1.746e-18 -3.919        1
11576  HLA-DQA2       6_26 5.551e-16  242.45 1.746e-18 -3.919        1
10760      APOM       6_26 1.079e-08  201.55 2.821e-11  8.945        1
10755   ABHD16A       6_26 8.934e-09  201.25 2.332e-11  8.934        1
11740       C4A       6_26 2.019e-10  192.59 5.044e-13  8.445        1
10753      MSH5       6_26 0.000e+00  190.83 0.000e+00  7.722        1
10989     DDAH2       6_26 0.000e+00  187.23 0.000e+00  7.661        1
10266  HLA-DQA1       6_26 0.000e+00  157.40 0.000e+00 -1.344        2
3613  HIST1H2BJ       6_21 0.000e+00  148.31 0.000e+00  1.674        1
10158  HLA-DRB1       6_26 0.000e+00  139.84 0.000e+00  5.148        1
10762      BAG6       6_26 1.110e-16  129.77 1.869e-19  6.613        1
10727      PBX2       6_26 0.000e+00  126.29 0.000e+00  3.355        1
10984     ATF6B       6_26 0.000e+00  117.45 0.000e+00  3.821        1
2073       MPP6       7_21 1.278e-02  109.91 1.822e-05 -3.302        1
10747   C6orf48       6_26 2.220e-16   98.21 2.829e-19  5.387        2
10732     PRRT1       6_26 0.000e+00   95.47 0.000e+00 -7.907        1

Genes with highest PVE

        genename region_tag susie_pip   mu2       PVE      z num_eqtl
2890       SF3B1      2_117    0.9090 45.13 0.0005321  6.784        1
10447     ZNF823      19_10    0.9812 29.69 0.0003779  5.485        1
3741        KLC1      14_54    0.6618 41.08 0.0003526  6.933        1
2445         MDK      11_28    0.6770 38.32 0.0003365 -6.344        1
8068      INO80E      16_24    0.6482 38.30 0.0003220  6.230        1
5935     ARFGAP2      11_29    0.9426 25.52 0.0003120  4.839        1
3025      MAP7D1       1_22    0.9221 25.98 0.0003107  5.058        1
8557     MAP3K11      11_36    0.8541 22.88 0.0002535 -4.409        1
11504 AC012074.2       2_15    0.8675 21.80 0.0002452  4.457        2
104        ELAC2      17_11    0.8446 21.79 0.0002387  4.518        1
3216       HSDL2       9_57    0.7845 22.13 0.0002251  4.378        1
2823      LMAN2L       2_57    0.7344 23.58 0.0002246 -4.454        2
3886      SPECC1      17_16    0.7326 23.29 0.0002213 -4.591        1
7005       MAIP1      2_118    0.3907 43.09 0.0002183  7.321        1
7004        TYW5      2_118    0.3907 43.09 0.0002183 -7.321        1
9840     TMEM222       1_19    0.7116 23.53 0.0002172  3.936        2
3391     TBC1D15      12_44    0.6959 22.66 0.0002045  4.461        2
1568    KIAA0391       14_9    0.6447 23.53 0.0001967 -4.788        2
2760      PDCD10      3_103    0.7122 20.41 0.0001886 -4.030        1
8916        LY6H       8_94    0.6192 23.06 0.0001852  4.236        1

Genes with largest z scores

       genename region_tag susie_pip     mu2       PVE      z num_eqtl
11457 HIST1H2BN       6_21 1.414e-06  969.11 1.778e-08 10.773        1
10760      APOM       6_26 1.079e-08  201.55 2.821e-11  8.945        1
10755   ABHD16A       6_26 8.934e-09  201.25 2.332e-11  8.934        1
5732    PPP1R18       6_24 3.681e-04   89.59 4.278e-07  8.730        1
9594   HIST1H1B       6_21 1.743e-14 1148.25 2.596e-16 -8.699        1
11740       C4A       6_26 2.019e-10  192.59 5.044e-13  8.445        1
4810      PGBD1       6_22 6.452e-03   71.16 5.955e-06 -8.295        2
9231  HIST1H2BC       6_20 2.051e-02   50.70 1.349e-05 -7.978        1
10732     PRRT1       6_26 0.000e+00   95.47 0.000e+00 -7.907        1
10753      MSH5       6_26 0.000e+00  190.83 0.000e+00  7.722        1
10989     DDAH2       6_26 0.000e+00  187.23 0.000e+00  7.661        1
10729      RNF5       6_26 0.000e+00   89.08 0.000e+00  7.459        2
12858 HIST1H2BO       6_21 8.042e-11 1705.20 1.779e-12 -7.423        1
7005      MAIP1      2_118 3.907e-01   43.09 2.183e-04  7.321        1
7004       TYW5      2_118 3.907e-01   43.09 2.183e-04 -7.321        1
11468    TRIM26       6_24 2.888e-12   64.86 2.430e-15 -7.007        2
3741       KLC1      14_54 6.618e-01   41.08 3.526e-04  6.933        1
9836     BTN3A2       6_20 1.572e-01   51.01 1.040e-04  6.821        1
2890      SF3B1      2_117 9.090e-01   45.13 5.321e-04  6.784        1
10762      BAG6       6_26 1.110e-16  129.77 1.869e-19  6.613        1

Comparing z scores and PIPs

[1] 0.007601

GO enrichment analysis for genes with PIP>0.5

#number of genes for gene set enrichment
length(genes)
[1] 21
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"

                                                     Term Overlap
1 positive regulation of MAP kinase activity (GO:0043406)    3/69
  Adjusted.P.value                 Genes
1           0.0112 PDCD10;DIRAS1;MAP3K11
[1] "GO_Cellular_Component_2021"

[1] Term             Overlap          Adjusted.P.value Genes           
<0 rows> (or 0-length row.names)
[1] "GO_Molecular_Function_2021"

[1] Term             Overlap          Adjusted.P.value Genes           
<0 rows> (or 0-length row.names)

DisGeNET enrichment analysis for genes with PIP>0.5

                                               Description      FDR Ratio
46                      Cerebral Cavernous Malformations 3 0.006714   1/8
47       Reticular Dystrophy Of Retinal Pigment Epithelium 0.006714   1/8
50                Familial cerebral cavernous malformation 0.006714   1/8
53                          PROSTATE CANCER, HEREDITARY, 2 0.006714   1/8
55        COMBINED OXIDATIVE PHOSPHORYLATION DEFICIENCY 17 0.006714   1/8
56              MENTAL RETARDATION, AUTOSOMAL RECESSIVE 52 0.006714   1/8
57 RETINAL DYSTROPHY WITH OR WITHOUT EXTRAOCULAR ANOMALIES 0.006714   1/8
38              Refractory anemia with ringed sideroblasts 0.011746   1/8
49                           Cavernous Hemangioma of Brain 0.015656   1/8
19                                   Exudative retinopathy 0.016762   1/8
   BgRatio
46  1/9703
47  1/9703
50  1/9703
53  1/9703
55  1/9703
56  1/9703
57  1/9703
38  2/9703
49  3/9703
19  4/9703

WebGestalt enrichment analysis for genes with PIP>0.5

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

PIP Manhattan Plot

Warning: 'timedatectl' indicates the non-existent timezone name 'n/a'
Warning: Your system is mis-configured: '/etc/localtime' is not a symlink
Warning: It is strongly recommended to set envionment variable TZ to 'America/
Chicago' (or equivalent)

Sensitivity, specificity and precision for silver standard genes

#number of genes in known annotations
print(length(known_annotations))
[1] 130
#number of genes in known annotations with imputed expression
print(sum(known_annotations %in% ctwas_gene_res$genename))
[1] 57
#significance threshold for TWAS
print(sig_thresh)
[1] 4.567
#number of ctwas genes
length(ctwas_genes)
[1] 7
#number of TWAS genes
length(twas_genes)
[1] 77
#show novel genes (ctwas genes with not in TWAS genes)
ctwas_gene_res[ctwas_gene_res$genename %in% novel_genes,report_cols]
        genename region_tag susie_pip   mu2       PVE      z num_eqtl
11504 AC012074.2       2_15    0.8675 21.80 0.0002452  4.457        2
8557     MAP3K11      11_36    0.8541 22.88 0.0002535 -4.409        1
104        ELAC2      17_11    0.8446 21.79 0.0002387  4.518        1
#sensitivity / recall
print(sensitivity)
  ctwas    TWAS 
0.02308 0.04615 
#specificity
print(specificity)
 ctwas   TWAS 
0.9996 0.9930 
#precision / PPV
print(precision)
  ctwas    TWAS 
0.42857 0.07792 

cTWAS is more precise than TWAS in distinguishing silver standard and bystander genes

#number of genes in known annotations (with imputed expression)
print(length(known_annotations))
[1] 57
#number of bystander genes (with imputed expression)
print(length(unrelated_genes))
[1] 667
#subset results to genes in known annotations or bystanders
ctwas_gene_res_subset <- ctwas_gene_res[ctwas_gene_res$genename %in% c(known_annotations, unrelated_genes),]

#assign ctwas and TWAS genes
ctwas_genes <- ctwas_gene_res_subset$genename[ctwas_gene_res_subset$susie_pip>0.8]
twas_genes <- ctwas_gene_res_subset$genename[abs(ctwas_gene_res_subset$z)>sig_thresh]

#significance threshold for TWAS
print(sig_thresh)
[1] 4.567
#number of ctwas genes (in known annotations or bystanders)
length(ctwas_genes)
[1] 4
#number of TWAS genes (in known annotations or bystanders)
length(twas_genes)
[1] 15
#sensitivity / recall
sensitivity
  ctwas    TWAS 
0.05263 0.10526 
#specificity / (1 - False Positive Rate)
specificity
 ctwas   TWAS 
0.9985 0.9865 
#precision / PPV / (1 - False Discovery Rate)
precision
ctwas  TWAS 
 0.75  0.40 

pip_range <- (0:1000)/1000
sensitivity <- rep(NA, length(pip_range))
specificity <- rep(NA, length(pip_range))

for (index in 1:length(pip_range)){
  pip <- pip_range[index]
  ctwas_genes <- ctwas_gene_res_subset$genename[ctwas_gene_res_subset$susie_pip>=pip]
  sensitivity[index] <- sum(ctwas_genes %in% known_annotations)/length(known_annotations)
  specificity[index] <- sum(!(unrelated_genes %in% ctwas_genes))/length(unrelated_genes)
}

plot(1-specificity, sensitivity, type="l", xlim=c(0,1), ylim=c(0,1), main="", xlab="1 - Specificity", ylab="Sensitivity")
title(expression("ROC Curve for cTWAS (black) and TWAS (" * phantom("red") * ")"))
title(expression(phantom("ROC Curve for cTWAS (black) and TWAS (") * "red" * phantom(")")), col.main="red")

sig_thresh_range <- seq(from=0, to=max(abs(ctwas_gene_res_subset$z)), length.out=length(pip_range))

for (index in 1:length(sig_thresh_range)){
  sig_thresh_plot <- sig_thresh_range[index]
  twas_genes <- ctwas_gene_res_subset$genename[abs(ctwas_gene_res_subset$z)>=sig_thresh_plot]
  sensitivity[index] <- sum(twas_genes %in% known_annotations)/length(known_annotations)
  specificity[index] <- sum(!(unrelated_genes %in% twas_genes))/length(unrelated_genes)
}

lines(1-specificity, sensitivity, xlim=c(0,1), ylim=c(0,1), col="red", lty=1)

abline(a=0,b=1,lty=3)

#add previously computed points from the analysis
ctwas_genes <- ctwas_gene_res_subset$genename[ctwas_gene_res_subset$susie_pip>0.8]
twas_genes <- ctwas_gene_res_subset$genename[abs(ctwas_gene_res_subset$z)>sig_thresh]

points(1-specificity_plot["ctwas"], sensitivity_plot["ctwas"], pch=21, bg="black")
points(1-specificity_plot["TWAS"], sensitivity_plot["TWAS"], pch=21, bg="red")

Undetected silver standard genes have low TWAS z-scores or stronger signal from nearby variants

#table of outcomes for silver standard genes
-sort(-table(silver_standard_case))
silver_standard_case
          Not Imputed Insignificant z-score         Nearby SNP(s) 
                   73                    50                     4 
 Detected (PIP > 0.8) 
                    3 
#show inconclusive genes
silver_standard_case[silver_standard_case=="Inconclusive"]
named character(0)


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] parallel  stats4    stats     graphics  grDevices utils     datasets 
[8] methods   base     

other attached packages:
 [1] GenomicRanges_1.36.1 GenomeInfoDb_1.20.0  IRanges_2.18.1      
 [4] S4Vectors_0.22.1     BiocGenerics_0.30.0  biomaRt_2.40.1      
 [7] readxl_1.3.1         forcats_0.5.1        stringr_1.4.0       
[10] dplyr_1.0.7          purrr_0.3.4          readr_2.1.1         
[13] tidyr_1.1.4          tidyverse_1.3.1      tibble_3.1.6        
[16] WebGestaltR_0.4.4    disgenet2r_0.99.2    enrichR_3.0         
[19] cowplot_1.0.0        ggplot2_3.3.5        workflowr_1.7.0     

loaded via a namespace (and not attached):
  [1] ggbeeswarm_0.6.0       colorspace_2.0-2       rjson_0.2.20          
  [4] ellipsis_0.3.2         rprojroot_2.0.2        XVector_0.24.0        
  [7] fs_1.5.2               rstudioapi_0.13        farver_2.1.0          
 [10] ggrepel_0.9.1          bit64_4.0.5            AnnotationDbi_1.46.0  
 [13] fansi_1.0.2            lubridate_1.8.0        xml2_1.3.3            
 [16] codetools_0.2-16       doParallel_1.0.17      cachem_1.0.6          
 [19] knitr_1.36             jsonlite_1.7.2         apcluster_1.4.8       
 [22] Cairo_1.5-12.2         broom_0.7.10           dbplyr_2.1.1          
 [25] compiler_3.6.1         httr_1.4.2             backports_1.4.1       
 [28] assertthat_0.2.1       Matrix_1.2-18          fastmap_1.1.0         
 [31] cli_3.1.0              later_0.8.0            prettyunits_1.1.1     
 [34] htmltools_0.5.2        tools_3.6.1            igraph_1.2.10         
 [37] GenomeInfoDbData_1.2.1 gtable_0.3.0           glue_1.6.2            
 [40] reshape2_1.4.4         doRNG_1.8.2            Rcpp_1.0.8            
 [43] Biobase_2.44.0         cellranger_1.1.0       jquerylib_0.1.4       
 [46] vctrs_0.3.8            svglite_1.2.2          iterators_1.0.14      
 [49] xfun_0.29              ps_1.6.0               rvest_1.0.2           
 [52] lifecycle_1.0.1        rngtools_1.5.2         XML_3.99-0.3          
 [55] zlibbioc_1.30.0        getPass_0.2-2          scales_1.1.1          
 [58] vroom_1.5.7            hms_1.1.1              promises_1.0.1        
 [61] yaml_2.2.1             curl_4.3.2             memoise_2.0.1         
 [64] ggrastr_1.0.1          gdtools_0.1.9          stringi_1.7.6         
 [67] RSQLite_2.2.8          highr_0.9              foreach_1.5.2         
 [70] rlang_1.0.1            pkgconfig_2.0.3        bitops_1.0-7          
 [73] evaluate_0.14          lattice_0.20-38        labeling_0.4.2        
 [76] bit_4.0.4              processx_3.5.2         tidyselect_1.1.1      
 [79] plyr_1.8.6             magrittr_2.0.2         R6_2.5.1              
 [82] generics_0.1.1         DBI_1.1.2              pillar_1.6.4          
 [85] haven_2.4.3            whisker_0.3-2          withr_2.4.3           
 [88] RCurl_1.98-1.5         modelr_0.1.8           crayon_1.5.0          
 [91] utf8_1.2.2             tzdb_0.2.0             rmarkdown_2.11        
 [94] progress_1.2.2         grid_3.6.1             data.table_1.14.2     
 [97] blob_1.2.2             callr_3.7.0            git2r_0.26.1          
[100] reprex_2.0.1           digest_0.6.29          httpuv_1.5.1          
[103] munsell_0.5.0          beeswarm_0.2.3         vipor_0.4.5