[adegenet-forum] HWE

Jombart, Thibaut t.jombart at imperial.ac.uk
Thu Aug 20 18:04:43 CEST 2015


Hi Carlo,

I am confused - I thought you wanted to keep only loci *not* in HWE?

Yes, what you describe is doable - only a bit more cumbersome. You need to use seppop and then sapply over the objects:

data(nancycats)
hw.test(nancycats)
allPval <- sapply(seppop(nancycats), function(e) hw.test(e, B=0)[,3,drop=FALSE])

and allPval contains the pvalues for all loci (row) and populations (columns).
>From that it's trivial to get what you need, e.g.
apply(allPval<0.05, 1, sum, na.rm=TRUE) > 8

To get the loci with significant departure from HWE in at least 8 populations (just tweak the 0.05 to use correction for multiple testing).

Cheers
Thibaut




________________________________
From: Carlo Pecoraro [carlo.pecoraro2 at unibo.it]
Sent: 18 August 2015 12:42
To: Jombart, Thibaut
Subject: R: HWE

Hi Thibaut,

first of all many thanks for your answer.

It works perfectly..many thanks for that!
The problem is that in this way I am going to lose more than 1000 loci in my dataset.

I am wondering if I have just to remove those loci which are out of Hardy–Weinberg equilibrium in at least the 80/90% of my geographical samples/populations (i.e. 8/10).

Would it be possible to filter out those loci in disequilibrium, for instance, in 8 o more populations?

Sorry for disturbing you again with these boring stuff.

Many thanks for your help.

Cheers,
Carlo


Da: Jombart, Thibaut [mailto:t.jombart at imperial.ac.uk]
Inviato: lunedì 17 agosto 2015 18:16
A: Carlo Pecoraro; adegenet-forum at lists.r-forge.r-project.org
Oggetto: RE: HWE

Hi Carlo,

if you want to be conservative, you can apply Bonferroni correction to your data.
Here's an example using nancycats:

> library(adegenet)
> library(pegas)
> temp <- hw.test(nancycats)

> pval <- temp[,3]
> pval
        fca8        fca23        fca43        fca45        fca77        fca78
0.000000e+00 0.000000e+00 0.000000e+00 1.622163e-03 0.000000e+00 0.000000e+00
       fca90        fca96        fca37
0.000000e+00 1.965095e-14 1.209777e-10

> loc.to.keep <- pval < (0.05/nLoc(nancycats)) # use Bonferroni
> loc.to.keep
 fca8 fca23 fca43 fca45 fca77 fca78 fca90 fca96 fca37
 TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
> x <- nancycats[loc=loc.to.keep]


Here all the loci are kept, but loci at HWE would have been filtered out.

Cheers
Thibaut



==============================
Dr Thibaut Jombart
MRC Centre for Outbreak Analysis and Modelling
Department of Infectious Disease Epidemiology
Imperial College - School of Public Health
Norfolk Place, London W2 1PG, UK
Tel. : 0044 (0)20 7594 3658
http://sites.google.com/site/thibautjombart/
http://sites.google.com/site/therepiproject/
http://adegenet.r-forge.r-project.org/
Twitter: @thibautjombart

________________________________
From: adegenet-forum-bounces at lists.r-forge.r-project.org [adegenet-forum-bounces at lists.r-forge.r-project.org] on behalf of Carlo Pecoraro [carlo.pecoraro2 at unibo.it]
Sent: 17 August 2015 16:58
To: adegenet-forum at lists.r-forge.r-project.org
Cc: Thibaut Jombart
Subject: [adegenet-forum] I: HWE
Hi all,

I am trying to remove from my dataset those loci in HWE. I have measured it both per population: hwe.pop<-(lapply(seppop(x), hw.test) and per locus hwe.loc<-hw.test(x), B=1000).
Now I would like to define a threshold (0.05) for the Pr(chi^2>), removing all those loci with a derived P-values above this threshold. How could I perform this analysis? Do you have any suggestion?

I am wondering if this is the best way to filter my dataset according to the HWE. Any advise would be more than welcome.

Best regards,
Carlo


Da: Carlo Pecoraro
Inviato: lunedì 17 agosto 2015 16:14
A: 'adegenet-forum at lists.r-forge.r-project.org'
Oggetto: HWE

Hi all,

I am trying to remove from my dataset those loci in HWE. I have measured it both per population: hwe.pop<-(lapply(seppop(x), hw.test) and per locus hwe.loc<-hw.test(x), B=1000).
Now I would like to define a threshold (0.05) for the Pr(chi^2>), removing all those loci with a derived P-values above this threshold. How could I perform this analysis? Do you have any suggestion?

I am wondering if this is the best way to filter my dataset according to the HWE. Any advise would be more than welcome.

Best regards,
Carlo
--

Carlo Pecoraro, PhD Candidate

Laboratory of Genetics & Genomics of Marine Resources and Environment (GenoDREAM)
Dept. Biological, Geological & Environmental Sciences (BiGeA)
University of Bologna
Via S. Alberto 163, 48123 Ravenna (Italy)

IRD (Institut de Recherche pour le Développement)
UMR 212 EME (Ecosytèmes Marins Exploités)
BP 570
Victoria, Mahé
Seychelles

Ph: +39 3337603101
skype contact: carlo_pecoraro

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20150820/c146cace/attachment.html>


More information about the adegenet-forum mailing list