Thank you for your interest in contributing to Biodiversity Horizons! This guide provides step-by-step instructions to set up the project locally, run the R scripts, and use Docker for containerized execution. Follow these guidelines to get started.
Read our Code of Conduct to keep our community approachable and respectable.
Ensure the following tools are installed on your system:
- R (version >= 4.0.0)
- RStudio (optional, but recommended for development)
- Docker (if you want to use the Docker setup)
- Git (for version control)
To start using the package, clone the repository and navigate into the project directory:
git clone https://github.com/uw-ssec/biodiversity-horizons.git
cd biodiversity-horizons
The package requires several dependencies to function. Use the following commands in your R console or RStudio to install them:
- Install devtools if you don't already have it:
install.packages("devtools")
- Install all dependencies from the DESCRIPTION file:
devtools::install_deps()
The primary script for running the project is located at
scripts/VISS_Sample_Data.R
. Follow these steps to use it.
Run the script using the Rscript command in your terminal. Here are examples of how to use it:
Rscript scripts/VISS_Sample_Data.R
This will use:
- path ="data-raw/"
- plan_type ="multisession"
- workers =availableCores() - 1
Rscript scripts/VISS_Sample_Data.R /path/to/data multicore 4
The script processes the data and saves the output files in the outputs/
directory. The primary result file is res_final.rds
.
If you prefer a containerized setup, you can use Docker to run the project.
Use the provided Dockerfile
to build the image:
docker build -t biodiversity-horizons .
Run the container and mount your local data directory to the container’s
data-raw/
directory:
docker run --rm \
-v /path/to/data-raw/:/home/biodiversity-horizons/data-raw/ \
biodiversity-horizons
This will:
- Mount your local data-raw/ directory to
/home/biodiversity-horizons/data-raw/
inside the container. - Execute the script using the default arguments.
You can pass custom arguments to the script by appending them to the docker run command. For example:
docker run --rm \
-v /path/to/data-raw/:/home/biodiversity-horizons/data-raw/ \
-v /path/to/outputs/:/home/biodiversity-horizons/outputs/ \
biodiversity-horizons \
Rscript scripts/VISS_Sample_Data.R /home/biodiversity-horizons/data-raw multicore 4
This command:
- Mounts local
data-raw/
directory to/home/biodiversity-horizons/data-raw/
inside the container. - Mounts local
outputs/
directory to/home/biodiversity-horizons/outputs/
inside the container. - Passes custom arguments to the script:
/home/biodiversity-horizons/data-raw
: Path to the data directory.multicore
: Parallelization plan.4
: Number of workers.
If your current working directory already contains the data-raw/
folder, you
can simplify the command by replacing /path/to/data-raw/
with
$(pwd)/data-raw/
:
Example:
docker run --rm \
-v $(pwd)/data-raw/:/home/biodiversity-horizons/data-raw/ \
biodiversity-horizons
We welcome contributions! Please follow these guidelines when submitting a Pull Request:
-
It may be helpful to review this tutorial on how to contribute to open source projects. A typical task workflow is:
- Fork the code repository specified in the task and clone it locally.
- Review the repo's README.md and CONTRIBUTING.md files to understand what is required to run and modify this code.
- Create a branch in your local repo to implement the task.
- Commit your changes to the branch and push it to the remote repo.
- Create a pull request, adding the task owner as the reviewer.
-
Please follow the Conventional Commits naming for pull request titles.
Your contributions make this project better—thank you for your support! 🚀
PRs will fail style and formatting checks as configured by precommit, but you can set up your local repository such that precommit runs every time you commit. This way, you can fix any errors before you send out pull requests!!
To do this, install Pixi using either the instructions on their website, or the commands below:
MacOS/Linux:
curl -fsSL https://pixi.sh/install.sh | bash
Windows: Check the website
Then, once Pixi is installed, run the following command to set up precommit checks on every commit
pixi run precommit-install
pixi run precommit
pixi run precommit-all