-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_from_cli.sh
More file actions
executable file
·150 lines (120 loc) · 3.51 KB
/
run_from_cli.sh
File metadata and controls
executable file
·150 lines (120 loc) · 3.51 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/bin/bash
# Script to run cqall_plotter from the command line with parameters
set -e
# Get the directory of this script
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Function to display usage
usage() {
cat << EOF
${GREEN}Usage: $0 [OPTIONS]${NC}
${GREEN}Options:${NC}
-m, --preprocessing_method METHOD
Preprocessing method for summary plots (default: illumina)
-c, --methylation_classes CLASSES
Comma-separated list of methylation classes to plot
Example: "BR_CA,IDH_HG,IDH_LG"
-s, --min_sentrix_ids_per_plot NUMBER
Minimum number of samples required per plot (default: 3)
-p, --min_probes_per_bin NUMBER
Minimum number of probes per bin
-b, --bin_size SIZE
Bin size for plotting
-d, --downsize_to TARGET
Downsizing target (default: NO_DOWNSIZING)
-h, --help
Display this help message
${GREEN}Examples:${NC}
# Run with default settings
$0
# Run with specific methylation classes
$0 --methylation_classes "BR_CA,IDH_HG"
# Run with custom bin settings
$0 --bin_size 50000 --min_probes_per_bin 20
# Run with all options
$0 -m illumina -c "BR_CA" -s 3 -b 50000 -p 20 -d NO_DOWNSIZING
EOF
}
# Parse arguments
PREPROCESSING_METHOD=""
METHYLATION_CLASSES=""
MIN_SENTRIX_IDS=""
MIN_PROBES_PER_BIN=""
BIN_SIZE=""
DOWNSIZE_TO=""
while [[ $# -gt 0 ]]; do
case $1 in
-m|--preprocessing_method)
PREPROCESSING_METHOD="$2"
shift 2
;;
-c|--methylation_classes)
METHYLATION_CLASSES="$2"
shift 2
;;
-s|--min_sentrix_ids_per_plot)
MIN_SENTRIX_IDS="$2"
shift 2
;;
-p|--min_probes_per_bin)
MIN_PROBES_PER_BIN="$2"
shift 2
;;
-b|--bin_size)
BIN_SIZE="$2"
shift 2
;;
-d|--downsize_to)
DOWNSIZE_TO="$2"
shift 2
;;
-h|--help)
usage
exit 0
;;
*)
echo -e "${RED}Unknown option: $1${NC}"
usage
exit 1
;;
esac
done
# Check if virtual environment exists
if [ ! -d "$SCRIPT_DIR/.venv" ]; then
echo -e "${RED}Error: Virtual environment not found at $SCRIPT_DIR/.venv${NC}"
echo -e "${YELLOW}Please run 'uv sync' first to set up the environment${NC}"
exit 1
fi
# Activate virtual environment
source "$SCRIPT_DIR/.venv/bin/activate"
# Build the Python command
PYTHON_CMD="python -m cqall_plotter.run_cqall_plotter"
# Add optional parameters
if [ -n "$PREPROCESSING_METHOD" ]; then
PYTHON_CMD="$PYTHON_CMD --preprocessing_method $PREPROCESSING_METHOD"
fi
if [ -n "$METHYLATION_CLASSES" ]; then
PYTHON_CMD="$PYTHON_CMD --methylation_classes $METHYLATION_CLASSES"
fi
if [ -n "$MIN_SENTRIX_IDS" ]; then
PYTHON_CMD="$PYTHON_CMD --min_sentrix_ids_per_plot $MIN_SENTRIX_IDS"
fi
if [ -n "$MIN_PROBES_PER_BIN" ]; then
PYTHON_CMD="$PYTHON_CMD --min_probes_per_bin $MIN_PROBES_PER_BIN"
fi
if [ -n "$BIN_SIZE" ]; then
PYTHON_CMD="$PYTHON_CMD --bin_size $BIN_SIZE"
fi
if [ -n "$DOWNSIZE_TO" ]; then
PYTHON_CMD="$PYTHON_CMD --downsize_to $DOWNSIZE_TO"
fi
# Display command being run
echo -e "${GREEN}Running:${NC}"
echo -e "${YELLOW}$PYTHON_CMD${NC}"
echo ""
# Run the Python script
eval "$PYTHON_CMD"