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

2023-05-03 Thread Ruff, Sergej
I implemented teh limma Bioconductor dependency into the Suggests file and made 
it conditionally


Meaning I provided the Description File with


Suggests:
BiocManager,
limma


and created a short function which checks if limma is available


#' Check for package dependency
#'
#' @title Check for 'limma' availability
#' @description checks if the 'limma' package is installed. If not already 
installed,
#' limma will be installed automatically.
#' @author Sergej Ruff
#' @importFrom utils install.packages menu
#' @export
#' @keywords internal
check_limma <- function() # Returns TRUE if available, FALSE otherwise
{
  if(requireNamespace("limma", quietly=TRUE)) return(TRUE)
  if(!interactive()) return(FALSE)
  inst <- menu(c("Yes", "No"), title="Package {limma} required but not 
installed.\nDo you want to install it now?")
  if(inst != 1)
  {
message("To run this example, first install {limma} following the 
directions at 'https://bioconductor.org/packages/limma'")
return(FALSE)
  }
  # the following could be wrapped in try and conditionally return TRUE / FALSE
  if(!requireNamespace("BiocManager", quietly=TRUE)) 
install.packages("BiocManager", quiet=TRUE)
  BiocManager::install("limma", update=FALSE, ask=FALSE, quiet=TRUE)
  return(TRUE)
}

In the example field which uses the limma functions I then implemented the 
check-function:


if(check_limma()){
group = gl(2, n)
design = model.matrix(~ group)
fit1 = limma::lmFit(X, design)
fit = limma::eBayes(fit1)

### Calculation of confidence intervals
CI = fc_ci(fit=fit, alpha=0.05, method="raw")
head(CI)
CI = fc_ci(fit=fit, alpha=0.05, method="BH")
head(CI)
CI = fc_ci(fit=fit, alpha=0.05, method="BY")
head(CI)

fc_plot(CI, xlim=c(-0.5, 3), ylim=-log10(c(1, 0.0001)), updown="up")
fc_plot(CI, xlim=c(-3, 0.5), ylim=-log10(c(1, 0.0001)), updown="down")
fc_plot(CI, xlim=c(-3, 3), ylim=-log10(c(1, 0.0001)), updown="all")
}



I don�t get any Errors. Thank you R mailing list for providing the tips.


I just wanted to ask, if theres any other way to implement it, since I have 
never seen an example field

which has a check-if dependency is available function.


Is there any Improvments i could make or better methods.


Also for the future - how Do i provide Bioconductor dependencies as "Imports" 
for a package that I want to submit to CRAN?

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

that the Bioconductor dependencies dont cause a rejection from CRAN?


Best Regards,

Sergej


Von: Ivan Krylov 
Gesendet: Montag, 20. M�rz 2023 21:08:38
An: Ruff, Sergej
Cc: r-package-devel@r-project.org
Betreff: Re: [R-pkg-devel] How to declare Bioconductor Dependencies in the 
Description File of my R Package

On Mon, 20 Mar 2023 19:32:03 +
"Ruff, Sergej"  wrote:

> but I thought Notes will also cause rejection when submitting a
> package to CRAN. Won�t that be a problem?

True, a NOTE during an automatic check may cause a rejection, but you
won't get this NOTE there. Automatic CRAN pre-tests are done with a
full package set: anything from CRAN and BioConductor that runs on a
given operating system can be loaded.

(This differentiates CRAN from, say, PyPI or NPM: the two latter
ecosystems are much larger and are expected to handle conflicting
dependency requirements. CRAN is small enough to be able to enforce the
rule that every package must play well with the latest version of
everything else.)

There's an additional CRAN check called noSuggests
. You will
get a NOTE there, but it's expected and won't count against you. The
only way avoid this NOTE there is to not have any packages in Suggests:
(or Enhances:).

--
Best regards,
Ivan

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2023-05-03 Thread Duncan Murdoch




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

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2023-05-03 Thread Ruff, Sergej
Thanks,


So is it just necessary for suggested packages.


So, is it just good practice to make a conditional check?

I saw some packages still include it.


For example the Seurat package.


Under Utils.R (line 349-379) of the SeuratObject-Package 
(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/) 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/)

or for limma (starting line 2292).




Von: Duncan Murdoch 
Gesendet: Mittwoch, 3. Mai 2023 14:25:56
An: Ruff, Sergej; Ivan Krylov
Cc: r-package-devel@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


[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2023-05-03 Thread Duncan Murdoch

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/ 
) you will 
find the PackageCheck-function


which used by the Seurat-Package 
(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/ 
)


or for limma (starting line 2292).




*Von:* Duncan Murdoch 
*Gesendet:* Mittwoch, 3. Mai 2023 14:25:56
*An:* Ruff, Sergej; Ivan Krylov
*Cc:* r-package-devel@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



__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2023-05-03 Thread Ruff, Sergej
I took the Seurat package as an example, because it both lists the Bioconductor 
Dependencies under Imports in the DESCRIPTION-File

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 
Gesendet: Mittwoch, 3. Mai 2023 15:29:34
An: Ruff, Sergej; Ivan Krylov
Cc: r-package-devel@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/
> ) you will
> find the PackageCheck-function
>
> which used by the Seurat-Package
> (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/
> )
>
> or for limma (starting line 2292).
>
>
>
> 
> *Von:* Duncan Murdoch 
> *Gesendet:* Mittwoch, 3. Mai 2023 14:25:56
> *An:* Ruff, Sergej; Ivan Krylov
> *Cc:* r-package-devel@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
>


[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2023-05-03 Thread Dirk Eddelbuettel


Sergej,

Please consider:

  - there are nearly 20k CRAN packages
  
  - all of them are mirrored at https://github.com/cran so you can browse

  - pick any one 'heavy' package you like, Seurat is a good example; there
are other examples in geospatial or bioinformatics etc

  - you can browse _and search_ these to your hearts content

Here is an example of mine. In RcppArmadillo, years ago we (thanks to fine
Google Summer of Code work by Binxiang Ni) added extended support for sparse
matrices pass-through / conversione from R to C++ / Armadillo and back. That
is clearly an optional feature as most uses of (Rcpp)Armadillo use dense
matrices. So all code and test code is _conditional_.  File DESCRIPTION has

   Suggests: [...], Matrix (>= 1.3.0), [...], reticulate, slam

mostly for tests. I.e. We have very little R code: in one single file
R/SciPy2R.R we switched to doing this via reticulate and opee the function
with

if (!requireNamespace("reticulate", quietly=TRUE)) {
stop("You must install the 'reticulate' package (and have SciPy).", 
call.=FALSE)
}

after an actual deprecation warning (as there was scipy converter once).

Similarly, the testsuites in inst/tinytests/* have several

if (!requireNamespace("Matrix", quietly=TRUE)) exit_file("No Matrix 
package")

as well as

if (!requireNamespace("reticulate", quietly=TRUE)) exit_file("Package 
reticulate missing")

if (!packageVersion("reticulate") >= package_version("1.14"))
exit_file("SciPy not needed on newer reticulate")

and tests for slam (another sparse matrix package besides the functionality
in Matrix).

Hopefully this brief snapshot gives you an idea.  There are (likely!!)
thousandss of examples you can browse, and I am sure you will find something.
If you have further (concrete) questions please do not hesitate to use the
resource of this list.

Cheers (or I should say "mit Braunschweiger Gruessen nach Hannover),

Dirk

-- 
dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2023-05-03 Thread Ruff, Sergej
Thank you, Dirk.


I see your dependencies are Suggested. I know that Suggested dependencies 
should be conditional.


Do you know if Non-Cran (Bioconductor) packages need to be conditional?  Do you 
have any experiece regarding Non-CRAN Dependencies

and how to handle them?


I believe Duncan Murdoch's experience and opinion regarding that topic, but i 
take any second and third opinion to be sure.


Thank you for your help.


Sergej


Von: Dirk Eddelbuettel 
Gesendet: Mittwoch, 3. Mai 2023 16:22:09
An: Ruff, Sergej
Cc: Duncan Murdoch; Ivan Krylov; r-package-devel@r-project.org
Betreff: Re: [R-pkg-devel] How to declare Bioconductor Dependencies in the 
Description File of my R Package


Sergej,

Please consider:

  - there are nearly 20k CRAN packages

  - all of them are mirrored at https://github.com/cran so you can browse

  - pick any one 'heavy' package you like, Seurat is a good example; there
are other examples in geospatial or bioinformatics etc

  - you can browse _and search_ these to your hearts content

Here is an example of mine. In RcppArmadillo, years ago we (thanks to fine
Google Summer of Code work by Binxiang Ni) added extended support for sparse
matrices pass-through / conversione from R to C++ / Armadillo and back. That
is clearly an optional feature as most uses of (Rcpp)Armadillo use dense
matrices. So all code and test code is _conditional_.  File DESCRIPTION has

   Suggests: [...], Matrix (>= 1.3.0), [...], reticulate, slam

mostly for tests. I.e. We have very little R code: in one single file
R/SciPy2R.R we switched to doing this via reticulate and opee the function
with

if (!requireNamespace("reticulate", quietly=TRUE)) {
stop("You must install the 'reticulate' package (and have SciPy).", 
call.=FALSE)
}

after an actual deprecation warning (as there was scipy converter once).

Similarly, the testsuites in inst/tinytests/* have several

if (!requireNamespace("Matrix", quietly=TRUE)) exit_file("No Matrix 
package")

as well as

if (!requireNamespace("reticulate", quietly=TRUE)) exit_file("Package 
reticulate missing")

if (!packageVersion("reticulate") >= package_version("1.14"))
exit_file("SciPy not needed on newer reticulate")

and tests for slam (another sparse matrix package besides the functionality
in Matrix).

Hopefully this brief snapshot gives you an idea.  There are (likely!!)
thousandss of examples you can browse, and I am sure you will find something.
If you have further (concrete) questions please do not hesitate to use the
resource of this list.

Cheers (or I should say "mit Braunschweiger Gruessen nach Hannover),

Dirk

--
dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2023-05-03 Thread Duncan Murdoch

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 
*Gesendet:* Mittwoch, 3. Mai 2023 15:29:34
*An:* Ruff, Sergej; Ivan Krylov
*Cc:* r-package-devel@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/
>) you will

find the PackageCheck-function

which used by the Seurat-Package 
(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/
>)


or for limma (starting line 2292).




*Von:* Duncan Murdoch 
*Gesendet:* Mittwoch, 3. Mai 2023 14:25:56
*An:* Ruff, Sergej; Ivan Krylov
*Cc:* r-package-devel@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





__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2023-05-03 Thread Ruff, Sergej
my bad,


I looked at the DESCRIPTIOn fiel again. I assumed that Cluster was a 
Bioconductor package.

I also didn�t see that DeSeq2 was in Suggests.


I will follow your advice and try using Bioconductor packages without a 
conditional function.


Sergej


Von: Duncan Murdoch 
Gesendet: Mittwoch, 3. Mai 2023 17:25:15
An: Ruff, Sergej; Ivan Krylov
Cc: r-package-devel@r-project.org
Betreff: Re: AW: AW: [R-pkg-devel] How to declare Bioconductor Dependencies in 
the Description File of my R Package

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 
> *Gesendet:* Mittwoch, 3. Mai 2023 15:29:34
> *An:* Ruff, Sergej; Ivan Krylov
> *Cc:* r-package-devel@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/
>>  >) you will
>> find the PackageCheck-function
>>
>> which used by the Seurat-Package
>> (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/
>>  >)
>>
>> or for limma (starting line 2292).
>>
>>
>>
>> 
>> *Von:* Duncan Murdoch 
>> *Gesendet:* Mittwoch, 3. Mai 2023 14:25:56
>> *An:* Ruff, Sergej; Ivan Krylov
>> *Cc:* r-package-devel@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
>>
>


[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2023-05-03 Thread Martin Morgan
CRAN is fine with Bioconductor Depends: and Imports: dependencies, as 
previously mentioned. This is because the CRAN maintainers explicitly configure 
their system to know about Bioconductor package repositories.

Users face a different challenge -- many users will not have identified (e.g., 
via `setRepositories()` a Bioconductor repository, so when they try to install 
your package it will fail in a way that you have no control over -- a generic 
message saying that the Bioconductor dependencies was not found.

You could mitigate this by advertising that your CRAN package should be 
installed via `BiocManager::install("")`, which defines 
appropriate repositories for both CRAN and Bioconductor, but there is no way to 
unambiguously communicate this to users.

Martin

From: R-package-devel  on behalf of 
Ruff, Sergej 
Date: Wednesday, May 3, 2023 at 11:13 AM
To: Dirk Eddelbuettel 
Cc: r-package-devel@r-project.org 
Subject: Re: [R-pkg-devel] How to declare Bioconductor Dependencies in the 
Description File of my R Package
Thank you, Dirk.


I see your dependencies are Suggested. I know that Suggested dependencies 
should be conditional.


Do you know if Non-Cran (Bioconductor) packages need to be conditional?  Do you 
have any experiece regarding Non-CRAN Dependencies

and how to handle them?


I believe Duncan Murdoch's experience and opinion regarding that topic, but i 
take any second and third opinion to be sure.


Thank you for your help.


Sergej


Von: Dirk Eddelbuettel 
Gesendet: Mittwoch, 3. Mai 2023 16:22:09
An: Ruff, Sergej
Cc: Duncan Murdoch; Ivan Krylov; r-package-devel@r-project.org
Betreff: Re: [R-pkg-devel] How to declare Bioconductor Dependencies in the 
Description File of my R Package


Sergej,

Please consider:

  - there are nearly 20k CRAN packages

  - all of them are mirrored at https://github.com/cran so you can browse

  - pick any one 'heavy' package you like, Seurat is a good example; there
are other examples in geospatial or bioinformatics etc

  - you can browse _and search_ these to your hearts content

Here is an example of mine. In RcppArmadillo, years ago we (thanks to fine
Google Summer of Code work by Binxiang Ni) added extended support for sparse
matrices pass-through / conversione from R to C++ / Armadillo and back. That
is clearly an optional feature as most uses of (Rcpp)Armadillo use dense
matrices. So all code and test code is _conditional_.  File DESCRIPTION has

   Suggests: [...], Matrix (>= 1.3.0), [...], reticulate, slam

mostly for tests. I.e. We have very little R code: in one single file
R/SciPy2R.R we switched to doing this via reticulate and opee the function
with

if (!requireNamespace("reticulate", quietly=TRUE)) {
stop("You must install the 'reticulate' package (and have SciPy).", 
call.=FALSE)
}

after an actual deprecation warning (as there was scipy converter once).

Similarly, the testsuites in inst/tinytests/* have several

if (!requireNamespace("Matrix", quietly=TRUE)) exit_file("No Matrix 
package")

as well as

if (!requireNamespace("reticulate", quietly=TRUE)) exit_file("Package 
reticulate missing")

if (!packageVersion("reticulate") >= package_version("1.14"))
exit_file("SciPy not needed on newer reticulate")

and tests for slam (another sparse matrix package besides the functionality
in Matrix).

Hopefully this brief snapshot gives you an idea.  There are (likely!!)
thousandss of examples you can browse, and I am sure you will find something.
If you have further (concrete) questions please do not hesitate to use the
resource of this list.

Cheers (or I should say "mit Braunschweiger Gruessen nach Hannover),

Dirk

--
dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2023-05-03 Thread Simon Urbanek



> On May 4, 2023, at 3:36 AM, Martin Morgan  wrote:
> 
> CRAN is fine with Bioconductor Depends: and Imports: dependencies, as 
> previously mentioned. This is because the CRAN maintainers explicitly 
> configure their system to know about Bioconductor package repositories.
> 

That is not exactly true (at least not for all maintainers ;)). Bioconductor 
packages are installed on as-needed (best-effort) basis and it is a manual 
process. Ideally, Bioconductor packages would be in Suggests, because if they 
are not, the package binary will be effectively broken for most users as they 
cannot install it without additional steps (and no stable state can be 
guaranteed, either). That's why I believe someone was suggesting a pre-flight 
check that alerts the user to such situation and prints instructions to remedy 
it (e.g., to use setRepositories()) as the majority of users will have no idea 
what's going on.

Cheers,
Simon



> Users face a different challenge -- many users will not have identified 
> (e.g., via `setRepositories()` a Bioconductor repository, so when they try to 
> install your package it will fail in a way that you have no control over -- a 
> generic message saying that the Bioconductor dependencies was not found.
> 
> You could mitigate this by advertising that your CRAN package should be 
> installed via `BiocManager::install("")`, which defines 
> appropriate repositories for both CRAN and Bioconductor, but there is no way 
> to unambiguously communicate this to users.
> 
> Martin
> 
> From: R-package-devel  on behalf of 
> Ruff, Sergej 
> Date: Wednesday, May 3, 2023 at 11:13 AM
> To: Dirk Eddelbuettel 
> Cc: r-package-devel@r-project.org 
> Subject: Re: [R-pkg-devel] How to declare Bioconductor Dependencies in the 
> Description File of my R Package
> Thank you, Dirk.
> 
> 
> I see your dependencies are Suggested. I know that Suggested dependencies 
> should be conditional.
> 
> 
> Do you know if Non-Cran (Bioconductor) packages need to be conditional?  Do 
> you have any experiece regarding Non-CRAN Dependencies
> 
> and how to handle them?
> 
> 
> I believe Duncan Murdoch's experience and opinion regarding that topic, but i 
> take any second and third opinion to be sure.
> 
> 
> Thank you for your help.
> 
> 
> Sergej
> 
> 
> Von: Dirk Eddelbuettel 
> Gesendet: Mittwoch, 3. Mai 2023 16:22:09
> An: Ruff, Sergej
> Cc: Duncan Murdoch; Ivan Krylov; r-package-devel@r-project.org
> Betreff: Re: [R-pkg-devel] How to declare Bioconductor Dependencies in the 
> Description File of my R Package
> 
> 
> Sergej,
> 
> Please consider:
> 
>  - there are nearly 20k CRAN packages
> 
>  - all of them are mirrored at https://github.com/cran so you can browse
> 
>  - pick any one 'heavy' package you like, Seurat is a good example; there
>are other examples in geospatial or bioinformatics etc
> 
>  - you can browse _and search_ these to your hearts content
> 
> Here is an example of mine. In RcppArmadillo, years ago we (thanks to fine
> Google Summer of Code work by Binxiang Ni) added extended support for sparse
> matrices pass-through / conversione from R to C++ / Armadillo and back. That
> is clearly an optional feature as most uses of (Rcpp)Armadillo use dense
> matrices. So all code and test code is _conditional_.  File DESCRIPTION has
> 
>   Suggests: [...], Matrix (>= 1.3.0), [...], reticulate, slam
> 
> mostly for tests. I.e. We have very little R code: in one single file
> R/SciPy2R.R we switched to doing this via reticulate and opee the function
> with
> 
>if (!requireNamespace("reticulate", quietly=TRUE)) {
>stop("You must install the 'reticulate' package (and have SciPy).", 
> call.=FALSE)
>}
> 
> after an actual deprecation warning (as there was scipy converter once).
> 
> Similarly, the testsuites in inst/tinytests/* have several
> 
>if (!requireNamespace("Matrix", quietly=TRUE)) exit_file("No Matrix 
> package")
> 
> as well as
> 
>if (!requireNamespace("reticulate", quietly=TRUE)) exit_file("Package 
> reticulate missing")
> 
>if (!packageVersion("reticulate") >= package_version("1.14"))
>exit_file("SciPy not needed on newer reticulate")
> 
> and tests for slam (another sparse matrix package besides the functionality
> in Matrix).
> 
> Hopefully this brief snapshot gives you an idea.  There are (likely!!)
> thousandss of examples you can browse, and I am sure you will find something.
> If you have further (concrete) questions please do not hesitate to use the
> resource of this list.
> 
> Cheers (or I should say "mit Braunschweiger Gruessen nach Hannover),
> 
> Dirk
> 
> --
> dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
> 
>[[alternative HTML version deleted]]
> 
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
> 
>   [[alternative HTML version deleted]]
> 
> __

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

2023-05-03 Thread Dirk Eddelbuettel


On 4 May 2023 at 09:00, Simon Urbanek wrote:
| > On May 4, 2023, at 3:36 AM, Martin Morgan  wrote:
| > CRAN is fine with Bioconductor Depends: and Imports: dependencies, as 
previously mentioned. This is because the CRAN maintainers explicitly configure 
their system to know about Bioconductor package repositories.
| 
| That is not exactly true (at least not for all maintainers ;)). Bioconductor 
packages are installed on as-needed (best-effort) basis and it is a manual 
process. Ideally, Bioconductor packages would be in Suggests, because if they 
are not, the package binary will be effectively broken for most users as they 
cannot install it without additional steps (and no stable state can be 
guaranteed, either). That's why I believe someone was suggesting a pre-flight 
check that alerts the user to such situation and prints instructions to remedy 
it (e.g., to use setRepositories()) as the majority of users will have no idea 
what's going on.

That is not exactly true either.

Everything depends on the repository you look at, and have set. In the
command below (broken over two lines for legibility)
 
  $ docker run --rm -ti rocker/r2u:jammy \
  Rscript -e 'system.time(install.packages("Seurat", 
"SingleCellExperiment"))'

we see it takes 35 seconds to download and install 138 binary packages
implied by this particular pair of CRAN and BioConductor packages.

Now, this works because r2u is 'joint' repo with (essentially all of) CRAN
and (a decent chunk of) BioConductor. We also not that we do not need
Martin's suggestion of a bioc wrapper to the installation as the packages are
known (and are _effectively_ in an apt repo, but that is a r2u [1] story).

That said, _in general_ it can be dicey to depends on BioConductor as not
every user may have it set.  So this thread is slowly meandering in the right
direction.

Dirk

[1] https://eddelbuettel.github.io/r2u/

-- 
dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel