Skip to contents

Introduction

The aim of the BED (Biological Entity Dictionary) R package is to get and explore mapping between identifiers of biological entities (BE). This package provides a way to connect to a BED Neo4j database in which the relationships between the identifiers from different sources are recorded.

Installation

From CRAN

Dependencies

The following R packages available on CRAN are required:

  • neo2R: Neo4j to R
  • visNetwork: Network Visualization using ‘vis.js’ Library
  • dplyr: A Grammar of Data Manipulation
  • readr: Read Rectangular Text Data
  • stringr: Simple, Consistent Wrappers for Common String Operations
  • utils: The R Utils Package
  • shiny: Web Application Framework for R
  • DT: A Wrapper of the JavaScript Library ‘DataTables’
  • miniUI: Shiny UI Widgets for Small Screens
  • rstudioapi: Safely Access the RStudio API

And those are suggested:

  • knitr: A General-Purpose Package for Dynamic Report Generation in R
  • rmarkdown: Dynamic Documents for R
  • biomaRt: Interface to BioMart databases (i.e. Ensembl)
  • GEOquery: Get data from NCBI Gene Expression Omnibus (GEO)
  • base64enc: Tools for base64 encoding
  • htmltools: Tools for HTML
  • webshot: Take Screenshots of Web Pages
  • RCurl: General Network (HTTP/FTP/…) Client Interface for R

Installation from github

devtools::install_github("patzaw/BED")

Possible issue when updating from releases <= 1.3.0

If you get an error like the following…

Error: package or namespace load failed for ‘BED’:
 .onLoad failed in loadNamespace() for 'BED', details:
  call: connections[[connection]][["cache"]]
  error: subscript out of bounds

… remove the BED folder located here:

file.exists(file.path(Sys.getenv("HOME"), "R", "BED"))

R package in normal use

Documentation is provided in the BED vignette.

A public instance of the BED Neo4j database is provided for convenience and can be reached as follows:

library(BED)
connectToBed("https://genodesy.org/BED/", remember=TRUE, useCache=TRUE)
findBeids()

BED database instance available as a docker image

An instance of the BED database (UCB-Human) has been built using the script provided in the BED R package and made available in a Docker image available here: https://hub.docker.com/r/patzaw/bed-ucb-human/

This instance is focused on Homo sapiens, Mus musculus, Rattus norvegicus, Sus scrofa and Danio rerio organisms and it has been built from the following resources:

  • Ensembl
  • NCBI
  • Uniprot
  • biomaRt
  • GEOquery
  • Clarivate Analytics MetaBase

The following commands can be adapted according to user needs and called to get a running container with a BED database instance.

export BED_HTTP_PORT=5454
export BED_BOLT_PORT=5687

docker run -d \
    --name bed \
    --publish=$BED_HTTP_PORT:7474 \
    --publish=$BED_BOLT_PORT:7687 \
    --env=NEO4J_dbms_memory_heap_initial__size=4G \
    --env=NEO4J_dbms_memory_heap_max__size=4G \
    --env=NEO4J_dbms_memory_pagecache_size=4G \
   --env=NEO4J_dbms_read__only=true \
    --env=NEO4J_AUTH=none \
   --restart=always \
    patzaw/bed-ucb-human

Sergio Espeso-Gil has reported stability issues with this image running on Docker in Windows. It’s mainly solved by checking the “Use the WSL2 based engine” options in docker settings. More information are provided here: https://docs.docker.com/docker-for-windows/wsl/

Build a BED database instance

Building and feeding a BED database instance is achieved using scripts available in the “supp/Build” folder.

Run a neo4j docker images

Using the S01-NewBED-Container.sh script.

Build and feed BED

Using the S02-Rebuild-BED.sh script which compile the Rebuild-BED.Rmd document.

Create a docker image with BED database

Using the S03-NewBED-image.sh script

Push the image on docker hub

Using the S04-Push-on-docker-hub.sh script

Run the new image

Using the S05-BED-Container.sh script

Notes about Docker

Start docker

sudo systemctl start docker
sudo systemctl enable docker

Saving and loading an image archive

You can save the created image:

docker save bed-ucb-human:$BED_VERSION > docker-bed-ucb-human-$BED_VERSION.tar

And the image archive can be loaded with the following command:

cat docker-bed-ucb-human-$BED_VERSION.tar | docker load

Managing containers/images/volumes

List created containers

docker ps # list running containers
docker ps -a # list all containers

Remove container

docker rm CONTAINER

Remove image

docker rmi IMAGE # only if no corresponding container

List volumes

docker volume ls

Remove unused volumes

docker volume prune