forked from MHH-RCUG/haybaler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_haybaler.sh
67 lines (55 loc) · 1.68 KB
/
run_haybaler.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
#!/bin/bash
# Sophia Poertner
# Run haybaler https://github.com/MHH-RCUG/haybaler/
version="0.22, June 2021"
echo "Starting Haybaler, run_haybaler.sh version" $version
outputDir=haybaler_output
if [[ ! -d $outputDir ]]
then
echo "INFO: Creating directory:" $outputDir
mkdir $outputDir
fi
# Setup config
source $WOCHENENDE_DIR/scripts/parse_yaml.sh
eval $(parse_yaml $WOCHENENDE_DIR/config.yaml)
# Setup conda and directories
. $CONDA_SH_PATH
conda activate $HAYBALER_CONDA_ENV_NAME
cp $HAYBALER_DIR/*.py $outputDir
cp $HAYBALER_DIR/runbatch_heatmaps.sh $outputDir
cp $HAYBALER_DIR/create_heatmap.R $outputDir
cp $HAYBALER_DIR/run_heattrees.sh $outputDir
cp $HAYBALER_DIR/create_heattrees.R $outputDir
cp $HAYBALER_DIR/run_haybaler_tax.sh $outputDir
# cleanup possible old haybaler runs
count=$(ls -1 $outputDir/*haybaler.csv 2>/dev/null | wc -l)
if [[ $count != 0 ]]
then
rm $outputDir/*haybaler.csv
fi
rm -f excluded_taxa.csv
input_files=""
# Only run for *bam*.csv if files exist in current dir
count=$(ls -1 *.bam*.csv 2>/dev/null | wc -l)
if [[ $count != 0 ]]
then
for csv in *.bam*.csv
do
input_files="$input_files;$csv"
done
fi
# Only run for *bam*.txt if files exist in current dir
count=$(ls -1 *.bam*.txt 2>/dev/null | wc -l)
if [[ $count != 0 ]]
then
for csv in *.bam*.txt
do
input_files="$input_files;$csv"
done
fi
python3 haybaler.py -i "$input_files" -p . -op $outputDir -o haybaler.csv
# for pipeline testing only!!
#python3 haybaler.py -i "$input_files" -p . -op $outputDir -o haybaler.csv --readcount_limit 1 --rpmm_limit 10
# Move log file into log directory
mkdir -p $outputDir/logs
mv $outputDir/excluded_taxa.csv $outputDir/logs/