Skip to content

Commit

Permalink
Merge pull request #1 from SouthernMethodistUniversity/biostats_mcgee
Browse files Browse the repository at this point in the history
Biostats mcgee
  • Loading branch information
rkalescky authored Feb 7, 2023
2 parents 8870f77 + bd3ce4f commit 923e167
Show file tree
Hide file tree
Showing 4 changed files with 202 additions and 0 deletions.
89 changes: 89 additions & 0 deletions biostats_mcgee/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# docker build -t biostats:latest .
# docker build --platform linux/amd64 -t biostats:latest .
# docker build --no-cache --progress=plain -t biostats:latest .
# docker run --entrypoint /bin/bash -it biostats:latest

FROM rocker/rstudio:4.2.2
LABEL maintainer="Robert Kalescky <[email protected]>"

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update &&\
apt-get remove -y libcurl4 &&\
apt-get upgrade -y &&\
apt-get install -y --no-install-recommends\
apt-transport-https\
autoconf\
ca-certificates\
cmake\
curl\
default-jdk\
default-jre\
g++\
gcc\
git\
git-lfs\
gnupg\
libboost-all-dev\
libbz2-dev\
libcereal-dev\
libcurl4-openssl-dev\
libgff-dev\
libjemalloc-dev\
liblzma-dev\
libtbb-dev\
libz-dev\
make\
ninja-build\
python3-pip\
software-properties-common\
unzip\
wget\
zlib1g-dev

# FastQC
RUN git clone --depth 1 --branch v0.11.9\
https://github.com/s-andrews/FastQC.git /opt/FastQC &&\
ln -s /opt/FastQC/fastqc /usr/local/bin/fastqc

# Cutadapt (https://cutadapt.readthedocs.io)
RUN pip3 install cutadapt

# TrimGalore!
RUN git clone --depth 1 --branch 0.6.7\
https://github.com/FelixKrueger/TrimGalore.git /opt/TrimGalore &&\
ln -s /opt/TrimGalore/trim_galore /usr/local/bin/trim_galore

# STAR
RUN git clone --depth 1 --branch 2.7.10b\
https://github.com/alexdobin/STAR.git /opt/STAR &&\
cd /opt/STAR/source &&\
make STAR &&\
mv /opt/STAR/bin/Linux_x86_64_static/STAR* /usr/local/bin/ &&\
rm -rf /opt/STAR

# RSEM
RUN git clone --depth 1 --branch v1.3.3\
https://github.com/deweylab/RSEM.git /opt/RSEM &&\
cd /opt/RSEM &&\
make -j install &&\
rm -rf /opt/RSEM

# Install R Packages
COPY install_packages.R /
RUN Rscript /install_packages.R

# GATK4
RUN git clone --depth 1 --branch 4.2.6.1\
https://github.com/broadinstitute/gatk.git /opt/gatk &&\
cd /opt/gatk &&\
./gradlew installAll

# Salmon
RUN git clone --depth 1 --branch v1.9.0\
https://github.com/COMBINE-lab/salmon.git /opt/salmon &&\
mkdir /opt/salmon/build &&\
cd /opt/salmon/build &&\
cmake .. &&\
make install

58 changes: 58 additions & 0 deletions biostats_mcgee/biostats.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
load("singularity")

local img_name = 'biostats_latest-2023-02-07-858e2914ccfc.sif'
local img_directory = '/hpc/applications/containers/'
local img_path = pathJoin(img_directory, img_name)

function build_command(cmd)
local home = os.getenv("HOME")
local user_libs = pathJoin(home, 'R/portal/rocker-images/biostats_0')
local cmd = 'singularity exec --nv '
local cmd_beginning = cmd .. '--env R_LIBS_USER=' .. user_libs.. ' '
local cmd_ending = img_path .. ' ' .. cmd
local sh_ending = ' "$@"'
local csh_ending = ' $*'
local sh_cmd = cmd_beginning .. cmd_ending .. sh_ending
local csh_cmd = cmd_beginning .. cmd_ending .. csh_ending
set_shell_function(cmd, sh_cmd, csh_cmd)
end

local executables = {
'python3'
'R',
'Rscript',
'rserver',
'rstudio-server',
'fastqc',
'cutadapt',
'STAR',
'STARlong',
'rsem-bam2readdepth',
'rsem-get-unique',
'rsem-run-em',
'rsem-bam2wig',
'rsem-gff3-to-gtf',
'rsem-run-gibbs',
'rsem-build-read-index',
'rsem-parse-alignments',
'rsem-sam-validator',
'rsem-calculate-credibility-intervals',
'rsem-plot-model',
'rsem-scan-for-paired-end-reads',
'rsem-calculate-expression',
'rsem-plot-transcript-wiggles',
'rsem-simulate-reads',
'rsem-extract-reference-transcripts',
'rsem-prepare-reference',
'rsem-synthesis-reference-transcripts',
'rsem-generate-data-matrix',
'rsem-preref',
'rsem-tbam2gbam',
'rsem-gen-transcript-plots',
'rsem-refseq-extract-primary-assembly'
}

for _, executable in ipairs(executables) do
build_command(executable)
end

38 changes: 38 additions & 0 deletions biostats_mcgee/build_images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env zsh

# Set version
version="latest"

# Set platform
#if [ -z "$1" ]; then
case $1 in
m[2,3,p])
platform="linux/amd64"
;;
*)
platform="linux/$(uname -m)"
;;
esac

# Build container with Docker
docker build --platform ${platform} -t biostats:${version} .

# Convert Docker image to Singularity image
docker run -v /var/run/docker.sock:/var/run/docker.sock\
-v $PWD:/output --privileged -t --rm\
singularityware/docker2singularity biostats:${version} | tee build.log

# Get Singularity image name
simg=$(basename $(awk '/Build complete/{print $NF}' build.log) | tr -d '\b\r')
img="${simg%.*}.sif"
mv $simg $img

# Change Singularity image permissions
if [[ $(uname -s) == "Linux" ]]; then
sudo chown $USER:$USER $img
fi

# Update module file with new Singularity image name
sed -i'' -e "s/^local img_name.*/local img_name = \'${img}\'/g"\
biostats.lua

17 changes: 17 additions & 0 deletions biostats_mcgee/install_packages.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cran = list(
packages = c(
"BiocManager")
)

bioc = list(
packages = c(
"edgeR",
"AnnotationDbi",
"org.Hs.eg.db"),
version = "3.16"
)

install.packages(cran$packages)
BiocManager::install(version = bioc$version)
BiocManager::install(bioc$packages)

0 comments on commit 923e167

Please sign in to comment.