Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Submit script for calculating robustness
#!/bin/sh
pdb_dir=$1
# test the input to be correct
if [ "x" = "x$pdb_dir" ]; then
echo "Please specify a pdb directory"
exit 1
fi
# Make the condor output directory
mkdir -p condor_out
# First, create base submit file
cat > submit.condor << EOF
universe = vanilla
arguments = \$(PDB_FILE_BASENAME) \$(PROCESS)
should_transfer_files = YES
when_to_transfer_output = ON_EXIT
output = condor_out/output.\$(PDB_FILE_BASENAME).\$(PROCESS)
error = condor_out/error.\$(PDB_FILE_BASENAME).\$(PROCESS)
executable = wrapper.sh
transfer_input_files = scwrl4_lin, \$(PDB_FILE), calculaterobustnessLOOP, dnaseqs
log = condor.log
EOF
# Count the number of lines in aastable and divide by 10
lines=`wc -l dnaseqs | awk '{print $1}'`
num_submits=$(($lines / 10))
# Now, for each pdb file in the directory given as the argument, create a submit line
for pdb_file in `find $pdb_dir -type f`; do
cat >> submit.condor << EOF
PDB_FILE=$pdb_file
PDB_FILE_BASENAME=`basename $pdb_file`
queue $num_submits
EOF
done
# Print a helpful message
echo "Created a condor submit file submit.condor"
echo "To submit the job, issue the command:"
echo "condor_submit submit.condor"
# $1 = pdb file
# $2 = run number
pdb_file=$1
run_number=$2
# First, make the dnaseqs file
linesperrun=10
# Find what line number to start at
start_line=$((linesperrun*run_number))
echo "Before"
ls -l
cat dnaseqs | head -n $start_line | tail -n $linesperrun > dnaseqs.new
mv dnaseqs.new dnaseqs
./calculaterobustnessLOOP $pdb_file
rm dnaseqs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment