Error in snp to gds conversion

I have set a VCF file (from as my working directory but when using 'snpgdsVCF2GDS', I get an error saying there is no such file or directory even though I can see the file and data in my directory.
Code and error:

vcf.fn <- ("VCF")
setwd("~/Documents/Year 3/Sequence Analysis/Workshop 4 - Week 9/VCF")
snpgdsVCF2GDS(vcf.fn, "test.gds", method="biallelic.only")
Start file conversion from VCF to SNP GDS ...
Method: extracting biallelic SNPs
Error in file(filename, "rt") : cannot open the connection
In addition: Warning message:
In file(filename, "rt") : cannot open file 'VCF': No such file or directory

Is VCF a directory or is it a file. For setwd() it must be a directory and for use in snpgdsVCF2GDS() it should be a file in the form

vcf.fn <- "~/your_parent_folder(s)_your_folder/your_vcf_file.vcf"

Consider creating a .Rproj project in RStudio with the menu option. Create a folder data and place the data files you will be using there. (I like also to create a folder obj to put whatever new objects I derive in a separate folder to avoid overwriting the source data.)


Then when you open the project there is no need to setwd().

snpgdsVCF2GDS("data/your_file.vcf", ...)

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.