Skip to contents

Basic Utilities

Core helper functions from R/0.basic_tools.R.

across_df_na()
Across a df to count na
across_df_TF()
Across a df to count TRUE and FALSE
is_complementary() fetch_indel() fetch_non_indel() duplicated_SNP_lines() slice1_SNP_lines() fetch_same_direcrtion() any_na() get_biallelic_snp()
Helper functions for leo.gwas_qc
chisq_p_value()
Give precise p-value for chi-square test
count_duplicate_element()
Count or Identify Duplicates in a Vector
count_matching_elements()
Count or Identify Matches of a Pattern in a Vector
get_id()
Get Unique Identifier for Genetic Data

Annotation

Annotation and mapping workflows from R/0.annotation.R.

add_rsid()
Convert CHR:BP to rsID (not recommended)
add_rsid_using_ref()
Add rsID based on local reference file (recommended)
add_chrpos()
Convert rsID to CHR & BP
annotate_cpg_sites()
Annotate CpG Sites with Gene Information
leo_map_GtoCP()
Map Gene Symbols to Genomic Positions
map_gene_to_chrbp_using_TxDb()
Map Gene Symbols Using Bioconductor Packages
map_gene_to_chrbp_using_gtf()
Map Gene Symbols Using GTF File
map_gene_to_chrbp_using_biomaRt()
Map Gene Symbols to Genomic Positions Using biomaRt
map_gene_to_tss_using_gtf()
Map Genes to Their TSS Positions
map_ensg_to_chrbp_using_biomaRt()
Map Ensembl Gene IDs to Genomic Positions using biomaRt
map_ensg_to_tss_using_biomaRt()
Map Ensembl Gene IDs to TSS Using biomaRt
map_ensg_to_gene_using_org.Hs.eg.db()
Map Ensembl IDs to Gene Symbols using org.Hs.eg.db
map_ensg_to_gene_using_biomaRt()
Map Ensembl Gene IDs to Gene Symbols using biomaRt
map_gene_to_ensembl()
Map Gene Symbols to Ensembl IDs
map_gene_class_using_annotables()
Map Gene Symbols to biotype & description via annotables
map_gene_class_using_biomarRt()
Map Gene Symbols to biotype & description via biomaRt (GRCh38 -> GRCh37 fallback)

Visualization

Plotting and locus visualization from R/0.visual_tools.R.

leo_scale_color()
Apply Color Palette to ggplot
correlation_calculate()
Calculate Correlation between Two Vectors
correlation_draw()
Draw Correlation between Two Vectors
group_comparison_draw()
Draw Group Comparison for a Continuous Variable
ld_ps_index()
Loci_plot: Calculate the LD-matrix (LD r2) for the index SNP
locuszoomr_loc()
Loci_plot: prepare the locus data for locuszoomr
plot_gsMap()
Plot gsMap (full & highlight) with robust color mapping
plot_gsMap_color()
Build color maps for gsMap plots (helper function)
save_regional_plot()
Loci_plot: save_regional_plot

PRS and ML

PRS modeling and ranking from R/prs_tools.R.

dr.prs() combine_rank()
DuoRank PRS (Dr.PRS)
catboost_prs() catboost_prs_target() catboost_prs_rank()
CatBoost PRS utilities
lasso_prs() lasso_prs_target() lasso_prs_rank()
Iterative Lasso PRS (iLasso) utilities
plink_clump_hla_aware()
HLA-aware PLINK clumping (Yet implemented)

Two-Sample MR

MR data prep and analysis from R/tsmr_tools.R.

clump_data_local()
Perform LD Clumping Locally or via Reference Panel
extract_instruments_local()
Extract instruments locally for MR Analysis
find_proxy()
find_proxy
format_outcome()
format outcome data
is_complementary() fetch_indel() fetch_non_indel() duplicated_SNP_lines() slice1_SNP_lines() fetch_same_direcrtion() any_na() get_biallelic_snp()
Helper functions for leo.gwas_qc
filter_chr_basedonSNP_p()
Filter Chromosomes Based on SNP P-value Threshold
filter_chr_basedonSNP_p_qtltools()
Filter Chromosomes Based on SNP P-value Threshold for .qtltoolsnomi files
leo_iterator()
Leo batch iterator builder
mr_one_pair()
One-Click Perform 2SMR
mr_scatter_plot_modified()
Modified MR Scatter Plot
mrlap_one_pair()
mrlap_one_pair

SMR and BESD

SMR/BESD processing from R/smr_besd_tools.R.

combine_smr_res_chr()
Combine SMR Results for All Chromosomes
combine_smr_res_1outcome()
Combine .fdr files for one or multiple outcomes (seperately)
leo_smr_adjust()
Adjust SMR Results with FDR and Bonferroni Corrections
leo_smr_adjust_loop()
Batch Adjust SMR Results with FDR and Bonferroni Corrections
leo_smr_extract_sig_res()
Extract significant results from .all files
leo_smr_merge_shared_probes()
Merge multiple SMR files and keep only shared probes for 2 outcomes

HLA Tools

HLA region helpers from R/hla_tools.R.

HLA_get()
Extract HLA region from genomic summary data
HLA_exclude()
Exclude HLA region from genomic summary data

Summary QC

Summary statistics QC from R/summary_qc.R.

leo.gwas_qc()
GWAS summary QC pipeline (chip + imputed)
check_significant_SNP()
locate the significant SNP for conditional analysis

csMR Workflow

Cell-stratified MR (csMR) pipeline.

csMR_env()
Configure Conda Environment for csMR
csMR_step1_prep()
Prepare csMR Step1 Input
csMR_step2_config.yml()
Build csMR config.yml
csMR_step3_run()
Run csMR Step 3