Debian Codegraph @

scripts/generate_freebayes_region_scripts.sh

raw
1 #!/bin/bash
2
3 regionfile=$1
4 stub=$2
5 outputdir=$3
6 scriptdir=$4
7
8 if [ $# -ne 4 ]
9 then
10 echo "usage: $0 [region list] [stub script] [output directory] [script directory]"
11 echo "Writes single-region scripts using the list of regions in [region list]."
12 echo "The scripts will write their output to [output directory]."
13 echo "The stub script has REGION in the place of the region and OUTPUT in the"
14 echo "place of the output directory."
15 exit
16 fi
17
18 mkdir -p $scriptdir
19 mkdir -p $outputdir
20
21 for region in $(cat $regionfile)
22 do
23 echo writing script for $region with output to $outputdir
24 cat $stub | sed -e "s/REGION/$region/g" | sed -e "s%OUTPUT%$outputdir%g" >$scriptdir/$region.sh
25 done