comparison bin/mapping_rmap.sh @ 1:adc0f7765d85 draft

planemo upload
author bioitcore
date Thu, 07 Sep 2017 15:06:58 -0400
parents
children
comparison
equal deleted inserted replaced
0:d4ca551ca300 1:adc0f7765d85
1 #/data/zhang/wuj/tools/bowtie-0.12.3/bowtie -a --best /data/zhang/wuj/database/hg18/AS/TXdb.2/btw/TXdb -f -t s_1_sequence.txtparta >s_1.map &
2 #SrcFolder='/data/zhang/wuj/scripts/SpliceTrap.0.8'
3 InputFileName=$1
4 faorfq=$2
5 DatabasePrefix=$3
6 Outputfolder=$4
7 SrcFolder=$5
8 DatabaseFolder=$SrcFolder'/../db/'$DatabasePrefix'/TXdb.fasta'
9 TmpFolderName=`basename $1`
10
11 cd $Outputfolder;
12 #prepare the folder
13 if [ -d $TmpFolderName.result ];then
14 echo "MAPPING: !!!Error, there is already a folder named "$TmpFolderName".result !"
15 echo "MAPPING: !!!change the name of that folder first in case I erase them..."
16 exit
17 fi
18 echo "MAPPING: Start to map $InputFileName....Creating cache folder $TmpFolderName.result"
19 mkdir $TmpFolderName".result"
20 cd $TmpFolderName".result"
21 mkdir cache stat
22 cd cache
23 echo "MAPPING: Split file..."
24 split -l 1000000 $InputFileName
25 echo "MAPPING: generating shell scirpts...."
26 for name in x*
27 do
28
29 echo "rmap -M 100 -m 2 -c $DatabaseFolder -o $name.rmap $name; perl $SrcFolder/rmap2eland.pl $name.rmap $name $name.eland;rm $name.rmap ;perl $SrcFolder/mark.mt.4eland.pl $name.eland >$name.nomt;rm $name.eland">>map.sh
30 echo $name >>checklist
31 done
32 tasknum=`wc -l map.sh |tr -d "\n"`
33 perl $SrcFolder/batchqsub.pl map.sh
34
35 echo "MAPPING: map $InputFileName to TXdb done...start to check.."
36 while [ 1 ]
37 do
38 if [ -f mapcheck.sh ];then
39 rm mapcheck.sh
40 fi
41 while read checklist
42 do
43
44 name=`echo $checklist |tr -d "\n"`
45 echo "MAPPING: checking $name...."
46 readnum=`wc -l $name | cut -f1 -d" "`
47 if [ $faorfq == "fasta" ];then
48 readnum=`echo "$readnum/2"|bc`
49 else
50 readnum=`echo "$readnum/4"|bc`
51 fi
52 if [ -f $name.nomt ];then
53 rmapnum=`wc -l $name.nomt | cut -f1 -d" "`
54 else
55 rmapnum=0
56 fi
57 if [ $rmapnum != $readnum ];then
58 echo "rmap -M 100 -m 2 -c $DatabaseFolder -o $name.rmap $name; perl $SrcFolder/rmap2eland.pl $name.rmap $name $name.eland;rm $name.rmap ;perl $SrcFolder/mark.mt.4eland.pl $name.eland >$name.nomt;rm $name.eland">>mapcheck.sh
59
60 fi
61 done <checklist
62 if [ -f mapcheck.sh ];then
63 checktasknum=`wc -l mapcheck.sh |tr -d "\n"`
64 if [ $checktasknum == $tasknum ];then
65 echo "MAPPING: warning! none of the mapping tasks properly finished!"
66 fi
67 echo "MAPPING: resubmiting TASKS...."
68 perl $SrcFolder/batchqsub.pl mapcheck.sh
69 else
70 break
71 fi
72 done
73 echo "MAPPING: Mapping is really done....merging files..."
74
75
76 cat *.nomt >$Outputfolder/$TmpFolderName.nomt
77 cd ../../
78
79 rm $TmpFolderName.result -rf
80