diff --git a/docs/1-tutorial.R b/docs/1-tutorial.R new file mode 100644 index 0000000..2635de1 --- /dev/null +++ b/docs/1-tutorial.R @@ -0,0 +1,127 @@ +## Installing packages +## install.packages("qtlpoly") +##install.packages("mappoly") +## ##install.packages("devtools") +## devtools::install_github("gabrielgesteira/qtlpoly") + +## Loading packages +library(qtlpoly) +library(mappoly) +plot_map_list(maps4x) +plot(maps4x[[1]]) +summary_maps(maps4x) +head(pheno4x) + +## Calculating genotype probabilities +genoprob4x = lapply(maps4x, calc_genoprob) + +## Putting geno + pheno together +data = read_data(ploidy = 4, geno.prob = genoprob4x, pheno = pheno4x, step = 1) + +## Viewing dataset +print(data, detailed = TRUE) + +## Adjusting null model +null.mod = null_model(data = data, n.clusters = 4) + +## Viewing null model +print(null.mod) + +## Performing first search round +search.mod = search_qtl(data = data, model = null.mod, w.size = 15, sig.fwd = 0.01, n.clusters = 4) + +## Visualizing results +print(search.mod) + +## Performing model optimization +optimize.mod = optimize_qtl(data = data, model = search.mod, sig.bwd = 0.0001, n.clusters = 4) + +## Visualizing results +print(optimize.mod) + +## Performing another search round +search.mod2 = search_qtl(data=data, model = optimize.mod, sig.fwd = 0.0001, n.clusters = 4) + +## Visualizing results +print(search.mod2) + +## Genomewide profiling with final set of QTL +profile.mod = profile_qtl(data = data, model = optimize.mod, d.sint = 1.5, polygenes = FALSE, n.clusters = 4) + +## Visualizing results +print(profile.mod) + +## Checking lower SI +print(profile.mod, sint = "lower") + +## Checking upper SI +print(profile.mod, sint = "upper") + +## Performing automatic search +remim.mod = remim(data = data, w.size = 15, sig.fwd = 0.01, sig.bwd = 0.0001, d.sint = 1.5, n.clusters = 4) + +## Visualizing results +print(remim.mod) + +## Checking lower SI +print(remim.mod, sint = "lower") + +## Checking upper SI +print(remim.mod, sint = "upper") + +## Plotting profile +for(p in remim.mod$pheno.col) plot_profile(data = data, model = remim.mod, pheno.col = p, ylim = c(0,10)) + +## Plotting profile +plot_profile(data = data, model = remim.mod, grid = TRUE) +plot_profile(data = data, model = remim.mod, grid = FALSE) + +## Plotting QTL SI +plot_sint(data = data, model = remim.mod) + +## Calculate metrics +fitted.mod = fit_model(data=data, model=remim.mod, probs="joint", polygenes="none") + +## Viewing results +summary(fitted.mod) + +## Plotting QTL info +plot_qtl(data = data, model = remim.mod, fitted = fitted.mod, drop.pheno = FALSE) + +## Account for allele effects +est.effects = qtl_effects(ploidy = 4, fitted = fitted.mod) + +## Plot allele effects +plot(est.effects) + +## Calculate breeding values +y.hat = breeding_values(data = data, fitted = fitted.mod) + +## Plot BV +plot(y.hat) + +## FEIM +## Perform permutations +perm = permutations(data = data, n.sim = 1000, n.clusters = 4) + +## Check permutations +print(perm) + +## Define significance threshold +(sig.lod = perm$sig.lod$`0.95`) + +## Adjust FEIM model +feim.mod = feim(data = data, w.size = 15, sig.lod = sig.lod) + +## Viewing FEIM results +print(feim.mod) + +## Plotting FEIM results +plot_profile(data = data, model = feim.mod, grid = TRUE) + +## Exporting results to VIEWpoly +## save(maps4x, file="mappoly.maps.RData") +## save(data, file="qtlpoly.data.RData") +## save(remim.mod, file="qtlpoly.remim.mod.RData") +## save(fitted.mod, file="qtlpoly.fitted.mod.RData") +## save(est.effects, file="qtlpoly.est.effects.RData") diff --git a/docs/1-tutorial.Rmd b/docs/1-tutorial.Rmd index 60ef43d..b9b1aea 100644 --- a/docs/1-tutorial.Rmd +++ b/docs/1-tutorial.Rmd @@ -36,7 +36,7 @@ knitr::opts_chunk$set(eval = TRUE, cache = TRUE, echo = TRUE, results = 'hold', # Introduction -The R package `qtlpoly` (v. 0.2.3) [@Pereira2020] is an under development software to map multiple quantitative trait loci (QTL) in full-sib families of outcrossing autopolyploid species. It is based on the following random-effect model: +The R package `qtlpoly` (v. 0.2.4) [@Pereira2020] is an under development software to map multiple quantitative trait loci (QTL) in full-sib families of outcrossing autopolyploid species. It is based on the following random-effect model: $$\boldsymbol{y} = \boldsymbol{1}\mu + \sum_{q=1}^Q \boldsymbol{g}_q + \boldsymbol{e}$$ @@ -56,7 +56,7 @@ install.packages("qtlpoly") To use the development version, please run the following commands to install `qtlpoly` and all of its dependencies: -```{r, eval=TRUE} +```{r, eval=FALSE} ##install.packages("devtools") devtools::install_github("gabrielgesteira/qtlpoly") ``` @@ -445,6 +445,18 @@ plot_profile(data = data, model = feim.mod, grid = TRUE) +# Exporting to VIEWpoly + +One can export the results from `MAPpoly` and `QTLpoly` to visualize them in the R package `VIEWpoly` with the commands below: + +```{r, eval=FALSE} +save(maps4x, file="mappoly.maps.RData") +save(data, file="qtlpoly.data.RData") +save(remim.mod, file="qtlpoly.remim.mod.RData") +save(fitted.mod, file="qtlpoly.fitted.mod.RData") +save(est.effects, file="qtlpoly.est.effects.RData") +``` + # Acknowledgments This package has been developed as part of the [Genomic Tools for Sweetpotato Improvement](https://sweetpotatogenomics.cals.ncsu.edu/) (GT4SP) and [SweetGAINS](https://cgspace.cgiar.org/handle/10568/106838) projects, both funded by [Bill \& Melinda Gates Foundation](https://www.gatesfoundation.org/). diff --git a/docs/1-tutorial.html b/docs/1-tutorial.html index 805523f..d6c20fa 100644 --- a/docs/1-tutorial.html +++ b/docs/1-tutorial.html @@ -1627,7 +1627,7 @@
The R package qtlpoly
(v. 0.2.3) (Pereira et al. 2020) is an under development
+
The R package qtlpoly
(v. 0.2.4) (Pereira et al. 2020) is an under development
software to map multiple quantitative trait loci (QTL) in full-sib
families of outcrossing autopolyploid species. It is based on the
following random-effect model:
qtlpoly
package and dataTo use the development version, please run the following commands to
install qtlpoly
and all of its dependencies:
> ##install.packages("devtools")
-> devtools::install_github("gabrielgesteira/qtlpoly")
-## Downloading GitHub repo gabrielgesteira/qtlpoly@HEAD
-## Installing 17 packages: pillar, tibble, rlang, ps, processx, pkgload, evaluate, callr, Rcpp, nloptr, viridisLite, farver, lme4, scales, RcppArmadillo, gtools, ggplot2
-## Installing packages into '/home/gdesiqu/R/x86_64-pc-linux-gnu-library/4.2'
-## (as 'lib' is unspecified)
-## Installing package into '/home/gdesiqu/R/x86_64-pc-linux-gnu-library/4.2'
-## (as 'lib' is unspecified)
-## Warning in i.p(...): installation of package '/tmp/RtmpJHrUuN/file43d3e1185e802/
-## qtlpoly_0.2.4.tar.gz' had non-zero exit status
-## pillar (1.7.0 -> 1.8.1 ) [CRAN]
-## tibble (3.1.6 -> 3.1.8 ) [CRAN]
-## rlang (1.0.2 -> 1.0.4 ) [CRAN]
-## ps (1.7.0 -> 1.7.1 ) [CRAN]
-## processx (3.5.3 -> 3.7.0 ) [CRAN]
-## pkgload (1.2.4 -> 1.3.0 ) [CRAN]
-## evaluate (0.15 -> 0.16 ) [CRAN]
-## callr (3.7.0 -> 3.7.2 ) [CRAN]
-## Rcpp (1.0.8.3 -> 1.0.9 ) [CRAN]
-## nloptr (2.0.0 -> 2.0.3 ) [CRAN]
-## viridisLite (0.4.0 -> 0.4.1 ) [CRAN]
-## farver (2.1.0 -> 2.1.1 ) [CRAN]
-## lme4 (1.1-29 -> 1.1-30 ) [CRAN]
-## scales (1.2.0 -> 1.2.1 ) [CRAN]
-## RcppArmad... (0.11.1.1.0 -> 0.11.2.3.1) [CRAN]
-## gtools (3.9.2 -> 3.9.3 ) [CRAN]
-## ggplot2 (3.3.5 -> 3.3.6 ) [CRAN]
-## * checking for file ‘/tmp/RtmpJHrUuN/remotes43d3ef58f51d/gabrielgesteira-QTLpoly-847ee41/DESCRIPTION’ ... OK
-## * preparing ‘qtlpoly’:
-## * checking DESCRIPTION meta-information ... OK
-## * cleaning src
-## * checking for LF line-endings in source and make files and shell scripts
-## * checking for empty or unneeded directories
-## * building ‘qtlpoly_0.2.4.tar.gz’
-## Warning: invalid uid value replaced by that for user 'nobody'
Then, use the function library()
– or
require()
– to load the package:
> library(qtlpoly)
One can export the results from MAPpoly
and
+QTLpoly
to visualize them in the R package
+VIEWpoly
with the commands below:
> save(maps4x, file="mappoly.maps.RData")
+> save(data, file="qtlpoly.data.RData")
+> save(remim.mod, file="qtlpoly.remim.mod.RData")
+> save(fitted.mod, file="qtlpoly.fitted.mod.RData")
+> save(est.effects, file="qtlpoly.est.effects.RData")