#!/bin/bash # Multiple Runs of BioNetGen 2.1.8 (Not for 2.1.7!) if [ "$1" = "-h" ]; then echo "Script to generate multiple runs of BioNetGen" echo "Usage: MultBNGSim full_path_to_BNG2.pl full_name_of_model_file output_path number_of_runs" echo "Example ~/Desktop/RuleBender/BioNetGen-2.1.7/Perl2/ ~/Desktop/Model.bngl ~/Desktop/workspace/ 5" exit 0 elif [ "$1" = "-help" ]; then echo "Script to generate multiple runs of BioNetGen" echo "Usage: MultBNGSim full_path_to_BNG2.pl full_name_of_model_file output_path number_of_runs" echo "Example ~/Desktop/RuleBender/BioNetGen-2.1.7/Perl2/ ~/Desktop/Model.bngl ~/Desktop/workspace/ 5" exit 0 elif [ "$1" = "" ]; then echo "Undefined parameters" echo "Usage: MultBNGSim full_path_to_BNG2.pl full_name_of_model_file output_path number_of_runs" echo "Example ~/Desktop/RuleBender/BioNetGen-2.1.7/Perl2/ ~/Desktop/Model.bngl ~/Desktop/workspace/ 5" exit 1 fi scriptPath=$1 model=$2 outputPath=$3 runNumber=$4 script="BNG2.pl" outDir=$outputPath$(date +"%Y-%m-%d-%H-%M-%S") echo $outputPath echo $outDir mkdir $outDir logfile="$(date +"%Y-%m-%d-%H-%M-%S").log" touch $outDir/$logfile curr_dir=$(pwd) for ((x=0; x < $runNumber ; x++)) do newDir="Run$x" mkdir $outDir/$newDir echo "************************ Multiple Runs - Run $x *******************" >> $outDir/$logfile cd $outDir/$newDir perl $scriptPath$script $model >> $outDir/$logfile cd $curr_dir #rm $outDir/$newDir/*.cdat # may want to use this echo "Run number $x complete" done echo "BioNetGen output available at $outDir/$logfile"