sneumann / xcms

This is the git repository matching the Bioconductor package xcms: LC/MS and GC/MS Data Analysis
Other
177 stars 81 forks source link

Question about Warning: replacing previous import #658

Closed felipe-mansoldo closed 1 year ago

felipe-mansoldo commented 1 year ago

Dear all, I'm developing a package that uses xcms and Spectra. In the script I declared the packages of each function, like:

Spectra::MsBackendMzR
xcms::findChromPeaks

and so on.. However, when building the package I get the following alerts:

Warning: multiple tables of methods found for 'aperm'
Warning: replacing previous import 'BiocGenerics::aperm' by 'DelayedArray::aperm' when loading 'SummarizedExperiment'
Warning: replacing previous import 'Spectra::estimatePrecursorIntensity' by 'xcms::estimatePrecursorIntensity' when loading 'pack_test'
Warning: replacing previous import 'dplyr::collect' by 'xcms::collect' when loading 'pack_test'
Warning: replacing previous import 'Spectra::pickPeaks' by 'xcms::pickPeaks' when loading 'pack_test'
Warning: replacing previous import 'Spectra::spectrapply' by 'xcms::spectrapply' when loading 'pack_test'
Warning: replacing previous import 'shiny::span' by 'xcms::span' when loading 'pack_test'
Warning: replacing previous import 'Spectra::ppm' by 'xcms::ppm' when loading 'pack_test'
Warning: replacing previous import 'dplyr::groups' by 'xcms::groups' when loading 'pack_test'

Interestingly, I didn't use any of those functions in my script: estimatePrecursorIntensity collect pickPeaks spectrapply span ppm groups

After installing the package it works normally. But these warnings got me worried.

It's normal? should I proceed otherwise?

my best,

jorainer commented 1 year ago

Hi Felipe,

generally, it would be better to specifically import the function you use instead of calling them with :: and to avoid putting too many packages into Depends (in the package DESCRIPTION) - it's better to add packages to Imports and specifically import the methods/functions you need in your package. These warnings can result in errors, i.e. if a specific implementation of a method is then not found.

But unfortunately you will not get around all import clashes - especially, since we're having partially redundant functionality in both MSnbase and Spectra. I would suggest to use the most recent versions of all our packages as I'm trying at the moment to unify all a bit better ... this means: using BioC 3.17 devel and the development versions of xcms, MSnbase, Spectra - note that I'm also at present updating xcms to use Spectra - this development is currently happening in the spectra branch of xcms.

felipe-mansoldo commented 1 year ago

Hi, thank you very much for the explanations. I will follow your directions. my best,