{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Mapping QTL in BXD mice using R/qtl2\n",
"\n",
"[Karl Broman](https://kbroman.org)\n",
"[
](https://orcid.org/0000-0002-4914-6671),\n",
"[Department of Biostatistics & Medical Informatics](https://www.biostat.wisc.edu), \n",
"[University of Wisconsin–Madison](https://www.wisc.edu)\n",
"\n",
"Our aim in this tutorial is to demonstrate how to map quantitative trait loci (QTL) in the BXD mouse recombinant inbred lines using the [R/qtl2](https://kbroman.org/qtl2) software. We will first show how to download BXD phenotypes from [GeneNetwork2](http://gn2.genenetwork.org) using its API, via the R package [R/GNapi](https://github.com/rqtl/GNapi). At the end, we will use the [R/qtl2browse](https://github.com/rqtl/qtl2browse) package to display genome scan results using the [Genetics Genome Browser](https://github.com/chfi/purescript-genome-browser)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Acquiring phenotypes with the GeneNetwork API\n",
"\n",
"We will first use the [GeneNetwork2](http://gn2.genenetwork.org) API to acquire BXD phenotypes to use for mapping. We will use the R package [R/GNapi](https://github.com/rqtl/GNapi). \n",
"\n",
"We first need to install the package, which is not available on [CRAN](https://cran.r-project.org), but is available via a private repository.\n",
"\n",
"```r\n",
"install.packages(\"GNapi\", repos=\"http://rqtl.org/qtl2cran\")\n",
"```\n",
"\n",
"We then load the package using `library()`."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"library(GNapi)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The [R/GNapi](https://github.com/kbroman/GNapi) has a variety of functions. For an overview, see [its vignette](http://kbroman.org/GNapi/GNapi.html). Here we will just do one thing: use the function `get_pheno()` to grab BXD phenotype data. You provide a data set and a phenotype. Phenotype 10038 concerns \"habituation\", measured as a difference in locomotor activity between day 1 and day 3 in a 5 minute test trial. "
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
| data_id | sample_name | sample_name_2 | se | value | |
|---|---|---|---|---|---|
| <int> | <chr> | <chr> | <dbl> | <dbl> | |
| BXD1 | 8967080 | BXD1 | BXD1 | 169.1 | 398.0 |
| BXD11 | 8967080 | BXD11 | BXD11 | 77.9 | 355.0 |
| BXD12 | 8967080 | BXD12 | BXD12 | 80.3 | 388.0 |
| BXD14 | 8967080 | BXD14 | BXD14 | 68.3 | -74.7 |
| BXD16 | 8967080 | BXD16 | BXD16 | 98.7 | 293.0 |
| BXD18 | 8967080 | BXD18 | BXD18 | 110.0 | -362.0 |