ErasmusMC-CCBC / ProteoDisco

Generates protein variant sequences based on imported mutations from VCF, MAF and additional files to generate a protein-variant database for use in proteogenomics studies
4 stars 1 forks source link

Attaching ProteoDisco breaks print() and summary() #2

Closed HenrikBengtsson closed 3 years ago

HenrikBengtsson commented 3 years ago

Hi, attaching ProteoDisco seems to break the essential functions print() and summary(), e.g.

$ R --vanilla

R version 4.1.2 (2021-11-01) -- "Bird Hippie"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ProteoDisco)

Attaching package: ‘ProteoDisco’

The following object is masked from ‘package:methods’:

    show

The following objects are masked from ‘package:base’:

    print, summary

> print(1:10)
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘print’ for signature ‘"integer"’
> summary(1:10)
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘summary’ for signature ‘"integer"’

Session info

> print
standardGeneric for "print" defined from package "ProteoDisco"

function (object) 
standardGeneric("print")
<bytecode: 0x24dfbba0>
<environment: 0x24df2748>
Methods may be defined for arguments: object
Use  showMethods(print)  for currently available ones.
> summary
standardGeneric for "summary" defined from package "ProteoDisco"

function (object, verbose = TRUE) 
standardGeneric("summary")
<bytecode: 0x24ed6a90>
<environment: 0x24ebb740>
Methods may be defined for arguments: object, verbose
Use  showMethods(summary)  for currently available ones.
> 

> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS:   /software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/lib/libRblas.so
LAPACK: /software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/lib/libRlapack.so

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

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

other attached packages:
[1] ProteoDisco_1.0.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7                  pillar_1.6.4               
 [3] compiler_4.1.2              restfulr_0.0.13            
 [5] GenomeInfoDb_1.30.0         plyr_1.8.6                 
 [7] XVector_0.34.0              MatrixGenerics_1.6.0       
 [9] bitops_1.0-7                tools_4.1.2                
[11] zlibbioc_1.40.0             lattice_0.20-45            
[13] lifecycle_1.0.1             tibble_3.1.6               
[15] BSgenome_1.62.0             pkgconfig_2.0.3            
[17] rlang_0.4.12                Matrix_1.3-4               
[19] DelayedArray_0.20.0         DBI_1.1.1                  
[21] yaml_2.2.1                  parallel_4.1.2             
[23] GenomeInfoDbData_1.2.7      rtracklayer_1.54.0         
[25] dplyr_1.0.7                 Biostrings_2.62.0          
[27] generics_0.1.1              S4Vectors_0.32.2           
[29] vctrs_0.3.8                 IRanges_2.28.0             
[31] grid_4.1.2                  stats4_4.1.2               
[33] tidyselect_1.1.1            Biobase_2.54.0             
[35] glue_1.5.0                  R6_2.5.1                   
[37] fansi_0.5.0                 XML_3.99-0.8               
[39] BiocParallel_1.28.0         purrr_0.3.4                
[41] cleaver_1.32.0              magrittr_2.0.1             
[43] GenomicAlignments_1.30.0    Rsamtools_2.10.0           
[45] ellipsis_0.3.2              matrixStats_0.61.0         
[47] BiocGenerics_0.40.0         GenomicRanges_1.46.0       
[49] SummarizedExperiment_1.24.0 assertthat_0.2.1           
[51] utf8_1.2.2                  RCurl_1.98-1.5             
[53] rjson_0.2.20                crayon_1.4.2               
[55] BiocIO_1.4.0          
J0bbie commented 3 years ago

Dear Henrik,

My apologies, it's seems that we somehow missed that during testing... It was due to our own S3 generics for the print and summary functions rather than using the alternate method.

E.g.:

setMethod("print", "ProteoDiscography", function(x) 
  ...
)

Instead of:

print.ProteoDiscography <- function(x, ...){
  ...
}

I've amended this in the package and it should work without breaking these crucial functions for the other classes.

Thanks for the report! Please let me know if this indeed also fixed it for you.

Kind regards,

Job

HenrikBengtsson commented 3 years ago

No worries. I found this through a big load-attach scan of all CRAN and Bioconductor packages where I did print(packageDescription(pkg)). If it makes you feel better, you're not alone - there are two other packages with the same issue :p ... RGCxGC and seqmin.

I can confirm that it works with the new

remotes::install_github("ErasmusMC-CCBC/ProteoDisco")
library(ProteoDisco)
packageVersion("ProteoDisco")
#> [1] ‘1.1.1’

print(1:10)
#> [1]  1  2  3  4  5  6  7  8  9 10

summary(1:10)
#>   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#>   1.00    3.25    5.50    5.50    7.75   10.00