Mercurial > repos > abossers > mummer_toolsuite
comparison MUMmer/mummer_tool.sh @ 0:59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
author | abossers |
---|---|
date | Tue, 07 Jun 2011 17:22:27 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:59f302448cf6 |
---|---|
1 #!/bin/bash | |
2 ## use #!/bin/bash -x for debugging | |
3 | |
4 ## Galaxy wrapper for MUMmer (nucmer/promer) | |
5 ## Alex Bossers, CVI of Wageningen UR, NL | |
6 ## alex_dot_bossers_at_wur_dot_nl | |
7 ## | |
8 ## Sep 2010 | |
9 ## | |
10 ## Wrapper runs MUMmer nucmer/promer and additional args | |
11 ## Calculates the comparison scores (delta and optional coords file) | |
12 ## Generates the optional STATIC comparison mummerplot to png (from delta file) | |
13 ## | |
14 ## finally the script renames (optional) output files to outfiles expected by Galaxy | |
15 ## | |
16 ## | |
17 ## INPUT args: | |
18 ## nucmer_tool.sh $input_ref $input_query $out_delta $out_coords $out_png $logfile | |
19 ## @0 @1 @2 @3 @4 @5 | |
20 ## $algorithm $keep_delta $make_coords $keep_log $make_image $cmd_extra | |
21 ## @6 @7 @8 @9 @10 @11 | |
22 ## | |
23 | |
24 # path to where mummer suite is installed | |
25 # adjust this for your machine | |
26 # this is the only hard coded path in the scripts | |
27 mum_path="/opt/MUMmer/MUMmer" | |
28 | |
29 # since we have more than 9 arguments we need to shift the sections or use own array | |
30 args=("$@") | |
31 # to keep things readible assign vars | |
32 input_ref="${args[0]}" | |
33 input_query="${args[1]}" | |
34 out_delta="${args[2]}" | |
35 out_coords="${args[3]}" | |
36 out_png="${args[4]}" | |
37 logfile="${args[5]}" | |
38 algorithm="${args[6]}" | |
39 keep_delta="${args[7]}" | |
40 make_coords="${args[8]}" | |
41 keep_log="${args[9]}" | |
42 make_image="${args[10]}" | |
43 cmd_extra="${args[11]}" | |
44 | |
45 # enable/disable the STDOUT log file | |
46 if [ "$keep_log" == "yes" ]; then | |
47 logfile_c="2>$logfile" | |
48 logfile_a="2>>$logfile" | |
49 else | |
50 #dump to dev/null | |
51 logfile_c="2>&-" | |
52 logfile_a="2>&-" | |
53 fi | |
54 | |
55 # extra mummer cmd line options | |
56 | |
57 ## generate coords file on the fly? | |
58 if [ "$make_coords" == "yes" ]; then | |
59 options=" --coords" | |
60 fi | |
61 ## extra cmd line args to be concatenated in options? We need to prevent extra spaces! | |
62 if [ "$cmd_extra" != "" ]; then | |
63 if [ "$options" == "" ]; then | |
64 options=" $cmd_extra" | |
65 else | |
66 options="$options $cmd_extra" | |
67 fi | |
68 fi | |
69 | |
70 # run nucmer/promer | |
71 eval "$mum_path/$algorithm$options $input_ref $input_query $logfile_c" | |
72 | |
73 ## generate large png if option make_image = yes | |
74 ## suppress error from mummerplot since some is deprecated but not a real error | |
75 ## error can be easily avoided by modifying the source of mummerplot... just in case | |
76 ## however we need to check if a valid png was generated. This is not the case is alignment is none | |
77 ## 1 is stderr and 2 stdout. redirect to dev/null | |
78 | |
79 if [ "${make_image}" == "yes" ]; then | |
80 eval "$mum_path/mummerplot --large --png out.delta 1>&- $logfile_a" | |
81 if [ -f "out.png" ]; then | |
82 mv out.png $out_png | |
83 #cleanup temp gnuplot file | |
84 rm out.gp | |
85 else | |
86 echo "not exist the req png file!" | |
87 fi | |
88 | |
89 ## clean up remaining files | |
90 rm out.fplot | |
91 rm out.rplot | |
92 | |
93 fi | |
94 | |
95 # keep/rename or delete delta file | |
96 if [ "$keep_delta" == "yes" ]; then | |
97 mv out.delta "$out_delta" | |
98 else | |
99 rm out.delta | |
100 fi | |
101 | |
102 # keep/rename coords file if it was created | |
103 if [ "$make_coords" == "yes" ]; then | |
104 mv out.coords "$out_coords" | |
105 fi | |
106 | |
107 # end script |