Search
Question: predictCoding fails with error
1
gravatar for Stephane Plaisance | VIB |
2.0 years ago by

I have used the command with success many times until yesterday, I did some package updates since last success that may explain this but have no clue on what to do now.

This looks like an old issue I found but does not seem to be recently reported. All my packages have been deinstalled and reinstalled without improvement.

Using R 3.3.0 under RStudio (BSgenome v1.4.0 ; TxDb.Hsapiens.UCSC.hg19.knownGene 3.2.2; VariantAnnotation 1.18.7)

Thanks for your help

Here is a significant part of my code

library("VariantAnnotation")
library("TxDb.Hsapiens.UCSC.hg19.knownGene")
library("BSgenome.Hsapiens.UCSC.hg19")

vcf <- readVcf(vcf_file, "hg19")

Warning message:
In .bcfHeaderAsSimpleList(header) :
  duplicate keys in header will be forced to unique rownames

# but the VCF is OK and I can do many things with it except the following:

# annotation database 
txdb <- "TxDb.Hsapiens.UCSC.hg19.knownGene"

# locate coding variants
pred.coding <- predictCoding(vcf, txdb, Hsapiens)

Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘predictCoding’ for signature ‘"CollapsedVCF", "character", "BSgenome", "missing"’

showMethods("predictCoding")
Function: predictCoding (package VariantAnnotation)
query="CollapsedVCF", subject="TxDb", seqSource="ANY", varAllele="missing"
query="ExpandedVCF", subject="TxDb", seqSource="ANY", varAllele="missing"
query="GRanges", subject="TxDb", seqSource="ANY", varAllele="DNAStringSet"
query="Ranges", subject="TxDb", seqSource="ANY", varAllele="DNAStringSet"
query="VRanges", subject="TxDb", seqSource="ANY", varAllele="missing"

> sessionInfo()

R version 3.3.0 (2016-05-03)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats4    parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] BiocInstaller_1.22.3                    BSgenome.Hsapiens.UCSC.hg19_1.4.0      
 [3] BSgenome_1.40.1                         rtracklayer_1.32.2                     
 [5] TxDb.Hsapiens.UCSC.hg19.knownGene_3.2.2 GenomicFeatures_1.24.5                 
 [7] AnnotationDbi_1.34.4                    VariantAnnotation_1.18.7               
 [9] Rsamtools_1.24.0                        Biostrings_2.40.2                      
[11] XVector_0.12.1                          SummarizedExperiment_1.2.3             
[13] Biobase_2.32.0                          GenomicRanges_1.24.3                   
[15] GenomeInfoDb_1.8.7                      IRanges_2.6.1                          
[17] S4Vectors_0.10.3                        BiocGenerics_0.18.0                    
[19] biomaRt_2.28.0                          reshape2_1.4.1                         
[21] ggplot2_2.1.0                           RColorBrewer_1.1-2                     
[23] pheatmap_1.0.8                          knitr_1.14                             

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.7             plyr_1.8.4              bitops_1.0-6            tools_3.3.0            
 [5] zlibbioc_1.18.0         RSQLite_1.0.0           gtable_0.2.0            DBI_0.5-1              
 [9] stringr_1.1.0           grid_3.3.0              XML_3.98-1.4            BiocParallel_1.6.6     
[13] magrittr_1.5            scales_0.4.0            GenomicAlignments_1.8.4 colorspace_1.2-6       
[17] stringi_1.1.2           RCurl_1.95-4.8          munsell_0.4.3    

 

ADD COMMENTlink modified 2.0 years ago • written 2.0 years ago by Stephane Plaisance | VIB |50

It does not seems to be my data as it also fails using package demo data (all packages already loaded as above)

fl <- system.file("extdata", "ex2.vcf", package="VariantAnnotation")

> vcft <- readVcf(fl, "hg19")
> pred.coding <- predictCoding(vcft, txdb, Hsapiens)
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘predictCoding’ for signature ‘"CollapsedVCF", "character", "BSgenome", "missing"’
ADD REPLYlink written 2.0 years ago by Stephane Plaisance | VIB |50
1
gravatar for Valerie Obenchain
2.0 years ago by
Valerie Obenchain ♦♦ 6.6k
United States
Valerie Obenchain ♦♦ 6.6k wrote:

The error message says no method is available for the combination of objects you're using. Use showMethods() to see available methods:

> showMethods("predictCoding")
Function: predictCoding (package VariantAnnotation)
query="CollapsedVCF", subject="TxDb", seqSource="ANY", varAllele="missing"
query="ExpandedVCF", subject="TxDb", seqSource="ANY", varAllele="missing"
query="GRanges", subject="TxDb", seqSource="ANY", varAllele="DNAStringSet"
query="Ranges", subject="TxDb", seqSource="ANY", varAllele="DNAStringSet"
query="VRanges", subject="TxDb", seqSource="ANY", varAllele="missing"

In your case 'subject' is a character and no method exists for 'subject' as a character.

Using quotes here assigns a character string to the 'txdb' variable, not the TxDb object:

# annotation database 
txdb <- "TxDb.Hsapiens.UCSC.hg19.knownGene"

The fix is to not use quotes. Double check the object with class(txdb).

Valerie

ADD COMMENTlink written 2.0 years ago by Valerie Obenchain ♦♦ 6.6k
0
gravatar for Stephane Plaisance | VIB |
2.0 years ago by

Valérie, thanks so much, you are an angel.

I most likely overwrote the previous unquoted with a quoted text and could never have found it myself.

It is now busy running and is surely fixed.

You saved my day. 

Thanks you so much for the very useful package and help

Stephane

 

ADD COMMENTlink written 2.0 years ago by Stephane Plaisance | VIB |50
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 281 users visited in the last hour