Skip to content

Commit

Permalink
Merge pull request #270 from NBISweden/docker-changes
Browse files Browse the repository at this point in the history
Changes to Docker material
  • Loading branch information
fasterius authored Nov 15, 2024
2 parents b6f3119 + 61d1b4a commit c5ed6fc
Show file tree
Hide file tree
Showing 6 changed files with 338 additions and 200 deletions.
408 changes: 281 additions & 127 deletions pages/containers.qmd

Large diffs are not rendered by default.

47 changes: 17 additions & 30 deletions tutorials/containers/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,54 +1,41 @@
FROM --platform=amd64 condaforge/miniforge3
FROM condaforge/miniforge3:24.7.1-0

LABEL authors="John Sundh, john.sundh@scilifelab.se; Erik Fasterius, erik.fasterius@nbis.se"
LABEL description="Image for the NBIS reproducible research course."
LABEL author="John Sundh"
LABEL email="john.sundh@scilifelab.se"

# Use bash as shell
SHELL ["/bin/bash", "--login", "-c"]

# Set workdir
WORKDIR /course

# Set timezone
ENV TZ="Europe/Stockholm"
ENV DEBIAN_FRONTEND=noninteractive
# Use bash as shell
SHELL ["/bin/bash", "-c"]

# Install packages require for timezone and Quarto installation
RUN apt-get update \
&& apt-get install -y tzdata curl \
&& apt-get clean
# Install required packages
RUN apt-get update && \
apt-get install -y curl && \
apt-get clean

# Install Quarto
ARG QUARTO_VERSION="1.3.450"
RUN mkdir -p /opt/quarto/${QUARTO_VERSION} \
&& curl -o quarto.tar.gz -L "https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.tar.gz" \
&& tar -zxvf quarto.tar.gz -C "/opt/quarto/${QUARTO_VERSION}" --strip-components=1 \
&& rm quarto.tar.gz
ENV PATH /opt/quarto/${QUARTO_VERSION}/bin:${PATH}
RUN mkdir -p /opt/quarto/${QUARTO_VERSION} && \
curl -o quarto.tar.gz -L "https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.tar.gz" && \
tar -zxvf quarto.tar.gz -C "/opt/quarto/${QUARTO_VERSION}" --strip-components=1 && \
rm quarto.tar.gz
ENV PATH=/opt/quarto/${QUARTO_VERSION}/bin:${PATH}

# Configure Conda
RUN conda init bash && conda config --set channel_priority strict && \
conda config --append channels bioconda && \
conda config --append channels r && \
conda config --set subdir linux-64
RUN conda config --set channel_priority strict && \
conda config --append channels bioconda

# Install environment
COPY environment.yml ./
RUN conda env create -f environment.yml -n project_mrsa && \
conda clean -a

# Set mrsa-workflow environment as active at start-up
RUN echo "source activate project_mrsa" >> ~/.bashrc

# Add environment to PATH
ENV PATH /opt/conda/envs/project_mrsa/bin:${PATH}
ENV PATH=/opt/conda/envs/project_mrsa/bin:${PATH}

# Add project files
COPY Snakefile config.yml ./
COPY code ./code/

# Open up port 8888
EXPOSE 8888

CMD snakemake -p -c 1 --configfile config.yml
CMD snakemake --configfile config.yml -p -c 1
29 changes: 0 additions & 29 deletions tutorials/containers/Dockerfile_slim

This file was deleted.

29 changes: 17 additions & 12 deletions tutorials/containers/code/supplementary_material.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: "Supplementary Material"
format:
html:
echo: false
embed_resources: true
embed-resources: true
engine: knitr
params:
counts_file: "results/tables/counts.tsv"
Expand Down Expand Up @@ -54,22 +54,29 @@ colnames(counts_summary) <- gsub(".*(SRR[0-9]+)\\..*", "\\1",
meta <- data.frame()
for (GSM in gsm_ids) {
gsm <- Meta(getGEO(GSM))
current_meta <- as.data.frame(do.call(cbind, gsm))
current_meta <- as.data.frame(
list(
title=gsm$title, geo_accession=gsm$geo_accession, source_name_ch1=gsm$source_name_ch1,
growth_phase=gsub("growth phase: ", "", gsm$characteristics_ch1[grep("growth phase", gsm$characteristics_ch1)]),
treatment=gsub("treatment: ", "", gsm$characteristics_ch1[grep("treatment", gsm$characteristics_ch1)])
)
)
meta <- rbind(meta, current_meta)
}
meta <- meta[c("title", "geo_accession", "source_name_ch1", "characteristics_ch1")]
meta <- meta[c("title", "geo_accession", "source_name_ch1", "growth_phase", "treatment")]
gsm2srr <- data.frame(geo_accession = gsm_ids, SRR = srr_ids)
meta <- merge(meta, gsm2srr, by = "geo_accession")
# Read FastQC data and update column names
qc <- read.delim(multiqc_file)
patterns <- c(".+percent_duplicates.*",
".+percent_gc.*",
".+avg_sequence_length.*",
".+percent_fails.*",
".+total_sequences.*")
patterns <- c("*.+percent_duplicates.*",
"*.+percent_gc.*",
"*.+avg_sequence_length.*",
"*.+median_sequence_length.*",
"*.+percent_fails.*",
"*.+total_sequences.*")
subs <- c("Percent duplicates", "Percent GC", "Avg sequence length",
"Percent fails", "Total sequences")
"Median sequence length", "Percent fails", "Total sequences")
for (i in 1:length(patterns)) {
colnames(qc) <- gsub(patterns[i], subs[i], colnames(qc))
}
Expand All @@ -85,10 +92,8 @@ was aligned and counted.
# Supplementary Tables and Figures

```{r Sample info}
columns <- c("SRR", "geo_accession", "source_name_ch1", "characteristics_ch1")
columns <- c("SRR", "geo_accession", "source_name_ch1", "growth_phase", "treatment")
sample_info <- meta[, columns]
sample_info$characteristics_ch1 <- gsub("treatment: ", "", sample_info$characteristics_ch1)
sample_info$characteristics_ch1 <- gsub("growth phase: ", "", sample_info$characteristics_ch1)
sample_info
```

Expand Down
20 changes: 20 additions & 0 deletions tutorials/containers/slim.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM condaforge/miniforge3

LABEL authors="John Sundh, john.sundh@scilifelab.se; Erik Fasterius, erik.fasterius@nbis.se"
LABEL description="Minimal image for the NBIS reproducible research course."

WORKDIR /course

SHELL ["/bin/bash", "-c"]

# Install `curl` for downloading of FASTQ data later in the tutorial
RUN apt-get update && \
apt-get install -y curl && \
apt-get clean

# Configure Conda
RUN conda config --set channel_priority strict && \
conda config --append channels bioconda

# Start Bash by default
CMD /bin/bash
5 changes: 3 additions & 2 deletions tutorials/git/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
FROM ubuntu:16.04

LABEL description = "Image for the NBIS reproducible research course."
MAINTAINER "John Sundh" john.sundh@scilifelab.se
LABEL authors="John Sundh, john.sundh@scilifelab.se"
LABEL description="Minimal image for the NBIS reproducible research course."

# Use bash as shell
SHELL ["/bin/bash", "-c"]

# Set workdir
WORKDIR /course

Expand Down

0 comments on commit c5ed6fc

Please sign in to comment.