Skip to content

This is a template I use for a new bioinformatics project.

License

Notifications You must be signed in to change notification settings

ljmesi/bioinfo-template

 
 

Repository files navigation

Bioinfo template

This is a working version of a template I use for new bioinformatic projects. This template uses Docker containers for the R environment called Rocker. There is also a paper introducing Rocker by Boettiger and Eddelbuettel (2017).

Overview

Here is a schema of the file structure:

project
|- README.md                    # the top level description of content (this doc)
|- CONTRIBUTING.md              # instructions for how to contribute to your project
|- LICENSE                      # the license for this project
|- CITATION                     # instructions on how to cite the work
|
|- manuscript/
| |- header.sty                 # LaTeX header file to format pdf version of manuscript
| |- bibliography.bib           # BibTeX formatted references
| |- csl/                       # csl files to format references
| |- study.Rmd                  # executable Rmarkdown for this study, if applicable
|
|- data                         # raw and primary data, are not changed once created
| |- references/                # reference files to be used in analysis
| |- raw/                       # raw data, will not be altered
| |- processed/                 # cleaned data, will not be altered once created;
|                               # will be committed to repo
|
|- docker                       # Dockerfiles defining exploratory notebooks and manuscript notebook
| |- Jupyterlab/                # Jupyter notebooks run in Jupyterlab
| |- RStudio_server/            # https://github.com/rocker-org/rocker-versioned/tree/master/rstudio
|                             # The Dockerfile has heavily loaned code from the Rocker project:
|                             # https://www.rocker-project.org/
|
|- _output.yaml                    # shared configurations for all presentations
|- presentation_style.css       # css for modifying features in presentation
|- presentation.Rmd            # R revealjs presentation
|
|- code/                          # any programmatic code
| |- test/                    # tests for the code
| |- data/                    # code for manipulating data
| |- utils/                   # code for utilities
| |- visualisation/           # code for producing visualisations
|
|- results                      # all output from workflows and analyses
| |- tables/                    # tables and other tabular data
| |- figures/                   # graphs, likely designated for manuscript figures
| |- pictures/                  # diagrams, images, and other non-graph graphics
|
|- exploratory/                 # exploratory data analysis for study
| |- notebook/                  # preliminary analyses
| |- scratch/                   # temporary files that can be safely deleted or lost
|
|- environments/                # conda environments used for running Snakemake
|
|- Snake_report/                # Caption data for report.html that Snakemake produces
|
|- Snake_config.yaml            # Configfile for snakefile global variables
|
|- Snakefile                    # executable Snakefile for this study, if applicable

Sources of inspiration

The structure of this template project is inspired by:

Prerequisites

There are some pieces of software that are needed to get this development environment up and running. You should install:

Steps for getting up and running

1. Navigate in terminal to the wished directory

Your working directory should be the location where you wish to have your project in. This is the location where you will setup the project using cookiecutter.

2. Run cookiecutter

cookiecutter https://github.com/ljmesi/bioinfo-template.git

3. Navigate to the created project directory

cd {{cookiecutter.project_name}}

4. Build Docker image using Dockerfile

Dockerfile is used to build an image which in turn is used to run containers.

docker build -t image_name:version.number docker/

Here you should exchange image_name, version and number with the appropriate values.

5. Run Docker container using the newly built image

docker run --name container_name -e PASSWORD=some_really_good_password -p 8787:8787 -v $(pwd):/home/rstudio image_name:version.number

Here you should exchange container_name with a suitable name. Some more information on running Rocker containers can be found here.

6. Access RStudio-Server running in the container through a browser

Here are instructions on accessing the container using a web browser.

7. Stopping and starting a container

In step 5 started running container can be stopped by pressing Ctrl + C and started again with command:

docker start container_name

and stopped again with:

docker stop container_name

8. Removing images and containers

Local images can be listed with:

docker images

and containers with:

docker ps -a

Images can be removed with:

# Using image_name:version.number
docker rmi image_name:version.number 
# Or using the image ID (2791ce80edf0)
docker rmi 2791ce80edf0

and containers with:

# Using container's name
docker rm container_name
# Using container ID
docker rm 9fcd57ea7ccb

Here can be found general information on removing images and containers. Here and here are links to docker rm and docker rmi command descriptions respectively.

Bonus step 1: Initialise git repository

Here are terrific instructions on how to initialise a git repository.

Bonus step 2: configure git

Git can be configured in RStudio server by running the following commands in the terminal panel:

git config --global user.name "your_Github_user_name" && \
git config --global user.email "your_email@address.com" && \
git config --global color.ui true && \
# Store the Github personal access token permanently in .git-credentials file
git config --global credential.helper store

License

This repository is released under the BSD License.

References

Boettiger, Carl, and Dirk Eddelbuettel. 2017. “An Introduction to Rocker: Docker Containers for R.” R Journal 9 (2): 527–36. https://rocker-project.org. http://arxiv.org/abs/1710.03675.

Wilson, Greg, Jennifer Bryan, Karen Cranston, Justin Kitzes, Lex Nederbragt, and Tracy K Teal. 2017. “Good enough practices in scientific computing.” Edited by Francis Ouellette. PLOS Computational Biology 13 (6): e1005510. https://doi.org/10.1371/journal.pcbi.1005510.

About

This is a template I use for a new bioinformatics project.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Dockerfile 56.2%
  • TeX 19.6%
  • Shell 17.3%
  • Python 2.9%
  • R 2.4%
  • CSS 1.6%