R code implementing QTL mapping of fear conditioning traits in LG/J x SM/J mouse advanced intercross line.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


QTL mapping of fear conditioning traits in LG/J x SM/J AIL mouse study


This repository contains code and data to reproduce the results of a study identifying regions of the genome containing quantitative trait loci (QTLs) for fear and anxiety-related traits in mice. The data are genotypes and phenotype measurements from a LG/J x SM/J F2 intercross, and a 34th generation advanced intercross bred from the same (inbred) strains. The QTL mapping procedures account for the fact that mice in the combined (F2 + F34) sample are related to each other at varying proportions. All the steps of the analysis are implemented in R using the QTLRel package.


Copyright (c) 2013, 2014, Peter Carbonetto

The lgsmfear project repository is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See LICENSE for more details.

Getting started

To reproduce the initial steps of the analysis, follow these steps:

  1. Download the R code and data. Clone or fork the github repository, or download the repository as a ZIP file.

  2. Install packages necessary to run the scripts in R. The necessary packages are abind, plyr, qtl and QTLRel.

  3. To assess support for regions of the genome (except the X chromosome) relevant to the fear conditioning traits, run R from the code subdirectory, and enter command source("map.qtls.R") in R. It may take some time (several hours) to complete this step.

  4. To display genome-wide scans summarizing the results of the QTL mapping, enter source("plot.gwscan.R") in R.

For additional steps in the statistical analysis, consult the descriptions of the R source code files below.

Overview of data files

Here is a brief summary of the files in the data directory:

  • pheno.csv Phenotype data from 3-day fear conditioning study for 490 mice from the F2 cross, and 687 mice from the F34 cross. Includes other information such as gender, age and coat colour.

  • geno.csv A large table giving the genotypes sampled at 4608 markers (single nucleotide polymorphisms, or SNPs) in the F2 and F34 crosses. Missing genotypes (NA entries) are imputed using QTLRel. Most of the genotypes are marked as missing in the F2 mice because a subset of only 162 SNPs were genotyped in these mice.

  • map.csv Information about SNPs genotyped in mouse advanced intercross line. Information for each SNP includes chromosome number, base pair position on chromosome, refSNP identifier (if available), and genetic distance estimate.

  • ped.csv Full pedigree data for the advanced intercross line.

  • inbred.ped.csv Pedigree fragment used to define inbred founders. QTLRel assumes that the alleles of founders in the pedigree are not identical by descent (IBD). This pedigree fragment is added to the pedigree to circumvent this restriction.

  • qtls.csv SNPs showing the strongest support for being QTLs based on the initial mapping.

  • F34.idcf.RData Identity coefficients for F34 cross. This file is generated by running script compute.idcf.R.

Overview of R source code files

Here is a brief summary of the files in the code directory:

  • map.qtls.R This is the main script used to generate the QTL mapping results on all chromosomes except the X chromosome. QTLs are mapped separately in the F2 and F34 crosses, and in the combined (F2 + F34) cohort. Pairwise relatedness can be estimated either using the pedigree, or using the marker data. This script also calculates significance thresholds using permutation tests. These permutation tests ignore unequal relatedness between mice.

  • plot.gwscan.R Script for plotting the QTL mapping results generated by map.qtls.R.

  • compute.idcf.R Script for generating the identity coefficients separately for the F2 and F34 mice.

  • map.X.qtls.R Script for mapping QTLs on the X chromosome using marker-based estimates of pairwise relatedness.

  • map.X.perms.R Script for calculating significance thresholds in the X chromosome using a permutation test.

  • map.multi.qtls.R Once we have identified markers showing strongest support for being QTLs, use this script to quantify support for multiple QTLs on the same chromosome.

  • read.data.R Contains function definitions for reading experimental cross data from CSV files.

  • data.manip.R Functions for manipulating the experimental cross data, and for converting the data into the various formats used by R/qtl and QTLRel.

  • mapping.tools.R Functions for analyzing the QTL experiment data, and for computing marker-based estimates of pairwise relatedness.

  • misc.R Contains symbol and function definitions that do not fit in the other files.


The R code implementing the analysis procedures was developed by:
Peter Carbonetto
Dept. of Human Genetics
University of Chicago
June 2014