Coder Social home page Coder Social logo

docker-pain-threshold's Introduction

docker-pain-threshold

A dockerfile to create an image of the R environment required to run the 'pain-threshold' data analysis scripts (kamermanpr/pain-threshold).


R environment

The image is built using the rocker/verse image of base R v3.5.1, and includes RStudio server, the TinyTex Latex distribution, the tidyverse suite of R packages (with dependencies), and several R packages (with dependencies) that are required to run the markdown scripts in pain-threshold. CRAN packages were installed from MRAN using the lasted package releases at the time the image was generated.

Details

  • OS:
    • Debian:stretch
  • R:
    • v3.5.1
  • RStudio server:
    • v1.1.456
  • GitHub packages:
    • patchwork
  • MRAN packages:
    • boot
    • car
    • knitr
    • magrittr
    • readxl
    • skimr
  • LaTex:
    • TinyTex

Using Docker to run the SPARS analysis

You need to have Docker installed on your computer. To do so, go to docker.com and follow the instructions for downloading and installing Docker for your operating system. Once Docker has been installed, follow the steps below, noting that Docker commands are entered in a terminal window (Linux and OSX/macOS) or command prompt window (Windows). Windows users also may wish to install GNU Make (required for the make method of running the scripts) and Git version control software (not essential).

Download the latest image

Enter: docker pull kamermanpr/docker-pain-threshold:v1.0.0

Run the container

Enter: docker run -d -p 8787:8787 -v </PATH>:/home/rstudio --name threshold -e USER=pain -e PASSWORD=threshold kamermanpr/docker-pain-threshold:v1.0.0

Where </PATH> refers to the path to the SPARS directory on your computer, which you either cloned from GitHub (kamermanpr/pain-threshold, git clone https://github.com/kamermanpr/pain-threshold), or downloaded and extracted from figshare (DOI: 10.6084/m9.figshare.???????).

If you use git you can preconfigure the docker image with your git credentials: docker run -d -p 8787:8787 -v </PATH>:/home/rstudio --name threshold -e USER=pain -e PASSWORD=threshold -e GIT_USER="<your name" -e GIT_EMAIL="<your email address>" kamermanpr/docker-pain-threshold:v1.0.0

Login to RStudio Server

  • Open a web browser window and navigate to: localhost:8787

  • Use the following login credentials:

    • Username: pain
    • Password: threshold

Prepare the pain-threshold directory

The pain-threshold directory comes with the outputs for all the analysis scripts in the /outputs directory (html and md formats). However, should you wish to run the scripts yourself, there are several preparatory steps that are required:

  1. Acquire the data. The data required to run the scripts have not been included in the repo because participants in the studies did not consent to public release of their data. However, the data are available on request from Peter Kamerman ([email protected]). Once the data have been obtained, the files should be copied into the /data subdirectory.

  2. Clean the /outputs directory by entering make clean in the Terminal tab in RStudio.

Run the pain-threshold analysis scripts

To run all the scripts (including the data cleaning scripts), enter make all in the Terminal tab in RStudio.

To run individual RMarkdown scripts (*.Rmd files)

  1. Generate the cleaned data using one of the following methods:

    • Enter make data-cleaned/clean-SPARSA.rds and then make data-cleaned/clean-SPARSB.rds in the Terminal tab in RStudio.
    • Enter source('clean-SPARSA.R') and then source('clean-SPARSB.R') in the Console tab in RStudio.
    • Open the clean-SPARSA.R script through the File tab in RStudio, and then click the 'Source' button on the right of the Script console in RStudio for each script. Repeat for clean-SPARSB.R
  2. Run the individual script by:

    • Entering make outputs/<NAME_OF_INPUT_FILE>.html in the Terminal tab in RStudio, OR
    • Opening the relevant *.Rmd file through the File tab in RStudio, and then clicking the 'knit' button on the left of the Script console in RStudio.

Shutting down

Once done, log out of RStudio Server and enter the following into a terminal to stop the Docker container: docker stop threshold. If you then want to remove the container, enter: docker rm threshold. If you also want to remove the Docker image you downloaded, enter: docker rmi kamermanpr/docker-pain-threshold:v1.0.0

docker-pain-threshold's People

Contributors

kamermanpr avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.