-
Notifications
You must be signed in to change notification settings - Fork 20
/
configure
85 lines (73 loc) · 3.24 KB
/
configure
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
# Short script to configure Earl Grey to run on any system in a portable manner
# check presence of RepeatMasker and RepeatModeler
echo "Checking RepeatMasker and RepeatModeler configuration"
if [ -x "$(command -v RepeatMasker)" ]; then
echo "Success! RepeatMasker is installed and in PATH"
else
echo "Error: RepeatMasker is not installed and in PATH"
exit 1
fi
if [ -x "$(command -v RepeatModeler)" ]; then
echo "Success! RepeatModeler is installed and in PATH"
else
echo "Error: RepeatModeler is not installed and in PATH"
exit 1
fi
# create new conda environment
if [ ! -z $(conda env list | awk '{OFS="\t"}{print $1}' | grep -w "earlgrey") ]; then
conda env update --name earlgrey -f ./earlGrey.yml --prune
else
conda env create -f ./earlgrey.yml
fi
eval "$(conda shell.bash hook)"
# conda update -n base -c defaults conda
conda activate earlgrey
# make Earl Grey Script executable
chmod +x ./earlGrey
# set paths in Earl Grey Script
echo "Setting path variables in script"
SCRIPT_DIR=$(realpath ./scripts/)
MOD_DIR=$(realpath ./modules/)
sed -i "s|SCRIPT_DIR=.*|SCRIPT_DIR=${SCRIPT_DIR}|g" ./earlGrey
sed -i "s|SCRIPT_DIR=.*|SCRIPT_DIR=${SCRIPT_DIR}|g" ./scripts/rcMergeRepeat*
sed -i "s|SCRIPT_DIR=.*|SCRIPT_DIR=${SCRIPT_DIR}|g" ./scripts/headSwap.sh
sed -i "s|SCRIPT_DIR=.*|SCRIPT_DIR=${SCRIPT_DIR}|g" ./scripts/autoPie.sh
sed -i "s|INSERT_FILENAME_HERE|${SCRIPT_DIR}/TEstrainer/scripts/|g" ./scripts/TEstrainer/TEstrainer_for_earlGrey.sh
chmod +x ${SCRIPT_DIR}/TEstrainer/TEstrainer_for_earlGrey.sh
chmod +x ${SCRIPT_DIR}/* > /dev/null 2>&1
chmod +x ${SCRIPT_DIR}/bin/LTR_FINDER.x86_64-1.0.7/ltr_finder
chmod a+w ${SCRIPT_DIR}/repeatCraft/example/
chmod +x ${MOD_DIR}/trf409.linux64
sleep 3
echo "Path variables set"
sleep 3
# install sa-ssr
if [ ! -f "${SCRIPT_DIR}/sa-ssr" ]; then
echo "Installing sa-ssr"
cd ${SCRIPT_DIR} && chmod a+w ${SCRIPT_DIR}
git clone https://github.com/ridgelab/SA-SSR && cd ./SA-SSR/
sed -i "s|PREFIX=/usr/local/bin|PREFIX=${SCRIPT_DIR}|g" Makefile && make && make install
sed -i "153s|.* -e|${SCRIPT_DIR}/sa-ssr -e|g" ${SCRIPT_DIR}/TEstrainer/TEstrainer_for_earlGrey.sh
sed -i "s|txt trf|txt ${MOD_DIR}/trf409.linux64|g" ${SCRIPT_DIR}/TEstrainer/TEstrainer_for_earlGrey.sh
cd ${SCRIPT_DIR}
else
cd ${SCRIPT_DIR}/SA-SSR/
sed -i "s|PREFIX=/usr/local/bin|PREFIX=${SCRIPT_DIR}|g" Makefile && make && make install
sed -i "153s|.* -e|${SCRIPT_DIR}/sa-ssr -e|g" ${SCRIPT_DIR}/TEstrainer/TEstrainer_for_earlGrey.sh
sed -i "s|txt trf|txt ${MOD_DIR}/trf409.linux64|g" ${SCRIPT_DIR}/TEstrainer/TEstrainer_for_earlGrey.sh
cd ${SCRIPT_DIR}
fi
# Install R packages - DEPRECATED
# echo "Installing R packages"
# Rscript ${SCRIPT_DIR}/install_r_packages.R
# Extract tRNAdb
echo "Extracting zip archives"
tar -zxf ${SCRIPT_DIR}/bin/LTR_FINDER.x86_64-1.0.7/tRNAdb.tar.gz --directory ${SCRIPT_DIR}/bin/LTR_FINDER.x86_64-1.0.7/
echo "Extracted required archives"
sleep 3
# Message Complete
echo "Remember to activate the earl grey conda environment before running earlGrey"
sleep 3
export PATH=$PATH:$(realpath .)
echo "earlGrey is ready to use. To execute from any directory, add earlGrey to path by pasting the code (minus the square brackets) below..."
echo '[export PATH=$PATH:$(realpath .)]'