-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsatsuma0.pbs
59 lines (49 loc) · 1.63 KB
/
satsuma0.pbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
#PBS -l nodes=1:ppn=16
#PBS -l walltime=96:00:00
#PBS -N satsuma
# Die if any variables are used that have not been declared
set -u
# Query and target species names (these will be replaced with the actual names by the build_pbs.sh script)
query="QUERY"
target="TARGET"
# Directory containing one fasta file for each entry in the query genome fasta file
datadir=split-$target
# File containing the filenames for this target that have been processed
proclist=${query}_proclist
# Create file if it does not already exist
touch $proclist
# Create output folder for the query against this target
# This folder will contain one subfolder for each entry sequence in the query genome
outdir=${query}.vs.${target}
# Make output directory if it does not already exist
mkdir -p $outdir
# Loop through every sequence in the query genome
ls $datadir/*fasta |
while read file
do
# Get a unique id for the current file
base=`basename $file`
# Only process the sequence if it has not already been done
if [[ `grep -c $file $proclist` -eq 0 ]]
then
rm -rf $outdir/$base
mkdir $outdir/$base
# Run Satsuma with default settings
$PWD/satsuma/SatsumaSynteny \
-t $file \
-q data/$query.fna \
-n 16 \
-o $outdir/$base
# Did the program complete successfully
if [[ $? -eq 0 ]]
then
# if successful, add this filename to the completed jobs list
echo $file >> $proclist
fi
else
# if the job has already been done, tell the user we are skipping the file
echo "skipping $file"
fi
done
wait