[adegenet-forum] Per locus pairwise Fst

Jombart, Thibaut t.jombart at imperial.ac.uk
Sun Sep 14 21:45:33 CEST 2014


Yes, you need to use:
?genind2hierfstat

Cheers
Thibaut

________________________________________
From: Vikram Chhatre [crypticlineage at gmail.com]
Sent: 13 September 2014 21:48
To: adegenet-forum at lists.r-forge.r-project.org; Jombart, Thibaut
Subject: Re: [adegenet-forum] Per locus pairwise Fst

Thank you for all the replies.  I have been looking at the pp.fst() function in the Hierfstat package.  Does the post-seploc data frame need to be converted into something that Hierfstat understands first?  The following doesn't seem to work:

# Use seploc to separate loci:
gen100_seploc <- seploc(gen100_genind, truenames=TRUE, res.type=c('genind', 'matrix')

# Load Hierfstat
library(hierfstat)

# Calculate pairwise Fst:
gen100_perLocusPWFst <- lapply(gen100_seploc, pp.fst, diploid=TRUE)

Error in unique.default(Pop) : unique() applies only to vectors

On Sat, Sep 13, 2014 at 2:20 PM, Jombart, Thibaut <t.jombart at imperial.ac.uk<mailto:t.jombart at imperial.ac.uk>> wrote:

Hi there,

yes, this function is not optimized for large datasets. You can use the same approach but using functions from the hierfstat package.

Cheers
Thibaut
________________________________________
From: adegenet-forum-bounces at lists.r-forge.r-project.org<mailto:adegenet-forum-bounces at lists.r-forge.r-project.org> [adegenet-forum-bounces at lists.r-forge.r-project.org<mailto:adegenet-forum-bounces at lists.r-forge.r-project.org>] on behalf of Vikram Chhatre [crypticlineage at gmail.com<mailto:crypticlineage at gmail.com>]
Sent: 12 September 2014 18:31
To: adegenet-forum at lists.r-forge.r-project.org<mailto:adegenet-forum at lists.r-forge.r-project.org>
Subject: Re: [adegenet-forum] Per locus pairwise Fst

I am revisiting this topic due to some technical problems.

The task at hand is to estimate pairwise Fst matrices for each locus separately.

# Genind object is stored in:
gen100_genind

# Use seploc to separate loci:
gen100_seploc <- seploc(gen100_genind, truenames=TRUE, res.type=c('genind', 'matrix')

# Calculate pairwise Fst:
gen100_perLocusPWFst <- lapply(gen100_seploc, pairwise.fst, res.type=c('dist', 'matrix'), trunames=TRUE)

For a data set consisting of 30 populations, 20 individuals each, 1000 loci and 2 alleles per locus (1.2 million data points), it takes up to 6 hours to estimate the pairwise Fst matrix with this method.

Is there any way to speed this up?  Should I look into any other packages?

Many thanks for your time and help.
Vikram




On Mon, Jul 14, 2014 at 9:16 AM, Vikram Chhatre <crypticlineage at gmail.com<mailto:crypticlineage at gmail.com><mailto:crypticlineage at gmail.com<mailto:crypticlineage at gmail.com>>> wrote:
Perfect!  Thank you for both solutions.

V


On Mon, Jul 14, 2014 at 9:13 AM, Jombart, Thibaut <t.jombart at imperial.ac.uk<mailto:t.jombart at imperial.ac.uk><mailto:t.jombart at imperial.ac.uk<mailto:t.jombart at imperial.ac.uk>>> wrote:

Hi there,

you can use seploc to separate loci, and lapply over the resulting list using your prefered fst function.

Cheers
Thibaut
________________________________________
From: adegenet-forum-bounces at lists.r-forge.r-project.org<mailto:adegenet-forum-bounces at lists.r-forge.r-project.org><mailto:adegenet-forum-bounces at lists.r-forge.r-project.org<mailto:adegenet-forum-bounces at lists.r-forge.r-project.org>> [adegenet-forum-bounces at lists.r-forge.r-project.org<mailto:adegenet-forum-bounces at lists.r-forge.r-project.org><mailto:adegenet-forum-bounces at lists.r-forge.r-project.org<mailto:adegenet-forum-bounces at lists.r-forge.r-project.org>>] on behalf of Vikram Chhatre [crypticlineage at gmail.com<mailto:crypticlineage at gmail.com><mailto:crypticlineage at gmail.com<mailto:crypticlineage at gmail.com>>]
Sent: 14 July 2014 14:01
To: adegenet-forum at lists.r-forge.r-project.org<mailto:adegenet-forum at lists.r-forge.r-project.org><mailto:adegenet-forum at lists.r-forge.r-project.org<mailto:adegenet-forum at lists.r-forge.r-project.org>>
Subject: [adegenet-forum] Per locus pairwise Fst

Good morning.

I would like to estimate per locus pairwise Fst for populations, but it appears that Adegenet only estimates this over all loci (i.e. single matrix).  What I would like is one matrix per locus.  Has anyone modified the functions or know of alternative programs that can do this?

Thanks
Vikram






More information about the adegenet-forum mailing list