-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerateUpSet.sh
66 lines (52 loc) · 1.6 KB
/
generateUpSet.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
#!/bin/bash
# Parsing arguments
# Initialize variables with default values
min_incidences_argument=""
# Parse command-line options
while getopts "m:" opt; do
case $opt in
m )
min_incidences_argument="$OPTARG"
;;
\? )
echo "Invalid option: -$OPTARG" 1>&2
exit 1
;;
: )
echo "Option -$OPTARG requires an argument." 1>&2
exit 1
;;
esac
done
# Shift to remove the parsed options
shift $((OPTIND-1))
# Check if required arguments are provided
if [ -z "$min_incidences_argument" ]; then
echo "Usage: $0 -m <min_incidences_argument>"
exit 1
fi
echo "Minimum incidences taken for the plot: $min_incidences_argument"
#####
# Search for the gene_presence_absence.csv file in the current directory
csv_file=$(find . -type f -name "collapsed_gene_presence_absence.csv" -print -quit)
if [ -z "$csv_file" ]; then
echo "gene_presence_absence.csv file not found in the current directory."
exit 1
fi
# Execute getDataFrame.py with the found CSV file
python3 getDataFrame.py --filename "$csv_file"
# Check if the Python script executed successfully
if [ $? -ne 0 ]; then
echo "getDataFrame.py script encountered an error."
exit 1
fi
# Search for the gene_presence_absence.csv file in the current directory
pan_file=$(find . -type f -name "pangenome_upsetplot.csv" -print -quit)
# Run upsetPlot.py
python3 upsetPlot.py --filename "$pan_file" --min_incidences "$min_incidences_argument"
# Check if the second Python script executed successfully
if [ $? -ne 0 ]; then
echo "upsetPlot.py script encountered an error."
exit 1
fi
echo "Scripts executed successfully."