forked from CRG-Beato/utils_beatolab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopy_analyses_to_public_docs.sh
executable file
·84 lines (64 loc) · 2.3 KB
/
copy_analyses_to_public_docs.sh
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
#!/bin/bash
#==================================================================================================
# Created on: 2016-01-28
# Usage: ./copy_analyses_to_public_docs.sh <project> <analysis>
# Author: Javier Quilez (GitHub: jaquol)
# Goal: copy project-specific analyses from their original directory to the one which is visible
# from the public-docs website http://public-docs.crg.es/mbeato/jquilez/
# ipy_hide_input is used to remove the code from the *.slides.html report
# source: http://hannes-brt.github.io/blog/2013/08/11/ipython-slideshows-will-change-the-way-you-work/
#==================================================================================================
#==================================================================================================
# CONFIGURATION VARIABLES AND PATHS
#==================================================================================================
# variables
project=$1
analysis=$2
# paths
PROJECTS=$HOME/projects
FILE_TRANSFER=$HOME/file_transfer
ipy_hide_input=$HOME/utils/ipy_hide_input
#==================================================================================================
# COMMANDS
#==================================================================================================
copy_directory() {
p=$1
a=$2
echo -e "... uploading analyses for the $p project to http://public-docs.crg.es/mbeato/jquilez/"
# make output directories
ODIR=$FILE_TRANSFER/projects/$p/$a
rm -fr $ODIR
mkdir -p $ODIR
# copy analysis directories to output directory
ANALYSIS=$PROJECTS/$p/analysis/$a
for d in `ls $ANALYSIS |grep -v data`; do
cp -r $ANALYSIS/$d $ODIR
done
#cp -fr $PROJECTS/$p/analysis/$a/* $ODIR/
# copy project notebook to output directory
if [ -e $PROJECTS/$p/project_notebook* ]; then
cp -fr $PROJECTS/$p/project_notebook* $FILE_TRANSFER/projects/$p/
fi
# convert ipython notebook to html
cd $ODIR
for i in `ls *ipynb`; do
#for d in `ls $ODIR | grep -v project_notebook`; do
# echo $d
# cd $ODIR/$d
# if [ -e *ipynb ]; then
#ls *ipynb
#rm *slides.html
#ls *slides.html
jupyter nbconvert --to slides *ipynb
$ipy_hide_input $analysis.slides.html
# fi
# cd
done
}
if [[ $project == "all" ]]; then
for p in `ls $PROJECTS`; do
copy_directory $p
done
else
copy_directory $project $analysis
fi