[adegenet-forum] seppop/repool question

Jombart, Thibaut t.jombart at imperial.ac.uk
Mon Mar 2 19:14:19 CET 2009


Dear Stephen,

thanks for your post.
> Hello,
> I am trying to separate populations and repool them but I am getting an error which I think is due to the information I have stored in the $other slots. Below are the steps I took and the error that was returned. The question ultimately is why do I loose my $other information when I seppop and repool?
Well, separating genotypes into populations and then repooling the whole data is straightforward only for the genetic information. Since there could be anything inside the @other slot, it is difficult to know how to "repool" that information, and repool's current behaviour is indeed to discard this information. Another option might be to add non-empty @other slots of objects as components of the new (i.e. output of repool) @other slot, but that would not provide the same @other as before using 'seppop' anyway.

When using seppop only, things are a bit different, since when items in the @other match individuals (in genind) or population in genpop), it makes sense to subset these items when subsetting individuals. This subsetting is done provided length or nrow of items match nrow(x at tab), and when "[" is called with argument "treatOther" set to TRUE (default).
>  Thanks in advance
>
> PCt <- read.structure("PC7Nov20074pop_spca.str", n.ind=151, n.loc=9,  onerowperind=T, 
> 	col.lab=1, col.pop=2, col.others=NULL, row.marknames=1, NA.char="-9", pop=pop, 
> 	missing="mean", ask=F, quiet=F)
> PCxy <- read.table("PC7Nov2007xy_spca.txt", header=T)
> PCsex <- read.table("PC7Nov2007sex_spca.txt", header=T)
> PCs$other$xy <- PCxy #2 column list of x and y coordinates
> PCs$other$sex <- PCsex #1 column list of the sex of animals (M,F,U)
>
> PCs
>
>    #####################
>    ### Genind object ### 
>    #####################
> - genotypes of individuals - 
>
> S4 class:  genind
> @call: read.structure(file = "PC7Nov20074pop_spca.str", n.ind = 151, 
>     n.loc = 9, onerowperind = T, col.lab = 1, col.pop = 2, col.others = NULL, 
>     row.marknames = 1, NA.char = "-9", pop = NULL, missing = "mean", 
>     ask = F, quiet = F)
>
> @tab:  151 x 55 matrix of genotypes
>
> @ind.names: vector of  151 individual names
> @loc.names: vector of  9 locus names
> @loc.nall: number of alleles per locus
> @loc.fac: locus factor for the  55 columns of @tab
> @all.names: list of  9 components yielding allele names for each locus
> @ploidy:  2
>
> Optionnal contents: 
> @pop:  factor giving the population of each individual
> @pop.names:  factor giving the population of each individual
>
> @other: a list containing: xy  sex 
>
> ###seems good so far 
>
> pop <- c("Central", "NorthEast", "NorthWest", "SouthCentral")
> pcs <- seppop(PCs)
> pcs
> ###everything looks fine except the $other slots which now say
> #@other: a list containing: elements without names 
Yes, this is abnormal, but I think I remember fixing this in the devel version.
> ###and when I try to repool I get the following
>
> pcttt <- repool(pctt$Central, pctt$SouthCentral, pctt$NorthEast)
> pcttt 
>
> ###everything looks fine except the $other slot which now say
> #@other: - empty -
Yes, this is normal since it is difficult (in general, impossible) to know how to repool that kind of information. The most straightforward way to proceed is I guess to re-assign the other slot:
pcttt at other <- PCs at other


Best regards,

Thibaut.

>
> Thanks
> Stephen
>
>
> Stephen D. Petersen, M.Sc. Ph.D.
> Visiting Fellow, Fisheries & Oceans Canada
> Winnipeg, MB
> E-mail:
> stephen.petersen at dfo-mpo.gc.ca
> stephenpetersen at trentu.ca
> spetersen at nrdpfc.ca
> <http://sites.google.com/site/stephendpetersen/>
> <http://people.trentu.ca/stephenpetersen/>
> <http://ace.acadiau.ca/science/biol/Stephen/stephen_dp_home.htm>
> _______________________________________________
> 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
>
>


-- 
######################################
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://biomserv.univ-lyon1.fr/%7Ejombart/
http://adegenet.r-forge.r-project.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20090302/49a6dde7/attachment.htm 


More information about the adegenet-forum mailing list