[adegenet-forum] Any suggestions about conducting a 3-D sPCA?

Jombart, Thibaut t.jombart at imperial.ac.uk
Tue Jan 15 19:29:29 CET 2013


Hello, 

theoretically yes, it is perfectly possible to perform a sPCA in 3D. In practice, the issue will be getting a matrix of connectivity between locations. The general approach is

1) compute Euclidean distances between locations in the 3D space
2) use these distances to define a graph of neighbouring sites (such as options 5 or 7 in chooseCN)
3) use this graph as input in the sPCA

Step 1 is easy. Just load a x,y,z matrix in R (with x,y,z in column), say in an object matXYZ, and then:
##
D <- dist(matXYZ)
##

Step 2 is not implemented in chooseCN, or the subroutines it calls from. One can do this manually. If you want to define neighbours based on distances in the 3d space (neighbours are distant by less than dMax):
##
dMax=quantile(D, .25) # 25% quantile is perfectly arbitrary
M <- 1* (as.matrix(D) < dMax) # non-standardized matrix of connectivity (1:neighbours; 0: otherwise)
W <- prop.table(M,1) # this is your spatial weighting matrix
##

Then you can use sPCA with the argument matWeight=W, and here you go.

Cheers

Thibaut

ps: if anyone has any knowledge of 3D-based connectivity graphs, that'd still be useful


________________________________________
From: adegenet-forum-bounces at lists.r-forge.r-project.org [adegenet-forum-bounces at lists.r-forge.r-project.org] on behalf of Kelvin Gorospe [kgorospe at hawaii.edu]
Sent: 15 January 2013 17:54
To: adegenet-forum at lists.r-forge.r-project.org
Subject: [adegenet-forum] Any suggestions about conducting a 3-D sPCA?

Hi everyone,

For my PhD dissertation, I have sampled and mapped (x,y coordinate) every individual coral (n=2352) of one species within a single, circular coral reef. They are all genotyped at 6 micro satellite loci. I also have depth information for each individual coral.

I did some analyses previously and found spatial autocorrelation in the genetic data. Furthermore, I found that in addition to this x,y spatial autocorrelation, there is also spatial autocorrelation with regards to depth (using just a single z coordinate) in the genetic data.

Originally, I was conducting sPCA in R to do some exploratory analysis on the genetic data vs the x,y coordinates, in hopes of visualizing how genetic diversity was spatially structured and then comparing this to my maps of depth for the reef. However, I am wondering if I am approaching this the wrong way. Instead of treating depth as an environmental variable, is it better to conduct an sPCA using depth as a single spatial coordinate? And then look to see if there is a genetic cline along this single-coordinate system?

Or is it better (or even possible) to do a 3-dimensional sPCA using all three coordinates together (x,y, depth)? Has anyone ever attempted this? The reef is essentially shaped like an underwater hill or mound, such that the shallow sites are in the middle of the reef, and deeper sites are on the outer slopes or edges. Thus, some corals with similar depths are found on opposite sides of the reef, while others are found next to each other on the same side of the reef. If I am interested in exploring a genetic cline that is partitioned by both space (x,y) and depth (z), then corals on opposite sides of the reef are "connected" in terms of their depth, while those on the same side of the reef are "connected" by both space and depth. Given that, does anyone have any suggestions regarding what connection network would be best?

Any thoughts you might have would be greatly appreciated!

Thanks for your time and I look forward to hearing from you soon.

-Kelvin


More information about the adegenet-forum mailing list