Skip to content
Arun Durvasula edited this page Aug 23, 2015 · 22 revisions

Welcome! This is a short guide to population genetics analysis using angsd-wrapper. We will be using a test data set containing sequence from Oryza sativa and Oryza glumaepetula. First, we need to clone the angsd-wrapper repository. You need to have git installed to do this. Alternatively, you can download a zip file from the releases page or use the download zip button on the home page of the repository.

$ git clone https://github.com/arundurvasula/angsd-wrapper.git aw-tutorial
$ cd aw-tutorial/

angsd-wrapper comes with its own version of ANGSD to prevent compatibility breaking changes in ANGSD from affecting angsd-wrapper and comes with a few other programs. In order to compile these programs, you must run make:

$ cd angsd; make
$ cd ../ngsPopGen/; make
$ cd ../ngsF/; make

Great! Now we're ready to get the example data.

$ cd ../data
$ wget http://de.iplantcollaborative.org/dl/d/3A541C91-A66A-4651-949D-4E65028C4A2F/iplant.zip
$ unzip -j iplant.zip

The example data should now be in the data folder. Now we need to change the Common_Variables.conf file to point to the correct paths.

$ nano scripts/Common_Variables.conf

Modify this line to point to your cloned directory:

PROJECT_DIR=${HOME}/rilab/aw-tutorial

And these two lines to point to the reference and ancestral sequences.

#   Reference genome sequence
REF_SEQ=${DATA_DIR}/reference.Oryza_sativa.IRGSP-1.0.23.dna.genome_chr.fa.gz
#   Ancestral sequence
ANC_SEQ=${DATA_DIR}/ancestral.merid_japonica_chr.fa.gz

Great! Now we're ready to calculate a site frequency spectrum on the data. The script to do this is called scripts/Site_Frequency_Spectrum.sh and the variables are stored in scripts/Site_Frequency_Spectrum.conf


New tutorial outline (comments welcome)

  1. clone angsd-wrapper
  2. wget data (http://de.iplantcollaborative.org/dl/d/3A541C91-A66A-4651-949D-4E65028C4A2F/iplant.zip)
  3. set up common.conf
  4. run SFS
  5. run theta
  6. visualize both with shiny

old:

Welcome! This page will walk you through basic population genetic analysis using ANGSD and angsd-wrapper.

Data preparation

There are 3 types of data needed for analysis in ANGSD:

  • A reference sequence (.fasta)
  • An ancestral reference sequence (.fasta)
  • Individual sequences mapped to the reference sequence (.bam)

In order to simplify the input, ANGSD requires that the file paths to the bam files be placed in one file. For example, the data/BKN_samples.txt included in the repository has a list of paths to bam files. Thus, to get started with ANGSD analysis, our data folder will contain the following files:

data/{TAXON}_samples.txt
data/refseq.fasta
data/ancseq.fasta

NOTE: The {TAXON} part of the samples file is important. angsd-wrapper will look for files named exactly like that. See the wiki page for more information.

Site frequency spectrum

Now we are ready to do our first analysis, a site frequency spectrum. In ANGSD, this takes 2 steps that have been simplified in angsd-wrapper:

  1. create a binary file containing a prior for the SFS
  2. obtain a maximum likelihood estimate of the SFS

Using angsd-wrapper, we can accomplish this by modifying the included configuration file (or creating a new one) to include the path to the ancestral sequence, the reference sequence, and the TAXON variable (which will point to the list of bams).

Once you have modified the configuration file to include this information, you can begin the analysis. If you are just running the analysis on your local computer, you can begin it by running (from the angsd directory):

$ bash scripts/ANGSD_SFS.sh scripts/sfs_example.conf

If you are running it on a cluster, you will likely need to create a submission script. In slurm, you can do something like the following:

sfs_submit.sh:

#!/bin/bash
#SBATCH -D /home/adurvasu/angsd-wrapper
#SBATCH -J Slurm-SFS
#SBATCH -o /home/adurvasu/angsd-wrapper/results/out-%j.txt
#SBATCH -e /home/adurvasu/angsd-wrapper/results/error-%j.txt

bash scripts/ANGSD_SFS.sh scripts/sfs_example.conf

Then submit the script to your cluster's queue:

$ sbatch -p serial scripts/sfs_submit.sh

Clone this wiki locally