[R-pkg-devel] How to declare Bioconductor Dependencies in the Description File of my R Package

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Wed May 3 17:25:15 CEST 2023


On 03/05/2023 9:50 a.m., Ruff, Sergej wrote:
> I took the Seurat package as an example, because it both lists the 
> Bioconductor Dependencies under Imports in the DESCRIPTION-File

Which packages are you talking about?  I don't see any BioConductor 
dependencies in the Imports list for the current Seurat version.

Duncan Murdoch

> 
> and it uses conditional functions to check if those dependencies are 
> pre-installed.
> 
> 
> "No, it is a requirement if the package is used but is not listed in
> Depends or Imports.
> 
> If the package is in Depends or Imports it is a waste of time to make
> the check:  it will always succeed."
> 
> 
> that's what I also thought but I am confused why a package like Seurat 
> then lists the dependencies in the DESCRIPTION-File and on top of that uses
> 
> conditional functions to check if the package is pre-installed or not. 
> Wouldn't that make the packagecheck function used by Seurat redundant?
> 
> Sergej Ruff
> 
> ------------------------------------------------------------------------
> *Von:* Duncan Murdoch <murdoch.duncan using gmail.com>
> *Gesendet:* Mittwoch, 3. Mai 2023 15:29:34
> *An:* Ruff, Sergej; Ivan Krylov
> *Cc:* r-package-devel using r-project.org
> *Betreff:* Re: AW: [R-pkg-devel] How to declare Bioconductor 
> Dependencies in the Description File of my R Package
> On 03/05/2023 9:17 a.m., Ruff, Sergej wrote:
>> Thanks,
>> 
>> 
>> So is it just necessary for suggested packages.
> 
> Those and "Enhances" packages, but hardly anyone uses "Enhances".
>> 
>> 
>> So, is it just good practice to make a conditional check?
> 
> No, it is a requirement if the package is used but is not listed in
> Depends or Imports.
> 
> If the package is in Depends or Imports it is a waste of time to make
> the check:  it will always succeed.
> 
>> I saw some packages still include it.
>> 
>> 
>> For example the Seurat package.
>>
> I don't understand your question here.
> 
> Duncan Murdoch
> 
>> 
>> Under Utils.R (line 349-379) of the SeuratObject-Package 
>> (https://cran.r-project.org/src/contrib/Archive/SeuratObject/
>> <https://cran.r-project.org/src/contrib/Archive/SeuratObject/ 
> <https://cran.r-project.org/src/contrib/Archive/SeuratObject/>>) you will
>> find the PackageCheck-function
>> 
>> which used by the Seurat-Package 
>> (https://cran.r-project.org/src/contrib/Archive/Seurat/
>> <https://cran.r-project.org/src/contrib/Archive/Seurat/ 
> <https://cran.r-project.org/src/contrib/Archive/Seurat/>>) to check if
>> packages are alredy installed.
>> 
>> 
>> You can find examples for DEseq2 under differential_expression.R 
>> (starting line 1314 or you cntr+f for packagecheck) in 
>> the Seurat.package 
>> (https://cran.r-project.org/src/contrib/Archive/Seurat/
>> <https://cran.r-project.org/src/contrib/Archive/Seurat/ 
> <https://cran.r-project.org/src/contrib/Archive/Seurat/>>)
>> 
>> or for limma (starting line 2292).
>> 
>> 
>> 
>> ------------------------------------------------------------------------
>> *Von:* Duncan Murdoch <murdoch.duncan using gmail.com>
>> *Gesendet:* Mittwoch, 3. Mai 2023 14:25:56
>> *An:* Ruff, Sergej; Ivan Krylov
>> *Cc:* r-package-devel using r-project.org
>> *Betreff:* Re: [R-pkg-devel] How to declare Bioconductor Dependencies in 
>> the Description File of my R Package
>> 
>> 
>> On 03/05/2023 8:00 a.m., Ruff, Sergej wrote:
>> ... [ lines about current solution deleted ]
>> 
>>> Also for the future - how Do i provide Bioconductor dependencies as "Imports" for a package that I want to submit to CRAN?
>> 
>> Just list it as you would a CRAN package.  The CRAN docs talk about
>> "mainstream repositories"; I forget what the definition is of that
>> (maybe repositories listed in `file.path(R.home(),
>> "etc/repositories")`?), but definitely BioConductor is included.
>> 
>>> Do I need to make that also conditional? I know I should provide Installation description in a readme fiel but how do I make sure
>> 
>> No, you don't need to check.  If any imported package is not available,
>> your package will not load, so errors will happen before you ever get to
>> running examples.
>> 
>>> that the Bioconductor dependencies dont cause a rejection from CRAN?
>> 
>> Just make sure they exist on BioC and your code works with them.
>> 
>> Duncan Murdoch
>> 
>



More information about the R-package-devel mailing list