Title: | Automate package and project setup for Bioconductor packages |
---|---|
Description: | This package expands the usethis package with the goal of helping automate the process of creating R packages for Bioconductor or making them Bioconductor-friendly. |
Authors: | Leonardo Collado-Torres [aut, cre] , Marcel Ramos [ctb] |
Maintainer: | Leonardo Collado-Torres <[email protected]> |
License: | Artistic-2.0 |
Version: | 1.17.0 |
Built: | 2024-12-11 03:10:21 UTC |
Source: | https://github.com/bioc/biocthis |
These functions add markdown text to the README
to include all or
individual badges from the Bioconductor landing page.
use_bioc_badges() use_bioc_build_badge(which = c("release", "devel")) use_bioc_support_badge() use_bioc_rank_badge() use_bioc_history_badge() use_bioc_last_commit_badge() use_bioc_dependencies_badge()
use_bioc_badges() use_bioc_build_badge(which = c("release", "devel")) use_bioc_support_badge() use_bioc_rank_badge() use_bioc_history_badge() use_bioc_last_commit_badge() use_bioc_dependencies_badge()
which |
Which branch to report the build status for. Possible values:
|
use_bioc_badges()
: adds all badges listed below, mimicking the
Bioconductor landing page
use_bioc_build_badge()
: badge indicating Bioconductor build status for either the devel
or
release
branch
use_bioc_support_badge()
: Bioc support site activity in the last 6 months
(answered posts / total posts)
use_bioc_rank_badge()
: ranking by number of downloads
use_bioc_history_badge()
: how long since the package was first in a
released Bioconductor version (or if it is in devel only)
use_bioc_last_commit_badge()
: time since last commit
use_bioc_dependencies_badge()
: number of recursive dependencies needed to
install the package
## Not run: ## Add all Bioc badges at once use_bioc_badges() ## Add just the Bioc build status badge for devel use_bioc_build_badge("devel") ## End(Not run)
## Not run: ## Add all Bioc badges at once use_bioc_badges() ## Add just the Bioc build status badge for devel use_bioc_build_badge("devel") ## End(Not run)
This function uses styler::tidyverse_style()
and modifies it to make it
Bioconductor friendly. The full Bioconductor coding style is described at
https://bioconductor.org/developers/how-to/coding-style/ and it shares
many properties with the Tidyverse coding style guide
https://style.tidyverse.org/. This function defines the transformers
code
that you can then use with other styler
functions such as
styler::style_pkg()
.
bioc_style(indent_by = 4, ...)
bioc_style(indent_by = 4, ...)
indent_by |
How many spaces of indention should be inserted after
operators such as |
... |
Other arguments passed to |
The styler
package seems to be more actively maintained and better
performance than formatR
, though that package can also be useful. This
function does not produce an exact Bioconductor coding style, but it gets
you close enough! =)
For more details on how this function came to be, check https://github.com/r-lib/styler/issues/636 https://github.com/Bioconductor/BiocCheck/issues/57 https://github.com/Bioconductor/bioconductor.org/issues/54
A list()
object with the information required by functions in
the transformers
argument in the styler
package functions such as
styler::style_pkg()
.
## Not run: ## Run these functions in your package styler::style_pkg(transformers = biocthis::bioc_style()) styler::style_dir(usethis::proj_path("dev"), transformers = biocthis::bioc_style()) ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg() ## Automatically style the example package styler::style_pkg(pkgdir, transformers = biocthis::bioc_style())
## Not run: ## Run these functions in your package styler::style_pkg(transformers = biocthis::bioc_style()) styler::style_dir(usethis::proj_path("dev"), transformers = biocthis::bioc_style()) ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg() ## Automatically style the example package styler::style_pkg(pkgdir, transformers = biocthis::bioc_style())
This function creates a temporary example package. It is used by the
functions in biocthis
to illustrate the functionality of the package
without exposing users to internals of usethis
that users do not need
to use under typical working conditions.
biocthis_example_pkg(name = "biocthisexample", use_git = FALSE)
biocthis_example_pkg(name = "biocthisexample", use_git = FALSE)
name |
A |
use_git |
A |
This function creates a package under tempdir()
with the name
provided
and uses usethis::proj_set()
for setting the project directory. Users
do not need to rely on usethis::proj_set()
under typical scenarios. In
other words, if you are running R interactively, usethis
will set the
directory for you.
Check https://github.com/lcolladotor/biocthis/commit/dc387807623f0e945432d15f0d0f899de1b1dd9d#r39102094 for more details that motivated this function.
A character(1)
with the path to a temporary example package to use
in the examples of the biocthis
functions.
## Create an example temporary package for illustrative purposes pkgdir <- biocthis_example_pkg()
## Create an example temporary package for illustrative purposes pkgdir <- biocthis_example_pkg()
This function is very similar to usethis::use_citation()
except
that it uses a template from biocthis
. This template can help you get
started with a citation file for your Bioconductor package. You can
compare the template produced with the one from usethis::use_citation()
to pick and choose the parts you like best from each.
use_bioc_citation()
use_bioc_citation()
This function adds and/or replaces the inst/CITATION
file in your
R package.
## Not run: ## Run this function in your package use_bioc_citation() ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg() ## Create a template CITATION file that is Bioconductor-friendly biocthis::use_bioc_citation()
## Not run: ## Run this function in your package use_bioc_citation() ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg() ## Create a template CITATION file that is Bioconductor-friendly biocthis::use_bioc_citation()
This function is very similar to usethis::use_tidy_cov()
except
that it uses a template from biocthis
. This template links to the
Bioconductor Code of Conduct available at
http://bioconductor.org/about/code-of-conduct/. The function adds by
default the file .github/CODE_OF_CONDUCT.md
with a brief overview of
the Bioconductor Code of Conduct and links to the latest version.
use_bioc_coc(path = ".github")
use_bioc_coc(path = ".github")
path |
A |
This function adds and/or replaces the .github/CODE_OF_CONDUCT.md
file in your R package.
## Not run: ## Run this function in your package use_bioc_coc() ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg() ## Create a Bioconductor-styled CODE_OF_CONDUCT.md biocthis::use_bioc_coc()
## Not run: ## Run this function in your package use_bioc_coc() ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg() ## Create a Bioconductor-styled CODE_OF_CONDUCT.md biocthis::use_bioc_coc()
This function is very similar to usethis::use_description()
except
that it uses a template from biocthis
. This template includes some of the
information expected in the DESCRIPTION file of a Bioconductor package. You
can compare the output of this function to the one from
usethis::use_description()
to select the parts you want from each.
use_bioc_description(biocViews = "Software", report_bioc = TRUE)
use_bioc_description(biocViews = "Software", report_bioc = TRUE)
biocViews |
A |
report_bioc |
A |
For details about the DESCRIPTION file guidelines for Bioconductor packages check http://bioconductor.org/developers/package-guidelines/#description.
This function adds and/or replaces the DESCRIPTION
file in your
R package.
## Not run: ## Run this function in your package use_bioc_description() ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg(use_git = TRUE) ## Create a template DESCRIPTION file that is Bioconductor-friendly biocthis::use_bioc_description()
## Not run: ## Run this function in your package use_bioc_description() ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg(use_git = TRUE) ## Create a template DESCRIPTION file that is Bioconductor-friendly biocthis::use_bioc_description()
This function is very similar to usethis::use_tidy_issue_template()
except
that it uses a template from biocthis
and is tailored for feature requests.
use_bioc_feature_request_template()
use_bioc_feature_request_template()
For more details on how this function came to be, check https://github.com/lcolladotor/biocthis/pull/33.
This function adds and/or replaces the
.github/ISSUE_TEMPLATE/feature_request_template.md
file in your R package.
## Not run: ## Run this function in your package use_bioc_feature_request_template() ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg() ## Create a feature request template GitHub file that is Bioconductor-friendly biocthis::use_bioc_feature_request_template()
## Not run: ## Run this function in your package use_bioc_feature_request_template() ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg() ## Create a feature request template GitHub file that is Bioconductor-friendly biocthis::use_bioc_feature_request_template()
This function is very similar to usethis::use_github_action()
except
that it uses a template from biocthis
. It creates a Bioconductor-friendly
GitHub action workflow for your package. You can also use this GitHub
Actions workflow by executing usethis::use_github_action()
.
use_bioc_github_action( biocdocker, pkgdown = getOption("biocthis.pkgdown", FALSE), testthat = getOption("biocthis.testthat", FALSE), covr = testthat, covr_coverage_type = getOption("biocthis.covr_coverage_type", "all"), RUnit = getOption("biocthis.RUnit", FALSE), pkgdown_covr_branch = getOption("biocthis.pkgdown_covr_branch", "devel"), docker = getOption("biocthis.docker", FALSE) )
use_bioc_github_action( biocdocker, pkgdown = getOption("biocthis.pkgdown", FALSE), testthat = getOption("biocthis.testthat", FALSE), covr = testthat, covr_coverage_type = getOption("biocthis.covr_coverage_type", "all"), RUnit = getOption("biocthis.RUnit", FALSE), pkgdown_covr_branch = getOption("biocthis.pkgdown_covr_branch", "devel"), docker = getOption("biocthis.docker", FALSE) )
biocdocker |
A |
pkgdown |
A |
testthat |
A |
covr |
A |
covr_coverage_type |
A |
RUnit |
A |
pkgdown_covr_branch |
A |
docker |
A |
For the full history on how this GitHub Actions workflow came to be, check the "biocthis developer notes" vignette https://lcolladotor.github.io/biocthis/articles/biocthis_dev_notes.html.
This function adds and/or replaces the
.github/workflows/check-bioc.yml
file in your R package.
## Not run: ## Run this function in your package biocthis::use_bioc_github_action() ## End(Not run) ## I have the following options on my ~/.Rprofile set ## Check ## <https://github.com/lcolladotor/biocthis/issues/9#issuecomment-702401032> ## for more information. options("biocthis.pkgdown" = TRUE) options("biocthis.testthat" = TRUE)
## Not run: ## Run this function in your package biocthis::use_bioc_github_action() ## End(Not run) ## I have the following options on my ~/.Rprofile set ## Check ## <https://github.com/lcolladotor/biocthis/issues/9#issuecomment-702401032> ## for more information. options("biocthis.pkgdown" = TRUE) options("biocthis.testthat" = TRUE)
This function is very similar to usethis::use_tidy_issue_template()
except
that it uses a template from biocthis
.
use_bioc_issue_template()
use_bioc_issue_template()
For more details on how this function came to be, check https://github.com/r-lib/usethis/issues/1108.
This function adds and/or replaces the
.github/ISSUE_TEMPLATE/issue_template.md
file in your R package.
## Not run: ## Run this function in your package use_bioc_issue_template() ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg() ## Create a template GitHub issue file that is Bioconductor-friendly biocthis::use_bioc_issue_template()
## Not run: ## Run this function in your package use_bioc_issue_template() ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg() ## Create a template GitHub issue file that is Bioconductor-friendly biocthis::use_bioc_issue_template()
This function is very similar to usethis::use_news_md()
except that it
uses a template from biocthis
.
use_bioc_news_md(open = rlang::is_interactive())
use_bioc_news_md(open = rlang::is_interactive())
open |
Open the newly created file for editing? Happens in RStudio,
if applicable, or via |
Unlike the original function, use_bioc_news_md()
does not make git commits.
So you won't lose work you didn't save when using this function.
This function adds and/or replaces the NEWS.md
file in your
R package.
## Not run: ## Run this function in your package use_bioc_news_md() ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg() ## Create a template NEWS.md file that is Bioconductor-friendly biocthis::use_bioc_news_md()
## Not run: ## Run this function in your package use_bioc_news_md() ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg() ## Create a template NEWS.md file that is Bioconductor-friendly biocthis::use_bioc_news_md()
This function creates the dev
directory and in it, it creates R script
files that you can follow to create your own Bioconductor-friendly R
package. These R scripts include all the commands you need to get started =)
The commands are designed to be run on the order given, though we also
encourage you to check the latest utility functions in the usethis
package.
use_bioc_pkg_templates(open = rlang::is_interactive())
use_bioc_pkg_templates(open = rlang::is_interactive())
open |
Open the newly created file for editing? Happens in RStudio,
if applicable, or via |
For more details on how this function came to be, check: https://github.com/r-lib/actions/issues/84 https://github.com/r-lib/styler/issues/636 https://github.com/Bioconductor/BiocCheck/issues/57 https://github.com/Bioconductor/bioconductor.org/issues/54 https://github.com/r-lib/usethis/issues/1108 as well as the "biocthis developer notes" vignette https://lcolladotor.github.io/biocthis/articles/biocthis_dev_notes.html.
This function adds and/or replaces the dev
files in your
R package. That is:
dev/01_create_pkg.R
dev/02_git_github_setup.R
dev/03_core_files.R
dev/04_update.R
## Not run: ## Run this function in your package use_bioc_pkg_templates() ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg() ## Create the biocthis templates biocthis::use_bioc_pkg_templates()
## Not run: ## Run this function in your package use_bioc_pkg_templates() ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg() ## Create the biocthis templates biocthis::use_bioc_pkg_templates()
This function creates the pkgdown/extra.css
file with Bioconductor-style
colors that will make your pkgdown
documentation websites much cooler ^_^.
use_bioc_pkgdown_css()
use_bioc_pkgdown_css()
For more details on how this function came to be, check https://github.com/lcolladotor/biocthis/issues/34.
This function adds and/or replaces the pkgdown/extra.css
file in
your R package.
## Not run: ## Run this function in your package use_bioc_support() ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg() ## Create a css file to style your pkgdown website in Bioconductor colors biocthis::use_bioc_pkgdown_css()
## Not run: ## Run this function in your package use_bioc_support() ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg() ## Create a css file to style your pkgdown website in Bioconductor colors biocthis::use_bioc_pkgdown_css()
This function is very similar to usethis::use_readme_rmd()
except that it
uses a template from biocthis
. This template README.Rmd includes
information on how to install your Bioconductor package, how to cite it,
and thanks the authors of several packages. It was built on top of the
original template from usethis::use_readme_rmd()
.
use_bioc_readme_rmd(open = rlang::is_interactive())
use_bioc_readme_rmd(open = rlang::is_interactive())
open |
Open the newly created file for editing? Happens in RStudio,
if applicable, or via |
This function adds and/or replaces the README.Rmd
file in your
R package. It's useful to use devtools::build_readme()
after running
this function or whenever you update the README.Rmd
file.
## Not run: ## Run this function in your package use_bioc_readme_rmd() ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg(use_git = TRUE) ## Create a template README.Rmd file that is Bioconductor-friendly biocthis::use_bioc_readme_rmd()
## Not run: ## Run this function in your package use_bioc_readme_rmd() ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg(use_git = TRUE) ## Create a template README.Rmd file that is Bioconductor-friendly biocthis::use_bioc_readme_rmd()
This function is very similar to usethis::use_tidy_support()
except that it
uses a template from biocthis
.
use_bioc_support()
use_bioc_support()
For more details on how this function came to be, check https://github.com/r-lib/usethis/issues/1108.
This function adds and/or replaces the .github/SUPPORT.md
file in
your R package.
## Not run: ## Run this function in your package use_bioc_support() ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg() ## Create a template GitHub support file that is Bioconductor-friendly biocthis::use_bioc_support()
## Not run: ## Run this function in your package use_bioc_support() ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg() ## Create a template GitHub support file that is Bioconductor-friendly biocthis::use_bioc_support()
This function is very similar to usethis::use_vignette()
except
that it uses a template from biocthis
. This template includes
instructions for citing other packages using RefManageR
, uses
sessioninfo::session_info()
for displaying the R session information since
it includes GitHub installation information and other useful details. The
template also includes a section on how to ask for help and required
knowledge.
use_bioc_vignette(name, title = name)
use_bioc_vignette(name, title = name)
name |
Just like in |
title |
Just like in |
This function adds and/or replaces the
vignettes/<name>.Rmd
file in your R package.
## Not run: ## Run this function in your package pkg <- basename(usethis::proj_get()) biocthis::use_bioc_vignette(pkg, paste("Introduction to", pkg)) ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg() ## Create a template vignette file that is Bioconductor-friendly biocthis::use_bioc_vignette("biocthisexample", "Introduction to biocthisexample")
## Not run: ## Run this function in your package pkg <- basename(usethis::proj_get()) biocthis::use_bioc_vignette(pkg, paste("Introduction to", pkg)) ## End(Not run) ## Create an example package for illustrative purposes. ## Note: you do not need to run this for your own package! pkgdir <- biocthis_example_pkg() ## Create a template vignette file that is Bioconductor-friendly biocthis::use_bioc_vignette("biocthisexample", "Introduction to biocthisexample")
tinytest
framework for unit testsThis function works similarly to usethis::use_testthat
. It sets up the
minimal files required to make tinytest
compatible with the current
project.
use_tinytest() use_tiny_test(name = NULL, open = interactive())
use_tinytest() use_tiny_test(name = NULL, open = interactive())
name |
Either a string giving a file name (without directory) or
|
open |
Whether to open the file for interactive editing. |
use_tinytest: creates a tinytest.R
file in the tests
directory
use_tiny_test: creates a test_<name>.R
file in the inst/tinytest
directory where are to reside
use_tiny_test()
: add a unit test file for testing functions in the
current R file