calc_isolation_by_distance | R Documentation |
Calculates Isolation by Distance (IBD) for snpRdata objects by comparing the genetic distance between samples or sets of samples to the geographic distances between samples or sets of samples. IBD calculated via a mantel test.
calc_isolation_by_distance(
x,
facets = NULL,
x_y = c("x", "y"),
genetic_distance_method = "Edwards",
interpolate = "bernoulli",
...
)
x |
snpRdata object |
facets |
character, default NULL. Facets over which to calculate IBD, as
described in |
x_y |
character, default c("x", "y"). Names of the columns containing geographic coordinates where samples were collected. There is no need to specify projection formats. The first should be longitude, the second should be latitude. |
genetic_distance_method |
character, default "Edwards". The genetic
distance method to use, see |
interpolate |
Character or FALSE, default "bernoulli". If transforming to
"sn" format, notes the interpolation method to be used to fill missing data.
Options are "bernoulli", "af", "iPCA", or FALSE. See
|
... |
Additional arguments passed to |
Genetic distance is calculated via calc_genetic_distances
.
Geographic distances are taken as-is for individual-individual comparisons
and by finding the geographic mean of a group of samples when sample level
facets are requested using the methods described by
geomean
. Note that this means that if many samples
were collected from the same location, and those samples compose a single
level of a facet, the mean sampling location will be that single location.
IBD is calculated by comparing geographic and genetic distances using a
mantel test via mantel.randtest
.
Note that geographic distance objects are also included in the returned values.
A snpRdata object with both geographic distance and IBD results merged into existing data.
William Hemstrom
mantel.randtest
,
calc_genetic_distances
# calculate ibd for several different facets
## Not run:
y <- stickSNPs
sample.meta(y) <- cbind(sample.meta(y), x = rnorm(ncol(y)), y = rnorm(ncol(y)))
y <-calc_isolation_by_distance(y, facets = c(".base", "pop", "pop.chr","pop.chr.fam"))
res <- get.snpR.stats(y, "pop.chr", "ibd") # fetch results
res
plot(res$chr.pop$groupV$Edwards) # plot perms vs observed
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.