Here is my workaround. It is awfully hacky but until I learn what I am missing (both singularity and julia), I see no other way at present. It works by making use of /tmp for the read/write filesystem which Julia seems to need for its package directory.
Please keep in mind, the solution I am looking for on this forum is one which removes the need for there to be a writable filesystem for $JULIA_PKGDIR and also one where library files owned by root can still be read, write and executed by any other user (one of many user/group ids, etc)
STEP1: Build an image, which when executed produces an archive of packages/libraries within a tar file in the current working directory:
Singularity def for ‘dump tar’ image (save as nextgensequtils_julia-0-6-4_dumptar.def):
Bootstrap: docker
From: julia:0.6.4
%post
apt-get -y update
apt-get -y install bzip2
%environment
export PATH=/usr/local/julia/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
export JULIA_PATH=/usr/local/julia
export JULIA_GPG=3673DF529D9049477F76B37566E3C7DC03D6E495
export JULIA_VERSION=0.6.4
export JULIA_PKGDIR=/tmp/.julia #This needs to be somewhere read/writable and location must be consistent between both images described here.
%runscript
rm -rf ${JULIA_PKGDIR}
julia -e 'Pkg.init(); Pkg.update(); Pkg.clone("https://github.com/MurrellGroup/NextGenSeqUtils.jl"); using NextGenSeqUtils'
export NEXTGEN_TARDIR=${PWD}/nextgensequtils_julia-0-6-4.tar
cd ${JULIA_PKGDIR}
rm -f ${NEXTGEN_TARDIR}
tar cf ${NEXTGEN_TARDIR} . # Note the dot here
Singularity build command:
sudo singularity build nextgensequtils_julia-0-6-4_dumptar.sif nextgensequtils_julia-0-6-4_dumptar.def
STEP2: Run the image from step 1. It should produce a tar file in your $PWD when done
STEP3: Build an image based off this one, just a different runscript.
I failed to see how to do that, so I reluctently copied and pasted the top.
Singularity def for main image:
Bootstrap: docker
From: julia:0.6.4
%post
apt-get -y update
apt-get -y install bzip2
%environment
export PATH=/usr/local/julia/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
export JULIA_PATH=/usr/local/julia
export JULIA_GPG=3673DF529D9049477F76B37566E3C7DC03D6E495
export JULIA_VERSION=0.6.4
export JULIA_PKGDIR=/tmp/.julia
%runscript
rm -rf ${JULIA_PKGDIR}
mkdir -p ${JULIA_PKGDIR}
tar -xf ${PWD}/nextgensequtils_julia-0-6-4.tar -C ${JULIA_PKGDIR}/
julia
Singularity build command:
sudo singularity build nextgensequtils_julia-0-6-4.sif nextgensequtils_julia-0-6-4.def
STEP4: Run the image from step 3. It should drop you into a Julia shell
STEP5: Attempt to make the import
using NextGenSeqUtils
If that works, it is looking good. Here is some more code to actually use one of the functions:
q_seqs = [
"GATAGTTTTTTTTTTTTGTTTTTTTTTTTTTTTTTAAAAATTTTTTTTTTTTTTGTTTTTTTTTTTTTTTGACAG",
"GATAGTTTTTTTTTTTTGGTTTTTTTTTTTTTTTTAAAAATTTTTTTTTTTTGGTTTTTTTTTTTTTTTTGACAG",
"GATAGTTTTTTTTTGGTTTTTTTTTTTTTTTTTTTAAAAATTTTTTTTTTTTGGTTTTTTTTTTTTTTTTGACAG",
"GATAGTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTAAAAATTTTTTTTGGGGGTTTTTTTTTTTTTTTTTGACAG",
"TCTACTTTTTTTTTGGTTTTTTTTTTTTTTTTTTTAAAAATTTTTTTTTTTTTTTTTTTTTTTTTTTTTTGACAG",
"TCTACTTTTTTTTTTGTTTTTTTTTTTTTTTTTTTAAAAATTTTTTTTTTTTTTTTTTTTTTTTTTTTTTGACAG",
"TCTACTTTTTTTTTTTTTGGTTTTTTTTTTTTTTTAAAAATTTTTTTTTTTTTTTGTTTTTTTTTTTTTTGACAG",
"TCTACTTTTTTTTTTTGGGGGTTTTTTTTTTTTTTAAAAATTTTTTTTTTTGGGGGTTTTTTTTTTTTTTGACAG",
"CATCATTTTTTTTTTTTTTTTTTTTTTTTTTTTTTAAAAATTTTTTTTTTGGTTTTTTTTTTTTTTTTTTGACAG",
"CATCATTTTTTTTTTTTTTTTTTGGTTTTTTTTTTAAAAATTTTTTTTTTTTTTTTTTTTTTTTTTTTTTGACAG",
"CATCATTTTTTTTTTT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TTTTTTTTTTTTTTTTTTTTTTTTTTTT"
]
reversePrimers = [
"CTGTCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"CTGTCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"CTGTCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"CTGTCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
]
forwardNames = ["1", "3", "4", "5"]
reverseNames = ["A", "A", "A", "A"]
using NextGenSeqUtils
demultiplexing = NextGenSeqUtils.deMux(q_seqs,forwardPrimers,reversePrimers,forwardNames,reverseNames)
This all works. Any ideas how I can make this work a bit more smoothly?