VCF to R problems
1
0
Entering edit mode
6.7 years ago

Hi there,

I am having trouble with my vcf files in R. These files were generated by custom perl wrappers that automate STACKS. For context, my study is a landscape pop-gen analysis of pest insects. At first, I could not load the finished files into R at all (30 000 loci unfiltered). I reduced the file down to 10 individuals (from >100), and the file will read into R now using the command:

>MPB10vcf=read.vcf('10_thinned.recode.vcf')

However, I can't seem to do anything with it now that it's there.

I would like to convert the vcf data into a genind object so I can run a PCA/DAPC and graph out the genetic structure. However, I am getting some different errors each time try to do this:

> MPB10_genind=vcfR2genind(MPB10vcf)
#Error in extract.gt(x) : ID column contains non-unique names

Does anyone have any thoughts/experiences with this?

R snp next-gen vcf • 2.7k views
ADD COMMENT
0
Entering edit mode
6.7 years ago

I think this happened, here's an example row from my own data which triggers the same error:

Chrom1    3653    .    A       G       86      PASS    NS=2    GT:DP   1/1:39  0/0:47  0/0:5   0/0:5   1/1:5   1/1:5   0/0:5   1/1:5   1/1:5   0/1:5   1/1:5   1/1:5   1/1:5   0/0:5   0/0:5   0/1:5   0/0:5   0/0:5   0/0:5   0/0:5   0/0:5

The third column is the ID column, which in my case is a dot for all SNPs! I have to replace these by something unique (Chrom+Position should work), then vcfR2genind should work too.

By the way, vcfR comes with its own vcf loading command, no need to use pegas' read.vcf: read.vcfR()

ADD COMMENT
0
Entering edit mode

Thanks! I can load the modified file into R now, though I think there are still some troubles with how the original VCF file was generated. Ever forward!

ADD REPLY

Login before adding your answer.

Traffic: 1940 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6