-
Notifications
You must be signed in to change notification settings - Fork 1
/
run-abyss.bash
executable file
·85 lines (58 loc) · 1.54 KB
/
run-abyss.bash
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#! /bin/bash
#placeholder for header EDIT
if [ $# -lt 3 ]; then
cat << _TEXT
usage:$0 <kmer file> <"fastq file(s)"> <cores> [coverage]
Use full paths.
Run with kmer file, examples contained in kmer_lists.
For multiple fastq files, or when using *, please use
"" around file list.
Cores must be set with respect to your SGE cluster environment.
_TEXT
exit 1
fi
kmer=$1
data=$2
cores=$3
if [ ! -z $4 ]; then
cov=$4
else
cov=5
fi
spcs=`pwd | awk -F/ '{print $NF}'`
mkdir -p abyss;cd abyss
if [ ! -f $kmer ]; then
cat << _TEXT
ERROR: kmer file not found, "$kmer", please create kmer file.
Examples can be found in the kmer_lists directory in BPA.
_TEXT
exit 1
fi
for f in $data; do
if [ ! -f $f ]; then
cat << _TEXT
FAILED to locate fastq data in "$f" please check data input.
_TEXT
exit 1
fi
done
cp /dev/null ../properties.txt
echo "kmer file = $kmer" >> ../properties.txt
echo "cores = $cores" >> ../properties.txt
echo "input file(s) = `ls -1 $data | tr '\n' ' '`" >> ../properties.txt
path=$(dirname `which manage_cluster.bash`)
cp -f $kmer ./kmer.txt
kmers=`cat kmer.txt`
for i in $kmers; do
let coretest=$(find $i -name "core*"|wc -l)
let filetest=$(find $i -name "abyssrun-3.fa"|wc -l)
label=$$'_'$i'_'$spcs
echo $label
if [[ "$coretest" -ne "0" || "$filetest" -ne "1" || ! -s $i/abyssrun-3.fa ]]; then
if [ -d $i ]; then
rm -rf $i 2>/dev/null
fi
mkdir -p $i
( echo $i; cd $i; manage_cluster.bash $i "$data" $label $cores $cov $path > ${label}.out 2>${label}.err )
fi
done