-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path05.run_gmap.sh
39 lines (39 loc) · 1.3 KB
/
05.run_gmap.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
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
#Considering splicing
if [ ! -n "$3" ]
then
echo " Part 5: Mapping hq/lq cluster to genome"
echo " Usage: bash `basename $0` [*.ccs.flnc.clustered.hq.fasta] [db_name] [threads]"
echo " <db_name> if no db_name, use 'gmap_build -d db_name genome.fa' to build it"
echo " Example: bash `basename $0` JJ27_Tes.ccs.flnc.clustered.hq.fasta ssc_ens107db 2"
echo " Output: sorted sam file [*.ccs.flnc.clustered.hq.fasta.db_name.sorted.sam]"
else
#-n 1 will not report chimeric
data=$1
db=$2
threads=$3
if [[ -e $data ]]
then
echo "`basename $0`"
echo ">>Starting genome mapping by gmap"
echo " Input data: "$data
echo " Using db: "$db
echo " Only mapped reads will be reported"
st=`date`
gmap.sse42 -d $db -t $threads -B 5 -A -f samse --nofails -n 1 $data 1>${data}.${db}.sam 2>${data}.${db}.log && \
sort -k 3,3 -k 4,4n ${data}.${db}.sam > ${data}.${db}.sorted.sam && \
rm ${data}.${db}.sam
bn=`less $data|grep ">"|wc -l`
an=`less ${data}.${db}.sorted.sam|grep -v "^@"|wc -l`
ed=`date`
echo " **Summary:"
echo "Input reads: "$bn
echo "Mapped reads: "$an
echo "Started time: "$st
echo "Ended time: "$ed
echo "Done running `basename $0`"
echo "**********************************************************************************"
else
echo "No such file: "$data
fi
fi