[adegenet-forum] Hardy-weinberg using R

Vitor Aguiar vitor.aguiar at me.com
Thu Jan 19 20:46:59 CET 2012


Hi.

I sent an email to the author and he answered me saying that he was able to read my file using:

x <- read.loci("nist.csv", loci.sep=",", row.names=1)

However, I can't do the HWE test, there's the error message below:

"Error in expand.genotype(Nall, ploidy = ploidy, matrix = TRUE):
	object 'ans' not found"

The author said the pegas interpret my data as haploid, which doesn't make sense to test for HW. Maybe I have to present my data in a different way, but he doesn't offer this kind of support...

The exact file I'm using is attached.

Thanks,
Vitor

-------------- next part --------------
A non-text attachment was scrubbed...
Name: nist.csv
Type: text/csv
Size: 29229 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20120119/b15e2dda/attachment-0001.csv>
-------------- next part --------------





On Jan 19, 2012, at 2:57 AM, Jombart, Thibaut wrote:

> Hello, 
> 
> are you sure "file" contains the path to the file you try to analyse? What does 'x' look like?
> 
> Cheers
> 
> Thibaut
> ________________________________________
> From: adegenet-forum-bounces at r-forge.wu-wien.ac.at [adegenet-forum-bounces at r-forge.wu-wien.ac.at] on behalf of Vitor Aguiar [vitor.aguiar at me.com]
> Sent: 19 January 2012 03:58
> To: adegenet-forum at r-forge.wu-wien.ac.at
> Subject: [adegenet-forum] Hardy-weinberg using R
> 
> Hello! May anyone help me? I'd like to know what's the best way to calculate Hardy-Weinberg Equilibrium using R. I tried the pegas package, but since I'm not familiar with programming I could not make it work yet... I'm analyzing multi allelic STR markers.
> 
> example file: 3rd "Raw Data as Excel File" link on the website below  (with the green tag "New"):
> http://www.cstl.nist.gov/strbase/NISTpop.htm
> 
> I'm doing the steps below:
>> install.packages(pegas)
>> library(pegas)
> 
> #you can see that other packages are also loaded, such as adegenet.
> 
> #now, I have to take the HWE test using the function:
> 
> hw.test(x, B=1000)
> where x = an object of class 'loci'
>           B = the number of replicates for the Monte Carlo procedure
> 
> #So, accordingly to the manual ( http://ape.mpl.ird.fr/pegas/pegas-manual.pdf ) I have to do the follow:
> 
>> x=as.loci(file)
>> hw.test(x)
> 
> #error message:
> Error in expand.genotype(Nall, ploidy = ploidy, matrix = TRUE) :
>  object 'ans' not found
> #this could be due to the structure of the input file or its format (I used .csv)... I don't know...
> 
> I also tried the function read.loci, which reads allele data from text files (saving the input file as .txt before). This doesn't work either, as many other things I tried...
> I think this analysis somehow should be simple to do...
> 
> 
> Vitor Rezende da Costa Aguiar
> ---------------------------------------------------
> PhD student in Biotechnology
> Rede Nordeste de Biotecnologia
> Universidade Federal do Esp?rito Santo
> ---------------------------------------------------
> Current Adress:
> Department of Integrative Biology
> University of California, Berkeley
> 2033 Valley Life Sciences Building, office 4134
> Berkeley, CA - USA 94720
> Phone: 1 (510)-643-0060
> 




More information about the adegenet-forum mailing list