-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathrun_multiple_species.sh
executable file
·59 lines (55 loc) · 1.65 KB
/
run_multiple_species.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
#! /bin/bash
OPTIND=1 # Reset in case getopts has been used previously in the shell.
input_dir=""
output_dir=""
end_output=""
gff_extension=".gff3"
fasta_extension=".fasta"
while getopts "h?:f:g:i:e:o:" opt; do
case "$opt" in
h|\?)
echo "-i is a required directory with input .fasta and .gff3 files. "
echo "-o is a required output directory for pairwise JustOrtholog comparisons"
echo "-e is a required end output file for the combined analysis"
echo "-f is optional and is the extension for fasta files in the input directory. Default=.fasta"
echo "-g is optional and is the extension for gff3 files in the input directory. Default=.gff3"
echo "-h shows this help message"
echo "-v shows verbose messages of progress"
exit 0
;;
i) input_dir=$OPTARG
if [[ "${input_dir: -1}" != '/' ]]; then
input_dir=${input_dir}"/"
fi
input_dir=${input_dir}"*"
;;
e) end_output=$OPTARG
;;
g) gff_extension=$OPTARG
;;
f) fasta_extension=$OPTARG
;;
o) output_dir=$OPTARG
if [[ "${output_dir: -1}" != '/' ]]; then
output_dir=${output_dir}"/"
fi
mkdir -p ${output_dir}
esac
done
shift $(( OPTIND-1 ))
SED_EXEC="sed"
OS_TYPE=`uname -s`
if [ "${OS_TYPE}" == "Darwin" ]
then
SED_EXEC="gsed"
fi
set -- `ls -1 ${input_dir} | ${SED_EXEC} -e 's/\..*$//' | uniq`
for a; do
file_a=`basename ${a%%.*}`
shift
for b; do
file_b=`basename ${b%%.*}`
python2 wrapper.py -g1 "${a}${gff_extension}" -g2 "${b}${gff_extension}" -r1 "${a}${fasta_extension}" -r2 "${b}${fasta_extension}" -all -o ${output_dir}/${file_a}_${file_b}
done
done
python2 combineOrthoGroups.py -id ${output_dir} -o ${end_output}