[adegenet-forum] help with sPCA basics: plotting a raster map with xy points overlaid

Thibaut Jombart thibautjombart at gmail.com
Fri Nov 10 13:15:23 CET 2017


Hello

Err.. I can't see a question in your message.

For the record you don't have to store your GIS layer in the @other
slot, although it is possible.

>From your code it doesn't seem 'xy' is defined, but other(data)$xy is.

Best
Thibaut

--
Dr Thibaut Jombart
Lecturer, Department of Infectious Disease Epidemiology, Imperial College London
Head of RECON: repidemicsconsortium.org
WHO Consultant - outbreak analysis
sites.google.com/site/thibautjombart/
Twitter: @TeebzR
+44(0)20 7594 3658


On 6 November 2017 at 20:25, Caroline Judy <caroline.duffie at gmail.com> wrote:
> Dear Adegenet forum,
>
> As a first step to the sPCA, I am trying to plot the xy points on the topo
> map using the following code similar to the example "rupica" in the SPCA
> tutorial that appears on page 27.
>
> plot(data$other$topo.jam)
>
> points(xy,col="red", pch=20)
>
> Both the xy points and the map of my study region are part of the Genind
> object I created, see details below.
>
>
>
> ---------------
>
> /// GENIND OBJECT /////////
>
>  // 158 individuals; 6,451 loci; 12,902 alleles; size: 10.7 Mb
>
>  // Basic content
>    @tab:  158 x 12902 matrix of allele counts
>    @loc.n.all: number of alleles per locus (range: 2-2)
>    @loc.fac: locus factor for the 12902 columns of @tab
>    @all.names: list of allele names for each locus
>    @ploidy: ploidy of each individual  (range: 2-2)
>    @type:  codom
>    @call: read.structure(file =
> "~/Documents/Trochilus/second_chapter/Analysis/structure/input/GBS_all_pop_pheno.stru",
>     n.ind = 158, n.loc = 6451, onerowperind = TRUE, col.lab = 1,
>     col.pop = 2, col.others = 3:8, row.marknames = 0, ask = FALSE)
>
>  // Optional content
>    @pop: population of each individual (group size range: 6-37)
>    @strata: a data frame with 3 columns ( sex, phenotype, HI )
>    @other: a list containing: X  xy  topo  topo.east  topo.jam
> --------------------------------------------------------------------------------------
> $topo.jam
> class       : RasterLayer
> band        : 1  (of  3  bands)
> dimensions  : 1416, 2558, 3622128  (nrow, ncol, ncell)
> resolution  : 0.0008333333, 0.0008333333  (x, y)
> extent      : -78.27649, -76.14482, 17.48716, 18.66716  (xmin, xmax, ymin,
> ymax)
> coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84
> +towgs84=0,0,0
> data source :
> /Users/carolineduffie/Documents/Trochilus/second_chapter/Analysis/PCA/sPCA/jamaica_elevation.tif
> names       : jamaica_elevation
> values      : 0, 255  (min, max)
>
>
>
>
>
> _______________________________________________
> 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