33# PEPATAC pipeline installation check
44#
55
6- if [[ $# -gt 0 ] ] ; then
6+ if [ $# -gt 0 ] ; then
77 echo " Usage: checkinstall"
88 exit 1
99fi
1010
1111set -o pipefail
12+ # set -e
1213
1314echo -e " -----------------------------------------------------------"
1415echo -e " "
@@ -49,28 +50,28 @@ GREEN='\033[0;32m'
4950YELLOW=' \033[0;33m'
5051NC=' \033[0m' # No Color
5152
52- function fail {
53+ fail () {
5354 printf " ${RED} \u2716 $@ ${NC} \n"
5455}
5556
56- function success {
57+ success () {
5758 printf " ${GREEN} \xE2\x9C\x94 $@ ${NC} \n"
5859}
5960
60- function warn {
61- printf " ${YELLOW} $@ ${NC} \n"
61+ warn () {
62+ printf " ${YELLOW} \u26A0 $@ ${NC} \n"
6263}
6364
6465# ###############################################################################
6566echo -e " Checking base requirements... "
66- echo -e " "
67+
6768BASE_REQS=0
6869
69- declare -a requiredPkgs=(" refgenie " " looper" )
70+ declare -a requiredPkgs=(" looper" )
7071
7172for package in ${requiredPkgs[@]} ; do
7273 if ! pip_show $package ; then
73- echo $( fail " ERROR: PEPATAC requires the Python package, $package . Try pip install $package and checkinstall again ." )
74+ echo $( fail " ERROR: PEPATAC requires the Python package, $package . Try pip install $package ." )
7475 printf " \n"
7576 exit 1
7677 fi
8485# ###############################################################################
8586echo -e " -----------------------------------------------------------"
8687echo -e " Checking native installation... "
87- echo -e " "
8888NATIVE_INSTALL=0
8989
9090# Check Python
@@ -111,6 +111,12 @@ if ! is_executable "pip"; then
111111 BULKER_INSTALL=1
112112fi
113113
114+ if [ -f " requirements.txt" ]; then
115+ REQS=" requirements.txt"
116+ else
117+ REQS=$( curl https://raw.githubusercontent.com/databio/pepatac/master/requirements.txt)
118+ fi
119+
114120while IFS= read -r line; do
115121 [ " ${line: 0: 1} " = " #" ] && continue
116122 IFS=' >=' read -r -a array <<< " $line"
@@ -164,15 +170,15 @@ while IFS= read -r line; do
164170 echo -e $( success " SUCCESS: Python package ${package} \trequired: any\tinstalled: ${installed_version} " )
165171 fi
166172 fi
167- done < " requirements.txt "
173+ done < $REQS
168174
169175# Check tool installation
170176declare -a requiredCommands=(" perl" " awk" " grep" " sed" " bedtools" " bowtie2" " fseq" " macs2" " preseq" " samblaster" " samtools" " skewer" " bedToBigBed" " bigWigCat" " wigToBigWig" " Rscript" )
171177
172178for cmd in ${requiredCommands[@]} ; do
173179 if ! is_executable $cmd ; then
174180 echo $( warn " WARNING: Install $cmd and checkinstall again." )
175- printf " \n"
181+ # printf "\n"
176182 NATIVE_INSTALL=1
177183 else
178184 echo -e $( success " SUCCESS: ${cmd} " )
210216# ###############################################################################
211217echo -e " -----------------------------------------------------------"
212218echo -e " Checking conda installation... "
213- echo -e " "
214219CONDA_INSTALL=0
215220
216221if ! is_executable " conda" ; then
@@ -246,6 +251,12 @@ else
246251 CONDA_INSTALL=1
247252 fi
248253
254+ if [ -f " requirements.txt" ]; then
255+ REQS=" requirements.txt"
256+ else
257+ REQS=$( curl https://raw.githubusercontent.com/databio/pepatac/master/requirements.txt)
258+ fi
259+
249260 while IFS= read -r line; do
250261 [ " ${line: 0: 1} " = " #" ] && continue
251262 IFS=' >=' read -r -a array <<< " $line"
298309 echo -e $( success " SUCCESS: Python package ${package} \trequired: any\tinstalled: ${installed_version} " )
299310 fi
300311 fi
301- done < " requirements.txt "
312+ done < $REQS
302313
303314 # Check tool installation
304315 declare -a requiredCommands=(" perl" " awk" " grep" " sed" " bedtools" " bowtie2" " fseq" " macs2" " preseq" " samblaster" " samtools" " skewer" " bedToBigBed" " bigWigCat" " wigToBigWig" " Rscript" )
@@ -347,62 +358,115 @@ fi
347358# ###############################################################################
348359echo -e " -----------------------------------------------------------"
349360echo -e " Checking bulker installation... "
350- echo -e " "
351361BULKER_INSTALL=0
352362
353- if ! is_executable " bulker" ; then
354- echo $( warn " WARNING: To use bulker, pip install bulker and checkinstall again." )
355- printf " \n"
356- BULKER_INSTALL=1
363+ if ! is_executable " docker" ; then
364+ DOCKER=1
357365else
358- BULKER_INSTALL=0
359- echo -e $( success " SUCCESS: bulker" )
366+ DOCKER=0
360367fi
361368
362- CWD=$( pwd)
363- crate=$( grep ' bulker_crate' $CWD /sample_pipeline_interface.yaml | awk ' {print $2}' )
364- echo " crate: ${crate} "
369+ if ! is_executable " singularity" ; then
370+ SINGULARITY=1
371+ else
372+ SINGULARITY=0
373+ fi
365374
366- yes n | bulker load $crate
375+ if [ " $DOCKER " -eq 0 ]; then
376+ CMD_CHECK=$( docker --help)
377+ if [ $? -eq 0 ]; then
378+ echo -e $( success " SUCCESS: docker." )
379+ else
380+ echo -e $( warn " WARNING: Docker is a recognized command, but does not appear to be active. Please ensure docker is running and checkinstall again." )
381+ DOCKER=1
382+ fi
383+ fi
367384
368- if [ $? -eq 0 ]; then
369- echo $( warn " WARNING: Could not bulker load ${crate} . Check out https://bulker.databio.org/en/latest/install/." )
370- printf " \n"
371- BULKER_INSTALL=1
385+ if [ " $SINGULARITY " -eq 0 ]; then
386+ echo -e $( success " SUCCESS: singularity." )
372387fi
373388
374- isActivatable=$( bulker run ${crate} $CWD /pipelines/pepatac.py --help)
375- # echo "isActivatable: ${isActivatable}"
376- if [ -v " $isActivatable " ]; then
377- echo $( warn " WARNING: Could not activate the bulker crate, ${crate} . Check out https://bulker.databio.org/en/latest/install/." )
378- printf " \n"
389+ if [ " $DOCKER " -eq 1 ] && [ " $SINGULARITY " -eq 1 ]; then
390+ echo -e $( fail " ERROR: bulker" )
379391 BULKER_INSTALL=1
380392else
381- BULKER_INSTALL=0
382- echo -e $( success " SUCCESS: bulker run ${crate} " )
393+ if ! is_executable " bulker" ; then
394+ echo $( warn " WARNING: To use bulker, pip install bulker and checkinstall again." )
395+ printf " \n"
396+ BULKER_INSTALL=1
397+ else
398+ BULKER_INSTALL=0
399+ echo -e $( success " SUCCESS: bulker" )
400+ fi
401+
402+ CWD=$( pwd)
403+
404+ if [ -f " sample_pipeline_interface.yaml" ]; then
405+ IFACE=" sample_pipeline_interface.yaml"
406+ CRATE=$( cat $IFACE | grep ' bulker_crate' | tr " " " \n" | tail -n 1)
407+ else
408+ IFACE=$( curl https://raw.githubusercontent.com/databio/pepatac/master/sample_pipeline_interface.yaml)
409+ CRATE=$( echo $IFACE | tr " " " \n" | grep -A1 ' bulker_crate' | tail -n 1)
410+ fi
411+
412+ yes n | bulker load $CRATE
413+ if [ $? -eq 0 ]; then
414+ echo $( warn " WARNING: Could not bulker load ${CRATE} . Check out https://bulker.databio.org/en/latest/install/." )
415+ printf " \n"
416+ BULKER_INSTALL=1
417+ fi
418+
419+ if [ -f " $CWD /pipelines/pepatac.py" ]; then
420+ PIPELINE=" $CWD /pipelines/pepatac.py"
421+ else
422+ PIPELINE=$( curl https://raw.githubusercontent.com/databio/pepatac/master/pipelines/pepatac.py)
423+ fi
424+
425+ CMD_CHECK=$( bulker run ${CRATE} $PIPELINE --help)
426+ EXIT_CODE=$( echo $? )
427+ isActivatable=$( echo " ${EXIT_CODE} " | awk ' { print $1+0; exit }' )
428+ if [ " $isActivatable " -eq 0 ]; then
429+ BULKER_INSTALL=0
430+ echo -e $( success " SUCCESS: bulker run ${CRATE} " )
431+ else
432+ echo $( warn " WARNING: Could not activate the bulker crate, ${CRATE} . Check out https://bulker.databio.org/en/latest/install/." )
433+ printf " \n"
434+ BULKER_INSTALL=1
435+ fi
383436fi
384437
385438# ###############################################################################
386439echo -e " -----------------------------------------------------------"
387440echo -e " PEPATAC checkinstall results "
388- echo -e " "
389441
390442if [ " $NATIVE_INSTALL " -eq 0 ]; then
391- echo -e $( success " SUCCESS: PEPATAC can be run utilizing native installations!" )
443+ echo -e $( success " SUCCESS: PEPATAC can be run using native installations!" )
444+ else
445+ echo -e $( fail " ERROR: PEPATAC cannot be run using native installations." )
446+ fi
447+
448+ if [ " $CONDA_INSTALL " -eq 0 ]; then
449+ echo -e $( success " SUCCESS: PEPATAC can be run using conda installation!" )
450+ else
451+ echo -e $( fail " ERROR: PEPATAC cannot be run via conda." )
452+ fi
453+
454+ if [ " $DOCKER " -eq 0 ]; then
455+ echo -e $( success " SUCCESS: PEPATAC can be run using docker!" )
392456else
393- echo -e $( fail " WARNING : PEPATAC cannot be run utilizing native installations! " )
457+ echo -e $( fail " ERROR : PEPATAC cannot be run using docker. " )
394458fi
395459
396- if [ " $CONDA_INSTALL " -eq 0 ]; then
397- echo -e $( success " SUCCESS: PEPATAC can be run utilizing conda installation !" )
460+ if [ " $SINGULARITY " -eq 0 ]; then
461+ echo -e $( success " SUCCESS: PEPATAC can be run using singularity !" )
398462else
399- echo -e $( fail " WARNING : PEPATAC cannot be run via conda! " )
463+ echo -e $( fail " ERROR : PEPATAC cannot be run using singularity. " )
400464fi
401465
402- if [ " $BULKER_INSTALL " -eq 0 ]; then
403- echo -e $( success " SUCCESS: PEPATAC can be run utilizing bulker!" )
466+ if [ " $BULKER_INSTALL " -eq 0 ]; then
467+ echo -e $( success " SUCCESS: PEPATAC can be run using bulker!" )
404468else
405- echo -e $( fail " WARNING : PEPATAC cannot be run utilizing bulker! " )
469+ echo -e $( fail " ERROR : PEPATAC cannot be run using bulker. " )
406470fi
407471
408472if [ " $NATIVE_INSTALL " -eq 1 ] && [ " $CONDA_INSTALL " -eq 1 ] && [ " $BULKER_INSTALL " -eq 1 ]; then
0 commit comments