Skip to content

Instantly share code, notes, and snippets.

@akkornel
Created May 4, 2017 20:32
Show Gist options
  • Save akkornel/77991ad58796f7b53b6034c5cd73b251 to your computer and use it in GitHub Desktop.
Save akkornel/77991ad58796f7b53b6034c5cd73b251 to your computer and use it in GitHub Desktop.
Complete bootstrap definition file, with runscript
# vim: ts=4 sw=4 noet
# Stanford Quake Lab bufferbox workflow container bootstrap
BootStrap: yum
OSVersion: 7
MirrorURL: http://yum.stanford.edu/mrepo/centos%{OSVERSION}-x86_64/RPMS.all/
GPG: https://www.centos.org/keys/RPM-GPG-KEY-CentOS-7
Include: perl
%setup
TMPDIR=`mktemp -d`
echo "(Files being downloaded to ${TMPDIR})"
echo 'Downloading and unpacking the workflow software...'
curl -o ${TMPDIR}/quake-bufferbox-workflow.zip 'https://code.stanford.edu/research-computing-public/quake-bufferbox-workflow/repository/archive.zip?ref=release%2F1'
unzip ${TMPDIR}/quake-bufferbox-workflow.zip -d ${TMPDIR}
mkdir ${SINGULARITY_ROOTFS}/workflow
mv ${TMPDIR}/quake-bufferbox-workflow-release*/* ${SINGULARITY_ROOTFS}/workflow/
echo 'Downloading and installing bcl2fastq package...'
curl -o ${TMPDIR}/bcl2fastq.rpm 'https://support.illumina.com/content/dam/illumina-support/documents/downloads/software/bcl2fastq/bcl2fastq2-v2.19.0.316-Linux-x86_64.rpm' || exit 1
rpm --root ${SINGULARITY_ROOTFS} -i ${TMPDIR}/bcl2fastq.rpm
echo 'Downloading and installing EPEL key and release package...'
curl -o ${TMPDIR}/epel-key.gpg 'https://getfedora.org/static/352C64E5.txt'
curl -o ${TMPDIR}/epel-release.rpm -L 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm'
rpm --root ${SINGULARITY_ROOTFS} --import ${TMPDIR}/epel-key.gpg
rpm --root ${SINGULARITY_ROOTFS} -i ${TMPDIR}/epel-release.rpm
echo 'Installing EPEL-based packages'
yum --installroot ${SINGULARITY_ROOTFS} -y install perl-Email-MIME perl-Email-Send
echo 'Cleaning up'
rmdir ${TMPDIR}/quake-bufferbox-workflow-release*
rm ${TMPDIR}/quake-bufferbox-workflow.zip
rm ${TMPDIR}/bcl2fastq.rpm
rm ${TMPDIR}/epel-key.gpg ${TMPDIR}/epel-release.rpm
rmdir ${TMPDIR}
%runscript
#!/bin/bash
if [ $# -eq 0 ]; then
echo 'Hello! This is the Mr. Workflow runscript.'
echo 'Please run this again, with either "NextSeq" or "MiSeq" as the next parameter.'
echo 'That will run either the NextSeq workflow script, or the MiSeq workflow script.'
echo 'For example (if the container is called "container.img"):'
echo ' ./container.img nextseq scan path/to/runfolders'
echo ' ./container.img miseq deliver path/to/a/runfolder'
exit 0
fi
case "${1,,}" in
miseq)
shift
exec /workflow/bbox-workflow-miseq $*
;;
nextseq)
shift
exec /workflow/bbox-workflow-nextseq $*
;;
*)
echo "I'm sorry; I didn't recognize what you want me to do."
echo "Please make 'nextseq' or 'miseq' the first argument, before anything else (like 'run' or 'scan')."
echo 'Thanks!'
exit 1
;;
esac
# Nothing should ever reach here!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment