[adegenet-forum] selecting SNPs according to chromosome list

Amaranta amaranta.fontcuberta at gmail.com
Tue May 8 16:49:00 CEST 2018


Great it worked perfectly!

Thanks a lot!

2018-04-20 18:04 GMT+02:00 Thibaut Jombart <thibautjombart at gmail.com>:

> Hello,
>
> here's an example using made up data:
>
> ## make up data
> > x <- glSim(40, 1e4, LD=FALSE, parallel=FALSE)
>
> ## fake chromosome info
> > chromosome(x) <- rep(c("chr1", "chr2"), c(2000, 8000))
>
> ## create a list of genlights, 1 per chromosome
> > lapply(levels(chromosome(x)), function(lev) x[,chromosome(x)==lev])
> [[1]]
>  /// GENLIGHT OBJECT /////////
>
>  // 40 genotypes,  2,000 binary SNPs, size: 73.5 Kb
>  0 (0 %) missing data
>
>  // Basic content
>    @gen: list of 40 SNPbin
>    @ploidy: ploidy of each individual  (range: 1-1)
>
>  // Optional content
>    @chromosome: factor storing chromosomes of the SNPs
>    @other: a list containing: ancestral.pops
>
>
> [[2]]
>  /// GENLIGHT OBJECT /////////
>
>  // 40 genotypes,  8,000 binary SNPs, size: 126.3 Kb
>  0 (0 %) missing data
>
>  // Basic content
>    @gen: list of 40 SNPbin
>    @ploidy: ploidy of each individual  (range: 1-1)
>
>  // Optional content
>    @chromosome: factor storing chromosomes of the SNPs
>    @other: a list containing: ancestral.pops
>
>
> This could be an option in seploc; I don't really have time to implement
> it now but maybe worth filing as an issue on github?
>
> Note that if you want to randomise SNPs you can tweak the above using
> 'sample'.
> Best
> Thibaut
>
>
>
> --
> Dr Thibaut Jombart
> Lecturer, Department of Infectious Disease Epidemiology, Imperial College
> London
> Head of RECON: repidemicsconsortium.org
> WHO Consultant - outbreak analysis
> https://thibautjombart.netlify.com
> Twitter: @TeebzR
> +44(0)20 7594 3658
>
> On 20 April 2018 at 13:50, Amaranta <amaranta.fontcuberta at gmail.com>
> wrote:
>
>> Hello,
>>
>> I am working with a genelight object. I would like to do analsyes on a
>> subset of SNPs, defined by a list of chromosomes.  Is there a way to do
>> this in adegenet ?
>>  I know I could convert the genelight object to a matrix and select
>> columns according to a list of names. But I am interested in keeping the
>> information of the genelight object.  Also, I know there is the Seploc()
>> function that subsets the dataset in groups of /random/ SNPs. Is there way
>> to use Seploc() to select locus according to a criteria?
>>
>> Many thanks in advance,
>>
>>
>> Amaranta.
>>
>> _______________________________________________
>> 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/20180508/a989add6/attachment.html>


More information about the adegenet-forum mailing list