-
Notifications
You must be signed in to change notification settings - Fork 3
/
EAreport
executable file
·70 lines (60 loc) · 2.8 KB
/
EAreport
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
#!/usr/bin/env bash
# EAreport generates a bookdown summary of the current project
if [[ -n "$1" ]]; then
src="$(dirname $0)/src"
if [[ ! -f "$src/.env" ]]; then
echo "EAreport: Please run ./install to setup necessary env variables"
exit
fi
source $src/.env
eval $condaEnv
workingdir=$(dirname $1)
configdir=$1
if [[ $workingdir = ..* ]];then
CurrentPath=`pwd`"/"
workingdir=$CurrentPath$workingdir
configdir=$CurrentPath$configdir
fi
if [[ $workingdir = .* ]];then
CurrentPath=`pwd`
RestPath=`echo $workingdir|sed 's/^\.//'`
RestConfigPath=`echo $1|sed 's/^\.//'`
workingdir=$CurrentPath$RestPath
if [[ ! $RestConfigPath = /* ]];then
configdir=$CurrentPath"/"$RestConfigPath
else
configdir=$CurrentPath$RestConfigPath
fi
fi
if [[ ! $workingdir = /* ]];then
CurrentPath=`pwd`
workingdir=$CurrentPath"/"$workingdir
configdir=$CurrentPath"/"$configdir
fi
echo -e "Building bookdown report in: \n "$workingdir/BookdownReport/
rm -rf $workingdir/BookdownReport && cp -r $(dirname $0)/src/BookdownTemplates $workingdir/BookdownReport
#Create a bookdown.info.txt file
echo -e "Source_code\t"$(dirname $0)/src/ > $workingdir/BookdownReport/bookdown.info.txt
echo -e "Working_dir\t"$workingdir/BookdownReport/ >> $workingdir/BookdownReport/bookdown.info.txt
echo -e "Config_file\t"$configdir >> $workingdir/BookdownReport/bookdown.info.txt
ProjName=`awk '{if ($1=="prj_name:") print $2}' $configdir`
echo "Running the following command:"
echo -e "Rscript $(dirname $0)/src/BookdownReport.R \ \n $(dirname $0)/src/ \ \n $workingdir/BookdownReport/ \ \n $configdir"
Rscript $(dirname $0)/src/BookdownReport.R $(dirname $0)/src/ $workingdir/BookdownReport/ $configdir && \
echo -e "Done building report ..." && \
echo -e "Please find the report in: \n "$workingdir/BookdownReport/docs/index.html && \
mkdir $workingdir/${ProjName}_BookdownReport && \
cp -r $workingdir/BookdownReport/docs/* $workingdir/${ProjName}_BookdownReport && \
cd $workingdir && \
tar -czf ${ProjName}_BookdownReport.tar.gz ${ProjName}_BookdownReport && \
rm -rf ${ProjName}_BookdownReport && \
echo -e "The tarball containing the full report is ready: \n "$workingdir/${ProjName}_BookdownReport.tar.gz
else
echo "=============== EAreport path/to/config/file"
echo "EAreport generates a bookdown summary of the current project"
exePath=$(dirname $0)
echo "An example config file can be found: $exePath/example/config.yml"
echo "'EAinit' can be used to create a config file for a RNAseq project downloaded from DNAnexus"
echo "==============="
exit 0
fi