Heritability Estimate and Computing Genetic Correlation with GXwasR
Banabithi Bose
University of Colorado Anschutz Medical;Northwestern Universitybanabithi.bose@gmail.com
16 October 2025
Source:vignettes/GXwasR_heritability.Rmd
GXwasR_heritability.RmdThis document provides a tutorial for heritability estimate and computing genetic correlation utilizing GXwasR R package.
## Call some libraries
library(GXwasR)
#>
#> GXwasR: Genome-wide and x-chromosome wide association analyses applying
#> best practices of quality control over genetic data
#> Version 0.99.0 () installed
#> Author: c(
#> person(given = "Banabithi",
#> family = "Bose",
#> role = c("cre", "aut"),
#> email = "banabithi.bose@gmail.com",
#> comment = c(ORCID = "0000-0003-0842-8768"))
#> )
#> Maintainer: Banabithi Bose <banabithi.bose@gmail.com>
#> Tutorial: https://github.com
#> Use citation("GXwasR") to know how to cite this work.
library(printr)
#> Registered S3 method overwritten by 'printr':
#> method from
#> knit_print.data.frame rmarkdown
library(rmarkdown)
#>
#> Attaching package: 'rmarkdown'
#> The following objects are masked from 'package:BiocStyle':
#>
#> html_document, md_document, pdf_documentComputing heritability estimate using EstimateHerit():
help(EstimateHerit, package = GXwasR)| EstimateHerit | R Documentation |
EstimateHerit: Computing SNP heritability i.e., the proportion of phenotypic variance explained by SNPs.
Description
This functions performs two types of heritability estimation, (i)GREML:Genomic relatedness matrix (GRM) restricted maximum likelihood-based method following GCTA (Yang et al. 2011) and (ii)LDSC: LD score regression-based method following (Bulik-Sullivan et al. 2014; Privé et al. 2020). For the details, please follow the associated paper.
Prior to using this function, it is recommended to apply QCsnp and QCsample to ensure data quality control.
Usage
EstimateHerit(
DataDir = NULL,
ResultDir = tempdir(),
finput = NULL,
precomputedLD = NULL,
indepSNPs = NULL,
summarystat = NULL,
ncores = 2,
model = c("LDSC", "GREML"),
computeGRM = TRUE,
grmfile_name = NULL,
byCHR = FALSE,
r2_LD = 0,
LDSC_blocks = 20,
intercept = NULL,
chi2_thr1 = 30,
chi2_thr2 = Inf,
REMLalgo = c(0, 1, 2),
nitr = 100,
cat_covarfile = NULL,
quant_covarfile = NULL,
prevalence = NULL,
partGRM = FALSE,
autosome = TRUE,
Xsome = TRUE,
nGRM = 3,
cripticut = 0.025,
minMAF = NULL,
maxMAF = NULL,
hg = c("hg19", "hg38"),
PlotIndepSNP = TRUE,
IndepSNP_window_size = 50,
IndepSNP_step_size = 5,
IndepSNP_r2_threshold = 0.02,
highLD_regions = NULL,
plotjpeg = TRUE,
plotname = "Heritability_Plots"
)
Arguments
DataDir |
A character string for the file path of the all the input files. The default is |
ResultDir |
A character string for the file path where all output files will be stored. The default is |
finput |
Character string, specifying the prefix of the input PLINK binary files for the genotype data. This file needs to be in |
precomputedLD |
A dataframe object as LD matrix with columns: |
indepSNPs |
A dataframe with independent SNP ids with column name "rsid". The default is |
summarystat |
A dataframe object with GWAS summary statistics. The mandatory column headers in this dataframe are
For case-control study, effective sample size should be |
ncores |
Integer value, specifying the number of cores to be used for running LDSC model. The default is 2. |
model |
Character string, specifying the heritability estimation model. There are two options, “GREML” or “LDSC”. The default is “GREML”. Note: argument For LDSC, DataDir and finput can be |
computeGRM |
Boolean value, |
grmfile_name |
A string of characters specifying the prefix of autosomal .grm.bin file. Users need to provide separate GRM files
for autosomes and X chromosome in The X chromosomal GRM file should have "x" added in the autosomal prefix as file name. For instance, if autosomal file is "ABC.grm.bin", then X chromosomal file should be "xABC.grm.bim". If you are providing chromosome-wise GRMs, then the prefix should add "ChrNumber_" at the start of the prefix like, "Chr1_ABC.grm.bin". The default is NULL. |
byCHR |
Boolean value, |
r2_LD |
Numeric value, specifying the LD threshold for clumping in LDSC model. The default is 0. |
LDSC_blocks |
Integer value, specifying the block size for performing jackknife variance estimator in LDSC model following (Privé et al. 2020). The default is 200. |
intercept |
Numeric value to constrain the intercept to some value (e.g. 1) in LDSC regression. Default is |
chi2_thr1 |
Numeric value for threshold on chi2 in step 1 of LDSC regression. Default is 30. |
chi2_thr2 |
Numeric value for threshold on chi2 in step 2. Default is |
REMLalgo |
Integer value of 0, 1 or 2, specifying the algorithm to run REML iterations, 0 for average information (AI), 1 for Fisher-scoring and 2 for EM. The default option is 0, i.e. AI-REML (Yang et al. 2011). |
nitr |
Integer value, specifying the number of iterations for performing the REML. The default is 100. |
cat_covarfile |
A character string, specifying the name of the categorical covariate file which is a plain text file with no header line; columns
are family ID, individual ID and discrete covariates. The default is |
quant_covarfile |
A character string, specifying the name of the quantitative covariate file which is a plain text file with no header line;
columns are family ID, individual ID and continuous covariates. The default is |
prevalence |
Numeric value, specifying the disease prevalence. The default is Note: for the continuous trait value, users should use the default. |
partGRM |
Boolean value, |
autosome |
Boolean value, |
Xsome |
Boolean value, |
nGRM |
Integer value, specifying the number of the partition of the GRM in GREML model. The default is 3. |
cripticut |
Numeric value, specifying the threshold to create a new GRM of "unrelated" individuals in GREML model. The default is arbitrary chosen as 0.025 following (Yang et al. 2011). |
minMAF |
Positive numeric value (0,1), specifying the minimum threshold for the MAF filter of the SNPs in the GREML model. This value cannot be
greater than |
maxMAF |
Positive numeric value (0,1), specifying the maximum threshold for the MAF filter of the SNPs in the GREML model. This value cannot be less
than |
hg |
Boolean value, specifying the genome built, “hg19” or “hg38” to use chromosome length from UCSC genome browser and getting genes and proteins according to this built. The default is “hg19”. |
PlotIndepSNP |
Boolean value, |
IndepSNP_window_size |
Integer value, specifying a window size in variant count or kilobase for LD-based filtering. The default is 50. |
IndepSNP_step_size |
Integer value, specifying a variant count to shift the window at the end of each step for LD filtering for pruned SNPs in the plots. The default is 5. |
IndepSNP_r2_threshold |
Numeric value between 0 to 1 of pairwise |
highLD_regions |
Character string, specifying the .txt file name with genomic regions with high LD for using in finding pruned SNPs in the plots.
This file needs to be in |
plotjpeg |
Boolean value, |
plotname |
String of character value specifying the name of the jpeg file with the plots. The default is "Heritability_Plots". |
Value
A dataframe with maximum eight columns for GREML (here, three columns if running genome-wide) and ten columns for LDSC model if byCHR is TRUE.
The columns, such as, "chromosome"(i.e., chromosome code),"snp_proportion" (i.e.,chromosome-wise SNP proportion)", "no.of.genes" (i.e., number of genes per chromosome),
"no.of.proteins" (i.e., number of genes per chromosome),"size_mb" (i.e., chromosome length), "Source" (i.e., source of heritability),
"Variance" (i.e., estimated heritability), and "SE" (i.e., standard error of the estimated heritability) are common for both GREML and LDSC model.
The column, "Intercept" (i.e., LDSC regression intercept) and "Int_SE" (i.e., standard error of the intercept) will be two extra columns for LDSC models.
Source column will have rows, such as V(1) (i.e., name of genetic variance), V(e) (i.e., residual variance), V(p) (i.e., phenotypic variance), V(1)/Vp (i.e.,
ratio of genetic variance to phenotypic variance), and V(1)/Vp_L (i.e., ratio of genetic variance to phenotypic variance in liability scale for binary phenotypes).
If byCHR is FALSE, then the first five columns will not be reported in the dataframe.
Author(s)
Banabithi Bose
References
Bulik-Sullivan B, Finucane HK, Anttila V, Gusev A, Day FR, Loh P, Consortium R, Consortium PG, of the Wellcome Trust Case Control Consortium GCfAN, Perry JRB, Patterson N, Robinson EB, Daly MJ, Price AL, Neale BM (2014).
“LD score regression distinguishes confounding from polygenicity in genome-wide association studies.”
Nature Genetics, 47, 291–295.
Privé F, Arbel J, Vilhjálmsson BJ (2020).
“LDpred2: better, faster, stronger.”
Bioinformatics, 36(22-23), 5424–5431.
doi:10.1093/bioinformatics/btaa1029.
Yang J, Lee SH, Goddard ME, Visscher PM (2011).
“GCTA: a tool for Genome-wide Complex Trait Analysis.”
American Journal of Human Genetics, 88(1), 76–82.
Examples
data("Summary_Stat_Ex1", package = "GXwasR")
data("highLD_hg19", package = "GXwasR")
DataDir <- GXwasR:::GXwasR_data()
ResultDir <- tempdir()
precomputedLD <- NULL
finput <- "GXwasR_example"
test.sumstats <- na.omit(Summary_Stat_Ex1[Summary_Stat_Ex1$TEST == "ADD", c(seq_len(4), 6:8)])
colnames(test.sumstats) <- c("chr", "rsid", "pos", "a1", "n_eff", "beta", "beta_se")
summarystat <- test.sumstats
ncores <- 3
model <- "GREML"
byCHR <- FALSE
r2_LD <- 0
LDSC_blocks <- 20
REMLalgo <- 0
nitr <- 3
cat_covarfile <- NULL
quant_covarfile <- NULL
prevalence <- 0.01
partGRM <- FALSE
autosome <- TRUE
Xsome <- TRUE
nGRM <- 3
cripticut <- 0.025
minMAF <- NULL
maxMAF <- NULL
hg <- "hg19"
PlotIndepSNP <- TRUE
IndepSNP_window_size <- 50
IndepSNP_step_size <- 5
IndepSNP_r2_threshold <- 0.02
highLD_regions <- highLD_hg19
H2 <- EstimateHerit(
DataDir = DataDir, ResultDir = ResultDir, finput = finput,
summarystat = NULL, ncores, model = "GREML", byCHR = TRUE, r2_LD = 0,
LDSC_blocks = 20, REMLalgo = 0, nitr = 100, cat_covarfile = NULL, quant_covarfile = NULL,
prevalence = 0.01, partGRM = FALSE, autosome = TRUE, Xsome = TRUE, nGRM = 3,
cripticut = 0.025, minMAF = NULL, maxMAF = NULL, hg = "hg19", PlotIndepSNP = TRUE,
IndepSNP_window_size = 50, IndepSNP_step_size = 5, IndepSNP_r2_threshold = 0.02,
highLD_regions = highLD_hg19
)
Running EstimateHerit() with model = “GREML”
# Running
data("highLD_hg19", package = "GXwasR")
DataDir <- GXwasR:::GXwasR_data()
ResultDir = tempdir()
finput <- "GXwasR_example"
ncores = 3
model = "GREML"
byCHR = FALSE
r2_LD = 0
LDSC_blocks = 20
REMLalgo = 0
nitr = 100
cat_covarfile = NULL
quant_covarfile = NULL
prevalence = 0.01
partGRM = FALSE
autosome = TRUE
Xsome = TRUE
nGRM = 3
cripticut = 0.025
minMAF = NULL
maxMAF = NULL
hg = "hg19"
byCHR = TRUE
PlotIndepSNP = TRUE
IndepSNP_window_size = 50
IndepSNP_step_size = 5
IndepSNP_r2_threshold = 0.02
# For saving the plot in .jpeg file, make plotjpeg = TRUE.
H2 <- EstimateHerit(DataDir = DataDir, ResultDir = ResultDir, finput = finput, summarystat = NULL, ncores = 5, model = model, byCHR = TRUE, r2_LD = 0, LDSC_blocks = 20,REMLalgo = 0, nitr = nitr, cat_covarfile = NULL, quant_covarfile = NULL,prevalence = 0.01, partGRM = FALSE, autosome = TRUE, Xsome = TRUE, nGRM = 3, computeGRM = TRUE, grmfile_name = NULL, cripticut = 0.025, minMAF = NULL, maxMAF = NULL,hg = "hg19",PlotIndepSNP = TRUE, IndepSNP_window_size = 50,IndepSNP_step_size = 5,IndepSNP_r2_threshold = 0.02,highLD_regions = highLD_hg19, plotjpeg = TRUE, plotname = "Heritability_Plots")
#> ✔ Input genotype files are present in specified directory.
#> Using PLINK v1.9.0-b.7.7 64-bit (22 Oct 2024)
#> Processing chromosome 1
#> Using GCTA version v1.94.4 Mac
#> Processing chromosome 2
#> Processing chromosome 3
#> Processing chromosome 4
#> Processing chromosome 5
#> Processing chromosome 6
#> Processing chromosome 7
#> Processing chromosome 8
#> Processing chromosome 9
#> Processing chromosome 10
#> Processing chromosome 23
#> ✔ GRM has been saved in the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/xGXwasR.grm.bin]
#> ℹ Number of SNPs in each pair of individuals has been saved in the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/xGXwasR.grm.N.bin]
#>
#>
#>
#> Processing chromosome 24
#> ✔ Plots are saved in /var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2 with name Heritability_Plots.jpeg
#> ✔ All GRM related files are in /var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2
#Heritability
H2| Chromosome | SNP_proportion | No.of.genes | No.of.proteins | Size_mb | Source | Variance | SE |
|---|---|---|---|---|---|---|---|
| 1 | 0.0277453 | 2177 | 1936 | 249.25062 | V(G) | 0.000000 | 0.054312 |
| 1 | 0.0277453 | 2177 | 1936 | 249.25062 | V(e) | 0.239076 | 0.058127 |
| 1 | 0.0277453 | 2177 | 1936 | 249.25062 | Vp | 0.239076 | 0.020390 |
| 1 | 0.0277453 | 2177 | 1936 | 249.25062 | V(G)/Vp | 0.000001 | 0.227173 |
| 1 | 0.0277453 | 2177 | 1936 | 249.25062 | V(G)/Vp_L | 0.000001 | 0.131597 |
| 2 | 0.0275568 | 1377 | 1188 | 243.19937 | V(G) | 0.000000 | 0.050757 |
| 2 | 0.0275568 | 1377 | 1188 | 243.19937 | V(e) | 0.239068 | 0.054764 |
| 2 | 0.0275568 | 1377 | 1188 | 243.19937 | Vp | 0.239068 | 0.020389 |
| 2 | 0.0275568 | 1377 | 1188 | 243.19937 | V(G)/Vp | 0.000001 | 0.212310 |
| 2 | 0.0275568 | 1377 | 1188 | 243.19937 | V(G)/Vp_L | 0.000001 | 0.122987 |
| 3 | 0.0237494 | 1205 | 1029 | 198.02243 | V(G) | 0.000000 | 0.049616 |
| 3 | 0.0237494 | 1205 | 1029 | 198.02243 | V(e) | 0.239070 | 0.053909 |
| 3 | 0.0237494 | 1205 | 1029 | 198.02243 | Vp | 0.239070 | 0.020391 |
| 3 | 0.0237494 | 1205 | 1029 | 198.02243 | V(G)/Vp | 0.000001 | 0.207539 |
| 3 | 0.0237494 | 1205 | 1029 | 198.02243 | V(G)/Vp_L | 0.000001 | 0.120224 |
| 4 | 0.0235986 | 824 | 720 | 191.15428 | V(G) | 0.000000 | 0.050377 |
| 4 | 0.0235986 | 824 | 720 | 191.15428 | V(e) | 0.238750 | 0.053826 |
| 4 | 0.0235986 | 824 | 720 | 191.15428 | Vp | 0.238750 | 0.020355 |
| 4 | 0.0235986 | 824 | 720 | 191.15428 | V(G)/Vp | 0.000001 | 0.211004 |
| 4 | 0.0235986 | 824 | 720 | 191.15428 | V(G)/Vp_L | 0.000001 | 0.122231 |
| 5 | 0.0217137 | 958 | 839 | 180.91526 | V(G) | 0.000000 | 0.047760 |
| 5 | 0.0217137 | 958 | 839 | 180.91526 | V(e) | 0.238982 | 0.051750 |
| 5 | 0.0217137 | 958 | 839 | 180.91526 | Vp | 0.238982 | 0.020378 |
| 5 | 0.0217137 | 958 | 839 | 180.91526 | V(G)/Vp | 0.000001 | 0.199849 |
| 5 | 0.0217137 | 958 | 839 | 180.91526 | V(G)/Vp_L | 0.000001 | 0.115769 |
| 6 | 0.0200550 | 922 | 826 | 171.11507 | V(G) | 0.000000 | 0.044094 |
| 6 | 0.0200550 | 922 | 826 | 171.11507 | V(e) | 0.237174 | 0.047108 |
| 6 | 0.0200550 | 922 | 826 | 171.11507 | Vp | 0.237175 | 0.020203 |
| 6 | 0.0200550 | 922 | 826 | 171.11507 | V(G)/Vp | 0.000001 | 0.185916 |
| 6 | 0.0200550 | 922 | 826 | 171.11507 | V(G)/Vp_L | 0.000001 | 0.107697 |
| 7 | 0.0206959 | 997 | 855 | 159.13866 | V(G) | 0.000000 | 0.046032 |
| 7 | 0.0206959 | 997 | 855 | 159.13866 | V(e) | 0.238933 | 0.050098 |
| 7 | 0.0206959 | 997 | 855 | 159.13866 | Vp | 0.238934 | 0.020373 |
| 7 | 0.0206959 | 997 | 855 | 159.13866 | V(G)/Vp | 0.000001 | 0.192657 |
| 7 | 0.0206959 | 997 | 855 | 159.13866 | V(G)/Vp_L | 0.000001 | 0.111602 |
| 8 | 0.0186225 | 761 | 642 | 146.36402 | V(G) | 0.000000 | 0.045378 |
| 8 | 0.0186225 | 761 | 642 | 146.36402 | V(e) | 0.232560 | 0.046633 |
| 8 | 0.0186225 | 761 | 642 | 146.36402 | Vp | 0.232560 | 0.019797 |
| 8 | 0.0186225 | 761 | 642 | 146.36402 | V(G)/Vp | 0.000001 | 0.195125 |
| 8 | 0.0186225 | 761 | 642 | 146.36402 | V(G)/Vp_L | 0.000001 | 0.113032 |
| 9 | 0.0164361 | 861 | 732 | 141.21343 | V(G) | 0.000000 | 0.037296 |
| 9 | 0.0164361 | 861 | 732 | 141.21343 | V(e) | 0.238767 | 0.042010 |
| 9 | 0.0164361 | 861 | 732 | 141.21343 | Vp | 0.238767 | 0.020357 |
| 9 | 0.0164361 | 861 | 732 | 141.21343 | V(G)/Vp | 0.000001 | 0.156201 |
| 9 | 0.0164361 | 861 | 732 | 141.21343 | V(G)/Vp_L | 0.000001 | 0.090484 |
| 10 | 0.0175293 | 820 | 696 | 135.53475 | V(G) | 0.000000 | 0.043767 |
| 10 | 0.0175293 | 820 | 696 | 135.53475 | V(e) | 0.234920 | 0.045847 |
| 10 | 0.0175293 | 820 | 696 | 135.53475 | Vp | 0.234920 | 0.020010 |
| 10 | 0.0175293 | 820 | 696 | 135.53475 | V(G)/Vp | 0.000001 | 0.186305 |
| 10 | 0.0175293 | 820 | 696 | 135.53475 | V(G)/Vp_L | 0.000001 | 0.107923 |
| 23 | 0.0057677 | 0 | 0 | 155.27056 | V(G) | 0.161447 | 0.035905 |
| 23 | 0.0057677 | 0 | 0 | 155.27056 | V(e) | 0.074652 | 0.025725 |
| 23 | 0.0057677 | 0 | 0 | 155.27056 | Vp | 0.236099 | 0.021754 |
| 23 | 0.0057677 | 0 | 0 | 155.27056 | V(G)/Vp | 0.683811 | 0.116600 |
| 23 | 0.0057677 | 0 | 0 | 155.27056 | V(G)/Vp_L | 0.396119 | 0.067544 |
| 24 | 0.0001131 | 0 | 0 | 59.37357 | V(G) | 0.000000 | 0.043767 |
| 24 | 0.0001131 | 0 | 0 | 59.37357 | V(e) | 0.234920 | 0.045847 |
| 24 | 0.0001131 | 0 | 0 | 59.37357 | Vp | 0.234920 | 0.020010 |
| 24 | 0.0001131 | 0 | 0 | 59.37357 | V(G)/Vp | 0.000001 | 0.186305 |
| 24 | 0.0001131 | 0 | 0 | 59.37357 | V(G)/Vp_L | 0.000001 | 0.107923 |
Running the EstimateHerit() by providing chromosome-wise GRM files in ResultDir
Set:
computeGRM = FALSE
grmfile_name = “GXwasR”…… This is the prefix. These
files are created in the previous run in ResultDir. Users are encouraged
to check that folder.
H2 <- EstimateHerit(DataDir = DataDir, ResultDir = ResultDir, finput = finput, summarystat = NULL, ncores = 5, model = model, byCHR = TRUE, r2_LD = 0, LDSC_blocks = 20,REMLalgo = 0, nitr = nitr, cat_covarfile = NULL, quant_covarfile = NULL,prevalence = 0.01, partGRM = FALSE, autosome = TRUE, Xsome = TRUE, nGRM = 3, computeGRM = FALSE, grmfile_name = "GXwasR", cripticut = 0.025, minMAF = NULL, maxMAF = NULL,hg = "hg19",PlotIndepSNP = TRUE, IndepSNP_window_size = 50,IndepSNP_step_size = 5,IndepSNP_r2_threshold = 0.02,highLD_regions = highLD_hg19, plotjpeg = FALSE, plotname = "Heritability_Plots")
#> ✔ Input genotype files are present in specified directory.
#> Processing chromosome 1
#> Processing chromosome 2
#> Processing chromosome 3
#> Processing chromosome 4
#> Processing chromosome 5
#> Processing chromosome 6
#> Processing chromosome 7
#> Processing chromosome 8
#> Processing chromosome 9
#> Processing chromosome 10
#> Processing chromosome 23
#> Processing chromosome 24
#> ✔ All GRM related files are in /var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2
#Heritability
H2| Chromosome | SNP_proportion | No.of.genes | No.of.proteins | Size_mb | Source | Variance | SE |
|---|---|---|---|---|---|---|---|
| 1 | 0.0277453 | 2177 | 1936 | 249.25062 | V(G) | 0.000000 | 0.054312 |
| 1 | 0.0277453 | 2177 | 1936 | 249.25062 | V(e) | 0.239076 | 0.058127 |
| 1 | 0.0277453 | 2177 | 1936 | 249.25062 | Vp | 0.239076 | 0.020390 |
| 1 | 0.0277453 | 2177 | 1936 | 249.25062 | V(G)/Vp | 0.000001 | 0.227173 |
| 1 | 0.0277453 | 2177 | 1936 | 249.25062 | V(G)/Vp_L | 0.000001 | 0.131597 |
| 2 | 0.0275568 | 1377 | 1188 | 243.19937 | V(G) | 0.000000 | 0.050757 |
| 2 | 0.0275568 | 1377 | 1188 | 243.19937 | V(e) | 0.239068 | 0.054764 |
| 2 | 0.0275568 | 1377 | 1188 | 243.19937 | Vp | 0.239068 | 0.020389 |
| 2 | 0.0275568 | 1377 | 1188 | 243.19937 | V(G)/Vp | 0.000001 | 0.212310 |
| 2 | 0.0275568 | 1377 | 1188 | 243.19937 | V(G)/Vp_L | 0.000001 | 0.122987 |
| 3 | 0.0237494 | 1205 | 1029 | 198.02243 | V(G) | 0.000000 | 0.049616 |
| 3 | 0.0237494 | 1205 | 1029 | 198.02243 | V(e) | 0.239070 | 0.053909 |
| 3 | 0.0237494 | 1205 | 1029 | 198.02243 | Vp | 0.239070 | 0.020391 |
| 3 | 0.0237494 | 1205 | 1029 | 198.02243 | V(G)/Vp | 0.000001 | 0.207539 |
| 3 | 0.0237494 | 1205 | 1029 | 198.02243 | V(G)/Vp_L | 0.000001 | 0.120224 |
| 4 | 0.0235986 | 824 | 720 | 191.15428 | V(G) | 0.000000 | 0.050377 |
| 4 | 0.0235986 | 824 | 720 | 191.15428 | V(e) | 0.238750 | 0.053826 |
| 4 | 0.0235986 | 824 | 720 | 191.15428 | Vp | 0.238750 | 0.020355 |
| 4 | 0.0235986 | 824 | 720 | 191.15428 | V(G)/Vp | 0.000001 | 0.211004 |
| 4 | 0.0235986 | 824 | 720 | 191.15428 | V(G)/Vp_L | 0.000001 | 0.122231 |
| 5 | 0.0217137 | 958 | 839 | 180.91526 | V(G) | 0.000000 | 0.047760 |
| 5 | 0.0217137 | 958 | 839 | 180.91526 | V(e) | 0.238982 | 0.051750 |
| 5 | 0.0217137 | 958 | 839 | 180.91526 | Vp | 0.238982 | 0.020378 |
| 5 | 0.0217137 | 958 | 839 | 180.91526 | V(G)/Vp | 0.000001 | 0.199849 |
| 5 | 0.0217137 | 958 | 839 | 180.91526 | V(G)/Vp_L | 0.000001 | 0.115769 |
| 6 | 0.0200550 | 922 | 826 | 171.11507 | V(G) | 0.000000 | 0.044094 |
| 6 | 0.0200550 | 922 | 826 | 171.11507 | V(e) | 0.237174 | 0.047108 |
| 6 | 0.0200550 | 922 | 826 | 171.11507 | Vp | 0.237175 | 0.020203 |
| 6 | 0.0200550 | 922 | 826 | 171.11507 | V(G)/Vp | 0.000001 | 0.185916 |
| 6 | 0.0200550 | 922 | 826 | 171.11507 | V(G)/Vp_L | 0.000001 | 0.107697 |
| 7 | 0.0206959 | 997 | 855 | 159.13866 | V(G) | 0.000000 | 0.046032 |
| 7 | 0.0206959 | 997 | 855 | 159.13866 | V(e) | 0.238933 | 0.050098 |
| 7 | 0.0206959 | 997 | 855 | 159.13866 | Vp | 0.238934 | 0.020373 |
| 7 | 0.0206959 | 997 | 855 | 159.13866 | V(G)/Vp | 0.000001 | 0.192657 |
| 7 | 0.0206959 | 997 | 855 | 159.13866 | V(G)/Vp_L | 0.000001 | 0.111602 |
| 8 | 0.0186225 | 761 | 642 | 146.36402 | V(G) | 0.000000 | 0.045378 |
| 8 | 0.0186225 | 761 | 642 | 146.36402 | V(e) | 0.232560 | 0.046633 |
| 8 | 0.0186225 | 761 | 642 | 146.36402 | Vp | 0.232560 | 0.019797 |
| 8 | 0.0186225 | 761 | 642 | 146.36402 | V(G)/Vp | 0.000001 | 0.195125 |
| 8 | 0.0186225 | 761 | 642 | 146.36402 | V(G)/Vp_L | 0.000001 | 0.113032 |
| 9 | 0.0164361 | 861 | 732 | 141.21343 | V(G) | 0.000000 | 0.037296 |
| 9 | 0.0164361 | 861 | 732 | 141.21343 | V(e) | 0.238767 | 0.042010 |
| 9 | 0.0164361 | 861 | 732 | 141.21343 | Vp | 0.238767 | 0.020357 |
| 9 | 0.0164361 | 861 | 732 | 141.21343 | V(G)/Vp | 0.000001 | 0.156201 |
| 9 | 0.0164361 | 861 | 732 | 141.21343 | V(G)/Vp_L | 0.000001 | 0.090484 |
| 10 | 0.0175293 | 820 | 696 | 135.53475 | V(G) | 0.000000 | 0.043767 |
| 10 | 0.0175293 | 820 | 696 | 135.53475 | V(e) | 0.234920 | 0.045847 |
| 10 | 0.0175293 | 820 | 696 | 135.53475 | Vp | 0.234920 | 0.020010 |
| 10 | 0.0175293 | 820 | 696 | 135.53475 | V(G)/Vp | 0.000001 | 0.186305 |
| 10 | 0.0175293 | 820 | 696 | 135.53475 | V(G)/Vp_L | 0.000001 | 0.107923 |
| 23 | 0.0057677 | 0 | 0 | 155.27056 | V(G) | 0.161447 | 0.035905 |
| 23 | 0.0057677 | 0 | 0 | 155.27056 | V(e) | 0.074652 | 0.025725 |
| 23 | 0.0057677 | 0 | 0 | 155.27056 | Vp | 0.236099 | 0.021754 |
| 23 | 0.0057677 | 0 | 0 | 155.27056 | V(G)/Vp | 0.683811 | 0.116600 |
| 23 | 0.0057677 | 0 | 0 | 155.27056 | V(G)/Vp_L | 0.396119 | 0.067544 |
| 24 | 0.0001131 | 0 | 0 | 59.37357 | V(G) | 0.000000 | 0.043767 |
| 24 | 0.0001131 | 0 | 0 | 59.37357 | V(e) | 0.234920 | 0.045847 |
| 24 | 0.0001131 | 0 | 0 | 59.37357 | Vp | 0.234920 | 0.020010 |
| 24 | 0.0001131 | 0 | 0 | 59.37357 | V(G)/Vp | 0.000001 | 0.186305 |
| 24 | 0.0001131 | 0 | 0 | 59.37357 | V(G)/Vp_L | 0.000001 | 0.107923 |
Running the EstimateHerit() for genome-wide heritability estimate by creating GRM files
Set:
computeGRM = TRUE
byCHR = FALSE
grmfile_name = NULL…….if computeGRM = TRUE the grmfile_name is by default NULL.
In genome-wide case, there no plot will be generated.
H2 <- EstimateHerit(DataDir = DataDir, ResultDir = ResultDir, finput = finput, summarystat = NULL, ncores = 5, model = model, byCHR = FALSE, r2_LD = 0, LDSC_blocks = 20,REMLalgo = 0, nitr = nitr, cat_covarfile = NULL, quant_covarfile = NULL,prevalence = 0.01, partGRM = FALSE, autosome = TRUE, Xsome = TRUE, nGRM = 3, computeGRM = TRUE, grmfile_name = NULL, cripticut = 0.025, minMAF = NULL, maxMAF = NULL,hg = "hg19",PlotIndepSNP = TRUE, IndepSNP_window_size = 50,IndepSNP_step_size = 5,IndepSNP_r2_threshold = 0.02,highLD_regions = highLD_hg19, plotjpeg = FALSE, plotname = "Heritability_Plots")
#> ✔ Input genotype files are present in specified directory.
#> ✔ GRM has been saved in the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/GXwasR.grm.bin]
#> ℹ Number of SNPs in each pair of individuals has been saved in the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/GXwasR.grm.N.bin]
#>
#>
#>
#> ✔ GRM has been saved in the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/xGXwasR.grm.bin]
#> ℹ Number of SNPs in each pair of individuals has been saved in the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/xGXwasR.grm.N.bin]
#>
#>
#>
#> ℹ computeGRM is set to: TRUE
#> • Creating multi_GRMs.txt because computeGRM is TRUE
#> ✖ Convergence issue occurred, please:
#> - verify the model used
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> Log output from 'Reading IDs':
#> • Reading IDs of the GRM from [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/GXwasR.grm.id].
#> • 276 IDs are read from [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/GXwasR.grm.id].
#> • Reading the GRM from [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/GXwasR.grm.bin].
#> • GRM for 276 individuals are included from [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/GXwasR.grm.bin].
#> • Reading the GRM from the 2th file ...
#> • Reading IDs of the GRM from [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/xGXwasR.grm.id].
#> • 276 IDs are read from [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/xGXwasR.grm.id].
#> • Reading the GRM from [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/xGXwasR.grm.bin].
#> • GRM for 276 individuals are included from [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/xGXwasR.grm.bin].
#> • 276 individuals are in common in these files.
#> •
#> • Performing REML analysis ... (Note: may take hours depending on sample size).
#> • 276 observations, 1 fixed effect(s), and 3 variance component(s)(including residual variance).
#> • Calculating prior values of variance components by EM-REML ...
#> • Updated prior values: 0.0766102 0.0812353 0.0774914
#> • logL: 65.5415
#> • Running AI-REML algorithm ...
#> • Iter. logL V(G1) V(G2) V(e)
#> • 1 65.89 0.00000 0.07619 0.15118 (1 component(s) constrained)
#> • 2 67.21 0.00000 0.16240 0.21670 (1 component(s) constrained)
#> • 3 53.24 0.00000 0.05086 0.24361 (1 component(s) constrained)
#> • 4 59.08 0.00000 0.22012 0.23090 (1 component(s) constrained)
#> • 5 43.58 0.00000 0.03335 0.27444 (1 component(s) constrained)
#> • 6 55.91 0.00000 0.23059 0.22225 (1 component(s) constrained)
#> • 7 43.71 0.00000 0.03591 0.27305 (1 component(s) constrained)
#> • 8 56.00 0.00000 0.23306 0.22260 (1 component(s) constrained)
#> • 9 43.33 0.00000 0.03483 0.27436 (1 component(s) constrained)
#> • 10 55.88 0.00000 0.23293 0.22218 (1 component(s) constrained)
#> • 11 43.42 0.00000 0.03517 0.27401 (1 component(s) constrained)
#> • 12 55.91 0.00000 0.23306 0.22229 (1 component(s) constrained)
#> • 13 43.39 0.00000 0.03505 0.27414 (1 component(s) constrained)
#> • 14 55.90 0.00000 0.23302 0.22225 (1 component(s) constrained)
#> • 15 43.40 0.00000 0.03509 0.27410 (1 component(s) constrained)
#> • 16 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 17 43.39 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 18 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 19 43.40 0.00000 0.03509 0.27411 (1 component(s) constrained)
#> • 20 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 21 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 22 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 23 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 24 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 25 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 26 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 27 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 28 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 29 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 30 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 31 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 32 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 33 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 34 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 35 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 36 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 37 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 38 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 39 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 40 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 41 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 42 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 43 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 44 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 45 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 46 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 47 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 48 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 49 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 50 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 51 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 52 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 53 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 54 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 55 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 56 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 57 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 58 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 59 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 60 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 61 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 62 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 63 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 64 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 65 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 66 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 67 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 68 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 69 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 70 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 71 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 72 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 73 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 74 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 75 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 76 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 77 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 78 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 79 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 80 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 81 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 82 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 83 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 84 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 85 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 86 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 87 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 88 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 89 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 90 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 91 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 92 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 93 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 94 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 95 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 96 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 97 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • 98 55.90 0.00000 0.23303 0.22226 (1 component(s) constrained)
#> • 99 43.40 0.00000 0.03508 0.27411 (1 component(s) constrained)
#> • Error: Log-likelihood not converged (stop after 100 iteractions).
#> • You can specify the option --reml-maxit to allow for more iterations.
#> •
#> • An error occurs, please check the options or data
#> ✔ All GRM related files are in /var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2
#Heritability
H2| Source | Variance | SE |
|---|---|---|
| NA | NA | NA |
Running the EstimateHerit() for genome-wide heritability estimate by utilizing the pre-computed GRM files in ResultDir
Set:
computeGRM = FALSE
byCHR = FALSE
grmfile_name = “GXwasR”
In genome-wide case, there no plot will be generated.
H2 <- EstimateHerit(DataDir = DataDir, ResultDir = ResultDir, finput = finput, summarystat = NULL, ncores = 5, model = model, byCHR = FALSE, r2_LD = 0, LDSC_blocks = 20,REMLalgo = 0, nitr = nitr, cat_covarfile = NULL, quant_covarfile = NULL,prevalence = 0.01, partGRM = FALSE, autosome = TRUE, Xsome = TRUE, nGRM = 3, computeGRM = FALSE, grmfile_name = "GXwasR", cripticut = 0.025, minMAF = NULL, maxMAF = NULL,hg = "hg19",PlotIndepSNP = TRUE, IndepSNP_window_size = 50,IndepSNP_step_size = 5,IndepSNP_r2_threshold = 0.02,highLD_regions = highLD_hg19, plotjpeg = FALSE, plotname = "Heritability_Plots")
#> ✔ Input genotype files are present in specified directory.
#> ℹ Skipping GRM computation.
#> ℹ computeGRM is set to: FALSE
#> • computeGRM is FALSE, checking grmfile_name
#> Warning: path[1]="/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/GXwasR": No such file or directory
#Heritability
H2
#> NULLRunning EstimateHerit() genome-wide with model = “LDSC”
data("Summary_Stat_Ex1", package = "GXwasR")
model <- "LDSC"
data("GXwasRData")
#> Warning in data("GXwasRData"): data set 'GXwasRData' not found
DataDir <- GXwasR:::GXwasR_data()
ResultDir = tempdir()
finput <- "GXwasR_example"
test.sumstats <- na.omit(Summary_Stat_Ex1[Summary_Stat_Ex1$TEST=="ADD",c(1:4,6:8)])
colnames(test.sumstats) <- c("chr","rsid","pos","a1","n_eff","beta","beta_se")
summarystat = test.sumstats
highLD_regions = highLD_hg19
H2 <- EstimateHerit(DataDir = DataDir, ResultDir = ResultDir, finput = "GXwasR_example", summarystat = summarystat, ncores, model = model, byCHR = FALSE, r2_LD = 0, LDSC_blocks = 20,REMLalgo = 0, nitr = 100, cat_covarfile = NULL, quant_covarfile = NULL,prevalence = 0.01, partGRM = FALSE, autosome = TRUE, Xsome = TRUE, nGRM = 3,cripticut = 0.025, minMAF = NULL, maxMAF = NULL,hg = "hg19",PlotIndepSNP = TRUE, IndepSNP_window_size = 50,IndepSNP_step_size = 5,IndepSNP_r2_threshold = 0.02,highLD_regions = highLD_hg19)
#> An error occurred: incorrect number of dimensions
#Heritability
H2
#> NULLRunning EstimateHerit() chromosome-wise with model = “LDSC”
model <- "LDSC"
DataDir <- GXwasR:::GXwasR_data()
ResultDir = tempdir()
finput <- "GXwasR_example"
test.sumstats <- na.omit(Summary_Stat_Ex1[Summary_Stat_Ex1$TEST=="ADD",c(1:4,6:8)])
colnames(test.sumstats) <- c("chr","rsid","pos","a1","n_eff","beta","beta_se")
summarystat = test.sumstats
highLD_regions = highLD_hg19
H2 <- EstimateHerit(DataDir = DataDir, ResultDir = ResultDir, finput = "GXwasR_example", summarystat = summarystat, ncores, model = model, byCHR = TRUE, r2_LD = 0, LDSC_blocks = 20,REMLalgo = 0, nitr = 100, cat_covarfile = NULL, quant_covarfile = NULL,prevalence = 0.01, partGRM = FALSE, autosome = TRUE, Xsome = TRUE, nGRM = 3,cripticut = 0.025, minMAF = NULL, maxMAF = NULL,hg = "hg19",PlotIndepSNP = TRUE, IndepSNP_window_size = 50,IndepSNP_step_size = 5,IndepSNP_r2_threshold = 0.02,highLD_regions = highLD_hg19)
#> ℹ IndepSNPs needed to be supplied else all SNPs are being used.
#> Processing chromosome 1
#> An error occurred: incorrect number of dimensions
# Chromosome-wise Heritability Estimate
H2
#> NULLComputing genetic correlation between traits using GeneticCorrBT()
help(GeneticCorrBT, package = GXwasR)| GeneticCorrBT | R Documentation |
GeneticCorrBT: Computing genetic correlation between two traits.
Description
This function computes genetic correlation, a quantitative genetic measure that describes the genetic link between two traits and has been predicted to indicate pleiotropic gene activity or correlation between causative loci in two traits. For example, it does a bivariate GREML analysis to determine the genetic association between two quantitative traits, two binary disease traits from case-control studies, and between a quantitative trait and a binary disease trait following (Yang et al. 2011; Lee et al. 2012). If users want, this function gives the flexibility to compute the genetic correlation chromosome-wise.
Usage
GeneticCorrBT(
DataDir,
ResultDir,
finput,
byCHR = FALSE,
REMLalgo = c(0, 1, 2),
nitr = 100,
phenofile,
cat_covarfile = NULL,
quant_covarfile = NULL,
computeGRM = TRUE,
grmfile_name = NULL,
partGRM = FALSE,
autosome = TRUE,
Xsome = TRUE,
nGRM = 3,
cripticut = 0.025,
minMAF = NULL,
maxMAF = NULL,
excludeResidual = FALSE,
ncores = 2
)
Arguments
DataDir |
A character string for the file path of the all the input files. |
ResultDir |
A character string for the file path where all output files will be stored. The default is |
finput |
Character string, specifying the prefix of the input PLINK binary files for the genotype data. This file needs to be in |
byCHR |
Boolean value, |
REMLalgo |
Integer value of 0, 1 or 2, specifying the algorithm to run REML iterations, 0 for average information (AI), 1 for Fisher-scoring and 2 for EM. The default option is 0, i.e. AI-REML (1). |
nitr |
Integer value, specifying the number of iterations for performing the REML. The default is 100. |
phenofile |
A dataframe for Bivar RELM has four columns |
cat_covarfile |
A character string, specifying the name of the categorical covariate file which is a plain text file with no header line; columns are
|
quant_covarfile |
A character string, specifying the name of the quantitative covariate file which is a plain text file with no header line; columns
are |
computeGRM |
Boolean value, |
grmfile_name |
A string of characters specifying the prefix of autosomal .grm.bin file. Users need to provide separate GRM files for autosomes
and X chromosome in For instance, if autosomal file is "ABC.grm.bin", then X chromosomal file should be "xABC.grm.bim". If you are providing
chromosome-wise GRMs, then the prefix should add "ChrNumber_" at the starting of the prefix like, "Chr1_ABC.grm.bin".
The default is |
partGRM |
Boolean value, |
autosome |
Boolean value, |
Xsome |
Boolean value, |
nGRM |
Integer value, specifying the number of the partition of the GRM in GREML model. The default is 3. |
cripticut |
Numeric value, specifying the threshold to create a new GRM of "unrelated" individuals in GREML model. The default is arbitrary chosen as 0.025 following (Yang et al. 2011). |
minMAF |
Positive numeric value (< maxMAF), specifying the minimum threshold for the MAF filter of the SNPs in the Bivariate GREML model. |
maxMAF |
Positive numeric value (minMAF,1), specifying the maximum threshold for the MAF filter of the SNPs in the Bivariate GREML model. |
excludeResidual |
Boolean value, |
ncores |
Integer value, specifying the number of cores to be used. |
Value
A dataframe with minimum three columns:
-
Source" (i.e., source of heritability)
-
Variance" (i.e. estimated heritability)
-
SE" (i.e., standard error of the estimated heritability)
Source column will have rows, such as V(G)_tr1 (genetic variance for trait 1), V(G)_tr2 (genetic variance for trait 2), C(G)_tr12 (genetic covariance between traits 1 and 2),V(e)_tr1 (residual variance for trait 1), V(e)_tr2 (residual variance for trait 2), C(e)_tr12 (residual covariance between traits 1 and 2), Vp_tr1 (proportion of variance explained by all SNPs for trait 1), Vp_tr2 (proportion of variance explained by all SNPs for trait 2), V(G)/Vp_tr1 (phenotypic variance for trait 1), V(G)/Vp_tr2 (phenotypic variance for trait 2), rG (genetic correlation) and n (sample size). In case of chromosome-wise analysis, there will be 'chromosome' column for chromosome code.
References
Lee SH, Wray NR, Goddard ME, Visscher PM (2012).
“Estimation of pleiotropy between complex diseases using SNP-derived genomic relationships and restricted maximum likelihood.”
Bioinformatics, 28, 2540–2542.
doi:10.1093/bioinformatics/bts474, http://www.ncbi.nlm.nih.gov/pubmed/22843982.
Yang J, Lee SH, Goddard ME, Visscher PM (2011).
“GCTA: a tool for Genome-wide Complex Trait Analysis.”
American Journal of Human Genetics, 88(1), 76–82.
Examples
data("Example_phenofile", package = "GXwasR")
DataDir <- GXwasR:::GXwasR_data()
ResultDir <- tempdir()
finput <- "GXwasR_example"
byCHR <- TRUE
REMLalgo <- 0
nitr <- 3
ncores <- 3
phenofile <- Example_phenofile # Cannot be NULL
cat_covarfile <- NULL
quant_covarfile <- NULL
partGRM <- FALSE # Partition the GRM into m parts (by row),
autosome <- TRUE
Xsome <- TRUE
cripticut <- 0.025
minMAF <- 0.01 # if MAF filter apply
maxMAF <- 0.04
excludeResidual <- TRUE
genetic_correlation <- GeneticCorrBT(
DataDir = DataDir, ResultDir = ResultDir, finput = finput, byCHR = byCHR,
REMLalgo = 0, nitr = 10, phenofile = phenofile, cat_covarfile = NULL, quant_covarfile = NULL,
partGRM = FALSE, autosome = TRUE, Xsome = TRUE, nGRM = 3,
cripticut = 0.025, minMAF = NULL, maxMAF = NULL, excludeResidual = TRUE, ncores = ncores
)
Running GeneticCorrBT() by computing GRM genome-wide
# Running
DataDir <- GXwasR:::GXwasR_data()
ResultDir <- tempdir()
finput <- "GXwasR_example"
byCHR = FALSE
REMLalgo = 0
nitr <- 3
ncores <- 3
data("Example_phenofile", package = "GXwasR")
phenofile <- Example_phenofile #Cannot be NULL, the interested phenotype column should be labeled as
cat_covarfile <- NULL
quant_covarfile <- NULL
partGRM <- FALSE #Partition the GRM into m parts (by row),
autosome = TRUE
Xsome <- TRUE
cripticut = 0.025
minMAF <- 0.01 # if MAF filter apply
maxMAF <- 0.04
excludeResidual = TRUE
GC <- GeneticCorrBT(DataDir = DataDir, ResultDir = ResultDir, finput = finput, byCHR = byCHR,
REMLalgo = 0, nitr = nitr, phenofile = phenofile, cat_covarfile = NULL, quant_covarfile = NULL, computeGRM = TRUE, grmfile_name = NULL, partGRM = FALSE, autosome = TRUE, Xsome = TRUE, nGRM = 3,cripticut = 0.025, minMAF = NULL, maxMAF = NULL,excludeResidual = TRUE, ncores = ncores)
#> ✔ GRM has been saved in the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/GXwasR.grm.bin]
#> ℹ Number of SNPs in each pair of individuals has been saved in the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/GXwasR.grm.N.bin]
#>
#>
#>
#> ✔ GRM has been saved in the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/xGXwasR.grm.bin]
#> ℹ Number of SNPs in each pair of individuals has been saved in the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/xGXwasR.grm.N.bin]
#>
#>
#>
#> ℹ computeGRM is set to: TRUE
#> ℹ Creating multi_GRMs.txt because computeGRM is TRUE
#> ✖ Error: Log-likelihood not converged (stop after 3 iteractions).
#> ℹ Note: to constrain the correlation being from -1 to 1, a genetic (or residual) variance-covariance matrix is bended to be positive definite. In this case, the SE is unreliable.
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
##Genetic correlation from the last iteration. In this example there was no rg value since the program stopped after nitr-1 = 2 iteration due to convergence issue.
GC| Source | Variance | |
|---|---|---|
| 2 | logL | 347.85 |
| 3 | V(G1)_tr1 | 0.00000 |
| 4 | V(G1)_tr2 | 0.00000 |
| 5 | C(G1)_tr12 | 0.00000 |
| 6 | V(G2)_tr1 | 0.04243 |
| 7 | V(G2)_tr2 | 0.00547 |
| 8 | C(G2)_tr12 | -0.00060 |
| 9 | V(e)_tr1 | 0.17746 |
| 10 | V(e)_tr2 | 0.00470 |
Running GeneticCorrBT() using precomputed genome-wide GRM
byCHR = FALSE
computeGRM = FALSE
grmfile_name = "GXwasR"
GC <- GeneticCorrBT(DataDir = DataDir, ResultDir = ResultDir, finput = finput, byCHR = byCHR,
REMLalgo = 0, nitr = nitr, phenofile = phenofile, cat_covarfile = NULL, quant_covarfile = NULL, computeGRM = FALSE, grmfile_name = grmfile_name, partGRM = FALSE, autosome = TRUE, Xsome = TRUE, nGRM = 3,cripticut = 0.025, minMAF = NULL, maxMAF = NULL,excludeResidual = TRUE, ncores = ncores)
#> ℹ Skipping GRM computation.
#> ℹ computeGRM is set to: FALSE
#> ℹ computeGRM is FALSE, checking grmfile_name
#> ✖ Error: Log-likelihood not converged (stop after 3 iteractions).
#> ℹ Note: to constrain the correlation being from -1 to 1, a genetic (or residual) variance-covariance matrix is bended to be positive definite. In this case, the SE is unreliable.
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
##Genetic correlation from the last iteration. In this example there was no rg value since the program stopped after nitr-1 = 2 iteration due to convergence issue.
GC| Source | Variance | |
|---|---|---|
| 2 | logL | 347.85 |
| 3 | V(G1)_tr1 | 0.00000 |
| 4 | V(G1)_tr2 | 0.00000 |
| 5 | C(G1)_tr12 | 0.00000 |
| 6 | V(G2)_tr1 | 0.04243 |
| 7 | V(G2)_tr2 | 0.00547 |
| 8 | C(G2)_tr12 | -0.00060 |
| 9 | V(e)_tr1 | 0.17746 |
| 10 | V(e)_tr2 | 0.00470 |
Running GeneticCorrBT() by computing GRM chromosome-wise
byCHR = TRUE
computeGRM = TRUE
grmfile_name = NULL
GC <- GeneticCorrBT(DataDir = DataDir, ResultDir = ResultDir, finput = finput, byCHR = byCHR,
REMLalgo = 0, nitr = nitr, phenofile = phenofile, cat_covarfile = NULL, quant_covarfile = NULL, computeGRM = computeGRM, grmfile_name = grmfile_name, partGRM = FALSE, autosome = TRUE, Xsome = TRUE, nGRM = 3,cripticut = 0.025, minMAF = NULL, maxMAF = NULL,excludeResidual = TRUE, ncores = ncores)
#> Processing chromosome 1
#> ✖ Error: Log-likelihood not converged (stop after 3 iteractions).
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 2
#> ✖ Error: Log-likelihood not converged (stop after 3 iteractions).
#> ℹ Note: to constrain the correlation being from -1 to 1, a genetic (or residual) variance-covariance matrix is bended to be positive definite. In this case, the SE is unreliable.
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 3
#> ✖ Error: Log-likelihood not converged (stop after 3 iteractions).
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 4
#> ✖ Error: Log-likelihood not converged (stop after 3 iteractions).
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 5
#> ✖ Error: Log-likelihood not converged (stop after 3 iteractions).
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 6
#> ✖ Error: Log-likelihood not converged (stop after 3 iteractions).
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 7
#> ✖ Error: Log-likelihood not converged (stop after 3 iteractions).
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 8
#> ✖ Error: Log-likelihood not converged (stop after 3 iteractions).
#> ℹ Note: to constrain the correlation being from -1 to 1, a genetic (or residual) variance-covariance matrix is bended to be positive definite. In this case, the SE is unreliable.
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 9
#> ✖ Error: Log-likelihood not converged (stop after 3 iteractions).
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 10
#> ✖ Error: Log-likelihood not converged (stop after 3 iteractions).
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 23
#> ✔ GRM has been saved in the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/xGXwasR.grm.bin]
#> ℹ Number of SNPs in each pair of individuals has been saved in the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/xGXwasR.grm.N.bin]
#>
#>
#>
#> ✖ Error: Log-likelihood not converged (stop after 3 iteractions).
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 24
#> ✖ Error: Log-likelihood not converged (stop after 3 iteractions).
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
GC| chromosome | Source | Variance |
|---|---|---|
| 1 | V.G._tr1 | 0.05138 |
| 1 | V.G._tr2 | 0.00213 |
| 1 | C.G._tr12 | 0.00469 |
| 1 | V.e._tr1 | 0.18285 |
| 1 | V.e._tr2 | 0.03878 |
| 1 | X | NA |
| 2 | V.G._tr1 | 0.04528 |
| 2 | V.G._tr2 | 0.00082 |
| 2 | C.G._tr12 | 0.00608 |
| 2 | V.e._tr1 | 0.18797 |
| 2 | V.e._tr2 | 0.04005 |
| 2 | X | NA |
| 3 | V.G._tr1 | 0.04650 |
| 3 | V.G._tr2 | 0.01572 |
| 3 | C.G._tr12 | 0.00651 |
| 3 | V.e._tr1 | 0.18726 |
| 3 | V.e._tr2 | 0.02617 |
| 3 | X | NA |
| 4 | V.G._tr1 | 0.04069 |
| 4 | V.G._tr2 | 0.01256 |
| 4 | C.G._tr12 | 0.00562 |
| 4 | V.e._tr1 | 0.19310 |
| 4 | V.e._tr2 | 0.02917 |
| 4 | X | NA |
| 5 | V.G._tr1 | 0.04711 |
| 5 | V.G._tr2 | 0.00633 |
| 5 | C.G._tr12 | 0.00598 |
| 5 | V.e._tr1 | 0.18671 |
| 5 | V.e._tr2 | 0.03486 |
| 5 | X | NA |
| 6 | V.G._tr1 | 0.02092 |
| 6 | V.G._tr2 | 0.01238 |
| 6 | C.G._tr12 | 0.00481 |
| 6 | V.e._tr1 | 0.20929 |
| 6 | V.e._tr2 | 0.02924 |
| 6 | X | NA |
| 7 | V.G._tr1 | 0.04212 |
| 7 | V.G._tr2 | 0.00460 |
| 7 | C.G._tr12 | 0.00347 |
| 7 | V.e._tr1 | 0.19032 |
| 7 | V.e._tr2 | 0.03621 |
| 7 | X | NA |
| 8 | V.G._tr1 | 0.01087 |
| 8 | V.G._tr2 | 0.00261 |
| 8 | C.G._tr12 | 0.00533 |
| 8 | V.e._tr1 | 0.21702 |
| 8 | V.e._tr2 | 0.03861 |
| 8 | X | NA |
| 9 | V.G._tr1 | 0.03287 |
| 9 | V.G._tr2 | 0.00896 |
| 9 | C.G._tr12 | 0.00466 |
| 9 | V.e._tr1 | 0.19717 |
| 9 | V.e._tr2 | 0.03229 |
| 9 | X | NA |
| 10 | V.G._tr1 | 0.01271 |
| 10 | V.G._tr2 | 0.00711 |
| 10 | C.G._tr12 | 0.00667 |
| 10 | V.e._tr1 | 0.21588 |
| 10 | V.e._tr2 | 0.03385 |
| 10 | X | NA |
| 23 | V.G._tr1 | 0.13520 |
| 23 | V.G._tr2 | 0.00746 |
| 23 | C.G._tr12 | 0.00435 |
| 23 | V.e._tr1 | 0.09522 |
| 23 | V.e._tr2 | 0.03324 |
| 23 | X | NA |
| 24 | V.G._tr1 | 0.01271 |
| 24 | V.G._tr2 | 0.00711 |
| 24 | C.G._tr12 | 0.00667 |
| 24 | V.e._tr1 | 0.21588 |
| 24 | V.e._tr2 | 0.03385 |
| 24 | X | NA |
Running GeneticCorrBT() using chromosome-wide pre-computed GRM
byCHR = TRUE
computeGRM = FALSE
grmfile_name = "GXwasR"
GC <- GeneticCorrBT(DataDir = DataDir, ResultDir = ResultDir, finput = finput, byCHR = byCHR,
REMLalgo = 0, nitr = nitr, phenofile = phenofile, cat_covarfile = NULL, quant_covarfile = NULL, computeGRM = computeGRM, grmfile_name = grmfile_name, partGRM = FALSE, autosome = TRUE, Xsome = TRUE, nGRM = 3,cripticut = 0.025, minMAF = NULL, maxMAF = NULL,excludeResidual = TRUE, ncores = ncores)
#> Processing chromosome 1
#> ✖ Error: cannot open the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/Chr1_GXwasR.grm.id] to read.
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 2
#> ✖ Error: cannot open the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/Chr2_GXwasR.grm.id] to read.
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 3
#> ✖ Error: cannot open the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/Chr3_GXwasR.grm.id] to read.
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 4
#> ✖ Error: cannot open the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/Chr4_GXwasR.grm.id] to read.
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 5
#> ✖ Error: cannot open the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/Chr5_GXwasR.grm.id] to read.
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 6
#> ✖ Error: cannot open the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/Chr6_GXwasR.grm.id] to read.
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 7
#> ✖ Error: cannot open the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/Chr7_GXwasR.grm.id] to read.
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 8
#> ✖ Error: cannot open the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/Chr8_GXwasR.grm.id] to read.
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 9
#> ✖ Error: cannot open the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/Chr9_GXwasR.grm.id] to read.
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 10
#> ✖ Error: cannot open the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/Chr10_GXwasR.grm.id] to read.
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 23
#> ✖ Error: cannot open the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/xGXwasR.grm.id] to read.
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
#>
#>
#>
#> Processing chromosome 24
#> ✖ Error: cannot open the file [/var/folders/d6/gtwl3_017sj4pp14fbfcbqjh0000gp/T//RtmpXETxP2/Chr24_GXwasR.grm.id] to read.
#> ✖ Convergence issue occurred, please:
#> - set byCHR = TRUE
#> - set different options
#> - verify SNP partitioning or quality of the data
#> ℹ The result will be provided for the last iteration.
GC| chromosome | Source | Variance |
|---|---|---|
| 1 | NA | NA |
| 2 | NA | NA |
| 3 | NA | NA |
| 4 | NA | NA |
| 5 | NA | NA |
| 6 | NA | NA |
| 7 | NA | NA |
| 8 | NA | NA |
| 9 | NA | NA |
| 10 | NA | NA |
| 23 | NA | NA |
| 24 | NA | NA |
Note: When computeGRM = FALSE, the function assumes that all required GRM files already exist in ResultDir with the expected naming convention (e.g., Chr1_GXwasR.grm.*). If these files are not present, the analysis will fail because GCTA will be unable to locate the input GRM files.
Citing GXwasR
We hope that GXwasR will be useful for your research. Please use the following information to cite the package and the overall approach. Thank you!
## Citation info
citation("GXwasR")
#> To cite package 'GXwasR' in publications use:
#>
#> Bose B, Blostein F, Kim J, Winters J, Actkins KV, Mayer D, Congivaram
#> H, Niarchou M, Edwards DV, Davis LK, Stranger BE (2025). "GXwasR: A
#> Toolkit for Investigating Sex-Differentiated Genetic Effects on
#> Complex Traits." _medRxiv 2025.06.10.25329327_.
#> doi:10.1101/2025.06.10.25329327
#> <https://doi.org/10.1101/2025.06.10.25329327>.
#>
#> A BibTeX entry for LaTeX users is
#>
#> @Article{,
#> title = {GXwasR: A Toolkit for Investigating Sex-Differentiated Genetic Effects on Complex Traits},
#> author = {Banabithi Bose and Freida Blostein and Jeewoo Kim and Jessica Winters and Ky’Era V. Actkins and David Mayer and Harrsha Congivaram and Maria Niarchou and Digna Velez Edwards and Lea K. Davis and Barbara E. Stranger},
#> journal = {medRxiv 2025.06.10.25329327},
#> year = {2025},
#> doi = {10.1101/2025.06.10.25329327},
#> }Reproducibility
The GXwasR package (Bose, Blostein, Kim, Winters, Actkins, Mayer, Congivaram, Niarchou, Edwards, Davis, and Stranger, 2025) was made possible thanks to:
- R (R Core Team, 2025)
- BiocStyle (Oleś, 2025)
- knitr (Xie, 2025)
- RefManageR (McLean, 2017)
- rmarkdown (Allaire, Xie, Dervieux, McPherson, Luraschi, Ushey, Atkins, Wickham, Cheng, Chang, and Iannone, 2025)
- sessioninfo (Wickham, Chang, Flight, Müller, and Hester, 2025)
- testthat (Wickham, 2011)
This package was developed using biocthis.
R session information.
#> ─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.5.1 (2025-06-13)
#> os macOS Sequoia 15.7.1
#> system aarch64, darwin24.4.0
#> ui unknown
#> language en-US
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz America/New_York
#> date 2025-10-16
#> pandoc 3.6.3 @ /Applications/Positron.app/Contents/Resources/app/quarto/bin/tools/aarch64/ (via rmarkdown)
#> quarto 1.8.25 @ /usr/local/bin/quarto
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> abind 1.4-8 2024-09-12 [1] CRAN (R 4.5.0)
#> backports 1.5.0 2024-05-23 [1] CRAN (R 4.5.1)
#> bibtex 0.5.1 2023-01-26 [1] CRAN (R 4.5.0)
#> bigassertr 0.1.7 2025-06-27 [1] CRAN (R 4.5.1)
#> bigparallelr 0.3.2 2021-10-02 [1] CRAN (R 4.5.0)
#> bigsnpr 1.12.21 2025-08-21 [1] CRAN (R 4.5.1)
#> bigsparser 0.7.3 2024-09-06 [1] CRAN (R 4.5.1)
#> bigstatsr 1.6.2 2025-07-29 [1] CRAN (R 4.5.1)
#> Biobase 2.68.0 2025-04-15 [1] Bioconduc~
#> BiocGenerics 0.54.0 2025-04-15 [1] Bioconduc~
#> BiocIO 1.18.0 2025-04-15 [1] Bioconduc~
#> BiocManager 1.30.26 2025-06-05 [1] CRAN (R 4.5.0)
#> BiocParallel 1.42.2 2025-09-14 [1] Bioconductor 3.21 (R 4.5.1)
#> BiocStyle * 2.36.0 2025-04-15 [1] Bioconduc~
#> Biostrings 2.76.0 2025-04-15 [1] Bioconduc~
#> bit 4.6.0 2025-03-06 [1] CRAN (R 4.5.1)
#> bit64 4.6.0-1 2025-01-16 [1] CRAN (R 4.5.1)
#> bitops 1.0-9 2024-10-03 [1] CRAN (R 4.5.0)
#> bookdown 0.45 2025-10-03 [1] CRAN (R 4.5.1)
#> broom 1.0.10 2025-09-13 [1] CRAN (R 4.5.1)
#> BSgenome 1.76.0 2025-04-15 [1] Bioconduc~
#> bslib 0.9.0 2025-01-30 [1] CRAN (R 4.5.0)
#> cachem 1.1.0 2024-05-16 [1] CRAN (R 4.5.0)
#> calibrate 1.7.7 2020-06-19 [1] CRAN (R 4.5.0)
#> car 3.1-3 2024-09-27 [1] CRAN (R 4.5.0)
#> carData 3.0-5 2022-01-06 [1] CRAN (R 4.5.0)
#> cli 3.6.5 2025-04-23 [1] CRAN (R 4.5.0)
#> codetools 0.2-20 2024-03-31 [3] CRAN (R 4.5.1)
#> cowplot 1.2.0 2025-07-07 [1] CRAN (R 4.5.1)
#> crayon 1.5.3 2024-06-20 [1] CRAN (R 4.5.0)
#> curl 7.0.0 2025-08-19 [1] CRAN (R 4.5.1)
#> data.table 1.17.8 2025-07-10 [1] CRAN (R 4.5.1)
#> DelayedArray 0.34.1 2025-04-17 [1] Bioconduc~
#> desc 1.4.3 2023-12-10 [1] CRAN (R 4.5.0)
#> digest 0.6.37 2024-08-19 [1] CRAN (R 4.5.0)
#> doParallel 1.0.17 2022-02-07 [1] CRAN (R 4.5.0)
#> doRNG 1.8.6.2 2025-04-02 [1] CRAN (R 4.5.0)
#> dplyr 1.1.4 2023-11-17 [1] CRAN (R 4.5.0)
#> evaluate 1.0.5 2025-08-27 [1] CRAN (R 4.5.1)
#> farver 2.1.2 2024-05-13 [1] CRAN (R 4.5.0)
#> fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.5.0)
#> flock 0.7 2016-11-12 [1] CRAN (R 4.5.1)
#> foreach 1.5.2 2022-02-02 [1] CRAN (R 4.5.0)
#> Formula 1.2-5 2023-02-24 [1] CRAN (R 4.5.0)
#> fs 1.6.6 2025-04-12 [1] CRAN (R 4.5.0)
#> gdsfmt 1.44.1 2025-07-09 [1] Bioconduc~
#> generics 0.1.4 2025-05-09 [1] CRAN (R 4.5.0)
#> GenomeInfoDb 1.44.3 2025-09-21 [1] Bioconductor 3.21 (R 4.5.1)
#> GenomeInfoDbData 1.2.14 2025-04-21 [1] Bioconductor
#> GenomicAlignments 1.44.0 2025-04-15 [1] Bioconduc~
#> GenomicRanges 1.60.0 2025-04-15 [1] Bioconduc~
#> ggplot2 4.0.0 2025-09-11 [1] CRAN (R 4.5.1)
#> ggpubr 0.6.1 2025-06-27 [1] CRAN (R 4.5.1)
#> ggrepel 0.9.6 2024-09-07 [1] CRAN (R 4.5.1)
#> ggsignif 0.6.4 2022-10-13 [1] CRAN (R 4.5.0)
#> glue 1.8.0 2024-09-30 [1] CRAN (R 4.5.0)
#> gridExtra 2.3 2017-09-09 [1] CRAN (R 4.5.0)
#> gtable 0.3.6 2024-10-25 [1] CRAN (R 4.5.0)
#> GXwasR * 0.99.0 2025-10-02 [1] Bioconductor
#> hms 1.1.3 2023-03-21 [1] CRAN (R 4.5.0)
#> htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.5.0)
#> htmlwidgets 1.6.4 2023-12-06 [1] CRAN (R 4.5.0)
#> httr 1.4.7 2023-08-15 [1] CRAN (R 4.5.0)
#> IRanges 2.42.0 2025-04-15 [1] Bioconduc~
#> iterators 1.0.14 2022-02-05 [1] CRAN (R 4.5.0)
#> jquerylib 0.1.4 2021-04-26 [1] CRAN (R 4.5.0)
#> jsonlite 2.0.0 2025-03-27 [1] CRAN (R 4.5.0)
#> knitr 1.50 2025-03-16 [1] CRAN (R 4.5.0)
#> labeling 0.4.3 2023-08-29 [1] CRAN (R 4.5.0)
#> lattice 0.22-7 2025-04-02 [3] CRAN (R 4.5.1)
#> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.5.0)
#> lubridate 1.9.4 2024-12-08 [1] CRAN (R 4.5.1)
#> magrittr 2.0.4 2025-09-12 [1] CRAN (R 4.5.1)
#> MASS 7.3-65 2025-02-28 [3] CRAN (R 4.5.1)
#> mathjaxr 1.8-0 2025-04-30 [1] CRAN (R 4.5.1)
#> Matrix 1.7-4 2025-08-28 [3] CRAN (R 4.5.1)
#> MatrixGenerics 1.20.0 2025-04-15 [1] Bioconduc~
#> matrixStats 1.5.0 2025-01-07 [1] CRAN (R 4.5.0)
#> memoise 2.0.1 2021-11-26 [1] CRAN (R 4.5.0)
#> mgcv 1.9-3 2025-04-04 [3] CRAN (R 4.5.1)
#> nlme 3.1-168 2025-03-31 [3] CRAN (R 4.5.1)
#> pillar 1.11.1 2025-09-17 [1] CRAN (R 4.5.1)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.5.0)
#> pkgdown 2.1.3 2025-05-25 [2] CRAN (R 4.5.0)
#> plyr 1.8.9 2023-10-02 [1] CRAN (R 4.5.1)
#> plyranges 1.28.0 2025-04-15 [1] Bioconduc~
#> polynom 1.4-1 2022-04-11 [1] CRAN (R 4.5.0)
#> poolr 1.2-0 2025-05-07 [1] CRAN (R 4.5.0)
#> prettyunits 1.2.0 2023-09-24 [1] CRAN (R 4.5.0)
#> printr * 0.3 2023-03-08 [1] CRAN (R 4.5.0)
#> progress 1.2.3 2023-12-06 [1] CRAN (R 4.5.0)
#> purrr 1.1.0 2025-07-10 [1] CRAN (R 4.5.1)
#> qqman 0.1.9 2023-08-23 [1] CRAN (R 4.5.0)
#> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.5.0)
#> R.oo 1.27.1 2025-05-02 [1] CRAN (R 4.5.0)
#> R.utils 2.13.0 2025-02-24 [1] CRAN (R 4.5.0)
#> R6 2.6.1 2025-02-15 [1] CRAN (R 4.5.0)
#> ragg 1.5.0 2025-09-02 [2] CRAN (R 4.5.1)
#> rbibutils 2.3 2024-10-04 [1] CRAN (R 4.5.1)
#> RColorBrewer 1.1-3 2022-04-03 [1] CRAN (R 4.5.0)
#> Rcpp 1.1.0 2025-07-02 [1] CRAN (R 4.5.1)
#> RCurl 1.98-1.17 2025-03-22 [1] CRAN (R 4.5.0)
#> Rdpack 2.6.4 2025-04-09 [1] CRAN (R 4.5.0)
#> RefManageR * 1.4.0 2022-09-30 [1] CRAN (R 4.5.1)
#> regioneR 1.40.1 2025-06-01 [1] Bioconductor 3.21 (R 4.5.0)
#> restfulr 0.0.16 2025-06-27 [1] CRAN (R 4.5.1)
#> rjson 0.2.23 2024-09-16 [1] CRAN (R 4.5.0)
#> rlang 1.1.6 2025-04-11 [1] CRAN (R 4.5.0)
#> rmarkdown * 2.30 2025-09-28 [1] CRAN (R 4.5.1)
#> rmio 0.4.0 2022-02-17 [1] CRAN (R 4.5.0)
#> rngtools 1.5.2 2021-09-20 [1] CRAN (R 4.5.0)
#> Rsamtools 2.24.1 2025-09-07 [1] Bioconductor 3.21 (R 4.5.1)
#> rstatix 0.7.2 2023-02-01 [1] CRAN (R 4.5.0)
#> rtracklayer 1.68.0 2025-04-15 [1] Bioconduc~
#> S4Arrays 1.8.1 2025-06-01 [1] Bioconductor 3.21 (R 4.5.0)
#> S4Vectors 0.46.0 2025-04-15 [1] Bioconduc~
#> S7 0.2.0 2024-11-07 [1] CRAN (R 4.5.1)
#> sass 0.4.10 2025-04-11 [1] CRAN (R 4.5.0)
#> scales 1.4.0 2025-04-24 [1] CRAN (R 4.5.0)
#> sessioninfo * 1.2.3 2025-02-05 [1] CRAN (R 4.5.1)
#> SNPRelate 1.42.0 2025-04-15 [1] Bioconduc~
#> SparseArray 1.8.1 2025-07-23 [1] Bioconduc~
#> stringi 1.8.7 2025-03-27 [1] CRAN (R 4.5.0)
#> stringr 1.5.2 2025-09-08 [1] CRAN (R 4.5.1)
#> sumFREGAT 1.2.5 2022-06-07 [1] CRAN (R 4.5.1)
#> SummarizedExperiment 1.38.1 2025-04-30 [1] Bioconductor 3.21 (R 4.5.0)
#> sys 3.4.3 2024-10-04 [1] CRAN (R 4.5.0)
#> systemfonts 1.3.1 2025-10-01 [1] CRAN (R 4.5.1)
#> textshaping 1.0.3 2025-09-02 [1] CRAN (R 4.5.1)
#> tibble 3.3.0 2025-06-08 [1] CRAN (R 4.5.0)
#> tidyr 1.3.1 2024-01-24 [1] CRAN (R 4.5.1)
#> tidyselect 1.2.1 2024-03-11 [1] CRAN (R 4.5.0)
#> timechange 0.3.0 2024-01-18 [1] CRAN (R 4.5.1)
#> tzdb 0.5.0 2025-03-15 [1] CRAN (R 4.5.1)
#> UCSC.utils 1.4.0 2025-04-15 [1] Bioconduc~
#> vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.5.0)
#> vroom 1.6.6 2025-09-19 [1] CRAN (R 4.5.1)
#> withr 3.0.2 2024-10-28 [1] CRAN (R 4.5.0)
#> xfun 0.53 2025-08-19 [1] CRAN (R 4.5.1)
#> XML 3.99-0.19 2025-08-22 [1] CRAN (R 4.5.1)
#> xml2 1.4.0 2025-08-20 [1] CRAN (R 4.5.1)
#> XVector 0.48.0 2025-04-15 [1] Bioconduc~
#> yaml 2.3.10 2024-07-26 [1] CRAN (R 4.5.0)
#>
#> [1] /Users/mayerdav/Library/R/arm64/4.5/library
#> [2] /opt/homebrew/lib/R/4.5/site-library
#> [3] /opt/homebrew/Cellar/r/4.5.1/lib/R/library
#> * ── Packages attached to the search path.
#>
#> ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Bibliography
This vignette was generated using BiocStyle (Oleś, 2025) with knitr (Xie, 2025) and rmarkdown (Allaire, Xie, Dervieux et al., 2025) running behind the scenes.
Citations made with RefManageR (McLean, 2017).
[1] J. Allaire, Y. Xie, C. Dervieux, et al. rmarkdown: Dynamic Documents for R. R package version 2.30. 2025. URL: https://github.com/rstudio/rmarkdown.
[2] B. Bose, F. Blostein, J. Kim, et al. “GXwasR: A Toolkit for Investigating Sex-Differentiated Genetic Effects on Complex Traits”. In: medRxiv 2025.06.10.25329327 (2025). DOI: 10.1101/2025.06.10.25329327.
[3] M. W. McLean. “RefManageR: Import and Manage BibTeX and BibLaTeX References in R”. In: The Journal of Open Source Software (2017). DOI: 10.21105/joss.00338.
[4] A. Oleś. BiocStyle: Standard styles for vignettes and other Bioconductor documents. R package version 2.36.0. 2025. DOI: 10.18129/B9.bioc.BiocStyle. URL: https://bioconductor.org/packages/BiocStyle.
[5] R Core Team. R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing. Vienna, Austria, 2025. URL: https://www.R-project.org/.
[6] H. Wickham. “testthat: Get Started with Testing”. In: The R Journal 3 (2011), pp. 5–10. URL: https://journal.r-project.org/archive/2011-1/RJournal_2011-1_Wickham.pdf.
[7] H. Wickham, W. Chang, R. Flight, et al. sessioninfo: R Session Information. R package version 1.2.3. 2025. DOI: 10.32614/CRAN.package.sessioninfo. URL: https://CRAN.R-project.org/package=sessioninfo.
[8] Y. Xie. knitr: A General-Purpose Package for Dynamic Report Generation in R. R package version 1.50. 2025. URL: https://yihui.org/knitr/.