-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSingularity.v1.3.4
90 lines (65 loc) · 3.17 KB
/
Singularity.v1.3.4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
Bootstrap: docker
From: ubuntu:20.04
%help
First level fMRI analysis for specific GenFac tasks
Info and usage:
/opt/gf-fmri/README.md
%setup
mkdir -p ${SINGULARITY_ROOTFS}/opt/gf-fmri
%files
src /opt/gf-fmri
matlab /opt/gf-fmri
README.md /opt/gf-fmri
test_container.sh /opt/gf-fmri
%labels
Maintainer baxter.rogers@vanderbilt.edu
%post
apt-get update > /dev/null 2>&1
apt-get install -y wget unzip zip xvfb ghostscript imagemagick bc > /dev/null 2>&1 # Misc tools
apt-get install -y openjdk-8-jre > /dev/null 2>&1 # Matlab
apt-get install -y libopenblas-base language-pack-en > /dev/null 2>&1 # FSL
# Fix imagemagick policy to allow PDF output and text read. See https://usn.ubuntu.com/3785-1/
sed -i 's/rights="none" pattern="PDF"/rights="read | write" pattern="PDF"/' \
/etc/ImageMagick-6/policy.xml
sed -i 's/rights="none" pattern="@\*"/rights="read" pattern="@*"/' \
/etc/ImageMagick-6/policy.xml
# Download the Matlab Compiled Runtime installer, install, clean up
mkdir /MCR
wget -nv -P /MCR https://ssd.mathworks.com/supportfiles/downloads/R2019b/Release/6/deployment_files/installer/complete/glnxa64/MATLAB_Runtime_R2019b_Update_6_glnxa64.zip
unzip -qq /MCR/MATLAB_Runtime_R2019b_Update_6_glnxa64.zip -d /MCR/MATLAB_Runtime_R2019b_Update_6_glnxa64
/MCR/MATLAB_Runtime_R2019b_Update_6_glnxa64/install -mode silent -agreeToLicense yes > /dev/null 2>&1
rm -r /MCR/MATLAB_Runtime_R2019b_Update_6_glnxa64 /MCR/MATLAB_Runtime_R2019b_Update_6_glnxa64.zip
rmdir /MCR
# FSL. We need 6.0.4 for the b02b01_1.sch topup schedule. See
# https://fsl.fmrib.ox.ac.uk/fsldownloads/manifest.csv
# And, the centos7 version suits for Ubuntu 14-20.
fslver=6.0.4
cd /usr/local
wget -nv https://fsl.fmrib.ox.ac.uk/fsldownloads/fsl-${fslver}-centos7_64.tar.gz
tar -zxf fsl-${fslver}-centos7_64.tar.gz
rm fsl-${fslver}-centos7_64.tar.gz
# FSL setup
export FSLDIR=/usr/local/fsl
. ${FSLDIR}/etc/fslconf/fsl.sh
export PATH=${FSLDIR}/bin:${PATH}
# Run the FSL python installer. A clue that we forgot this is an imglob error at runtime
${FSLDIR}/etc/fslconf/fslpython_install.sh
# Create input/output directories for binding
mkdir /INPUTS && mkdir /OUTPUTS
# Singularity-hub doesn't work with github LFS (it gets the pointer info instead
# of the actual file) so we get the compiled matlab executable via direct download.
rm /opt/gf-fmri/matlab/bin/spm12.ctf
wget -nv -P /opt/gf-fmri/matlab/bin https://github.com/baxpr/gf-fmri/raw/master/matlab/bin/spm12.ctf
# We need to run the matlab executable now to extract the CTF, because
# now is the only time the container is writeable
/opt/gf-fmri/matlab/bin/run_spm12.sh /usr/local/MATLAB/MATLAB_Runtime/v97 quit
%environment
# Matlab shell. We don't need to set the Matlab library path here, because
# Matlab's auto-generated run_??.sh script does it for us.
MATLAB_SHELL=/bin/bash
# FSL
export FSLDIR=/usr/local/fsl
# Path
export PATH=/opt/gf-fmri/src:/opt/gf-fmri/matlab/bin:/usr/local/fsl/bin:${PATH}
%runscript
wrapper.sh "$@"