Last updated: 2025-05-16
Checks: 7 0
Knit directory: Logica_Analysis/
This reproducible R Markdown analysis was created with workflowr (version 1.7.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
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(20250516)
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 f75c581. 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/_site.yml
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/Run_Logica.Rmd
) and HTML
(docs/Run_Logica.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 |
---|---|---|---|---|
html | 40d92e6 | borangao | 2025-05-16 | Build site. |
Rmd | 07263f2 | borangao | 2025-05-16 | Publish the initial files for myproject |
library(devtools)
# Install Logica
install_github("borangao/Logica",dependencies = FALSE)
── R CMD build ─────────────────────────────────────────────────────────────────
* checking for file ‘/tmp/RtmpHa3036/remotesafabd40a97eda/borangao-Logica-ee9bdd6/DESCRIPTION’ ... OK
* preparing ‘Logica’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building ‘Logica_0.1.0.tar.gz’
Warning: invalid uid value replaced by that for user 'nobody'
# Load Logica
library(Logica)
Use the example from Data preparation.
library(data.table)
library(Logica)
block_index = 1
trait = "LDL"
ancestry_1 = "EUR"
ancestry_2 = "EAS"
z1<-fread(file.path("/net/fantasia/home/borang/MALGC/pipeline_example/LDL/LDL_Block",paste0(trait , "_",ancestry_1,"_block_",block_index ,".txt")))
z2<-fread(file.path("/net/fantasia/home/borang/MALGC/pipeline_example/LDL/LDL_Block",paste0(trait , "_",ancestry_2,"_block_",block_index ,".txt")))
load(file.path("/net/fantasia/home/borang/MALGC/pipeline_example/LDL/LD_ref",paste0("LD_",block_index ,".RData")))
load(file.path("/net/fantasia/home/borang/MALGC/pipeline_example/LDL/LDL_Block",paste0(trait,"_intercept.RData")))
preprocess_data_file<-preprocess_data(z1,z2,ancestry_1_cov,ancestry_2_cov)
SNP pair up successful
logica_res<-run_Logica(preprocess_data_file$pop1$z,preprocess_data_file$pop2$z, preprocess_data_file$pop1$R, preprocess_data_file$pop2$R, median(preprocess_data_file$pop1$z$N),
median(preprocess_data_file$pop2$z$N),
z1_intercept = ancestry_1_lder_intercept, z2_intercept = ancestry_2_lder_intercept, fix_intercept = TRUE)
print(logica_res)
chr start end Est_h2_1 Est_h2_2 Est_cov Est_rho
1 1 838.67 KB 1.86 MB 8.981867e-06 4.328855e-15 6.776611e-18 3.436709e-08
P_h2_1 P_h2_2 P_rho_score P_rho_LLK
1 0.2711317 0.5964003 0.1269275 0.9999878
Logica Result Interpretation:
Note: We also provided code for submitting slurm array jobs to enable parallele computing Step4_Logica.R and Step4_Logica.sh
The composite null hypothesis is constructed by combining the individual null hypotheses from each genomic region.
setwd("/net/fantasia/home/borang/MALGC/pipeline_example/LDL_Block")
list.files(pattern = "Logica_res_LDL_block") -> file_list
library(data.table)
all_file<-c()
for(file in file_list){
logica_res<-fread(file)
all_file<-rbind(all_file,logica_res)
}
all_file$p_h2_HDMT<-p_HDMT(all_file$P_h2_1,all_file$P_h2_2)
head(all_file,10)
V1 chr start end Est_h2_1 Est_h2_2 Est_cov
<int> <int> <char> <char> <num> <num> <num>
1: 1 1 838.67 KB 1.86 MB 3.433780e-10 5.794911e-11 4.018560e-18
2: 1 1 12.19 MB 14.2 MB 9.346353e-11 6.075627e-09 2.581690e-18
3: 1 1 226.15 MB 227.67 MB 3.273844e-09 1.138188e-09 -9.915197e-17
4: 1 12 101.44 MB 102.73 MB 1.793660e-07 2.549977e-11 3.025052e-16
5: 1 12 102.74 MB 104.21 MB 6.536525e-06 5.809106e-09 2.106393e-12
6: 1 12 104.21 MB 106.2 MB 6.124684e-05 2.735646e-04 1.168637e-04
7: 1 12 106.2 MB 108.71 MB 2.610318e-04 2.620476e-03 -4.042489e-04
8: 1 12 108.71 MB 110.47 MB 5.898692e-06 1.891828e-09 1.916613e-13
9: 1 12 110.47 MB 111.71 MB 2.594760e-09 7.504605e-09 3.615900e-16
10: 1 12 111.71 MB 114.12 MB 3.411864e-11 4.058087e-11 -1.007814e-20
Est_rho P_h2_1 P_h2_2 P_rho_score P_rho_LLK
<num> <num> <num> <num> <num>
1: 2.848792e-08 2.658201e-01 5.881214e-01 0.1031767466 1.00000000
2: 3.426000e-09 4.093623e-01 9.140943e-02 0.7841214151 0.99996779
3: -5.136478e-08 7.025177e-02 1.748074e-01 0.5216719826 0.99411936
4: 1.414473e-07 9.053309e-02 6.919098e-01 0.1929000374 1.00000000
5: 1.080964e-05 4.214835e-02 1.396832e-01 0.0008370038 1.00000000
6: 9.028337e-01 2.927519e-05 8.369749e-11 0.0672410940 0.08787425
7: -4.887785e-01 0.000000e+00 0.000000e+00 0.3244676996 0.21361400
8: 1.814328e-06 1.100304e-02 1.432371e-01 0.0134956030 0.99995871
9: 8.194149e-08 8.796662e-02 6.260364e-02 0.1786418356 0.99998509
10: -2.708470e-10 7.899428e-01 8.589039e-01 0.6360415264 1.00000000
p_h2_HDMT
<num>
1: 4.803381e-01
2: 3.017791e-01
3: 1.106228e-01
4: 5.970586e-01
5: 8.621228e-02
6: 1.624945e-05
7: 0.000000e+00
8: 8.863226e-02
9: 5.226862e-02
10: 8.049808e-01
sessionInfo()
R version 4.5.0 (2025-04-11)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 20.04.6 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3; LAPACK version 3.9.0
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
time zone: America/New_York
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] data.table_1.16.0 Logica_0.1.0 devtools_2.4.5 usethis_3.0.0
[5] workflowr_1.7.1
loaded via a namespace (and not attached):
[1] gtable_0.3.5 xfun_0.47 bslib_0.8.0
[4] ggplot2_3.5.1 htmlwidgets_1.6.4 remotes_2.5.0
[7] processx_3.8.4 lattice_0.22-5 CompQuadForm_1.4.3
[10] callr_3.7.6 vctrs_0.6.5 tools_4.5.0
[13] ps_1.7.7 generics_0.1.4 curl_5.2.2
[16] tibble_3.2.1 fansi_1.0.6 pkgconfig_2.0.3
[19] Matrix_1.6-2 desc_1.4.3 lifecycle_1.0.4
[22] compiler_4.5.0 stringr_1.5.1 git2r_0.33.0
[25] munsell_0.5.1 getPass_0.2-4 httpuv_1.6.15
[28] htmltools_0.5.8.1 sass_0.4.9 fdrtool_1.2.18
[31] yaml_2.3.10 crayon_1.5.3 later_1.4.2
[34] pillar_1.9.0 jquerylib_0.1.4 urlchecker_1.0.1
[37] whisker_0.4.1 ellipsis_0.3.2 cachem_1.1.0
[40] sessioninfo_1.2.3 mime_0.13 tidyselect_1.2.1
[43] digest_0.6.37 stringi_1.8.4 reshape2_1.4.4
[46] dplyr_1.1.4 purrr_1.0.2 RcppArmadillo_14.4.2-1
[49] splines_4.5.0 rprojroot_2.0.4 fastmap_1.2.0
[52] grid_4.5.0 colorspace_2.1-1 cli_3.6.3
[55] magrittr_2.0.3 pkgbuild_1.4.7 utf8_1.2.4
[58] scales_1.3.0 promises_1.3.0 rmarkdown_2.28
[61] httr_1.4.7 matrixStats_1.4.1 qvalue_2.36.0
[64] HDMT_1.0.5 memoise_2.0.1 shiny_1.9.1
[67] evaluate_0.24.0 knitr_1.48 irlba_2.3.5.1
[70] miniUI_0.1.2 profvis_0.4.0 rlang_1.1.4
[73] mixsqp_0.3-54 Rcpp_1.0.14 xtable_1.8-4
[76] glue_1.8.0 susieR_0.12.35 pkgload_1.4.0
[79] reshape_0.8.9 rstudioapi_0.16.0 jsonlite_1.8.7
[82] plyr_1.8.9 R6_2.6.1 fs_1.6.6