[adegenet-forum] read.PLINK error

Emmanuel Paradis emmanuel.paradis at ird.fr
Wed Jul 30 17:41:13 CEST 2014

Hi Thibaut,

The last version of pegas (0.6) includes a function read.vcf to read 
VCF files. Together with the genotypes, it reads only the basic extra 
fields (POS, CHROM, FILTER, QUAL); the genotype likelihoods are not 
read (this could be changed in future releases). The purpose of this 
function is not to process very big VCF files, but rather to read 
files for downstream analyses with pegas or adegenet. By default, the 
first 1000 loci are read (this can be controlled by options).

pegas 0.6 is available as a pre-release here:


> I successfully loaded my unaltered file into R using ‘adegenet’, 

So why don't you filter your data in R?



Wed, 30 Jul 2014 09:45:27 +0000 "Jombart, Thibaut" 
<t.jombart at imperial.ac.uk>:
> Hi there, 
> I confess I never use vcftools so I'm not sure what it's been doing 
>to your data, but it looks like the format might have been altered. 
> I Cc Emmanuel Paradis (ape, pegas, ...) who I think might have been 
>developing something for this kind of data recently.
> Best
> Thibaut
> ________________________________________
>From: ADAM PETER CARDILINI [apcar at deakin.edu.au]
> Sent: 08 June 2014 23:24
> To: Jombart, Thibaut
> Cc: adegenet-forum at lists.r-forge.r-project.org
> Subject: Re: read.PLINK error
> G'day Thibaut,
> Sorry I should have included that in the original email.
> The code I use to read the data was:
> dat <- read.PLINK('myfiltered_plinkconvertedfile.raw', map.file = 
> This command line worked on the unfiltered data files, just not the 
>ones I got after filtering in vcftools.
> Cheers,
> Adam
> Sent from my iPad
>> On 9 Jun 2014, at 3:42 am, "Jombart, Thibaut" 
>><t.jombart at imperial.ac.uk> wrote:
>> Hello,
>> what command line did you use to read the data?
>> 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 
>>ADAM PETER CARDILINI [apcar at deakin.edu.au]
>> Sent: 06 June 2014 03:44
>> To: adegenet-forum at lists.r-forge.r-project.org
>> Subject: [adegenet-forum] read.PLINK error
>> G’day Everyone,
>> I have recently produced a .vcf file for a set of SNPs obtained 
>>using Genotype-by-sequencing. The .vcf file is the final output from 
>>the TASSEL pipeline which takes in fastq sequence files. I converted 
>>my .vcf file to a .ped and .map files using vcftools and then 
>>converted the .ped file to .raw so that I could load it into R using 
>>’adegenet’ function ‘read.PLINK’. The linux vcftools and plink code 
>>was as follows:
>> vcftools --vcf myfile.vcf --out myfile.plink --plink
>> plink --file myfile.plink --out myfile.plink --recodeA
>> I successfully loaded my unaltered file into R using ‘adegenet’, 
>>however it has way many SNPs that I am not interested in (because it 
>>has only been sequenced for a couple of individuals) so I thought I 
>>would filter my .vcf snp file using vcftools. I filtered my original 
>>file so that only SNPs that were sequenced from >90% of samples 
>>remained. This significantly reduced the number of SNPs I had and 
>>produced a new .vcf file. I then converted this file to .ped and 
>>.map, and then .ped to .raw so I could bring it into R and have a 
>>quick look.
>> When I tried to import the new, filtered .raw file using 
>>‘read.PLINK’ I got the following error:
>> Reading PLINK raw format into a genlight object...
>> Reading loci information...
>> Reading and converting genotypes...
>> .Error in (function (classes, fdef, mtable)  :
>>  unable to find an inherited method for function ‘nLoc’ for 
>>signature ‘"try-error"’
>> In addition: Warning message:
>> In mclapply(txt, function(e) new("SNPbin", snp = e, ploidy = 2),  :
>>  9 function calls resulted in an error
>> It seems as if something has gone wrong when I have produced the new 
>>.vcf file during filtering. I was wondering if anyone might know what 
>>I have done wrong, what these error messages mean and whether there 
>>is a fix I can try?
>> Thanks in advance for your time and help, I appreciate it.
>> Kind regards,
>> Adam Cardilini
>> PhD Candidate
>> Schools of Life and Environmental Sciences,
>> Deakin University, 75 Pigdons Rd,
>> Waurn Ponds, Vic, Australia, 3217
>> Mob: 0431 566 340
>> Email: apcar at deakin.edu.au

More information about the adegenet-forum mailing list