Created
July 11, 2012 09:36
-
-
Save dalloliogm/3089300 to your computer and use it in GitHub Desktop.
launch_single_cosi_iteration_local.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Launch a single cosi iteration. | |
# | |
# Standard usage (to run one single simulation) | |
# | |
# $: ./launch_single_cosi_iteration_local.sh simulation1 data/simulation_output/ | |
# | |
# | |
# Description of parameters: | |
# | |
# $1 -> iteration number (usually I execute 100 iteration for each set of parameters) | |
# $2 -> base output folder | |
# | |
# It is recommended to execute this script in combination with gnu/parallel. | |
# The following will launch 100 simulations, in parallel: | |
# | |
# $: seq 1 100 | parallel -i sh ./launch_single_cosi_iteration_local.sh {} ../../data/neutral_sims | |
# | |
# NOTES: | |
# | |
# each iteration is run in a single directory, defined by $1 | |
# all the files necessary are copied in the directory | |
# the recombination model is calculated by recosim for each iteration. | |
## | |
# | |
# | |
REPLICA_ID=$1 | |
OUTPUTDIR=$2 | |
#REPLICA_ID=$SGE_TASK_ID | |
#OUTPUTDIR=../../data/simulations | |
# Copy all cosi binaries to a temporary subfolder of the output directory | |
mkdir -p ${OUTPUTDIR}/tmp/${REPLICA_ID} | |
mkdir -p ${OUTPUTDIR}/param_logs | |
mkdir -p ${OUTPUTDIR}/results | |
cp autosomes_deCODE.distr params recParams recosim coalescent ${OUTPUTDIR}/tmp/${REPLICA_ID} | |
#cp autosomes_deCODE.distr recosim coalescent ${OUTPUTDIR}/${REPLICA_ID} | |
cp recParams ${OUTPUTDIR}/tmp/${REPLICA_ID}/bestfit_neutral_replica_${REPLICA_ID} | |
cd ${OUTPUTDIR}/tmp/${REPLICA_ID} | |
# generate the recombination model (model.test), and run cosi | |
./recosim bestfit_neutral_replica_${REPLICA_ID} 1000000 | |
./coalescent -p ./params -o ../../results/bestfit_neutral_replica_${REPLICA_ID} | |
gzip -f ../../results/bestfit_neutral_replica_${REPLICA_ID}.* | |
# Clean the temporary subfolder, and move all results to output dir | |
rm coalescent recosim | |
mv model.test ../../param_logs/bestfit_neutral_replica_rec_${REPLICA_ID} | |
gzip -f ../../param_logs/bestfit_neutral_replica_rec_${REPLICA_ID} | |
#rm model.test | |
#gzip ../../param_logs/bestfit_neutral_replica_decode_${REPLICA_ID} | |
#mv autosomes_deCODE.distr ../../param_logs/bestfit_neutral_replica_decode_${REPLICA_ID} | |
rm autosomes_deCODE.distr | |
#gzip ../../param_logs/bestfit_neutral_replica_decode_${REPLICA_ID} | |
#mv recParams ../../param_logs/bestfit_neutral_rec_replica_${REPLICA_ID} | |
#gzip ../../param_logs/bestfit_neutral_rec_replica_${REPLICA_ID} | |
rm recParams | |
rm params | |
rm bestfit_neutral_replica_${REPLICA_ID} | |
cd .. | |
rmdir ${REPLICA_ID} | |
#cd .. | |
#rmdir ${OUTPUTDIR} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment