[adegenet-forum] Jitter & sPCA

Thibaut Jombart thibautjombart at gmail.com
Fri Aug 4 15:14:29 CEST 2017


Hi Carol,

Roman's solution should have worked, but adding random noise to locations
may not be ideal anyway. You may prefer using a connection network which
can accommodate duplicated locations, such as neighbourhood defined by
distance interval (see ?chooseCN).

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 3 August 2017 at 23:53, Roman Luštrik <roman.lustrik at biolitika.si> wrote:

> As the error is reporting, you should use jitter() on your coordinates.
> Either specify new jittered coordinates directly to xy argument of spca(),
> or, jitter your genind object which you can access using `other(x)$xy`.
>
> Here's an example of the former approach:
>
> > library(adegenet)
> > data(spcaIllus)
> > x <- spcaIllus[[1]]
> > out <- spca(x, ask = FALSE, type = 1, scannf = FALSE)
> > xy <- other(x)$xy
> > newxy <- xy[rep(1:(nrow(xy)/10), length.out = nrow(xy)), ]
> > out.clumped <- spca(x, ask = FALSE, type = 1, scannf = FALSE, xy = newxy)
> Error in chooseCN(xy = xy, ask = ask, type = type, plot.nb = plot.nb, :
> Duplicate locations detected and incompatible with graph type 1-4.
> Please choose another graph (5-7) or add random noise to locations (see
> ?jitter).
> > out.jittered <- spca(x, ask = FALSE, type = 1, scannf = FALSE, xy =
> jitter(newxy))
> >
>
> Cheers,
> Roman
>
> ----
> In god we trust, all others bring data.
> > Zahtevaj IJZ na https://kurc.biolitika.si
>
> ------------------------------
> *From: *"Carol Ann Reeb" <creeb at stanford.edu>
> *To: *adegenet-forum at lists.r-forge.r-project.org
> *Sent: *Friday, August 4, 2017 12:14:01 AM
> *Subject: *[adegenet-forum] Jitter & sPCA
>
> I'm having trouble  jittering x-coordinates in order to run sPCA.   I'm
> still learning R so I don't know what code would work in adegent.  I did
> find R usage:  Jitter(x, factor=1, amount=NULL).  But that does not tell me
> how to call the proper files.  I did find code from a supplement from a
> manuscript comparing MENE to sPCA comparison.  And although that routine
> ran, the program would still not allow me to choose a network to plot
> sPCA coordinates because it said they were still identical in the xy file.
>  Any help, suggestions would be greatly appreciated.
>
>
> Carol
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20170804/8ec448d6/attachment.html>


More information about the adegenet-forum mailing list