vmatchPattern error using a DNA string and BSgenome
0
0
Entering edit mode
mb2subi • 0
@mb2subi-23239
Last seen 4.6 years ago

Hi, I'm using vmatchPatter for find the coordinates of a dna string into a BSgenome hg19 genome. But it isn't working.

viewpoint = "ACCTAGAAGGATATGCGCTTGCGCGTTAGAGATC"

> class(viewpoint)
[1] "character"

pos_viewpoint <- Biostrings::vmatchPattern(viewpoint,
                                           BSgenome.Hsapiens.UCSC.hg19::BSgenome.Hsapiens.UCSC.hg19,
                                             max.mismatch = 0)

And I'm getting this error:

Error in (function (classes, fdef, mtable)  :  unable to find an inherited method for function ‘metadata<-’ for signature ‘"DFrame"’

> sessionInfo() 
R version 3.6.2 (2019-12-12)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
 [1] LC_CTYPE=en_US.UTF-8      
 [2] LC_NUMERIC=C              
 [3] LC_TIME=es_ES.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=es_ES.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=es_ES.UTF-8      
 [8] LC_NAME=C                 
 [9] LC_ADDRESS=C              
[10] LC_TELEPHONE=C            
[11] LC_MEASUREMENT=es_ES.UTF-8
[12] LC_IDENTIFICATION=C       

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

other attached packages:
 [1] BSgenome.Hsapiens.UCSC.hg19_1.4.0
 [2] BSgenome_1.54.0                  
 [3] rtracklayer_1.46.0               
 [4] Biostrings_2.54.0                
 [5] XVector_0.26.0                   
 [6] UMI4Cats_0.99.1                  
 [7] SummarizedExperiment_1.16.1      
 [8] DelayedArray_0.12.2              
 [9] BiocParallel_1.20.1              
[10] matrixStats_0.56.0               
[11] Biobase_2.46.0                   
[12] GenomicRanges_1.38.0             
[13] GenomeInfoDb_1.22.0              
[14] IRanges_2.20.2                   
[15] S4Vectors_0.24.3                 
[16] BiocGenerics_0.32.0              

loaded via a namespace (and not attached):
  [1] colorspace_1.4-1                       
  [2] hwriter_1.3.2                          
  [3] ellipsis_0.3.0                         
  [4] rprojroot_1.3-2                        
  [5] htmlTable_1.13.3                       
  [6] base64enc_0.1-3                        
  [7] fs_1.3.1                               
  [8] rstudioapi_0.10                        
  [9] remotes_2.1.0                          
 [10] bit64_0.9-7                            
 [11] AnnotationDbi_1.46.1                   
 [12] fansi_0.4.0                            
 [13] R.methodsS3_1.8.0                      
 [14] splines_3.6.2                          
 [15] geneplotter_1.62.0                     
 [16] knitr_1.28                             
 [17] pkgload_1.0.2                          
 [18] Formula_1.2-3                          
 [19] Rsamtools_2.2.3                        
 [20] annotate_1.62.0                        
 [21] cluster_2.0.7-1                        
 [22] R.oo_1.23.0                            
 [23] png_0.1-7                              
 [24] compiler_3.6.2                         
 [25] httr_1.4.1                             
 [26] backports_1.1.5                        
 [27] assertthat_0.2.1                       
 [28] Matrix_1.2-17                          
 [29] lazyeval_0.2.2                         
 [30] TxDb.Hsapiens.UCSC.hg19.knownGene_3.2.2
 [31] cli_2.0.0                              
 [32] htmltools_0.4.0                        
 [33] acepack_1.4.1                          
 [34] prettyunits_1.0.2                      
 [35] tools_3.6.2                            
 [36] gtable_0.3.0                           
 [37] glue_1.3.1                             
 [38] GenomeInfoDbData_1.2.2                 
 [39] reshape2_1.4.3                         
 [40] dplyr_0.8.5                            
 [41] ShortRead_1.42.0                       
 [42] Rcpp_1.0.3                             
 [43] vctrs_0.2.4                            
 [44] xfun_0.12                              
 [45] stringr_1.4.0                          
 [46] ps_1.3.0                               
 [47] testthat_2.3.1                         
 [48] lifecycle_0.1.0                        
 [49] devtools_2.2.1                         
 [50] XML_3.99-0.3                           
 [51] org.Hs.eg.db_3.8.2                     
 [52] zlibbioc_1.32.0                        
 [53] zoo_1.8-7                              
 [54] scales_1.1.0                           
 [55] hms_0.5.3                              
 [56] RColorBrewer_1.1-2                     
 [57] memoise_1.1.0                          
 [58] gridExtra_2.3                          
 [59] ggplot2_3.2.1                          
 [60] biomaRt_2.40.5                         
 [61] rpart_4.1-13                           
 [62] latticeExtra_0.6-29                    
 [63] stringi_1.4.3                          
 [64] RSQLite_2.2.0                          
 [65] genefilter_1.68.0                      
 [66] desc_1.2.0                             
 [67] checkmate_2.0.0                        
 [68] GenomicFeatures_1.36.4                 
 [69] pkgbuild_1.0.6                         
 [70] rlang_0.4.5                            
 [71] pkgconfig_2.0.3                        
 [72] bitops_1.0-6                           
 [73] lattice_0.20-38                        
 [74] purrr_0.3.3                            
 [75] GenomicAlignments_1.22.1               
 [76] htmlwidgets_1.5.1                      
 [77] cowplot_1.0.0                          
 [78] bit_1.1-15.2                           
 [79] processx_3.4.1                         
 [80] tidyselect_1.0.0                       
 [81] plyr_1.8.5                             
 [82] magrittr_1.5                           
 [83] DESeq2_1.24.0                          
 [84] R6_2.4.1                               
 [85] magick_2.3                             
 [86] Hmisc_4.3-1                            
 [87] DBI_1.1.0                              
 [88] pillar_1.4.3                           
 [89] foreign_0.8-70                         
 [90] withr_2.1.2                            
 [91] survival_3.1-11                        
 [92] RCurl_1.98-1.1                         
 [93] nnet_7.3-12                            
 [94] tibble_2.1.3                           
 [95] crayon_1.3.4                           
 [96] jpeg_0.1-8.1                           
 [97] progress_1.2.2                         
 [98] usethis_1.5.1                          
 [99] locfit_1.5-9.1                         
[100] grid_3.6.2                             
[101] data.table_1.12.8                      
[102] blob_1.2.1                             
[103] callr_3.4.0                            
[104] digest_0.6.23                          
[105] xtable_1.8-4                           
[106] Rbowtie2_1.6.0                         
[107] regioneR_1.16.5                        
[108] R.utils_2.9.2                          
[109] munsell_0.5.0                          
[110] sessioninfo_1.1.1
Biostrings vmatchPattern BSgenome • 1.2k views
ADD COMMENT
0
Entering edit mode

Hi,

I can't reproduce this error:

library(BSgenome.Hsapiens.UCSC.hg19)
viewpoint <- "ACCTAGAAGGATATGCGCTTGCGCGTTAGAGATC"
pos_viewpoint <- vmatchPattern(viewpoint, BSgenome.Hsapiens.UCSC.hg19)
pos_viewpoint
# GRanges object with 1 range and 0 metadata columns:
#       seqnames            ranges strand
#          <Rle>         <IRanges>  <Rle>
#   [1]     chr3 37034778-37034811      -
#   -------
#   seqinfo: 93 sequences from an unspecified genome

My package versions are the same as yours (see below) except for GenomeInfoDb (I have 1.22.1 and you have 1.22.0). Make sure to always keep everything up-to-date by running BiocManager::install() on a regular basis.

Can you please show us the output of traceback()? Call this right after you get the error. Thanks!

H.

My sessionInfo():

R version 3.6.0 Patched (2019-05-02 r76454)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.6 LTS

Matrix products: default
BLAS:   /home/hpages/R/R-3.6.r76454/lib/libRblas.so
LAPACK: /home/hpages/R/R-3.6.r76454/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
 [1] BSgenome.Hsapiens.UCSC.hg19_1.4.0 BSgenome_1.54.0                  
 [3] rtracklayer_1.46.0                Biostrings_2.54.0                
 [5] XVector_0.26.0                    GenomicRanges_1.38.0             
 [7] GenomeInfoDb_1.22.1               IRanges_2.20.2                   
 [9] S4Vectors_0.24.3                  BiocGenerics_0.32.0              

loaded via a namespace (and not attached):
 [1] zlibbioc_1.32.0             GenomicAlignments_1.22.1   
 [3] BiocParallel_1.20.1         lattice_0.20-40            
 [5] tools_3.6.0                 SummarizedExperiment_1.16.1
 [7] grid_3.6.0                  Biobase_2.46.0             
 [9] matrixStats_0.56.0          Matrix_1.2-18              
[11] GenomeInfoDbData_1.2.2      bitops_1.0-6               
[13] RCurl_1.98-1.1              DelayedArray_0.12.2        
[15] compiler_3.6.0              Rsamtools_2.2.3            
[17] XML_3.99-0.3 
ADD REPLY
0
Entering edit mode

I realized that it happens when I reload the package and the BSgenome.

 Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘metadata<-’ for signature ‘"DFrame"’ 

> traceback()
20: stop(gettextf("unable to find an inherited method for function %s for signature %s", 
        sQuote(fdef@generic), sQuote(cnames)), domain = NA)
19: (function (classes, fdef, mtable) 
    {
        methods <- .findInheritedMethods(classes, fdef, mtable)
        if (length(methods) == 1L) 
            return(methods[[1L]])
        else if (length(methods) == 0L) {
            cnames <- paste0("\"", vapply(classes, as.character, 
                ""), "\"", collapse = ", ")
            stop(gettextf("unable to find an inherited method for function %s for signature %s", 
                sQuote(fdef@generic), sQuote(cnames)), domain = NA)
        }
        else stop("Internal error in finding inherited methods; didn't return a unique method", 
            domain = NA)
    })(list("DFrame"), new("standardGeneric", .Data = function (x, 
        ..., value) 
    standardGeneric("metadata<-"), generic = "metadata<-", package = "S4Vectors", 
        group = list(), valueClass = character(0), signature = c("x", 
        "value"), default = NULL, skeleton = (function (x, ..., value) 
        stop("invalid call in method dispatch to 'metadata<-' (no default method)", 
            domain = NA))(x, ..., value = value)), <environment>)
18: `metadata<-`(`*tmp*`, value = metadata)
17: DataFrame(..., check.names = FALSE)
16: GRanges(i, IRanges(1L, seqlength))
15: x@single_sequences[[seqname]]
14: x@single_sequences[[seqname]]
13: .loadBSgenomeSequence(x, seqname, user_seqname)
12: .getBSgenomeSequence(x, seqname, user_seqname)
11: BSParams@X[[seqname]]
10: BSParams@X[[seqname]]
9: FUN(X[[i]], ...)
8: lapply(X = X, FUN = FUN, ...)
7: sapply(seqnames, processSeqname, ..., simplify = BSParams@simplify)
6: sapply(seqnames, processSeqname, ..., simplify = BSParams@simplify)
5: bsapply(bsParams, posPattern = posPattern, negPattern = negPattern, 
       seqlengths = seqlengths, max.mismatch = max.mismatch, min.mismatch = min.mismatch, 
       with.indels = with.indels, fixed = fixed, algorithm = algorithm)
4: .local(pattern, subject, max.mismatch, min.mismatch, with.indels, 
       fixed, algorithm, ...)
3: Biostrings::vmatchPattern(viewpoint, ref_gen, max.mismatch = 0)
2: Biostrings::vmatchPattern(viewpoint, ref_gen, max.mismatch = 0) at getViewpointCoordinates.R#26
1: getViewpointCoordinates(bait_seq = bait_seq, bait_pad = bait_pad, 
       res_enz = res_enz, ref_gen = ref_gen)
ADD REPLY

Login before adding your answer.

Traffic: 546 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6