knausb / vcfR

Tools to work with variant call format files
246 stars 55 forks source link

no slot of name "group" #77

Closed ale07alvarez closed 7 years ago

ale07alvarez commented 7 years ago

I tried using: my.vcf <- readVcf("recode.vcf.gz") my.vcf.df <- cbind(as.data.frame(getFIX(my.vcf)), INFO2df(my.vcf)) get: Error in .setupMethodsTables(fdef, initialize = TRUE) : no slot of name "group" for this object of class "derivedDefaultMethod"

zkamvar commented 7 years ago

Hello,

I think you may be using the wrong function to read VCF data. Try using my.vcf <- vcfR::read.vcf("recode.vcf.gz") and see if that works.

Details:

I tried using: my.vcf <- readVcf("recode.vcf.gz")

This appears to be a Bioconductor function from the VariantAnnotation package (https://www.rdocumentation.org/packages/VariantAnnotation/versions/1.18.5/topics/readVcf https://www.rdocumentation.org/packages/VariantAnnotation/versions/1.18.5/topics/readVcf). If you have used the VariantAnnotation package earlier in your script (or even in the past if you save and load your workspace when you start up R), then this may be why you are having this issue.

HTH, Zhian


Zhian N. Kamvar, Ph. D. Postdoctoral Researcher (Everhart Lab) Department of Plant Pathology University of Nebraska-Lincoln ORCID: 0000-0003-1458-7108

On Sep 29, 2017, at 01:04 , ale07alvarez notifications@github.com wrote:

I tried using: my.vcf <- readVcf("recode.vcf.gz") my.vcf.df <- cbind(as.data.frame(getFIX(my.vcf)), INFO2df(my.vcf)) get: Error in .setupMethodsTables(fdef, initialize = TRUE) : no slot of name "group" for this object of class "derivedDefaultMethod"

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/knausb/vcfR/issues/77, or mute the thread https://github.com/notifications/unsubscribe-auth/ADeIltmGW_jk2xRcvhWXjE758HplvKXkks5snIhSgaJpZM4PoO5x.

knausb commented 7 years ago

Hello,

Zhian appears to be correct. The function 'readVcf' is a part of the bioconductor package 'VariantAnnotation'. This means that is will create objects that are not necessarily compatible with vcfR objects. And it means that it is beyond the scope of vcfR.

If you use the vcfR function 'read.vcfR' it should result in a 'vcfR' object.

library(vcfR) data("vcfR_test") class(vcfR_test) [1] "vcfR" attr(,"package") [1] "vcfR" my.vcf.df <- cbind(as.data.frame(getFIX(vcfR_test)), INFO2df(vcfR_test)) my.vcf.df CHROM POS ID REF ALT QUAL FILTER NS DP AF AA DB H2 1 20 14370 rs6054257 G A 29 PASS 3 14 0.5 NA NA 2 20 17330 T A 3 q10 3 11 0.017 NA NA 3 20 1110696 rs6040355 A G,T 67 PASS 2 10 0.333,0.667 T NA NA 4 20 1230237 T 47 PASS 3 13 T NA NA 5 20 1234567 microsat1 GTC G,GTCT 50 PASS 3 9 G NA NA

Appears to work. You'll want to use 'read.vcfR' to create your vcfR object instead of the above call to 'data'. But trying the above first should validate that your plan should return what you expect with a small example. Please give it a try and let me know how it works.

Thanks (and thanks Zhian)! Brian