Hi,

I just stumbled over the fact that 'writeVcf' for a 'VRanges' fails if 'sampleNames' is a factor with unused levels. Here a small example:

#+BEGIN_SRC R

library(VariantAnnotation)
example(VRanges)
writeVcf(vr, "out.vcf") ## works

f = sampleNames(vr)
f ## levels: a, b
levels(f) = c("a", "b", "c") ## c in unused
f ## levels: a, b, c
sampleNames(vr) = f
writeVcf(vr, "out.vcf")  ## fails

#+END_SRC

Error in writeVcf(as(obj, "VCF"), filename, ...) :
error in evaluating the argument 'obj' in selecting a method for function 'writeVcf': Error in ans[sampleToUniq] <- as.vector(v) : replacement has length zero

This occurs both with the latest bioc-release and bioc-devel. I don't know what exactly is causing this, but please let me know if I can be of any help.

Best wishes
Julian

_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel

Reply via email to