PCAngsd

From software
Revision as of 19:28, 30 May 2017 by Jonas2 (talk | contribs) (Created page with "This page contains information about the program PCAngsd, which estimates the covariance matrix for NGS data in an iterative manner in order to model individual allele frequen...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This page contains information about the program PCAngsd, which estimates the covariance matrix for NGS data in an iterative manner in order to model individual allele frequencies. PCAngsd is able to provide very promising results for low coverage data. Based on genotype likelihoods, PCAngsd is able to perform PCA (estimate covariance matrix), call genotypes, estimate per-individual inbreeding coefficients and perform a genome-wide selection scan using principal components in structured populations. The entire program is written in Python 2.7.

Download

The program can be downloaded from Github: https://github.com/Rosemeis/pcangsd

git clone https://github.com/Rosemeis/pcangsd.git;
cd pcangsd/

The following Python packages are the only ones needed to run PCAngsd (found in all popular distributions): numpy, scipy and pandas.

PCAngsd should work on all platforms meeting the requirements but server-use is recommended for heavy computations.


Quick start

# See all options in PCAngsd
python pcangsd.py -h

# Estimate covariance matrix only
python pcangsd.py test.beagle.gz -o test

# Estimate inbreeding coefficients
python pcangsd.py test.beagle.gz -inbreed 1 -o test

# Perform selection scan
python pcangsd.py test.beagle.gz -selection 1 -o test

Input

The only file PCAngsd needs and accepts are the genotype likelihoods in BEAGLE format. ANGSD can be easily be used to compute the genotype likelihoods and output them in the required BEAGLE format.

./angsd -GL 1 -out genoLikes -nThreads 10 -doGlf 2 -doMajorMinor 1  -doMaf 2 -SNP_pval 2e-6 -bam bam.filelist

See ANGSD for more info on how to compute the genotype likelihoods.

Using PCAngsd

All the different options in PCAngsd is listed here.

Covariance matrix

PCAngsd will always compute the covariance matrix since the principal components are of use in all the analyses it performs. It uses the principal components to model the individual allele frequencies such that they can be used to estimate another more accurate covariance matrix. This procedure is iterated until convergence for the individual allele frequencies.

beagle [BEAGLE file path]

Positional argument for the path of the genotype likelihoods in BEAGLE format.

-M [int]

Maximum number of iterations for covariance estimation. Only needed in rare cases. (Default: 100)

-M_tole [float]

Tolerance value for the iterative covariance matrix estimation. (Default: 1e-4)

-EM [int]

Maximum number of EM iterations for computing the population allele frequencies. (Default: 200)

-EM_tole [float]

Tolerance value in EM algorithm for population allele frequencies estimation. (Default: 1e-4)

-e [int]

Manually select the number of eigenvalues to use in modelling of individual allele frequencies. (Default: Automatically selected)

-reg

Toogle to use Tikhonov regularization in modelling of individual allele frequencies to penalize lesser important PCs. May also help on convergence.

-o [filename]

Set the prefix for all output files created by PCAngsd.

Call genotypes

Genotypes can be called very easily using the individual allele frequencies as prior.

-callGeno

Toggle to call genotypes.

Inbreeding

Per-individual inbreeding coefficients can be computed using three different methods:

-inbreed 1

A maximum likelihood estimator computed by an EM algorithm. Only allows F-values between 0 and 1.

-inbreed 2

Simple estimator also computed by an EM algorithm described in [1].

-inbreed 3

Moment estimator for the allele frequencies based on the model in PC-Relate. Sensitive to low-depth data.

-inbreed_iter [int]

Maximum number of iterations for the EM algorithm methods. (Default: 200)

-inbreed_tole [float]

Tolerance value for the EM algorithms for inbreeding coefficients estimation. (Default: 1e-4)

Selection

A genome-wide selection scan can be computed using two different methods:

-selection 1

Using the model described in FastPCA. Produces a genome-wide selection scan for all significant PCs.

-selection 2

Using the model described in PCAdapt.

LD can also be taken into account when performing selection scans. LD regression has been implemented in PCAngsd but the functionality is not fully tested.

-LD [int]

Select the window (in bases) of preceding sites to use in regression.

Relatedness

Relatedness will also be touched upon in future updates.