Package: HTRX 1.2.4

Yaoling Yang
HTRX: Haplotype Trend Regression with eXtra Flexibility (HTRX)
Detection of haplotype patterns that include single nucleotide polymorphisms (SNPs) and non-contiguous haplotypes that are associated with a phenotype. Methods for implementing HTRX are described in Yang Y, Lawson DJ (2023) <doi:10.1093/bioadv/vbad038> and Barrie W, Yang Y, Irving-Pease E.K, et al (2024) <doi:10.1038/s41586-023-06618-z>.
Authors:
HTRX_1.2.4.tar.gz
HTRX_1.2.4.tar.gz(r-4.5-noble)HTRX_1.2.4.tar.gz(r-4.4-noble)
HTRX_1.2.4.tgz(r-4.4-emscripten)HTRX_1.2.4.tgz(r-4.3-emscripten)
HTRX.pdf |HTRX.html✨
HTRX/json (API)
# Install 'HTRX' in R: |
install.packages('HTRX', repos = 'https://cloud.r-project.org') |
- example_data_nosnp - Example covariate data
- example_hap1 - Example genotype data for the first genome
- example_hap2 - Example genotype data for the second genome
This package does not link to any Github/Gitlab/R-forge repository. No issue tracker or development information is available.
Last updated 1 years agofrom:79df34a6d8. Checks:1 OK, 2 NOTE. Indexed: yes.
Target | Result | Latest binary |
---|---|---|
Doc / Vignettes | OK | Mar 06 2025 |
R-4.5-linux | NOTE | Mar 06 2025 |
R-4.4-linux | NOTE | Mar 06 2025 |
Exports:computeR2do_cumulative_htrxdo_cumulative_htrx_step1do_cvdo_cv_directdo_cv_step1extend_hapshtrx_maxhtrx_nfeaturesinfer_fixedfeaturesinfer_step1kfold_splitmake_cumulative_htrxmake_htrmake_htrxmake_snpmypredictthemodeltwofold_split
Dependencies:BHbigmemorybigmemory.sricaretclasscliclockcodetoolscolorspacecpp11data.tablediagramdialsDiceDesigndigestdoFuturedplyre1071fansifarverfastglmforeachfurrrfuturefuture.applygenericsggplot2glmnetglobalsgluegowerGPfitgtablehardhatipredisobanditeratorsKernSmoothlabelinglatticelavalhslifecyclelistenvlubridatemagrittrMASSMatrixmgcvmodelenvModelMetricsmunsellnlmennetnumDerivparallellyparsnippillarpkgconfigplyrprettyunitspROCprodlimprogressrproxypurrrR6RColorBrewerRcppRcppEigenrecipesreshape2rlangrpartrsamplescalessfdshapeslidersparsevctrsSQUAREMstringistringrsurvivaltibbletidyrtidyselecttimechangetimeDatetunetzdbutf8uuidvctrsviridisLitewarpwithrworkflowsyardstick
Citation
To cite package ‘HTRX’ in publications use:
Yang Y, Lawson D (2024). HTRX: Haplotype Trend Regression with eXtra Flexibility (HTRX). R package version 1.2.4, https://CRAN.R-project.org/package=HTRX.
Corresponding BibTeX entry:
@Manual{, title = {HTRX: Haplotype Trend Regression with eXtra Flexibility (HTRX)}, author = {Yaoling Yang and Daniel Lawson}, year = {2024}, note = {R package version 1.2.4}, url = {https://CRAN.R-project.org/package=HTRX}, }
Readme and manuals
Haplotype Trend Regression with eXtra flexibility (HTRX)
This is the location for the HTRX tool that was firstly proposed by Barrie, W., Yang, Y., Irving-Pease, E.K. et al. Elevated genetic risk for multiple sclerosis emerged in steppe pastoralist populations. Nature 625, 321–328 (2024).
and then illustrated in detail by
Yang Y, Lawson DJ. HTRX: an R package for learning non-contiguous haplotypes associated with a phenotype. Bioinformatics Advances 3.1 (2023): vbad038.
-
Authors:
Yaoling Yang (yaoling.yang@bristol.ac.uk)
Daniel Lawson (dan.lawson@bristol.ac.uk) -
License: GPL-3
Introduction:
Haplotype Trend Regression with eXtra flexibility (HTRX) searches a pre-defined set of SNPs for haplotype patterns that include single nucleotide polymorphisms (SNPs) and non-contiguous haplotypes.
We search over all possible templates which give a value for each SNP being ‘0’ or ‘1’, reflecting whether the reference allele of each SNP is present or absent, or an ‘X’ meaning either value is allowed.
We used a two-stage procedure to select the best HTRX model (function
“do_cv”).
Stage 1: select candidate models;
Stage 2: select the best model using 10-fold cross-validation.
Longer haplotypes are important for discovering interactions. However, there are $3^k-1$ haplotypes in HTRX if the region contains $k$ SNPs, making it unrealistic for regions with large numbers of SNPs. To address this issue, we proposed “cumulative HTRX” (function “do_cumulative_htrx”) that enables HTRX to run on longer haplotypes, i.e. haplotypes which include at least 7 SNPs (we recommend). Besides, we provide a parameter “max_int” which controls the maximum number of SNPs that can interact.
Install R package “HTRX”
devtools::install_github("https://github.com/YaolingYang/HTRX")
This package is also available from CRAN. You can install it by
install.packages("HTRX")
Tutorial
A tutorial of package HTRX can be found in vignettes/HTRX_vignette.pdf
Examples
library(HTRX)
## use dataset "example_hap1", "example_hap2" and "example_data_nosnp"
## "example_hap1" and "example_hap2" are both genomes of 8 SNPs for 5,000 individuals (diploid data)
## "example_data_nosnp" is an example dataset which contains the outcome (binary), sex, age and 18 PCs
## visualise the covariates data
head(HTRX::example_data_nosnp)
## visualise the genotype data for the first genome
head(HTRX::example_hap1)
## we perform HTRX on the first 4 SNPs
## we first generate all the haplotype data, as defined by HTRX
HTRX_matrix=make_htrx(HTRX::example_hap1[,1:4],HTRX::example_hap2[,1:4])
## If the data is haploid, please set
## HTRX_matrix=make_htrx(HTRX::example_hap1[,1:4],HTRX::example_hap1[,1:4])
## next compute the maximum number of independent features
featurecap=htrx_max(nsnp=4)
## then perform HTRX using 2-step cross-validation
## to compute additional variance explained by haplotypes
## If you want to compute total variance explained, please set gain=FALSE
htrx_results <- do_cv(HTRX::example_data_nosnp,
HTRX_matrix,train_proportion=0.5,
sim_times=3,featurecap=featurecap,usebinary=1,
method="stratified",criteria="BIC",
gain=TRUE,runparallel=FALSE)
## If we want to compute the total variance explained
## we can set gain=FALSE in the above example
## we perform cumulative HTRX on all the 8 SNPs using 2-step cross-validation
## to compute additional variance explained by haplotypes
## If the data is haploid, please set hap2=HTRX::example_hap1
## If you want to compute total variance explained, please set gain=FALSE
## For Linux/MAC users, we strongly encourage you to set runparallel=TRUE
cumu_htrx_results <- do_cumulative_htrx(data_nosnp=HTRX::example_data_nosnp,
hap1=HTRX::example_hap1,
hap2=HTRX::example_hap2,
train_proportion=0.5,sim_times=1,
featurecap=6,usebinary=1,
randomorder=TRUE,method="stratified",
criteria="BIC",runparallel=FALSE)
Help Manual
Help page | Topics |
---|---|
HTRX: Haplotype Trend Regression with eXtra flexibility | HTRX-package HTRX |
Compute variance explained by models | computeR2 mypredict |
Data split | data_split kfold_split twofold_split |
Cumulative HTRX on long haplotypes | do_cumulative_htrx do_cumulative_htrx_step1 extend_haps make_cumulative_htrx |
Two-stage HTRX: Model selection on short haplotypes | do_cv do_cv_step1 infer_fixedfeatures infer_step1 |
Direct HTRX: k-fold cross-validation on short haplotypes | do_cv_direct |
Example covariate data | example_data_nosnp |
Example genotype data for the first genome | example_hap1 |
Example genotype data for the second genome | example_hap2 |
Maximum independent features for HTRX | htrx_max |
Total number of features for HTRX | htrx_nfeatures |
Generate haplotype data | make_htr make_htrx make_snp |
Model fitting | themodel |