Skip to contents

This is a collection of helper functions and utilities to make working on the DNAnexus-based Our Future Health TRE more convenient. It provides wrapper functions around the dx utility and should therefore not be exclusively useful for working with the specific TRE it was designed for, but general work on DNAnexus from within an interactive R session.

This project is in no way affiliated with DNAnexus. In fact, the author does not particularly enjoy working on their platform, hence this package.

Main use-cases are:

  • Interact with the dx toolkit from within your R session, both locally and in a OFH TRE Jupyter session using convenience functions wrapping common calls to dx
  • Submit R commands to a worker job without the need to interact with with the web interface of DNAnexus
  • Where relevant, the functions work exclusively with dependencies available on the OFH TRE JupyterLab workstation

Key Features

Function documentation is also available at https://comp-med.github.io/r-ofhelper/.

Portability

The package relies on the external python executable dx, so using this package on Windows will probably only work from within WSL. The package should work without issues on Unix-based operating system.

Installation

Installing dxpy

The external dependency this package provides wrappers for must be installed separately. Package managers like uv or conda can be used for this purpose. The location of the required binary can then be queried and passed to the initialization function.

# Using conda
conda create -n dxpy python=3.10
conda activate dxpy
pip install dxpy

# Using uv
uv venv
uv pip install dxpy

After activating the environment, check the path of the executable (requires the whereis utility).

whereis dx

Installing ofhelper

Locally, you can install the packacke using:

install.packages("remotes")
remotes::install_github("comp-med/r-ofhelper")

On the OFH TRE, you can upload the package using the Airlock system, since no external packages can be installed and all development must take place in a vanilla Jupyter Notebook environment.

For this, a convenience function is provided (after installing the package locally) to create a single input string that can be then be written to a file to be submitted to the Airlock system. This is more convenient for the auditing process.

Locally, run the following command to create a string containing all functions. Write that to a file and upload it to the TRE.

# `ofhelper_string` contains all functions of this package. Submit those to the airlock.
ofhelper_string <- create_ofhelper_string()
writeLines(ofhelper_string, "upload_this_via_the_airlock.txt")

Getting Started

Please check the Getting Started Vignette.

Dependencies

Dependencies of functions that can be used are restricted to the packages available on the OFH TRE. Some functions are designed to be run for your local environment and might include additional dependencies.

  • data.table
  • fs
  • rlang
  • glue
  • withr

AI Disclosure

Due to the straight forward nature of parts of the package, some minor utility functions and some documentation was generated using a locally deployed LLM.

TODOs

  • Look for TODO tags in the functions!
  • Tests are mostly mock-tests right now and very much lacking
  • Integration tests with dx are not present yet