[adegenet-forum] pop argument

valeria montano mirainoshojo at gmail.com
Fri Aug 24 21:42:40 CEST 2012


Dear Tom,

the 'x' object provided in the example code corresponds to the genlight
object and not to the factor specifying the pops, you just have to load the
txt file of names and convert it to a factor then use

pop(your_genlight_obejct) <- your_factor_of_names  #I_am_quite_sure :-)

Ciao

Valeria

On 24 August 2012 18:58, Tom Devitt <tommydevitt at gmail.com> wrote:

> Thanks for your reply, Thibaut.
>
> But how do I do this if I have a separate text file of population names
> corresponding to the individuals listed in the FASTA file? I can load the
> file of population names using read.table, but then I'm not sure how to use
> the pop argument from there.
>
> When I tried:
>
> > x <-("~/path/file.txt")
> > pop(x)
>
> I get:
>
> Error in function (classes, fdef, mtable)  :
>   unable to find an inherited method for function "pop", for signature
> "character"
>
> Sorry, just learning R . . .
>
>
> On Aug 24, 2012, at 8:54 AM, Jombart, Thibaut wrote:
>
> Hello,
>
> you need to use 'pop(x) <- ...' to change or set population information;
> for instance, using simulated data:
>
> x <- glSim(10,100)
>
> pop(x)
>
> [1] A A A A A B B B B B
> Levels: A B
>
> pop(x) <- rep(1:2, c(2,8))
>
> pop(x)
>
> [1] 1 1 2 2 2 2 2 2 2 2
> Levels: 1 2
>
> Cheers
>
> Thibaut
>
>
> ________________________________________
> From: adegenet-forum-bounces at lists.r-forge.r-project.org [
> adegenet-forum-bounces at lists.r-forge.r-project.org] on behalf of Tom
> Devitt [tommydevitt at gmail.com]
> Sent: 24 August 2012 13:25
> To: adegenet-forum at lists.r-forge.r-project.org
> Subject: [adegenet-forum] pop argument
>
> Could someone please help me understand how to include population
> information using the pop argument for a genlight object? I've used the
> read.DNA argument to input my data (FASTA format) and then the
> fasta2genlight argument to extract SNPs. I don't know how to specify
> individual population assignments using the pop argument. Thanks for your
> help.
>
> (Sorry if this is a repost - I tried sending this message a couple days
> ago, but am not sure it posted to the 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
>
>
>
> _______________________________________________
> 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/20120824/5960a301/attachment.html>


More information about the adegenet-forum mailing list