Quantitative Trait Mapping: Setup

Installation

R is a programming language that is especially powerful for data exploration, visualization, and statistical analysis. To interact with R, we use RStudio.

  1. Install the latest version of R from CRAN.

  2. Install the latest version of RStudio here. Choose the free RStudio Desktop version for Windows, Mac, or Linux.

  3. Start RStudio. The qtl2 package contains code for haplotype reconstruction, QTL mapping and plotting. Install qtl2 by running the following code in the R console.

install.packages("qtl2", repos="http://rqtl.org/qtl2cran")

Make sure that the installation was successful by loading the qtl2 library. You shouldn’t get any error messages.

library(qtl2)

Data files and project organization

  1. Make a new folder in your Desktop called mapping. Move into this new folder.

  2. Create a data folder to hold the data, a scripts folder to house your scripts, and a results folder to hold results.

Alternatively, you can use the R console to run the following commands for steps 1 and 2.

setwd("~/Desktop")
dir.create("./mapping")
setwd("~/Desktop/mapping")
dir.create("./data")
dir.create("./scripts")
dir.create("./results")
  1. Please download the following large files before the workshop, and place them in your data folder. You can download the files from the URLs below and move the files the same way that you would for downloading and moving any other kind of data.

Alternatively, you can copy and paste the following into the R console to download the data.

setwd("~/Desktop/mapping")
download.file("https://ndownloader.figshare.com/files/9746485", "./data/cc_variants.sqlite")
download.file("https://ndownloader.figshare.com/files/9746458", "./data/mouse_genes.sqlite")
download.file("https://ndownloader.figshare.com/files/9746452", "./data/mouse_genes_mgi.sqlite")
download.file("ftp://ftp.jax.org/dgatti/qtl2_workshop/qtl2_demo.Rdata", "./data/qtl2_demo.Rdata")

You will need these for the final lesson episodes on SNP association mapping and QTL analysis in Diversity Outbred mice.

Make sure that both the SNP and gene files downloaded correctly by running the following code. If you get an error, check the file path carefully or download the files again. Make sure to change the file path to the location where you saved the file.

Check the SNP file.

snp_func = create_variant_query_func("/home/dmgatti/Desktop/mapping/data/cc_variants.sqlite")
snps = snp_func(1, 10, 11)
dim(snps)

You should get a result that is 13150 rows by 16 columns.

Check the gene file.

gene_func = create_gene_query_func("/home/dmgatti/Desktop/mapping/data/mouse_genes_mgi.sqlite")
genes = gene_func(1, 10, 11)
dim(genes)

You should get a result that is 18 rows by 15 columns.