domingo, 13 de julho de 2014

I promise after my PhD defence I will share o bunch of new things I have learned in data analysis and R.

segunda-feira, 9 de abril de 2012

R code for HW exact test

I show above a simple R code to perform Fisher's exact test using "pegas" package.
Enjoy!!!




require(adegenet) #load genepop/genetix/fstat datasets into R
require(pegas) #summary loci statistics as HE and HO and Fisher exact test for genotype/alles proportions




mydataset.genind<-read.genepop("MyData.gen",quiet=TRUE) #adegenet function
mydataset.genind
validObject( mydataset.genind ) #if TRUE == "is a genind object"


summary( mydataset.genind ) #alleles frequencies and HE/HO per locus


mydataset.loci<- as.loci( mydataset.genind ) #to converto to "pegas" object as.loci
mydataset.loci


HWtest<-function(x){hw.test(x, B=10000)} #I defined a R function that contains pegas' hw.test to change the number of Monte Carlo replications


HWtest( mydataset.loci ) #I used that "new function" to obtaint the test

domingo, 11 de dezembro de 2011

R capabilities

http://www.r-bloggers.com/a-view-on-r-capabilities/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+RBloggers+%28R+bloggers%29

New era of Population Genetics data analysis

As we have already know the R environment and other open sources tools are changing the way we perform and think on data analysis.  And this revolution is touching the population genetics data analysis as well.  Recently I discovered (so late) two very interesting R packages that perform basic and multivariate statistical analysis on gene frequencies accounted from populations. These packages are “pegas” and “adegenet”. The former I am using to test HW equilibrion (loci), gametic disequilibrium and F-statistics. The later I am using to access population structure (or sub-structure) into my data set through multivariate methods.  For more information I recommend:

‘pegas’ page:
‘adegenet’ page: