-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_all.sh
executable file
·59 lines (46 loc) · 1.7 KB
/
run_all.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
#!/bin/bash
# Define directories and base filenames
SEQUENCES_FILE="RNAcompete_sequences_rc.txt"
HTR_SELEX_DIR="htr-selex"
PYTHON_SCRIPT="main.py"
OUTPUT_DIR="output"
export PYTHONUNBUFFERED=1
# Create output directory if it doesn't exist
mkdir -p $OUTPUT_DIR
# Function to process a single RBP
process_rbp() {
local RBP_NUM=$1
local HTR_SELEX_FILES=()
# Collect relevant HTR-SELEX files
for CYCLE in {1..4}; do
FILE="${HTR_SELEX_DIR}/RBP${RBP_NUM}_${CYCLE}.txt"
if [ -f "$FILE" ]; then
FILENAME=$(basename "$FILE")
HTR_SELEX_FILES+=("$FILENAME")
fi
done
# Check if any HTR-SELEX files were found
if [ ${#HTR_SELEX_FILES[@]} -gt 0 ]; then
echo "Processing RBP${RBP_NUM} with files: ${HTR_SELEX_FILES[@]}"
# Construct the command to run
CMD="python -u $PYTHON_SCRIPT $SEQUENCES_FILE ${HTR_SELEX_FILES[@]}"
# Print the command
echo "Running command: $CMD"
# Run the command and redirect output to a log file
$CMD > "${OUTPUT_DIR}/RBP${RBP_NUM}.txt" 2>&1
# Rename the binding intensities file after the run, if it exists
if [ -f "bindings_intensities.txt" ]; then
mv bindings_intensities.txt "${OUTPUT_DIR}/RBP${RBP_NUM}.txt"
else
echo "Warning: bindings_intensities.txt not found for RBP${RBP_NUM}."
fi
else
echo "No files found for RBP${RBP_NUM}. Skipping..."
fi
}
# Loop through all RBP numbers and run each sequentially
for RBP_NUM in {1..38}; do
process_rbp $RBP_NUM
done
echo "All RBP processing tasks are complete."
echo "All test results have been saved in the output directory."