knausb / vcfR

Tools to work with variant call format files
248 stars 54 forks source link

write.vcf tilde expansion #85

Closed Neato-Nick closed 7 years ago

Neato-Nick commented 7 years ago

Hi,

I currently have a vcfR object that looks normal: Object of Class vcfR 69 samples 1 CHROMs 547 variants Object size: 0.7 Mb 10.2 percent missing data


when I use vcfR::write.vcf(vcf, "my_vcf.vcf.gz"), the function works no problem. However, when I specify a path using the tilde such as write.vcf(vcf, "~/Data/my_vcf.vcf.gz") I get the error: gzopen of ~/Data/my_vcf.vcf.gz failed: No such file or directory. If I specify an absolute path with no tilde such as write.vcf(vcf, "/abs/path/to/Data/my_vcf.vcf.gz") the function also works no problem.

Can you work on applying tilde expansion to write.vcf?

knausb commented 7 years ago

Hi Nick,

The library zlib, which I use to create the gzipped file, does not appear to support tilde expansion so we need to handle it on the R side. I've caught this in previous versions of read.vcfR(), but aparently we didn't fix it in write.vcf(). Thanks for the catch! Should be fixed now in the GitHub version. If you'd like to try it out you can use the following to install it.

devtools::install_github(repo="knausb/vcfR")