biyelunwen/99.scripts/workflow/coalescence_network/bpp/run_bpp.sh

60 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# Script to run BPP A00 analysis for coalescence network inference
# Set working directory
WORK_DIR=$(pwd)
SCRIPT_DIR="$(dirname "$0")"
# Check if BPP is installed and available
if ! command -v bpp &> /dev/null
then
echo "Error: BPP is not installed or not in PATH"
echo "Please install BPP and make sure it's accessible in your PATH"
exit 1
fi
# Check if control file exists
CONTROL_FILE="${SCRIPT_DIR}/run_bpp_a00.ctl"
if [ ! -f "$CONTROL_FILE" ]; then
echo "Error: Control file not found at $CONTROL_FILE"
echo "Please make sure the control file exists"
exit 1
fi
echo "Starting BPP A00 analysis..."
echo "Control file: $CONTROL_FILE"
echo "Working directory: $WORK_DIR"
# Run BPP analysis
bpp --cfile "$CONTROL_FILE"
# Check if the run was successful
if [ $? -eq 0 ]; then
echo "BPP analysis completed successfully!"
# Check for output files
JOBNAME=$(grep -E "^jobname\s*=" "$CONTROL_FILE" | sed -E 's/^jobname\s*=\s*(.*)/\1/' | tr -d ' ')
if [ -z "$JOBNAME" ]; then
JOBNAME="out"
fi
echo "Output files:"
echo " Main output: ${JOBNAME}.txt"
echo " MCMC samples: ${JOBNAME}.mcmc.txt"
if [ -f "${JOBNAME}.txt" ]; then
echo "Main output file created successfully"
else
echo "Warning: Main output file not found"
fi
if [ -f "${JOBNAME}.mcmc.txt" ]; then
echo "MCMC samples file created successfully"
else
echo "Warning: MCMC samples file not found"
fi
else
echo "Error: BPP analysis failed"
exit 1
fi