[adegenet-forum] read.PLINK alleles not properly read
t.jombart at imperial.ac.uk
Wed Mar 12 11:36:48 CET 2014
So far this function seemed to have behaved all right. Can you please send me off list a small subset of the data to reproduce the error?
As for your other question, yes, storing things in the @other slot is the way to go, but you probably want to reorder the data first. The simplest way to go is to name the rows of your meta-data matrix/dataframe, or the elements of your meta-data vector, after the individual labels used in the genlight, and then subset your object using these names. E.g.:
> lab <- c('c','a','b')
> meta <- 1:20
> names(meta) <- letters[1:20]
a b c d e f g h i j k l m n o p q r s t
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
c a b
3 1 2
As for your last point, it is true that generally only the most recent methods implemented in adegenet (e.g. dapc, find.clusters) are available for genlight objects. This is mostly because the overhead of implementing methods for this class is quite high if we want to keep things memory-efficient (the purpose of this class). If RAM is not a problem, then by all means, just use a matrix or a data.frame to store your binary SNPs, or DNAbin to store data as sequences, or DNAbin for SNPs data allowing >2 alleles.
From: adegenet-forum-bounces at lists.r-forge.r-project.org [adegenet-forum-bounces at lists.r-forge.r-project.org] on behalf of Celine Wuyts [celinewuyts at hotmail.com]
Sent: 08 March 2014 17:54
To: adegenet-forum at lists.r-forge.r-project.org
Subject: [adegenet-forum] read.PLINK alleles not properly read
I am new to this package but have been googling for a problem I encounter with the extract.PLINKmap function and cannot find an answer.
I read my SNP data from plink format with a standard line, choosing the appropriate files with .raw and .map extension from my directory as required.
Worked perfectly, although it took more than an hour to finally get my genlight object built.
However, the SNP map information is not read as it should. The x$other$chromosome is a vector of NA's, as is x$other$position. I tried the extract.PLINKmap as well but it gave the same result.
Also, the x$alleles is empty (NULL) and the locNames are the original names with the letter of the allele that is counted added to it.
For example: SNP1909 becomes SNP1909_C. I assume that the fact that my SNP map information is not read properly is due to the fact that names of SNPs have changed and R cannot find any matches so to say. What did I do wrong and how can I fix it?
Also, I would like to subset my genlight object for individuals based on information (geographic grouping) in a seperate file. I thought about simply reading this information in x$other and working from their, but also this is not straightforward, as the seperate file contains more individuals and in a different order.
Last question: seems that not many functions that work for genind objects are implemented for genlight objects. Is there a workaround for this, other than converting genlight to data frame and data frame to a genind object?
More information about the adegenet-forum