[adegenet-forum] AFLP data format

Jombart, Thibaut t.jombart at imperial.ac.uk
Mon Dec 6 00:42:50 CET 2010


Dear Russell, 

it would have been more informative to explain what your problem exactly was in the first place.

You need to provide a matrix of genetic data only to genind, and set the population information separately.
For instance:
###
myPop <- factor(dat$pop)
dat <- dat[,-1]
obj <- genind(dat, ploidy=1, type="PA")
pop(obj) <- myPop
###

Cheers

Thibaut
________________________________________
From: adegenet-forum-bounces at lists.r-forge.r-project.org [adegenet-forum-bounces at lists.r-forge.r-project.org] On Behalf Of Pfau, Dr. Russell S. [PFAU at tarleton.edu]
Sent: 05 December 2010 23:25
To: adegenet-forum at lists.r-forge.r-project.org
Subject: Re: [adegenet-forum] AFLP data format

I do appreciate your help...

I had already read the section on presence/absence, and did see the aflp dataset.  And, I can load data *without* the population designation column.  However, I cannot seem to load a dataset with the 2nd column designating populations.  I've read the ?read.table help but found no answers there.  It thinks the 2nd column is a column of alleles (see below...there are 4 loci, but it thinks there are 5).

I think my problem is that I do not know how to use the 'pop' argument in the 'genind' command, below:

pop     a factor giving the population of each genotype in 'x'


Here are my attempts:

> dat <- read.table("aflp2.txt", header = TRUE)
> dat
      pop loc1 loc2 loc3 loc4
indA pop1    1    0    1    1
indB pop1    0    1    1    1
indC pop1    1    1    0    1
indD pop2    0    1    1    1
indE pop2    1    1    0    0
indF pop2    1    0    1    1
indG pop2    0    1    1    0

> obj <-genind(dat, ploidy=2, type="PA")
> obj

   #####################
   ### Genind object ###
   #####################
- genotypes of individuals -

S4 class:  genind
@call: genind(tab = dat, ploidy = 2, type = "PA")

@tab:  7 x 5 matrix of genotypes

@ind.names: vector of  7 individual names
@loc.names: vector of  5 locus names
@loc.nall: NULL
@loc.fac: NULL
@all.names: NULL
@ploidy:  2
@type:  PA

Optionnal contents:
@pop:  - empty -
@pop.names:  - empty -

@other: - empty -

>



> obj <-genind(dat, ploidy=2, type="PA", pop=dat at pop)
Error in genind(dat, ploidy = 2, type = "PA", pop = dat at pop) :
  trying to get slot "pop" from an object (class "data.frame") that is not an S4 object
>



> obj <-genind(dat, ploidy=2, type="PA", pop=truenames(dat)$pop)
Error in function (classes, fdef, mtable)  :
  unable to find an inherited method for function "truenames", for signature "data.frame"
>



> obj <-genind(dat, ploidy=2, type="PA", pop = dat$pop)
> obj

   #####################
   ### Genind object ###
   #####################
- genotypes of individuals -

S4 class:  genind
@call: genind(tab = dat, pop = dat$pop, ploidy = 2, type = "PA")

@tab:  7 x 5 matrix of genotypes

@ind.names: vector of  7 individual names
@loc.names: vector of  5 locus names
@loc.nall: NULL
@loc.fac: NULL
@all.names: NULL
@ploidy:  2
@type:  PA

Optionnal contents:
@pop:  factor giving the population of each individual
@pop.names:  factor giving the population of each individual

@other: - empty -

>






________________________________________
From: Jombart, Thibaut [t.jombart at imperial.ac.uk]
Sent: Sunday, December 05, 2010 3:00 PM
To: Pfau, Dr. Russell S.; adegenet-forum at lists.r-forge.r-project.org
Subject: RE: AFLP data format

Dear Russell,

I am afraid you have been viewing an outdated version of the tutorial.

In the current version, there is a section titled "Handling presence/absence data" (section 3.13, p.49), which exactly answers your question, with a fake AFLP dataset remarkably similar to your data formatted as a table.

Best

Thibaut
--
######################################
Dr Thibaut JOMBART
MRC Centre for Outbreak Analysis and Modelling
Department of Infectious Disease Epidemiology
Imperial College - Faculty of Medicine
St Mary’s Campus
Norfolk Place
London W2 1PG
United Kingdom
Tel. : 0044 (0)20 7594 3658
t.jombart at imperial.ac.uk
http://sites.google.com/site/thibautjombart/
http://adegenet.r-forge.r-project.org/

________________________________________
From: adegenet-forum-bounces at lists.r-forge.r-project.org [adegenet-forum-bounces at lists.r-forge.r-project.org] On Behalf Of Pfau, Dr. Russell S. [PFAU at tarleton.edu]
Sent: 04 December 2010 03:03
To: adegenet-forum at lists.r-forge.r-project.org
Subject: [adegenet-forum] AFLP data format

I have spent the past 5 hours reading the adegenet manual, tutorial, and forum and have yet to learn how to put my AFLP data into a file like the nancycats.RData file for use in analysis with adegenet.  How on earth does one do this?

I have my data in two format types, and have created simple test files showing the two format types that I have (see below).  Please help....where do I go from here!

Russell


table format:

                loc1    loc2    loc3    loc4
indA    pop1    1       0       1       1
indB    pop1    0       1       1       1
indC    pop1    1       1       0       1
indD    pop2    0       1       1       1
indE    pop2    1       1       0       0
indF    pop2    1       0       1       1
indG    pop2    0       1       1       0


STRUCTURE format:

                loc1    loc2    loc3    loc4
indA    pop1    1       0       1       1
indA    pop1    1       0       1       1
indB    pop1    0       1       1       1
indB    pop1    0       1       1       1
indC    pop1    1       1       0       1
indC    pop1    1       1       0       1
indD    pop2    0       1       1       1
indD    pop2    0       1       1       1
indE    pop2    1       1       0       0
indE    pop2    1       1       0       0
indF    pop2    1       0       1       1
indF    pop2    1       0       1       1
indG    pop2    0       1       1       0
indG    pop2    0       1       1       0


_______________________________________________
adegenet-forum mailing list
adegenet-forum at lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum
_______________________________________________
adegenet-forum mailing list
adegenet-forum at lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum


More information about the adegenet-forum mailing list