Skip to content

Commit

Permalink
Added CLI R deps
Browse files Browse the repository at this point in the history
  • Loading branch information
khoroshevskyi committed Aug 27, 2024
1 parent 9bd2963 commit dfd0a87
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
13 changes: 13 additions & 0 deletions bedboss/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,19 @@ def check_requirements():
requirements_check()


@app.command(help="Install R dependencies")
def install_requirements():
import subprocess

r_path = os.path.abspath(
os.path.join(os.path.dirname(os.path.realpath(__file__)), "installRdeps.R")
)

subprocess.run(
["Rscript", r_path],
)


@app.callback()
def common(
ctx: typer.Context,
Expand Down
29 changes: 29 additions & 0 deletions bedboss/installRdeps.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.install_pkg = function(p, bioc=FALSE) {
if(!require(package = p, character.only=TRUE)) {
if(bioc) {
BiocManager::install(pkgs = p)
} else {
install.packages(pkgs = p)
}
}
}

.install_pkg("R.utils")
.install_pkg("BiocManager")
.install_pkg("optparse")
.install_pkg("devtools")
.install_pkg("GenomicRanges", bioc=TRUE)
.install_pkg("GenomicFeatures", bioc=TRUE)
.install_pkg("ensembldb", bioc=TRUE)
.install_pkg("LOLA", bioc=TRUE)
.install_pkg("BSgenome", bioc=TRUE)
.install_pkg("ExperimentHub", bioc=TRUE)
.install_pkg("AnnotationHub", bioc=TRUE)
.install_pkg("conflicted")
if(!require(package = "GenomicDistributions", character.only=TRUE)) {
devtools::install_github("databio/GenomicDistributions")
}
options(timeout=1000)
if(!require(package = "GenomicDistributionsData", character.only=TRUE)) {
install.packages("http://big.databio.org/GenomicDistributionsData/GenomicDistributionsData_0.0.2.tar.gz", repos=NULL)
}

0 comments on commit dfd0a87

Please sign in to comment.