-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunsoap.sh
28 lines (25 loc) · 914 Bytes
/
runsoap.sh
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
#!/bin/bash
# This script tries many combinations of K and d values for SOAP
# when assembling a genome, returning number of scaffolds and longest scaffold length
# It takes two parameters:
# 1.) starting K-mer length (will try up to 63) default: 25
# 2.) frequency cutoff (needs at least this many of a K-mer to keep it) default: 5
if [[ $1 -eq 0 ]] ; then
$1=25
fi
if [[ $2 -eq 0 ]] ; then
$2=5
fi
START=$1
FREQ=$2
let COUNTER=$START-2
while [ $COUNTER -lt 63 ]; do
let COUNTER=$COUNTER+2
VAR="K"$COUNTER"d"$FREQ
VAR2=$VAR".scafStatistics"
soapdenovo2-63mer all -s soap.config -K $COUNTER -d $FREQ -R -F -o $VAR 1> K49.err 2> K43.log
q=$(echo "~ K = "$COUNTER "and d = "$FREQ)
q+=$(grep -m2 "caffold" $VAR2 | tail -n1 | awk '{print " --- Scaffolds: "$2}')
q+=$(grep -m1 "Longest" $VAR2 | tail -n1 | awk '{print " --- Longest: "$2}')
echo "${q}"
done