comparison mgescan.sh @ 1:b7ea9a0e2714 draft

Uploaded
author hyungrolee
date Sat, 14 Jun 2014 19:06:49 -0400
parents
children
comparison
equal deleted inserted replaced
0:c9fe27da991c 1:b7ea9a0e2714
1 #!/bin/bash
2 # mgescan.sh $input $input.name 3 $output L None None None $ltr_gff3 None $sw_rm "$scaffold" $min_dist $max_dist $min_len_ltr $max_len_ltr $ltr_sim_condition $cluster_sim_condition $len_condition $repeatmasker
3 user_dir=/u/lee212
4 #script=$user_dir/retrotminer/wazim/MGEScan1.1/run_MGEScan.pl
5 #script=$user_dir/retrotminer/wazim/MGEScan1.3.1/run_MGEScan2.pl
6 source $user_dir/virtualenv/retrotminer/bin/activate
7 script_program=`which python`
8 script=$user_dir/github/retrotminer/retrotminer/retrotminer.py
9 input_file=$1
10 input_file_name=$2
11 hmmsearch_version=$3
12 output_file=$4
13 program=$5 # N is nonLTR, L is LTR and B is both
14 # Optional output parameters for nonLTR
15 clade=$6
16 en=$7
17 rt=$8
18 ltr_gff3=$9
19 nonltr_gff3=${10}
20 #### for ltr between $11 and $20
21 sw_rm=${11}
22 scaffold=${12}
23 min_dist=${13}
24 max_dist=${14}
25 min_len_ltr=${15}
26 max_len_ltr=${16}
27 ltr_sim_condition=${17}
28 cluster_sim_condition=${18}
29 len_condition=${19}
30 repeatmasker=${20}
31
32 # /nfs/nfs4/home/lee212/retrotminer/galaxy-dist/tools/retrotminer/find_ltr.sh /nfs/nfs4/home/lee212/retrotminer/galaxy-dist/database/files/000/dataset_1.dat /nfs/nfs4/home/lee212/retrotminer/galaxy-dist/database/files/000/dataset_3.dat
33
34 #load env?
35 source $user_dir/.bashrc
36 source $user_dir/.bash_profile
37
38 #set path for transeq
39 export PATH=$user_dir/retrotminer/EMBOSS/bin:/usr/bin:$PATH
40
41 #move to the working directory
42 work_dir=`dirname $script`
43 cd $work_dir
44
45 #create directory for input and output
46 mkdir -p input
47 t_dir=`mktemp -p input -d` #relative path
48 input_dir="$work_dir/$t_dir/seq" # full path
49 output_dir="$work_dir/$t_dir/data"
50 mkdir -p $input_dir
51 mkdir -p $output_dir
52
53 #make a copy of input
54 /bin/cp $input_file $input_dir/$input_file_name
55
56 if [ "2" == "$hmmsearch_version" ]
57 then
58 export PATH=$user_dir/retrotminer/HMMER2.0/bin:$PATH
59 else
60 export PATH=/usr/bin:$PATH
61 fi
62
63 if [ "$program" == "L" ]
64 then
65 program_name="ltr"
66 else
67 programname="nonltr"
68 fi
69
70 #run
71 $script_program $script $program_name $input_dir/ --output=$output_dir/ #-hmmerv=$hmmsearch_version -sw_rm=${11} -scaffold=${12} -min_dist=${13} -max_dist=${14} -min_len_ltr=${15} -max_len_ltr=${16} -ltr_sim_condition=${17} -cluster_sim_condition=${18} -len_condition=${19}
72 #/usr/bin/perl $script -genome=$input_dir/ -data=$output_dir/ -hmmerv=$hmmsearch_version -program=$program -sw_rm=${11} -scaffold=${12} -min_dist=${13} -max_dist=${14} -min_len_ltr=${15} -max_len_ltr=${16} -ltr_sim_condition=${17} -cluster_sim_condition=${18} -len_condition=${19}
73
74 #RES=`ssh -i $user_dir/.ssh/.internal silo.cs.indiana.edu "/usr/bin/perl $script -genome=$input_dir/ -data=$output_dir/ -hmmerv=$hmmsearch_version -program=$program > /dev/null"`
75
76 #make a copy of output
77 if [ "$program" != "N" ]
78 then
79 /bin/cp $output_dir/ltr/ltr.out $output_file
80 if [ "$ltr_gff3" != "None" ]
81 then
82 /bin/cp $output_dir/ltr/ltr.gff3 $ltr_gff3
83 fi
84
85 if [ "$repeatmasker" != "None" ]
86 then
87 # chr2L.fa.cat.gz chr2L.fa.masked chr2L.fa.out chr2L.fa.out.pos chr2L.fa.tbl
88 /bin/cp $output_dir/repeatmasker/${input_file_name}.out $repeatmasker
89 fi
90 fi
91 if [ "$program" != "L" ]
92 then
93
94 #compressed_file=$output_dir/$RANDOM.tar.gz
95 #/bin/tar cvzfP $compressed_file $output_dir/info
96 #/bin/cp $compressed_file $output_file
97 /bin/cp $output_dir/info/full/*/* $clade
98 /bin/cp $output_dir/info/validation/en $en
99 /bin/cp $output_dir/info/validation/rt $rt
100 if [ "$nonltr_gff3" != "None" ]
101 then
102 /bin/cp $output_dir/info/nonltr.gff3 $nonltr_gff3
103 # nonltr.gff3
104 ##gff-version 3
105 #chr2L.fa MGEScan_nonLTR mobile_genetic_element 19670384 19676921 . . . ID=chr2L.fa_19670384
106 #chr2L.fa MGEScan_nonLTR mobile_genetic_element 17689430 17695994 . . . ID=chr2L.fa_17689430
107 #chr2L.fa MGEScan_nonLTR mobile_genetic_element 11897186 11903717 . . . ID=chr2L.fa_11897186
108 #chr2L.fa MGEScan_nonLTR mobile_genetic_element 49574 56174 . . . ID=chr2L.fa_49574
109 fi
110
111 #else
112 # Both LTR, nonLTR executed
113 #compressed_file=$output_dir/$RANDOM.tar.gz
114 #/bin/tar cvzfP $compressed_file $output_dir
115 #/bin/cp $compressed_file $output_file
116 fi
117
118 # delete temp directory
119 if [ $? -eq 0 ]
120 then
121 rm -rf $work_dir/$t_dir
122 #echo
123 else
124 #echo cp -pr $work_dir/$t_dir $work_dir/error-cases/
125 cp -pr $work_dir/$t_dir $work_dir/error-cases/
126 fi