Skip to content

Instantly share code, notes, and snippets.

@calizarr
Last active February 5, 2016 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calizarr/28f32624c584f12d22bc to your computer and use it in GitHub Desktop.
Save calizarr/28f32624c584f12d22bc to your computer and use it in GitHub Desktop.
Bash script to parallelize ConPADE
#!/bin/bash
declare -a scaffolds
for ((i=$2; i<=$3; i++)); do
scaffolds+=("scaffold_$i")
done
for ((i=$2; i<=$3; i+=1000)); do
j=$((i+1000))
if [ -f scaffolds_$j.temp ]; then
echo "Scaffolds temp file already exists: $((i+1000))"
else
slice=( "${scaffolds[@]:$i:1000}" )
# samtools view -b $1 $slice > scaffolds_$j.temp
echo "Current i: $i"
echo "Next i: $j"
echo "Last scaffold in slice: ${slice[-1]}"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment