Type: Package
Title: Estimation of Pleiotropic Heritability from Genome-Wide Association Studies (GWAS) Summary Statistics
Version: 0.1.0
Description: Provides tools to compute unbiased pleiotropic heritability estimates of complex diseases from genome-wide association studies (GWAS) summary statistics. We estimate pleiotropic heritability from GWAS summary statistics by estimating the proportion of variance explained from an estimated genetic correlation matrix (Bulik-Sullivan et al. 2015 <doi:10.1038/ng.3406>) and employing a Monte-Carlo bias correction procedure to account for sampling noise in genetic correlation estimates.
License: GPL-3
Encoding: UTF-8
LazyData: true
Depends: R (≥ 2.10)
RoxygenNote: 7.3.2
Imports: data.table, dplyr, stats, rlang, mvtnorm, fs, arrow, checkmate, cli, gdata, glue, purrr, tibble, vroom
Suggests: knitr, rmarkdown, testthat (≥ 3.0.0)
Config/testthat/edition: 3
VignetteBuilder: knitr
Language: en-US
NeedsCompilation: no
Packaged: 2025-10-26 14:46:50 UTC; yujiezhao
Author: Yujie Zhao [aut, cre]
Maintainer: Yujie Zhao <yujiezhao@hsph.harvard.edu>
Repository: CRAN
Date/Publication: 2025-10-28 09:50:02 UTC

Compute a vector of pleioh2g for all diseases before correction This function computes pleioh2g for all diseases before correction in one go.

Description

Compute a vector of pleioh2g for all diseases before correction This function computes pleioh2g for all diseases before correction in one go.

Usage

Cal_cor_pleiotropic_h2(rg_mat, h2g_T)

Arguments

rg_mat

genetic correlation matrix.

h2g_T

heritability vector for all diseases.

Value

pleioh2g vector

Examples

data(Results_full_rg_15D)
data(h2_vector_15D)
Cal_cor_pleiotropic_h2(Results_full_rg_15D,h2_vector_15D)

Compute single pleioh2g for target disease after correction with referred disease index in the rg matrix and corrected ratio

Description

This function computes pleioh2g for the target disease after correction.

Usage

Cal_cor_pleiotropic_h2_corrected_single(
  rg_mat,
  h2g_T_single,
  corrected_weight_updated,
  plei_h2_idx
)

Arguments

rg_mat

genetic correlation matrix.

h2g_T_single

heritability for target diseases.

corrected_weight_updated

the ratio for correction

plei_h2_idx

index of the target disease in the rg_mat.

Value

pleioh2g value for the target disease after correction

Examples

data(Results_full_rg_15D)
data(h2_vector_15D)
plei_h2_idx<-1
h2g_T_single <- h2_vector_15D[plei_h2_idx]
corrected_weight_updated <- 0.78
Cal_cor_pleiotropic_h2_corrected_single(Results_full_rg_15D,h2g_T_single,
corrected_weight_updated,plei_h2_idx)

Compute single pleioh2g for target disease before correction with referred disease index in the rg matrix

Description

This function computes pleioh2g for the target disease before correction.

Usage

Cal_cor_pleiotropic_h2_single(rg_mat, h2g_T_single, plei_h2_idx)

Arguments

rg_mat

genetic correlation matrix.

h2g_T_single

heritability for target diseases.

plei_h2_idx

index of the target disease in the rg_mat.

Value

pleioh2g value for the target disease before correction

Examples

data(Results_full_rg_15D)
data(h2_vector_15D)
plei_h2_idx<-1
h2g_T_single<-h2_vector_15D[plei_h2_idx]
Cal_cor_pleiotropic_h2_single(Results_full_rg_15D,h2g_T_single,plei_h2_idx)

Compute inversed elements for the target disease in bias correction procedure with referred disease index in the rg matrix

Description

This function inversed elements for the target disease in bias correction procedure.

Usage

Cal_cor_test_single(rg_mat, plei_h2_idx)

Arguments

rg_mat

genetic correlation matrix.

plei_h2_idx

index of the target disease in the rg_mat.

Value

inverse element value for the target disease used for bias correction

Examples

data(Results_full_rg_15D)
plei_h2_idx<-1
Cal_cor_test_single(Results_full_rg_15D,plei_h2_idx)

Compute rg + h2g

Description

This function is used to compute rg + h2g using LDSC.

Usage

Cal_rg_h2g_alltraits(
  phenotype,
  munged_sumstats,
  ld_path,
  wld_path,
  sample_prev = NULL,
  population_prev = NULL
)

Arguments

phenotype

Vector of the phenotype name

munged_sumstats

All LDSC-munged GWAS .stat.gz

ld_path

Path to directory containing ld score files.

wld_path

Path to directory containing weight files.

sample_prev

Vector of sample prevalence, in the same order of input GWAS summary statistics.

population_prev

Vector of population prevalence, in the same order of input GWAS summary statistics.

Value

A named list containing LDSC-based heritability and genetic correlation estimates across all input phenotypes. The list includes the following elements:

Each element corresponds to one LDSC-derived summary statistic, with trait names used as both row and column names.


genomic-block jackknife and compute rg + h2g

Description

This function performs genomic-block jackknife and computes rg + h2g.

Usage

Cal_rg_h2g_jk_alltraits(
  n_block = 200,
  hmp3,
  phenotype,
  munged_sumstats,
  ld_path,
  wld_path,
  sample_prev = NULL,
  population_prev = NULL
)

Arguments

n_block

number of jackknife blocks.

hmp3

Directory for hapmap 3 snplist.

phenotype

Vector of the phenotype name

munged_sumstats

All LDSC-munged GWAS .stat.gz

ld_path

Path to directory containing ld score files.

wld_path

Path to directory containing weight files.

sample_prev

Vector of sample prevalence, in the same order of input GWAS summary statistics.

population_prev

Vector of population prevalence, in the same order of input GWAS summary statistics.

Value

A named list containing block jackknife estimates of SNP-heritability and genetic correlation across all input phenotypes. The list includes the following elements:

Each element provides per-block estimates that can be used to compute standard errors or confidence intervals via the block jackknife method.


Prune disease selection

Description

Prune disease selection

Usage

Prune_disease_selection_DTrgzscore(
  Target_disease,
  trait_name,
  Rg_mat,
  Rg_mat_z,
  rg_threshold
)

Arguments

Target_disease

trait_name of target disease

trait_name

trait_name of pre-prune rg_matrix

Rg_mat

pre-prune rg_matrix

Rg_mat_z

pre-prune rg z matrix

rg_threshold

rg_threshold

Value

Rg_mat_leave

Examples


trait_name<-c("401.1","244.5","318","735.3","411.4",
"427.2","454.1","278.1","250.2","550.1","530.11",
"296.22","519.8","562.1","763")
data("Results_full_rg_15D")
data("Rg_mat_z_15D")
Target_disease<-'401.1'
rg_threshold<-sqrt(0.3)
Rg_prune<-Prune_disease_selection_DTrgzscore(Target_disease, trait_name,
Results_full_rg_15D,Rg_mat_z_15D,rg_threshold)


Genetic correlation matrix for 15 diseases

Description

Example genetic correlation matrix used in the vignette and examples.

Usage

Results_full_rg_15D

Format

A numeric matrix.

Source

Internal simulation


Jackknife array of genetic correlations (15 diseases)

Description

Jackknife array of genetic correlations (15 diseases)

Usage

Results_full_rg_array_15D

Format

A 3-dim array.

Source

Internal simulation


Genetic correlation Z matrix for 15 diseases

Description

Example genetic correlation Z matrix used in the vignette and examples.

Usage

Rg_mat_z_15D

Format

A numeric matrix.

Source

Internal simulation


Generate samples based on sampling covariance matrix and rg matrix for target disease

Description

This function is used to generate samples based on sampling covariance matrix and rg matrix for target disease

Usage

generate_proposal_sample_changea_cor(
  Results_full_rg,
  Results_full_rg_array,
  plei_h2_idx,
  ratio_a
)

Arguments

Results_full_rg

genetic correlation matrix.

Results_full_rg_array

genetic correlation jackknife-block array.

plei_h2_idx

index of the target disease in the rg_mat.

ratio_a

corrected ratio.

Value

noisy_inversed_element for bias correction

Examples

data(Results_full_rg_15D)
data(Results_full_rg_array_15D)
plei_h2_idx<-1
ratio_a <- 0.75
generate_proposal_sample_changea_cor(Results_full_rg_15D,
 Results_full_rg_array_15D, plei_h2_idx, ratio_a)

Convert Heritability to Liability Scale

Description

'h2_liability()' converts heritability estimates from the observed to liability scale.

Usage

h2_liability(h2, sample_prev, population_prev)

Arguments

h2

(numeric) Estimate of observed-scale heritability

sample_prev

(numeric) Proportion of cases in the current sample

population_prev

(numeric) Population prevalence of trait

Value

(numeric) Liability-scale heritability

Examples

h2_liability(0.28, 0.1, 0.05)


h2 vector for 15 diseases

Description

Example h2 vector used in the vignette and examples.

Usage

h2_vector_15D

Format

A numeric matrix.

Source

Internal simulation


h2 jk matrix for 15 diseases

Description

Example h2 jk matrix used in the vignette and examples.

Usage

h2_vector_mat_15D

Format

A numeric matrix.

Source

Internal simulation


Estimate heritability - refer to ldscr R package (https://github.com/mglev1n/ldscr)

Description

'ldsc_h2()' uses ldscore regression to estimate the heritability of a trait from GWAS summary statistics and reference LD information.

Usage

ldsc_h2(
  munged_sumstats,
  sample_prev = NA,
  population_prev = NA,
  ld,
  wld,
  n_blocks = 200,
  chisq_max = NA,
  chr_filter = seq(1, 22, 1)
)

Arguments

munged_sumstats

Either a dataframe, or a path to a file containing munged summary statistics. Must contain at least columns named 'SNP' (rsid), 'A1' (effect allele), 'A2' (non-effect allele), 'N' (total sample size) and 'Z' (Z-score)

sample_prev

(numeric) For binary traits, this should be the prevalence of cases in the current sample, used for conversion from observed heritability to liability-scale heritability. The default is 'NA', which is appropriate for quantitative traits or estimating heritability on the observed scale.

population_prev

(numeric) For binary traits, this should be the population prevalence of the trait, used for conversion from observed heritability to liability-scale heritability. The default is 'NA', which is appropriate for quantitative traits or estimating heritability on the observed scale.

ld

(character) Path to directory containing ld score files, ending in '*.l2.ldscore.gz'.

wld

(character) Path to directory containing weight files.

n_blocks

(numeric) Number of blocks used to produce block jackknife standard errors. Default is '200'

chisq_max

(numeric) Maximum value of Z^2 for SNPs to be included in LD-score regression. Default is to set 'chisq_max' to the maximum of 80 and N*0.001.

chr_filter

(numeric vector) Chromosomes to include in analysis. Separating even/odd chromosomes may be useful for exploratory/confirmatory factor analysis.

Value

A [tibble][tibble::tibble-package] containing heritability information. If 'sample_prev' and 'population_prev' were provided, the heritability estimate will also be returned on the liability scale.


Estimate cross-trait genetic correlations (Robust Version) - refer to ldscr R package (https://github.com/mglev1n/ldscr)

Description

'ldsc_rg()' uses ldscore regression to estimate the pairwise genetic correlations between traits. The function relies on named lists of traits, sample prevalences, and population prevalences. The name of each trait should be consistent across each argument.

Usage

ldsc_rg(
  munged_sumstats,
  sample_prev = NA,
  population_prev = NA,
  ld,
  wld,
  n_blocks = 200,
  chisq_max = NA,
  chr_filter = seq(1, 22, 1)
)

Arguments

munged_sumstats

(list) A named list of dataframes, or paths to files containing munged summary statistics. Each set of munged summary statistics contain at least columns named 'SNP' (rsid), 'A1' (effect allele), 'A2' (non-effect allele), 'N' (total sample size) and 'Z' (Z-score)

sample_prev

(list) A named list containing the prevalence of cases in the current sample, used for conversion from observed heritability to liability-scale heritability. The default is 'NA', which is appropriate for quantitative traits or estimating heritability on the observed scale.

population_prev

(list) A named list containing the population prevalence of the trait, used for conversion from observed heritability to liability-scale heritability. The default is 'NA', which is appropriate for quantitative traits or estimating heritability on the observed scale.

ld

(character) Path to directory containing ld score files, ending in '*.l2.ldscore.gz'.

wld

(character) Path to directory containing weight files.

n_blocks

(numeric) Number of blocks used to produce block jackknife standard errors. Default is '200'

chisq_max

(numeric) Maximum value of Z^2 for SNPs to be included in LD-score regression. Default is to set 'chisq_max' to the maximum of 80 and N*0.001.

chr_filter

(numeric vector) Chromosomes to include in analysis. Separating even/odd chromosomes may be useful for exploratory/confirmatory factor analysis.

Details

This function estimates the pairwise genetic correlations between an arbitrary number of traits. The function also estimates heritability for each individual trait. There is a [ggplot2::autoplot()] method for visualizing a heatmap of the results.

This version handles cases where traits have non-positive heritability estimates more gracefully by returning NA values for correlations involving such traits.

Value

A list of class 'ldscr_list' containing heritablilty and genetic correlation information - 'h2' = [tibble][tibble::tibble-package] containing heritability information for each trait. If 'sample_prev' and 'population_prev' were provided, the heritability estimates will also be returned on the liability scale. - 'rg' = [tibble][tibble::tibble-package] containing pairwise genetic correlations information. - 'raw' = A list of correlation/covariance matrices


Internal Function to make weights - refer to ldscr R package (https://github.com/mglev1n/ldscr)

Description

'make_weights()' Internal Function to make weights

Usage

make_weights(chi1, L2, wLD, N, M.tot)

Arguments

chi1

chi-square

L2

ld score

wLD

wld score

N

sample size

M.tot

Number of SNPs

Value

A numeric vector of initial LDSC weights for each SNP


Merging summary statistics with LD-score files - refer to ldscr R package (https://github.com/mglev1n/ldscr)

Description

'merge_sumstats()' Merging summary statistics with LD-score files

Usage

merge_sumstats(sumstats_df, w, x, chr_filter)

Arguments

sumstats_df

dataframe of sumstat

w

wld score

x

ld score

chr_filter

(numeric vector) Chromosomes to include in analysis. Separating even/odd chromosomes may be useful for exploratory/confirmatory factor analysis.

Value

A tibble (data frame) containing the merged summary statistics and LD-score


Internal function to perform LDSC heritability/covariance analysis - refer to ldscr R package (https://github.com/mglev1n/ldscr)

Description

'perform_analysis()' Internal function to perform LDSC heritability/covariance analysis

Usage

perform_analysis(n.blocks, n.snps, weighted.LD, weighted.chi, N.bar, m)

Arguments

n.blocks

Number of blocks

n.snps

Number of SNPs

weighted.LD

wld score

weighted.chi

chi-square

N.bar

Average N after merging

m

Number of SNPs from LD data

Value

A list containing the results of the LDSC heritability/covariance analysis with the following elements:


Compute pleioh2g after bias correction for target disease

Description

This function is used to compute pleioh2g after bias correction for target disease

Usage

pleiotropyh2_cor_computing_single(
  G,
  phenotype,
  h2_vector,
  h2_vector_mat,
  Results_full_rg,
  Results_full_rg_array,
  sample_rep
)

Arguments

G

index of target disease.

phenotype

Vector of the phenotype name

h2_vector

h2g vector for all traits - aligned as the order in phenotype file

h2_vector_mat

h2g array from jackknife-block estimates for all traits - aligned as the order in phenotype file

Results_full_rg

genetic correlation matrix. - aligned as the order in phenotype file

Results_full_rg_array

genetic correlation jackknife-block array. - aligned as the order in phenotype file

sample_rep

sampling times in bias correction

Value

A 'list' containing the following elements: - 'target_disease' (character): The value "401.1". - 'target_disease_h2_est' (numeric): target disease h2g. - 'target_disease_h2_se' (numeric): target disease h2g_se. - 'selected_auxD' (character): auxiliary diseases. - 'h2pleio_uncorr' (numeric): pre-correction pleiotropic heritability estimate. - 'h2pleio_uncorr_se' (numeric): pre-correction pleiotropic heritability jackknife s.e. estimate. - 'percentage_h2pleio_uncorr' (numeric): pre-correction percentage of pleiotropic heritability estimate. - 'percentage_h2pleio_uncorr_se' (numeric): pre-correction percentage of pleiotropic heritability jackknife s.e. estimate. - 'percentage_h2pleio_uncorr_jackknife' (numeric): vector of all pre-correction percentage of pleiotropic heritability jackknife estimates. - 'h2pleio_corr' (numeric): post-correction pleiotropic heritability estimate. - 'h2pleio_corr_se' (numeric): post-correction pleiotropic heritability jackknife s.e. estimate. - 'percentage_h2pleio_corr' (numeric): post-correction percentage of pleiotropic heritability estimate. - 'percentage_h2pleio_corr_se' (numeric): post-correction percentage of pleiotropic heritability jackknife s.e. estimate. - 'corrected_weight' (numeric): corrected weight in bias correction.

Examples

G <- 1
data(Results_full_rg_15D)
data(Results_full_rg_array_15D)
data(h2_vector_15D)
data(h2_vector_mat_15D)
phenotype<-c("401.1","244.5","318","735.3","411.4",
"427.2","454.1","278.1","250.2","550.1","530.11",
"296.22","519.8","562.1","763")
sample_rep<-20
post_corrrresults_prune<-pleiotropyh2_cor_computing_single(G,phenotype,h2_vector_15D,
h2_vector_mat_15D,Results_full_rg_15D,Results_full_rg_array_15D, sample_rep)


Compute pleioh2g after bias correction for target disease

Description

This function is used to compute pleioh2g after bias correction for target disease

Usage

pleiotropyh2_cor_computing_single_prune(
  G,
  phenotype,
  h2_vector,
  h2_vector_mat,
  Results_full_rg,
  Results_full_rg_array,
  sample_rep
)

Arguments

G

index of target disease.

phenotype

Vector of the phenotype name

h2_vector

h2g vector for all traits - aligned as the order in phenotype file

h2_vector_mat

h2g array from jackknife-block estimates for all traits - aligned as the order in phenotype file

Results_full_rg

genetic correlation matrix. - aligned as the order in phenotype file

Results_full_rg_array

genetic correlation jackknife-block array. - aligned as the order in phenotype file

sample_rep

sampling times in bias correction

Value

A 'list' containing the following elements: - 'target_disease' (character): The value "401.1". - 'target_disease_h2_est' (numeric): target disease h2g. - 'target_disease_h2_se' (numeric): target disease h2g_se. - 'selected_auxD' (character): auxiliary diseases. - 'h2pleio_uncorr' (numeric): pre-correction pleiotropic heritability estimate. - 'h2pleio_uncorr_se' (numeric): pre-correction pleiotropic heritability jackknife s.e. estimate. - 'percentage_h2pleio_uncorr' (numeric): pre-correction percentage of pleiotropic heritability estimate. - 'percentage_h2pleio_uncorr_se' (numeric): pre-correction percentage of pleiotropic heritability jackknife s.e. estimate. - 'percentage_h2pleio_uncorr_jackknife' (numeric): vector of all pre-correction percentage of pleiotropic heritability jackknife estimates. - 'h2pleio_corr' (numeric): post-correction pleiotropic heritability estimate. - 'h2pleio_corr_se' (numeric): post-correction pleiotropic heritability jackknife s.e. estimate. - 'percentage_h2pleio_corr' (numeric): post-correction percentage of pleiotropic heritability estimate. - 'percentage_h2pleio_corr_se' (numeric): post-correction percentage of pleiotropic heritability jackknife s.e. estimate. - 'corrected_weight' (numeric): corrected weight in bias correction.

Examples

G <- 1
data(Results_full_rg_15D)
data(Results_full_rg_array_15D)
data(h2_vector_15D)
data(h2_vector_mat_15D)
phenotype<-c("401.1","244.5","318","735.3","411.4",
"427.2","454.1","278.1","250.2","550.1","530.11",
"296.22","519.8","562.1","763")
sample_rep<-10
post_corrrresults_prune<-pleiotropyh2_cor_computing_single_prune(G,phenotype,h2_vector_15D,
h2_vector_mat_15D,Results_full_rg_15D,Results_full_rg_array_15D, sample_rep)


Compute pleioh2g before bias correction for target disease

Description

This function is used to compute pleioh2g after bias correction for target disease

Usage

pleiotropyh2_nocor_computing_single(
  G,
  phenotype,
  h2_vector,
  h2_vector_mat,
  Results_full_rg,
  Results_full_rg_array
)

Arguments

G

index of target disease.

phenotype

Vector of the phenotype name

h2_vector

h2g vector for all traits - aligned as the order in phenotype file

h2_vector_mat

h2g array from jackknife-block estimates for all traits - aligned as the order in phenotype file

Results_full_rg

genetic correlation matrix.- aligned as the order in phenotype file

Results_full_rg_array

genetic correlation jackknife-block array.- aligned as the order in phenotype file

Value

A 'list' containing the following elements: - 'target_disease' (character): The value "401.1". - 'target_disease_h2_est' (numeric): target disease h2g. - 'target_disease_h2_se' (numeric): target disease h2g_se. - 'selected_auxD' (character): auxiliary diseases. - 'h2pleio_uncorr' (numeric): pre-correction pleiotropic heritability estimate. - 'h2pleio_uncorr_se' (numeric): pre-correction pleiotropic heritability jackknife s.e. estimate. - 'percentage_h2pleio_uncorr' (numeric): pre-correction percentage of pleiotropic heritability estimate. - 'percentage_h2pleio_uncorr_se' (numeric): pre-correction percentage of pleiotropic heritability jackknife s.e. estimate. - 'percentage_h2pleio_jackknife_uncorr' (numeric): vector of all pre-correction percentage of pleiotropic heritability jackknife estimates.

Examples

G <- 1
data(Results_full_rg_15D)
data(Results_full_rg_array_15D)
data(h2_vector_15D)
data(h2_vector_mat_15D)
phenotype<-c("401.1","244.5","318","735.3","411.4",
"427.2","454.1","278.1","250.2","550.1","530.11",
"296.22","519.8","562.1","763")
h2pleiobeforecorr<-pleiotropyh2_nocor_computing_single(G,phenotype,h2_vector_15D,
h2_vector_mat_15D,Results_full_rg_15D,Results_full_rg_array_15D)


Perform pruning in computing pleioh2g and correct bias

Description

Perform pruning in computing pleioh2g and correct bias

Usage

pruning_pleioh2g_wrapper(
  G,
  phenotype,
  munged_sumstats,
  ld_path,
  wld_path,
  sample_prev = NULL,
  population_prev = NULL,
  n_block = 200,
  hmp3,
  sample_rep
)

Arguments

G

index of target disease.

phenotype

Vector of the phenotype name

munged_sumstats

All LDSC-munged GWAS .stat.gz

ld_path

Path to directory containing ld score files.

wld_path

Path to directory containing weight files.

sample_prev

Vector of sample prevalence, in the same order of input GWAS summary statistics.

population_prev

Vector of population prevalence, in the same order of input GWAS summary statistics.

n_block

number of jackknife blocks.

hmp3

Directory for hapmap 3 snplist.

sample_rep

sampling times in bias correction

Value

A 'list' containing the following elements: - 'target_disease' (character): The value "401.1". - 'target_disease_h2_est' (numeric): target disease h2g. - 'target_disease_h2_se' (numeric): target disease h2g_se. - 'selected_auxD' (character): auxiliary diseases. - 'h2pleio_uncorr' (numeric): pre-correction pleiotropic heritability estimate. - 'h2pleio_uncorr_se' (numeric): pre-correction pleiotropic heritability jackknife s.e. estimate. - 'percentage_h2pleio_uncorr' (numeric): pre-correction percentage of pleiotropic heritability estimate. - 'percentage_h2pleio_uncorr_se' (numeric): pre-correction percentage of pleiotropic heritability jackknife s.e. estimate. - 'percentage_h2pleio_uncorr_jackknife' (numeric): vector of all pre-correction percentage of pleiotropic heritability jackknife estimates. - 'h2pleio_corr' (numeric): post-correction pleiotropic heritability estimate. - 'h2pleio_corr_se' (numeric): post-correction pleiotropic heritability jackknife s.e. estimate. - 'percentage_h2pleio_corr' (numeric): post-correction percentage of pleiotropic heritability estimate. - 'percentage_h2pleio_corr_se' (numeric): post-correction percentage of pleiotropic heritability jackknife s.e. estimate. - 'corrected_weight' (numeric): corrected weight in bias correction.


Read ld from either internal or external file - refer to ldscr R package (https://github.com/mglev1n/ldscr)

Description

'read_ld()' Read ld from either internal or external file.

Usage

read_ld(ld)

Arguments

ld

(character) Path to directory containing ld score files, ending in '*.l2.ldscore.gz'. Default is 'NA', which will utilize the built-in ld score files from Pan-UK Biobank for the ancestry specified in 'ancestry'.

Value

A data frame (tibble) containing LD score information read from the specified directory. Each row corresponds to a SNP, and columns typically include:


Read M from either internal or external file - refer to ldscr R package (https://github.com/mglev1n/ldscr)

Description

'read_m()' Read M from either internal or external file

Usage

read_m(ld)

Arguments

ld

(character) Path to directory containing ld score files, ending in '*.l2.ldscore.gz'. Default is 'NA', which will utilize the built-in ld score files from Pan-UK Biobank for the ancestry specified in 'ancestry'.

Value

A data frame (tibble) containing SNP counts read from the specified M files.


Read summary statistics from either internal or external file - refer to ldscr R package (https://github.com/mglev1n/ldscr)

Description

'read_sumstats()' Read summary statistics from either internal or external file

Usage

read_sumstats(munged_sumstats, name)

Arguments

munged_sumstats

Either a dataframe, or a path to a file containing munged summary statistics. Must contain at least columns named 'SNP' (rsid), 'A1' (effect allele), 'A2' (non-effect allele), 'N' (total sample size) and 'Z' (Z-score)

name

trait name

Value

A data frame (tibble) containing GWAS summary statistics for the specified trait. The returned object will always contain at least the following columns:


Read wld from either internal or external file - refer to ldscr R package (https://github.com/mglev1n/ldscr)

Description

'read_wld()' Read wld from either internal or external file

Usage

read_wld(wld)

Arguments

wld

(character) Path to directory containing weight files. Default is 'NA', which will utilize the built-in weight files from Pan-UK Biobank for the ancestry specified in 'ancestry'.

Value

A data frame (tibble) containing LD weight information read from the specified directory. Each row corresponds to a SNP, and columns typically include:


Example munged dataframe - refer to ldscr R package (https://github.com/mglev1n/ldscr)

Description

Example munged dataframe - refer to ldscr R package (https://github.com/mglev1n/ldscr)

Usage

sumstats_munged_example_input(example, dataframe = TRUE)

Arguments

example

(character) "401.1" which have been included as example traits.

dataframe

(logical) If 'TRUE' (default), return an example munged dataframe. If 'FALSE', return path to the file on disk.

Value

either a [tibble][tibble::tibble-package] containing a munged dataframe, or a path to the file on disk.