hansenlab / minfi

Devel repository for minfi
60 stars 70 forks source link

Error with `getAnnotation` #181

Closed LiNk-NY closed 5 years ago

LiNk-NY commented 5 years ago

I want to run getAnnotation inside package code.

Essentially the IlluminaHumanMethylation450kanno.ilmn12.hg19 package is required to be loaded when running getAnnotation. This shouldn't be a requirement inside package code (it works fine with interactive use, i.e., library(...)).

I'm running the following and getting a traceback() (below) that looks like this:

annote450k <- minfi::getAnnotation(
    IlluminaHumanMethylation450kanno.ilmn12.hg19::
        IlluminaHumanMethylation450kanno.ilmn12.hg19)
#> Registered S3 method overwritten by 'openssl':
#>   method      from
#>   print.bytes Rcpp
#> Setting options('download.file.method.GEOquery'='auto')
#> Setting options('GEOquery.inmemory.gpl'=FALSE)

#> Error in as.environment(pointer$envir): no item called
#> "package:IlluminaHumanMethylation450kanno.ilmn12.hg19" on the search list

sessionInfo()
#> R Under development (unstable) (2019-02-28 r76173)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 18.04.2 LTS
#> 
#> Matrix products: default
#> BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.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] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>   [1] nlme_3.1-137                                      
#>   [2] bitops_1.0-6                                      
#>   [3] matrixStats_0.54.0                                
#>   [4] bit64_0.9-7                                       
#>   [5] RColorBrewer_1.1-2                                
#>   [6] progress_1.2.0                                    
#>   [7] httr_1.4.0                                        
#>   [8] GenomeInfoDb_1.19.2                               
#>   [9] tools_3.6.0                                       
#>  [10] doRNG_1.7.1                                       
#>  [11] nor1mix_1.2-3                                     
#>  [12] R6_2.4.0                                          
#>  [13] HDF5Array_1.11.10                                 
#>  [14] DBI_1.0.0                                         
#>  [15] BiocGenerics_0.29.2                               
#>  [16] withr_2.1.2                                       
#>  [17] tidyselect_0.2.5                                  
#>  [18] prettyunits_1.0.2                                 
#>  [19] base64_2.0                                        
#>  [20] bit_1.1-14                                        
#>  [21] compiler_3.6.0                                    
#>  [22] preprocessCore_1.45.0                             
#>  [23] Biobase_2.43.1                                    
#>  [24] xml2_1.2.0                                        
#>  [25] DelayedArray_0.9.8                                
#>  [26] pkgmaker_0.27                                     
#>  [27] rtracklayer_1.43.3                                
#>  [28] readr_1.3.1                                       
#>  [29] genefilter_1.65.0                                 
#>  [30] quadprog_1.5-5                                    
#>  [31] askpass_1.1                                       
#>  [32] stringr_1.4.0                                     
#>  [33] digest_0.6.18                                     
#>  [34] Rsamtools_1.99.3                                  
#>  [35] illuminaio_0.25.0                                 
#>  [36] rmarkdown_1.12                                    
#>  [37] siggenes_1.57.4                                   
#>  [38] GEOquery_2.51.5                                   
#>  [39] XVector_0.23.0                                    
#>  [40] pkgconfig_2.0.2                                   
#>  [41] htmltools_0.3.6                                   
#>  [42] scrime_1.3.5                                      
#>  [43] bibtex_0.4.2                                      
#>  [44] limma_3.39.12                                     
#>  [45] highr_0.7                                         
#>  [46] rlang_0.3.1                                       
#>  [47] RSQLite_2.1.1                                     
#>  [48] DelayedMatrixStats_1.5.2                          
#>  [49] mclust_5.4.2                                      
#>  [50] BiocParallel_1.17.17                              
#>  [51] dplyr_0.8.0.1                                     
#>  [52] RCurl_1.95-4.12                                   
#>  [53] magrittr_1.5                                      
#>  [54] GenomeInfoDbData_1.2.0                            
#>  [55] Matrix_1.2-16                                     
#>  [56] Rcpp_1.0.0                                        
#>  [57] S4Vectors_0.21.11                                 
#>  [58] Rhdf5lib_1.5.1                                    
#>  [59] stringi_1.4.3                                     
#>  [60] yaml_2.2.0                                        
#>  [61] MASS_7.3-51.2                                     
#>  [62] SummarizedExperiment_1.13.0                       
#>  [63] zlibbioc_1.29.0                                   
#>  [64] rhdf5_2.27.15                                     
#>  [65] plyr_1.8.4                                        
#>  [66] bumphunter_1.25.3                                 
#>  [67] grid_3.6.0                                        
#>  [68] minfi_1.29.4                                      
#>  [69] blob_1.1.1                                        
#>  [70] parallel_3.6.0                                    
#>  [71] crayon_1.3.4                                      
#>  [72] lattice_0.20-38                                   
#>  [73] Biostrings_2.51.2                                 
#>  [74] splines_3.6.0                                     
#>  [75] multtest_2.39.0                                   
#>  [76] GenomicFeatures_1.35.7                            
#>  [77] annotate_1.61.1                                   
#>  [78] hms_0.4.2                                         
#>  [79] locfit_1.5-9.1                                    
#>  [80] pillar_1.3.1                                      
#>  [81] knitr_1.22                                        
#>  [82] beanplot_1.2                                      
#>  [83] GenomicRanges_1.35.1                              
#>  [84] rngtools_1.3.1                                    
#>  [85] codetools_0.2-16                                  
#>  [86] biomaRt_2.39.2                                    
#>  [87] stats4_3.6.0                                      
#>  [88] glue_1.3.1                                        
#>  [89] XML_3.98-1.19                                     
#>  [90] evaluate_0.13                                     
#>  [91] data.table_1.12.0                                 
#>  [92] foreach_1.4.4                                     
#>  [93] IlluminaHumanMethylation450kanno.ilmn12.hg19_0.6.0
#>  [94] tidyr_0.8.3                                       
#>  [95] purrr_0.3.1                                       
#>  [96] openssl_1.2.2                                     
#>  [97] reshape_0.8.8                                     
#>  [98] assertthat_0.2.0                                  
#>  [99] xfun_0.5                                          
#> [100] xtable_1.8-3                                      
#> [101] survival_2.43-3                                   
#> [102] tibble_2.0.1                                      
#> [103] iterators_1.0.10                                  
#> [104] GenomicAlignments_1.19.1                          
#> [105] AnnotationDbi_1.45.1                              
#> [106] registry_0.5-1                                    
#> [107] memoise_1.1.0                                     
#> [108] IRanges_2.17.4

Created on 2019-03-14 by the reprex package (v0.2.1)

 traceback()
7: get(pointer$what, envir = as.environment(pointer$envir))
6: .annoGet(wh, envir = annoObject@data)
5: FUN(X[[i]], ...)
4: lapply(what, function(wh) {
       .annoGet(wh, envir = annoObject@data)
   })
3: lapply(what, function(wh) {
       .annoGet(wh, envir = annoObject@data)
   })
2: do.call(cbind, lapply(what, function(wh) {
       .annoGet(wh, envir = annoObject@data)
   }))
1: minfi::getAnnotation(IlluminaHumanMethylation450kanno.ilmn12.hg19::IlluminaHumanMethylation450kanno.ilmn12.hg19)
wudustan commented 5 years ago

From the help files for getAnnotation():

getAnnotation(object, what = "everything", lociNames = NULL,
              orderByLocation = FALSE, dropNonMapping = FALSE)

object - A minfi object.

In this case a minfi object refers to one of the following - RGChannelSet, MethylSet, GenomicMethylSet and so on. So you're feeding the function the wrong thing. You can simply obtain the manifest using the IlluminaHumanMethylation450kanno.ilmn12.hg19 package but you wouldn't use the minfi::getAnnotation(). The benefit of using the minfi::getAnnotation() version is you can use it to only obtain the manifest info for your loci of interest.

The easiest way to get the full 450k annotation with this function is to simply invoke:

myAnno.df <- getAnnotation(minfiData::MsetEx)
LiNk-NY commented 5 years ago

Hi @wudustan

Thanks for clearing this up. I looks like I was only looking for the Locations data from the IlluminaHumanMethylation450kanno.ilmn12.hg19 package. I've updated TCGAutils to reflect that.

FWIW This is where I found this type of usage: https://www.bioconductor.org/packages/release/workflows/vignettes/methylationArrayAnalysis/inst/doc/methylationArrayAnalysis.html#loading-the-data It may be helpful to submit an issue / bug report for the workflow.

Best, Marcel