ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/yamap/yamap.pl
Revision: 1.12
Committed: Fri Dec 14 13:51:38 2007 UTC (8 years, 8 months ago) by gawi79
Branch: MAIN
CVS Tags: HEAD
Changes since 1.11: +99 -92 lines
Log Message:
Used in YAMAP v1.02

Line File contents
1 #!/usr/bin/perl
2
3 use strict;
4 use lib qw(/usr/local/bioinf/yamap/yamap/lib);
5
6 #use Bio::SeqIO;
7 use Config::Simple;
8 use Cwd;
9 use File::Copy;
10 use File::Basename;
11 use IO::Pipe;
12 use Proc::ProcessTable;
13 use Proc::Simple;
14 use Tk;
15 use Tk::DirSelect;
16 use Tk::ExecuteCommand;
17 use Tk::FileSelect;
18 use Tk::DialogBox;
19 use Tk::NoteBook;
20
21 # version
22 my $version="1.0.2";
23
24 # location of install files
25 my $script = "yamap_nogui.pl";
26 my $pwd = getcwd;
27 my $dir = undef;
28 my $glob = "fasta";
29 my $installdir = "/usr/local/bioinf/yamap/yamap";
30 my $artemis = "$installdir/bin/run_art.pl";
31 my $basedir;
32 my $oneormany = "one";
33 my $image = "$installdir/etc/yamap_small.gif";
34 my $text = "Yet\nAnother\nMicrobial/Metagenomic\nAnnotation\nPipeline/Program\nv. $version";
35 my $write_excel = 1;
36 my $top_hits = 1;
37
38 # location of config files
39 my $home = $ENV{'HOME'};
40
41 # set pager to less so that tfm works
42 $ENV{'EMBOSS_PAGER'} = "less";
43 my $tfm = "/usr/local/bioinf/EMBOSS/EMBOSS/emboss/bin/tfm";
44
45 # create a ~/.yamap dir for the user
46 unless (-e "$home/.yamap")
47 {
48 system("mkdir $home/.yamap") == 0 or warn "Can't create $home/.yamap: $!";
49 }
50 # set up the run file
51 unless (-e "$home/.yamap/yamap_run.ini")
52 {
53 &copy("$installdir/etc/yamap_run.ini","$home/.yamap/yamap_run.ini") or warn "Can't copy user config file to $home/.yamap: $!";
54 }
55 my $config_file = "$home/.yamap/yamap_run.ini";
56
57 # set up the quickmine file
58 unless (-e "$home/.yamap/quickmine.ini")
59 {
60 &copy("$installdir/etc/quickmine.ini","$home/.yamap/quickmine.ini") or warn "Can't copy quickmine config file to $home/.yamap: $!";
61 }
62 my $quickmine_file = "$home/.yamap/quickmine.ini";
63
64
65 # set up the paths file
66 my $update = 0;
67 my $path_file = "$home/.yamap/yamap_paths.ini";;
68 if (-e $path_file)
69 {
70 my $pathconf = new Config::Simple($path_file) or die "Can't open path config file: $!";
71 my $vers = $pathconf->param(-block=>'VERSION');
72 my $number = $vers->{version};
73
74 unless ($number eq $version)
75 {
76 $update = 1;
77 }
78 }
79 else
80 {
81 &copy("$installdir/etc/yamap_paths.ini","$home/.yamap/yamap_paths.ini") or warn "Can't copy path config file to $home/.yamap: $!";
82 }
83
84 my $config = new Config::Simple($config_file);
85 my $confcolour = "green";
86
87 # run variables, from config file
88 my $common = $config->param(-block=>'COMMON');
89 my $outdir = $common->{outdir};
90 my $r_quickmine = $common->{quickmine};
91 my $r_dbblast = $common->{dbblast};
92 my $r_selfblast = $common->{selfblast};
93 my $r_consblast = $common->{consblast};
94 my $r_bigblast = $common->{bigblast};
95 my $r_pfam = $common->{pfam};
96 my $r_invert = $common->{einverted};
97 my $r_tandem = $common->{etandem};
98 my $r_glim = $common->{glimmer};
99 my $r_msat = $common->{msatfinder};
100 my $r_palin = $common->{palindrome};
101 my $r_trna = $common->{trnascan};
102 my $r_trans = $common->{transterm};
103 my $dontask = $common->{dontask};
104
105 # get details for running artemis
106 my $paths = new Config::Simple($path_file) or die "Can't get artemis location: $!";
107 my $proc = $paths->param(-block=>'PROCESSING');
108
109 #########################
110 #Create the Main Window #
111 #########################
112 my $mw = MainWindow->new();
113 $mw->title('yamap');
114 my $photo = $mw -> Photo(-format => 'gif', -file => "$image");
115 my $label = $mw->Canvas(
116 -width => $photo->width,
117 -height => $photo->height);
118 $label->createImage(0, 0, -image => $photo, -anchor => 'nw');
119 my $tagline = $mw -> Label(-text=>"$text",-font=>"fixed 6",-justify=>"left");
120 my $spacer1 = $mw -> Label(-text=>"Select input files",-relief=>"groove", -background=>"white");
121 my $spacer2 = $mw -> Label(-text=>"Configure annotation programs",-relief=>"groove", -background=>"white");
122 my $spacer3 = $mw -> Frame(-width=>"500", -height=>"1", -background=>"light goldenrod yellow");
123 #my $spacer3 = $mw -> Label(-text=>"", -relief=>"groove", -background=>"SlateGrey");
124 my $spacer4 = $mw -> Label(-text=>"Select output directory",-relief=>"groove", -background=>"white");
125 my $spacer5 = $mw -> Label(-text=>"Sequence Type", -relief=>"groove", -background=>"white");
126 my $spacer6 = $mw -> Label(-text=>"Annotation Type", -relief=>"groove", -background=>"white");
127 my $column_spacer = $mw -> Frame(-width=>"5", -height=>"395", -background=>"light goldenrod yellow");
128
129
130 # the Tk listbox should be tied to the array of files
131 # allowing the selection to be changed before running.
132 my ($fsref,$basedir);
133 my (@files);
134 my %fullpath=();
135 my $file_names = $mw->ScrlListbox(-selectmode => "extended",
136 -height => 5);
137 tie @files, "Tk::Listbox", $file_names;
138 my $enter_args = $mw -> Button(-text=>"Select sequences",
139 -command => sub {
140 $dir = undef;
141 $fsref = $mw->FileSelect(-directory => "$pwd",
142 -selectmode => 'extended');
143 my @new = $fsref->Show();
144 $basedir = &dirname(@new[0]);
145 $basedir =~ s/\/$//;
146 foreach my $file (@new)
147 {
148 my $shortname = &basename($file);
149 $fullpath{$shortname} = $file;
150 $file_names->insert('end', $shortname);
151 }
152 });
153 my $clear_args = $mw -> Button(-text=>"Delete selected",
154 -command => sub {
155 my @elms = $file_names->curselection;
156 foreach my $elm (@elms)
157 {
158 $file_names->delete($elm);
159 }
160 });
161 # radio buttons for layout choices
162 my $anno_type;
163 my $meta_input_type;
164 my $anno_check = 1;
165 my $t_tester;
166 my $state;
167 my $genome_annotation = $mw -> Radiobutton(-text => 'Whole Genome Annotation', -value => 1, -variable =>\$anno_type, -command=>\&genome_function);
168
169 my $meta_annotation = $mw -> Radiobutton(-text => 'Meta-Genome Annotation', -value => 0, -variable =>\$anno_type, -command=>\&meta_function);
170
171 # run or quit
172 my $run_button = $mw -> Button(-text => "Run",
173 -command => \&runprogs );
174 my $quit_button = $mw -> Button(-text => "Quit",
175 -command => \&exitprogram );
176
177 # top section geometry
178 $label -> grid(-row=>0,-column=>1,-sticky=>"e");
179 $tagline -> grid(-row=>0,-column=>3,-sticky=>"w");
180 $spacer1-> grid(-row=>1,-column=>0,-columnspan=>2,-sticky=>"ew",-ipady=>3);
181 $clear_args -> grid(-row=>2,-column=>0);
182 $enter_args -> grid(-row=>2,-column=>1);
183 $file_names -> grid(-row=>3,-column=>0,-columnspan=>2,-rowspan=>3, -sticky=>"ew",-ipady=>3);
184 $spacer2-> grid(-row=>1,-column=>3,-columnspan=>2,-sticky=>"ew",-ipady=>3);
185
186 $column_spacer -> grid(-row=>1,-rowspan=>12,-column=>2);
187
188 # run and quit geometry
189 $spacer3-> grid(-row=>13,-column=>0,-columnspan=>5,-sticky=>"ew",-ipady=>3);
190 $run_button -> grid(-row=>14,-column=>1,-sticky=>"w");
191 $quit_button -> grid(-row=>14,-column=>3,-sticky=>"w");
192
193 #temp buttons
194 $genome_annotation -> grid(-row=>7,-column=>0,-sticky=>"w");
195 $meta_annotation -> grid(-row=>8,-column=>0,-sticky=>"w");
196 $spacer5-> grid(-row=>9,-column=>0,-columnspan=>2,-sticky=>"ew",-ipady=>3);
197 $spacer6-> grid(-row=>6,-column=>0,-columnspan=>2,-sticky=>"ew",-ipady=>3);
198 my $meta_protein = $mw -> Radiobutton(-text => 'Protein Input', -value => 1, -variable =>\$meta_input_type, -state=>"disabled");
199 my $meta_dna = $mw -> Radiobutton(-text => 'DNA Input', -value => 0, -variable =>\$meta_input_type, -state=>"disabled");
200 $meta_protein -> grid(-row=>10,-column=>0,-sticky=>"w");
201 $meta_dna -> grid(-row=>11,-column=>0,-sticky=>"w");
202
203 # a warning if there is a version mismatch
204 if ($update == 1)
205 {
206 my $message = "Version number has changed. If you experience problems, please delete \$HOME/.yamap and restart.";
207 $mw -> messageBox(-type=>"ok",
208 -icon=>'error',
209 -font=>'helvetica 10 bold',
210 -message=>"$message");
211 }
212
213
214 my $t_quickmine = $mw -> Checkbutton(-text=>"QuickMine BLAST", -variable=>\$r_quickmine, -state=>"disabled");
215 my $t_dbblast = $mw -> Checkbutton(-text=>"Blast vs. database", -variable=>\$r_dbblast, -state=>"disabled");
216 my $t_selfblast = $mw -> Checkbutton(-text=>"Blast vs. own seqs", -variable=>\$r_selfblast, -state=>"disabled");
217 my $t_consblast = $mw -> Checkbutton(-text=>"Blast vs. consortium db.", -variable=>\$r_consblast, -state=>"disabled");
218 my $t_bigblast = $mw -> Checkbutton(-text=>"Sanger\'s \"big blast\"", -variable=>\$r_bigblast, -state=>"disabled");
219 my $t_pfam = $mw -> Checkbutton(-text=>"Pfam", -variable=>\$r_pfam, -command=>sub {if ($r_pfam + $r_trans > 0) {$r_glim = 1 };}, -state=>"disabled"); # N.B. glimmer is needed for pfam to work properly
220 my $t_invert = $mw -> Checkbutton(-text=>"Einverted", -variable=>\$r_invert, -state=>"disabled");
221 my $t_tandem = $mw -> Checkbutton(-text=>"Etandem", -variable=>\$r_tandem, -state=>"disabled");
222 my $t_glim = $mw -> Checkbutton(-text=>"Glimmer", -variable=>\$r_glim, -state=>"disabled");
223 my $t_msat = $mw -> Checkbutton(-text=>"Msatfinder", -variable=>\$r_msat, -state=>"disabled");
224 my $t_palin = $mw -> Checkbutton(-text=>"Palindrome", -variable=>\$r_palin, -state=>"disabled");
225 my $t_trna = $mw -> Checkbutton(-text=>"tRNAscan", -variable=>\$r_trna, -state=>"disabled");
226 my $t_trans = $mw -> Checkbutton(-text=>"TransTerm", -variable=>\$r_trans, -command=>sub {if ($r_pfam + $r_trans > 0) {$r_glim = 1 };}, -state=>"disabled"); # N.B. glimmer is needed for transterm to work properly
227
228 # edit the configs
229 my $quickmine_button = $mw -> Button(-text=>"Configure", -command =>\&quickmine_conf);
230 my $dbblast_button = $mw -> Button(-text=>"Configure", -command =>\&dbblast_conf);
231 my $selfblast_button = $mw -> Button(-text=>"Configure", -command =>\&selfblast_conf);
232 my $consblast_button = $mw -> Button(-text=>"Configure", -command =>\&consblast_conf);
233 my $bigblast_button = $mw -> Button(-text=>"Configure", -command =>\&bigblast_conf);
234 my $pfam_button = $mw -> Button(-text=>"Configure", -command =>\&pfam_conf);
235 my $invert_button = $mw -> Button(-text=>"Configure", -command =>\&invert_conf);
236 my $tandem_button = $mw -> Button(-text=>"Configure", -command =>\&tandem_conf);
237 my $glim_button = $mw -> Button(-text=>"Configure", -command =>\&glim_conf);
238 my $msat_button = $mw -> Button(-text=>"Configure", -command =>\&msat_conf);
239 my $palin_button = $mw -> Button(-text=>"Configure", -command =>\&palin_conf);
240 my $trna_button = $mw -> Button(-text=>"Configure", -command =>\&trna_conf);
241 my $trans_button = $mw -> Button(-text=>"Configure", -command =>\&trans_conf);
242
243 # edit button geometry
244 # labels...
245
246 #$t_dbblast -> grid(-row=>8,-column=>0,-sticky=>"w");
247 #$t_selfblast -> grid(-row=>9,-column=>0,-sticky=>"w");
248 $t_consblast -> grid(-row=>2,-column=>3,-sticky=>"w");
249 $t_bigblast -> grid(-row=>4,-column=>3,-sticky=>"w");
250 $t_invert -> grid(-row=>5,-column=>3,-sticky=>"w");
251 $t_tandem -> grid(-row=>6,-column=>3,-sticky=>"w");
252 $t_glim -> grid(-row=>7,-column=>3,-sticky=>"w");
253 $t_msat -> grid(-row=>8,-column=>3,-sticky=>"w");
254 $t_palin -> grid(-row=>9,-column=>3,-sticky=>"w");
255 $t_pfam -> grid(-row=>10,-column=>3,-sticky=>"w");
256 $t_trna -> grid(-row=>11,-column=>3,-sticky=>"w");
257 $t_trans -> grid(-row=>12,-column=>3,-sticky=>"w");
258 $t_quickmine -> grid(-row=>3,-column=>3,-sticky=>"w");
259 # buttons...
260 #$dbblast_button -> grid(-row=>8,-column=>1,-sticky=>"e");
261 #$selfblast_button -> grid(-row=>9,-column=>1,-sticky=>"e");
262 $consblast_button -> grid(-row=>2,-column=>4,-sticky=>"e");
263 $bigblast_button -> grid(-row=>4,-column=>4,-sticky=>"e");
264 $invert_button -> grid(-row=>5,-column=>4,-sticky=>"e");
265 $tandem_button -> grid(-row=>6,-column=>4,-sticky=>"e");
266 $glim_button -> grid(-row=>7,-column=>4,-sticky=>"e");
267 $msat_button -> grid(-row=>8,-column=>4,-sticky=>"e");
268 $palin_button -> grid(-row=>9,-column=>4,-sticky=>"e");
269 $pfam_button -> grid(-row=>10,-column=>4,-sticky=>"e");
270 $trna_button -> grid(-row=>11,-column=>4,-sticky=>"e");
271 $trans_button -> grid(-row=>12,-column=>4,-sticky=>"e");
272 $quickmine_button -> grid(-row=>3,-column=>4,-sticky=>"e");
273
274 # initialise blast buttons for use in quickmine menu
275 my $sblastb;
276 my $dblastb;
277
278 # stick it on the screen!
279 $mw->MainLoop;
280
281 ###############
282 # subroutines #
283 ###############
284 # Creates gui layout for genome annotation
285 sub genome_function
286 {
287 #reset variables from meta annotation
288 $r_quickmine = 0;
289
290 $t_quickmine = $mw -> Checkbutton(-text=>"QuickMine BLAST", -variable=>\$r_quickmine, -state=>"normal");
291 #$t_dbblast = $mw -> Checkbutton(-text=>"Blast vs. database", -variable=>\$r_dbblast, -state=>"normal");
292 #$t_selfblast = $mw -> Checkbutton(-text=>"Blast vs. own seqs", -variable=>\$r_selfblast, -state=>"normal");
293 $t_consblast = $mw -> Checkbutton(-text=>"Blast vs. consortium db.", -variable=>\$r_consblast, -state=>"disabled");
294 $t_bigblast = $mw -> Checkbutton(-text=>"Sanger\'s \"big blast\"", -variable=>\$r_bigblast, -state=>"normal");
295 $t_pfam = $mw -> Checkbutton(-text=>"Pfam", -variable=>\$r_pfam, -command=>sub {if ($r_pfam + $r_trans > 0) {$r_glim = 1 };}, -state=>"normal"); # N.B. glimmer is needed for pfam to work properly
296 $t_invert = $mw -> Checkbutton(-text=>"Einverted", -variable=>\$r_invert, -state=>"normal");
297 $t_tandem = $mw -> Checkbutton(-text=>"Etandem", -variable=>\$r_tandem, -state=>"normal");
298 $t_glim = $mw -> Checkbutton(-text=>"Glimmer", -variable=>\$r_glim, -state=>"normal");
299 $t_msat = $mw -> Checkbutton(-text=>"Msatfinder", -variable=>\$r_msat, -state=>"normal");
300 $t_palin = $mw -> Checkbutton(-text=>"Palindrome", -variable=>\$r_palin, -state=>"normal");
301 $t_trna = $mw -> Checkbutton(-text=>"tRNAscan", -variable=>\$r_trna, -state=>"normal");
302 $t_trans = $mw -> Checkbutton(-text=>"TransTerm", -variable=>\$r_trans, -command=>sub {if ($r_pfam + $r_trans > 0) {$r_glim = 1 };}, -state=>"normal"); # N.B. glimmer is needed for transterm to work properly
303
304 #$t_dbblast -> grid(-row=>8,-column=>0,-sticky=>"w");
305 #$t_selfblast -> grid(-row=>9,-column=>0,-sticky=>"w");
306 $t_consblast -> grid(-row=>2,-column=>3,-sticky=>"w");
307 $t_bigblast -> grid(-row=>4,-column=>3,-sticky=>"w");
308 $t_invert -> grid(-row=>5,-column=>3,-sticky=>"w");
309 $t_tandem -> grid(-row=>6,-column=>3,-sticky=>"w");
310 $t_glim -> grid(-row=>7,-column=>3,-sticky=>"w");
311 $t_msat -> grid(-row=>8,-column=>3,-sticky=>"w");
312 $t_palin -> grid(-row=>9,-column=>3,-sticky=>"w");
313 $t_pfam -> grid(-row=>10,-column=>3,-sticky=>"w");
314 $t_trna -> grid(-row=>11,-column=>3,-sticky=>"w");
315 $t_trans -> grid(-row=>12,-column=>3,-sticky=>"w");
316 $t_quickmine -> grid(-row=>3,-column=>3,-sticky=>"w");
317
318
319 $meta_protein = $mw -> Radiobutton(-text => 'Protein Input', -value => 1, -variable =>\$meta_input_type, -state=>"disabled");
320 $meta_dna = $mw -> Radiobutton(-text => 'DNA Input', -value => 0, -variable =>\$meta_input_type, -state=>"disabled");
321 $meta_protein -> grid(-row=>10,-column=>0,-sticky=>"w");
322 $meta_dna -> grid(-row=>11,-column=>0,-sticky=>"w");
323
324 }
325 # Create layout for general meta annotation
326 sub meta_function
327 {
328 #reset variables from genome annotation
329 $r_consblast = 0;
330 $r_bigblast = 0;
331 $r_pfam = 0;
332 $r_invert = 0;
333 $r_tandem = 0;
334 $r_glim = 0;
335 $r_msat = 0;
336 $r_palin = 0;
337 $r_trna = 0;
338 $r_trans = 0;
339
340 $t_quickmine = $mw -> Checkbutton(-text=>"QuickMine BLAST", -variable=>\$r_quickmine, -state=>"normal");
341 #$t_dbblast = $mw -> Checkbutton(-text=>"Blast vs. database", -variable=>\$r_dbblast, -state=>"disable");
342 #$t_selfblast = $mw -> Checkbutton(-text=>"Blast vs. own seqs", -variable=>\$r_selfblast, -state=>"disable");
343 $t_consblast = $mw -> Checkbutton(-text=>"Blast vs. consortium db.", -variable=>\$r_consblast, -state=>"disable");
344 $t_bigblast = $mw -> Checkbutton(-text=>"Sanger\'s \"big blast\"", -variable=>\$r_bigblast, -state=>"disable");
345 $t_pfam = $mw -> Checkbutton(-text=>"Pfam", -variable=>\$r_pfam, -command=>sub {if ($r_pfam + $r_trans > 0) {$r_glim = 1 };}, -state=>"disable"); # N.B. glimmer is needed for pfam to work properly
346 $t_invert = $mw -> Checkbutton(-text=>"Einverted", -variable=>\$r_invert, -state=>"disable");
347 $t_tandem = $mw -> Checkbutton(-text=>"Etandem", -variable=>\$r_tandem, -state=>"disable");
348 $t_glim = $mw -> Checkbutton(-text=>"Glimmer", -variable=>\$r_glim, -state=>"disable");
349 $t_msat = $mw -> Checkbutton(-text=>"Msatfinder", -variable=>\$r_msat, -state=>"disable");
350 $t_palin = $mw -> Checkbutton(-text=>"Palindrome", -variable=>\$r_palin, -state=>"disable");
351 $t_trna = $mw -> Checkbutton(-text=>"tRNAscan", -variable=>\$r_trna, -state=>"disable");
352 $t_trans = $mw -> Checkbutton(-text=>"TransTerm", -variable=>\$r_trans, -command=>sub {if ($r_pfam + $r_trans > 0) {$r_glim = 1 };}, -state=>"disable"); # N.B. glimmer is needed for transterm to work properly
353
354 #$t_dbblast -> grid(-row=>8,-column=>0,-sticky=>"w");
355 #$t_selfblast -> grid(-row=>9,-column=>0,-sticky=>"w");
356 $t_consblast -> grid(-row=>2,-column=>3,-sticky=>"w");
357 $t_bigblast -> grid(-row=>4,-column=>3,-sticky=>"w");
358 $t_invert -> grid(-row=>5,-column=>3,-sticky=>"w");
359 $t_tandem -> grid(-row=>6,-column=>3,-sticky=>"w");
360 $t_glim -> grid(-row=>7,-column=>3,-sticky=>"w");
361 $t_msat -> grid(-row=>8,-column=>3,-sticky=>"w");
362 $t_palin -> grid(-row=>9,-column=>3,-sticky=>"w");
363 $t_pfam -> grid(-row=>10,-column=>3,-sticky=>"w");
364 $t_trna -> grid(-row=>11,-column=>3,-sticky=>"w");
365 $t_trans -> grid(-row=>12,-column=>3,-sticky=>"w");
366 $t_quickmine -> grid(-row=>3,-column=>3,-sticky=>"w");
367
368 $meta_input_type = 1;
369 $meta_protein = $mw -> Radiobutton(-text => 'Protein Input', -value => 1, -variable =>\$meta_input_type, -state=>"normal", -command=>\&protein_function);
370 $meta_dna = $mw -> Radiobutton(-text => 'DNA Input', -value => 0, -variable =>\$meta_input_type, -state=>"normal", -command=>\&dna_function);
371 $meta_protein -> grid(-row=>10,-column=>0,-sticky=>"w");
372 $meta_dna -> grid(-row=>11,-column=>0,-sticky=>"w");
373 }
374 # provides options available for annotation of proteins
375 sub protein_function
376 {
377 #reset variables from genome annotation
378 $r_consblast = 0;
379 $r_bigblast = 0;
380 $r_pfam = 0;
381 $r_invert = 0;
382 $r_tandem = 0;
383 $r_glim = 0;
384 $r_msat = 0;
385 $r_palin = 0;
386 $r_trna = 0;
387 $r_trans = 0;
388
389 $t_quickmine = $mw -> Checkbutton(-text=>"QuickMine BLAST", -variable=>\$r_quickmine, -state=>"normal");
390 #$t_dbblast = $mw -> Checkbutton(-text=>"Blast vs. database", -variable=>\$r_dbblast, -state=>"disable");
391 #$t_selfblast = $mw -> Checkbutton(-text=>"Blast vs. own seqs", -variable=>\$r_selfblast, -state=>"disable");
392 $t_consblast = $mw -> Checkbutton(-text=>"Blast vs. consortium db.", -variable=>\$r_consblast, -state=>"disable");
393 $t_bigblast = $mw -> Checkbutton(-text=>"Sanger\'s \"big blast\"", -variable=>\$r_bigblast, -state=>"disable");
394 $t_pfam = $mw -> Checkbutton(-text=>"Pfam", -variable=>\$r_pfam, -command=>sub {if ($r_pfam + $r_trans > 0) {$r_glim = 1 };}, -state=>"disable"); # N.B. glimmer is needed for pfam to work properly
395 $t_invert = $mw -> Checkbutton(-text=>"Einverted", -variable=>\$r_invert, -state=>"disable");
396 $t_tandem = $mw -> Checkbutton(-text=>"Etandem", -variable=>\$r_tandem, -state=>"disable");
397 $t_glim = $mw -> Checkbutton(-text=>"Glimmer", -variable=>\$r_glim, -state=>"disable");
398 $t_msat = $mw -> Checkbutton(-text=>"Msatfinder", -variable=>\$r_msat, -state=>"disable");
399 $t_palin = $mw -> Checkbutton(-text=>"Palindrome", -variable=>\$r_palin, -state=>"disable");
400 $t_trna = $mw -> Checkbutton(-text=>"tRNAscan", -variable=>\$r_trna, -state=>"disable");
401 $t_trans = $mw -> Checkbutton(-text=>"TransTerm", -variable=>\$r_trans, -command=>sub {if ($r_pfam + $r_trans > 0) {$r_glim = 1 };}, -state=>"disable"); # N.B. glimmer is needed for transterm to work properly
402
403 #$t_dbblast -> grid(-row=>8,-column=>0,-sticky=>"w");
404 #$t_selfblast -> grid(-row=>9,-column=>0,-sticky=>"w");
405 $t_consblast -> grid(-row=>2,-column=>3,-sticky=>"w");
406 $t_bigblast -> grid(-row=>4,-column=>3,-sticky=>"w");
407 $t_invert -> grid(-row=>5,-column=>3,-sticky=>"w");
408 $t_tandem -> grid(-row=>6,-column=>3,-sticky=>"w");
409 $t_glim -> grid(-row=>7,-column=>3,-sticky=>"w");
410 $t_msat -> grid(-row=>8,-column=>3,-sticky=>"w");
411 $t_palin -> grid(-row=>9,-column=>3,-sticky=>"w");
412 $t_pfam -> grid(-row=>10,-column=>3,-sticky=>"w");
413 $t_trna -> grid(-row=>11,-column=>3,-sticky=>"w");
414 $t_trans -> grid(-row=>12,-column=>3,-sticky=>"w");
415 $t_quickmine -> grid(-row=>3,-column=>3,-sticky=>"w");
416 }
417 # provides options for annotation of dna sequences
418 sub dna_function
419 {
420 $t_quickmine = $mw -> Checkbutton(-text=>"QuickMine BLAST", -variable=>\$r_quickmine, -state=>"normal");
421 #$t_dbblast = $mw -> Checkbutton(-text=>"Blast vs. database", -variable=>\$r_dbblast, -state=>"normal");
422 #$t_selfblast = $mw -> Checkbutton(-text=>"Blast vs. own seqs", -variable=>\$r_selfblast, -state=>"normal");
423 $t_consblast = $mw -> Checkbutton(-text=>"Blast vs. consortium db.", -variable=>\$r_consblast, -state=>"disabled");
424 $t_bigblast = $mw -> Checkbutton(-text=>"Sanger\'s \"big blast\"", -variable=>\$r_bigblast, -state=>"disabled");
425 $t_pfam = $mw -> Checkbutton(-text=>"Pfam", -variable=>\$r_pfam, -command=>sub {if ($r_pfam + $r_trans > 0) {$r_glim = 1 };}, -state=>"normal"); # N.B. glimmer is needed for pfam to work properly
426 $t_invert = $mw -> Checkbutton(-text=>"Einverted", -variable=>\$r_invert, -state=>"normal");
427 $t_tandem = $mw -> Checkbutton(-text=>"Etandem", -variable=>\$r_tandem, -state=>"normal");
428 $t_glim = $mw -> Checkbutton(-text=>"Glimmer", -variable=>\$r_glim, -state=>"normal");
429 $t_msat = $mw -> Checkbutton(-text=>"Msatfinder", -variable=>\$r_msat, -state=>"normal");
430 $t_palin = $mw -> Checkbutton(-text=>"Palindrome", -variable=>\$r_palin, -state=>"normal");
431 $t_trna = $mw -> Checkbutton(-text=>"tRNAscan", -variable=>\$r_trna, -state=>"normal");
432 $t_trans = $mw -> Checkbutton(-text=>"TransTerm", -variable=>\$r_trans, -command=>sub {if ($r_pfam + $r_trans > 0) {$r_glim = 1 };}, -state=>"normal"); # N.B. glimmer is needed for transterm to work properly
433
434 #$t_dbblast -> grid(-row=>8,-column=>0,-sticky=>"w");
435 #$t_selfblast -> grid(-row=>9,-column=>0,-sticky=>"w");
436 $t_consblast -> grid(-row=>2,-column=>3,-sticky=>"w");
437 $t_bigblast -> grid(-row=>4,-column=>3,-sticky=>"w");
438 $t_invert -> grid(-row=>5,-column=>3,-sticky=>"w");
439 $t_tandem -> grid(-row=>6,-column=>3,-sticky=>"w");
440 $t_glim -> grid(-row=>7,-column=>3,-sticky=>"w");
441 $t_msat -> grid(-row=>8,-column=>3,-sticky=>"w");
442 $t_palin -> grid(-row=>9,-column=>3,-sticky=>"w");
443 $t_pfam -> grid(-row=>10,-column=>3,-sticky=>"w");
444 $t_trna -> grid(-row=>11,-column=>3,-sticky=>"w");
445 $t_trans -> grid(-row=>12,-column=>3,-sticky=>"w");
446 $t_quickmine -> grid(-row=>3,-column=>3,-sticky=>"w");
447 }
448 # RUN
449 sub runprogs
450 {
451 # die if no files
452 my $len = @files;
453 unless (@files)
454 {
455 $mw -> messageBox(-type=>"ok",
456 -icon=>'error',
457 -message=>"Please select at least one sequence file.");
458 return;
459 }
460 #die if white space in file names
461 foreach my $space_check (@files)
462 {
463 if ($space_check =~m/\s/)
464 {
465 $mw -> messageBox(-type=>"ok",-icon=>'error',-message=>"Please remove spaces from your input filenames.");
466 return;
467 }
468 }
469 # save info on which programs are to be run
470 $config->param("COMMON.dbblast", $r_dbblast || 0);
471 $config->param("COMMON.selfblast", $r_selfblast || 0);
472 $config->param("COMMON.consblast", $r_consblast || 0);
473 $config->param("COMMON.bigblast", $r_bigblast || 0);
474 $config->param("COMMON.pfam", $r_pfam || 0);
475 $config->param("COMMON.einverted", $r_invert || 0);
476 $config->param("COMMON.etandem", $r_tandem || 0);
477 $config->param("COMMON.glimmer", $r_glim || 0);
478 $config->param("COMMON.msatfinder", $r_msat || 0);
479 $config->param("COMMON.palindrome", $r_palin || 0);
480 $config->param("COMMON.trnascan", $r_trna || 0);
481 $config->param("COMMON.transterm", $r_trans || 0);
482 $config->param("COMMON.quickmine", $r_quickmine || 0);
483 $config->save();
484
485 # make sure full path is passed to command line
486 # and only one copy of each file is viewed
487 # might be safe to omit full path if cd to
488 # $basedir before running $script
489 my %nameseen=();
490 my @fullnames;
491 foreach my $file (@files)
492 {
493 push(@fullnames, $fullpath{$file}) unless $nameseen{$file} == 1;
494 $nameseen{$file} = 1;
495 }
496
497 # create display window
498 my $top = $mw-> Toplevel();
499 $top->title('Executing annotation programs...');
500 my $label = $top -> Label(-text=>"Pipeline progress",
501 -relief=>"groove")->pack();
502
503 # set up path2proteins for quickmine
504 my $cfgq = new Config::Simple($quickmine_file);
505 my $outdirpath = "$basedir/$outdir";
506 $cfgq->param("PATHS.path2output", $outdirpath);
507 $cfgq->param("PATHS.path2blast", $outdirpath);
508 $cfgq->param("PATHS.path2public", $outdirpath);
509 $cfgq->param("PATHS.path2proteins", $outdirpath);
510 $cfgq -> save();
511
512 # run the program
513 my ($write,$tophits);
514 if ($write_excel ==1)
515 {
516 $write = "-w";
517 }
518 if ($top_hits ==1)
519 {
520 $tophits = "-t";
521 }
522 my $ec = $top->ExecuteCommand(-command => '',
523 -entryWidth => 50,
524 -height => 10,
525 -label => 'Run YAMAP',
526 -text => 'Execute')->pack(-fill=>"both",-expand=>1);
527 $ec->configure(-command => "cd $basedir; $installdir/bin/$script -x -c $config_file -p $path_file -q $quickmine_file @fullnames");
528 $ec->execute_command;
529 $ec->bell;
530 $ec->update;
531
532 # check to determine if analysis is of whole genome, if so provide artemis button
533 if ($anno_type == 1)
534 {
535 # view results in artemis
536 my $art = $top -> Button(-text=>"View results in artemis", -command => sub
537 {
538 # strange Tk::Widget::insert problems appear here
539 # this is a bit naughty, but will have to do for now
540 no warnings;
541
542 # view results in artemis
543 my $top2 = $top->Toplevel();
544 $top->title('Running Artemis...');
545 my $runart = $top2->ExecuteCommand(-command => '',-entryWidth => 40,-height => 5,-label => 'Run Artemis',-text=> 'View results in Artemis')->pack(-fill=>"both",-expand=>1);
546 $runart->configure(-command => "$artemis $basedir");
547 my $close = $top2 -> Button(-text=>"Close window", -command => sub { destroy $top2; })->pack();
548
549 $runart->execute_command;
550 $runart->bell;
551 $runart->update;
552 })->pack();
553 }
554 if ($anno_type == 0 && $r_quickmine == 1)
555 {
556 my $firefox = $top -> Button(-text=>"View QuickMine results in Firefox", -command=> sub
557 {
558 my $top2 = $top->Toplevel();
559 $top2->title('Running Firefox...');
560 my $exec_fox = $top2->ExecuteCommand(-command=>'',-entryWidth=>40,-height=>5,-label=>'',-text=>'Execute')->pack;
561 $exec_fox->configure(-command => "firefox $outdirpath/index.html");
562 my $close = $top2 -> Button(-text=>"Close window", -command => sub { destroy $top2; })->pack();
563 $exec_fox->execute_command;
564 $exec_fox->bell;
565 $exec_fox->update;
566 })->pack();
567 }
568 # add close button
569 my $close = $top -> Button(-text=>"Close window", -command => sub { destroy $top; })->pack();
570 }
571 # EXIT
572 sub exitprogram
573 {
574 if ($dontask eq "no" )
575 {
576 my $d = $mw->DialogBox(-title => "Confirm quit", -buttons => ["OK", "Cancel"]);
577 $d->add('Label', -text=>"Are you sure?", -font=>"helvetica 18 bold")->pack(-side=>"top",-anchor=>"center");
578 $d->add('Radiobutton', -text => 'Don\'t ask for confirmation again.',
579 -value => "yes",
580 -variable => \$dontask)->pack(-side=>"top",-anchor=>"w");
581
582 my $button = $d->Show;
583 if ($button =~ /OK/i)
584 {
585 $config->param("COMMON.dontask", $dontask || "no");
586 $config->save();
587 exit;
588 }
589 }
590 elsif ($dontask eq "yes")
591 {
592 $config->save();
593 exit;
594 }
595 }
596
597 # DBBLAST
598 sub dbblast_conf
599 {
600 # vars
601 my $confs = $config->param(-block=>'DBBLAST');
602 my $program = $confs->{program};
603 my $database = $confs->{database};
604 my $other_opts = $confs->{other_opts};
605 # new window
606 my $top = $mw -> Toplevel();
607 $top->title('dbblast');
608
609 # radio buttons
610 my $rad0 = $top -> Radiobutton(-text => 'blastn',
611 -value => "blastn",
612 -variable => \$program);
613 my $rad1 = $top -> Radiobutton(-text => 'blastx',
614 -value => "blastx",
615 -variable => \$program);
616 my $rad2 = $top -> Radiobutton(-text => 'tblastx',
617 -value => "tblastx",
618 -variable => \$program);
619 my $rad3 = $top -> Radiobutton(-text => 'blastp',
620 -value => "blastp",
621 -variable => \$program);
622
623 my $rad4 = $top -> Checkbutton(-text=>"Write summary of results (xls)", -variable=>\$write_excel);
624 my $rad5 = $top -> Checkbutton(-text=>"Write top hits only (xls)", -variable=>\$top_hits);
625 my $ent2 = $top -> Entry(-textvariable=>\$database);
626 my $ent4 = $top -> Entry(-textvariable=>\$other_opts);
627 my $save = $top -> Button(-text=>"Save", -command => sub {
628 $config->param("DBBLAST.program", $program);
629 $config->param("DBBLAST.database", $database);
630 $config->param("DBBLAST.other_opts", $other_opts);
631 $config -> save();
632 $dbblast_button -> configure(-background => "$confcolour");
633 destroy $top;
634 });
635 my $close = $top -> Button(-text=>"Close", -command => sub { destroy $top; });
636 my $rtfm = $top -> Button(-text=>"blastall documentation", -command => sub { &rtfm("xterm -e \"man blastall\"") });
637
638 # labels
639 my $lab1 = $top -> Label(-text=>"DB-blast configuration",-relief=>"groove");
640 my $lab2 = $top -> Label(-text=>"Database");
641 my $lab4 = $top -> Label(-text=>"Other options");
642
643 # geometry
644 $lab1 -> grid(-row=>0,-column=>0,-columnspan=>2);
645 $rad0 -> grid(-row=>1,-column=>0,-columnspan=>2);
646 $rad1 -> grid(-row=>2,-column=>0,-columnspan=>2);
647 $rad2 -> grid(-row=>3,-column=>0,-columnspan=>2);
648 $rad3 -> grid(-row=>4,-column=>0,-columnspan=>2);
649 $lab2 -> grid(-row=>5,-column=>0);
650 $lab4 -> grid(-row=>6,-column=>0);
651 $ent2 -> grid(-row=>5,-column=>1);
652 $ent4 -> grid(-row=>6,-column=>1);
653 $rad4 -> grid(-row=>7,-column=>0,-columnspan=>2,-sticky=>"w");
654 $rad5 -> grid(-row=>8,-column=>0,-columnspan=>2,-sticky=>"w");
655 $rtfm -> grid(-row=>9,-column=>0,-columnspan=>2,-sticky=>"ew");
656 $save -> grid(-row=>10,-column=>0,-sticky=>"w");
657 $close -> grid(-row=>10,-column=>1,-sticky=>"e");
658
659 }
660 # SELFBLAST
661 sub selfblast_conf
662 {
663 # vars
664 my $confs = $config->param(-block=>'SELFBLAST');
665 my $program = $confs->{program};
666 my $other_opts = $confs->{other_opts};
667
668 # new window
669 my $top = $mw -> Toplevel();
670 $top->title('selfblast');
671
672 # radio buttons
673 my $rad1 = $top -> Radiobutton(-text => 'blastn',
674 -value => "blastn",
675 -variable => \$program);
676 my $rad3 = $top -> Radiobutton(-text => 'tblastx',
677 -value => "tblastx",
678 -variable => \$program);
679
680
681 my $ent3 = $top -> Entry(-textvariable=>\$other_opts);
682 my $save = $top -> Button(-text=>"Save", -command => sub {
683 $config->param("SELFBLAST.program", $program);
684 $config->param("SELFBLAST.other_opts", $other_opts);
685 $config -> save();
686 $selfblast_button -> configure(-background => "$confcolour");
687 destroy $top;
688 });
689 my $close = $top -> Button(-text=>"Close", -command => sub { destroy $top; });
690 my $rtfm = $top -> Button(-text=>"blastall documentation", -command => sub { &rtfm("xterm -e \"man blastall\"") });
691
692 # labels
693 my $lab1 = $top -> Label(-text=>"Self-blast configuration",-relief=>"groove");
694 my $lab2 = $top -> Label(-text=>"Expect");
695 my $lab3 = $top -> Label(-text=>"Other options");
696
697 # geometry
698 $lab1 -> grid(-row=>0,-column=>0,-columnspan=>2);
699 $rad1 -> grid(-row=>1,-column=>0,-columnspan=>2);
700 $rad3 -> grid(-row=>2,-column=>0,-columnspan=>2);
701 $lab3 -> grid(-row=>3,-column=>0);
702 $ent3 -> grid(-row=>3,-column=>1);
703 $rtfm -> grid(-row=>4,-column=>0,-columnspan=>2,-sticky=>"ew");
704 $save -> grid(-row=>5,-column=>0,-sticky=>"w");
705 $close -> grid(-row=>5,-column=>1,-sticky=>"e");
706 }
707 # EINVERTED
708 sub invert_conf
709 {
710 # vars
711 my $confs = $config->param(-block=>'EINVERTED');
712 my $gap = $confs->{gap};
713 my $threshold = $confs->{threshold};
714 my $match = $confs->{match};
715 my $mismatch = $confs->{mismatch};
716 my $maxrepeat = $confs->{maxrepeat};
717
718 # new window
719 my $top = $mw -> Toplevel();
720 $top->title('einverted');
721 my $ent1 = $top -> Entry(-textvariable=>\$gap);
722 my $ent2 = $top -> Entry(-textvariable=>\$threshold);
723 my $ent3 = $top -> Entry(-textvariable=>\$match);
724 my $ent4 = $top -> Entry(-textvariable=>\$mismatch);
725 my $ent5 = $top -> Entry(-textvariable=>\$maxrepeat);
726 my $save = $top -> Button(-text=>"Save", -command => sub {
727 $config->param("EINVERTED.gap", $gap);
728 $config->param("EINVERTED.threshold", $threshold);
729 $config->param("EINVERTED.match", $match);
730 $config->param("EINVERTED.mismatch", $mismatch);
731 $config->param("EINVERTED.maxrepeat", $maxrepeat);
732 $config -> save();
733 $invert_button -> configure(-background => "$confcolour");
734 destroy $top;
735 });
736 my $close = $top -> Button(-text=>"Close", -command => sub { destroy $top; });
737 my $rtfm = $top -> Button(-text=>"einverted documentation", -command => sub { &rtfm("xterm -e \"$tfm einverted\"") });
738
739 # labels
740 my $lab1 = $top -> Label(-text=>"Einverted configuration",-relief=>"groove");
741 my $lab2 = $top -> Label(-text=>"Gap");
742 my $lab3 = $top -> Label(-text=>"Threshold");
743 my $lab4 = $top -> Label(-text=>"Match");
744 my $lab5 = $top -> Label(-text=>"Mismatch");
745 my $lab6 = $top -> Label(-text=>"Maxrepeat");
746
747 # geometry
748 $ent1 -> grid(-row=>1,-column=>1);
749 $ent2 -> grid(-row=>2,-column=>1);
750 $ent3 -> grid(-row=>3,-column=>1);
751 $ent4 -> grid(-row=>4,-column=>1);
752 $ent5 -> grid(-row=>5,-column=>1);
753 $rtfm -> grid(-row=>6,-column=>0,-columnspan=>2,-sticky=>"ew");
754 $save -> grid(-row=>7,-column=>0,-sticky=>"w");
755 $close -> grid(-row=>7,-column=>1,-sticky=>"e");
756 $lab1 -> grid(-row=>0,-column=>0,-columnspan=>2);
757 $lab2 -> grid(-row=>1,-column=>0);
758 $lab3 -> grid(-row=>2,-column=>0);
759 $lab4 -> grid(-row=>3,-column=>0);
760 $lab5 -> grid(-row=>4,-column=>0);
761 $lab6 -> grid(-row=>5,-column=>0);
762
763 }
764 # ETANDEM
765 sub tandem_conf
766 {
767 # vars
768 my $confs = $config->param(-block=>'ETANDEM');
769 my $uniform = $confs->{uniform};
770 my $mismatch = $confs->{mismatch};
771 my $minrepeat = $confs->{minrepeat};
772 # new window
773 my $top = $mw -> Toplevel();
774 $top->title('etandem');
775 my $ent1 = $top -> Entry(-textvariable=>\$uniform);
776 my $ent2 = $top -> Entry(-textvariable=>\$mismatch);
777 my $ent3 = $top -> Entry(-textvariable=>\$minrepeat);
778 my $save = $top -> Button(-text=>"Save", -command => sub {
779 $config->param("ETANDEM.program", $uniform);
780 $config->param("ETANDEM.database", $mismatch);
781 $config->param("ETANDEM.jobs", $minrepeat);
782 $config -> save();
783 $tandem_button -> configure(-background => "$confcolour");
784 destroy $top;
785 });
786 my $close = $top -> Button(-text=>"Close", -command => sub { destroy $top; });
787 my $rtfm = $top -> Button(-text=>"etandem documentation", -command => sub { &rtfm("xterm -e \"$tfm etandem\"") });
788
789 # labels
790 my $lab1 = $top -> Label(-text=>"Etandem configuration",-relief=>"groove");
791 my $lab2 = $top -> Label(-text=>"Uniform");
792 my $lab3 = $top -> Label(-text=>"Mismatch");
793 my $lab4 = $top -> Label(-text=>"Minrepeat");
794
795 # geometry
796 $ent1 -> grid(-row=>1,-column=>1);
797 $ent2 -> grid(-row=>2,-column=>1);
798 $ent3 -> grid(-row=>3,-column=>1);
799 $rtfm -> grid(-row=>4,-column=>0,-columnspan=>2,-sticky=>"ew");
800 $save -> grid(-row=>5,-column=>0,-sticky=>"w");
801 $close -> grid(-row=>5,-column=>1,-sticky=>"e");
802 $lab1 -> grid(-row=>0,-column=>0,-columnspan=>2);
803 $lab2 -> grid(-row=>1,-column=>0);
804 $lab3 -> grid(-row=>2,-column=>0);
805 $lab4 -> grid(-row=>3,-column=>0);
806
807
808 }
809 # GLIMMER
810 sub glim_conf
811 {
812 # vars
813 my $confs = $config->param(-block=>'GLIMMER');
814 my $arguments_longorfs = $confs->{arguments_longorfs};
815 my $arguments_glimmer2 = $confs->{arguments_glimmer2};
816
817 # new window
818 my $top = $mw -> Toplevel();
819 $top->title('glimmer');
820 my $ent1 = $top -> Entry(-textvariable=>\$arguments_longorfs);
821 my $ent2 = $top -> Entry(-textvariable=>\$arguments_glimmer2);
822 my $save = $top -> Button(-text=>"Save", -command => sub {
823 $config->param("GLIMMER.arguments_longorfs", $arguments_longorfs);
824 $config->param("GLIMMER.arguments_glimmer2", $arguments_glimmer2);
825 $config -> save();
826 $glim_button -> configure(-background => "$confcolour");
827 destroy $top;
828 });
829 my $close = $top -> Button(-text=>"Close", -command => sub { destroy $top; });
830 my $rtfm1 = $top -> Button(-text=>"glimmer documentation", -command => sub { &rtfm("xterm -e \"less /usr/local/bioinf/glimmer/glimmer/glimmer2.readme\"") });
831 my $rtfm2 = $top -> Button(-text=>"long-orfs documentation", -command => sub { &rtfm("xterm -e \"less /usr/local/bioinf/glimmer/glimmer/long-orfs.readme\"") });
832
833 # labels
834 my $lab1 = $top -> Label(-text=>"Glimmer configuration",-relief=>"groove");
835 my $lab2 = $top -> Label(-text=>"Glimmer arguments");
836 my $lab3 = $top -> Label(-text=>"Longorfs arguments");
837
838 # geometry
839 $ent1 -> grid(-row=>1,-column=>1);
840 $ent2 -> grid(-row=>2,-column=>1);
841 $rtfm1 -> grid(-row=>3,-column=>0,-columnspan=>2,-sticky=>"ew");
842 $rtfm2 -> grid(-row=>4,-column=>0,-columnspan=>2,-sticky=>"ew");
843 $save -> grid(-row=>5,-column=>0,-sticky=>"w");
844 $close -> grid(-row=>5,-column=>1,-sticky=>"e");
845 $lab1 -> grid(-row=>0,-column=>0,-columnspan=>2);
846 $lab2 -> grid(-row=>1,-column=>0);
847 $lab3 -> grid(-row=>2,-column=>0);
848 }
849 # PALINDROME
850 sub palin_conf
851 {
852 # vars
853 my $confs = $config->param(-block=>'PALINDROME');
854 my $minpallen = $confs->{minpallen};
855 my $maxpallen = $confs->{maxpallen};
856 my $gaplimit = $confs->{gaplimit};
857 my $nummismatches = $confs->{nummismatches};
858 my $overlap = $confs->{overlap};
859
860 # new window
861 my $top = $mw -> Toplevel();
862 $top->title('palindrome');
863 my $ent1 = $top -> Entry(-textvariable=>\$minpallen);
864 my $ent2 = $top -> Entry(-textvariable=>\$maxpallen);
865 my $ent3 = $top -> Entry(-textvariable=>\$gaplimit);
866 my $ent4 = $top -> Entry(-textvariable=>\$nummismatches);
867 my $ent5 = $top -> Entry(-textvariable=>\$overlap);
868 my $save = $top -> Button(-text=>"Save", -command => sub {
869 $config->param("PALINDROME.minpallen", $minpallen);
870 $config->param("PALINDROME.maxpallen", $maxpallen);
871 $config->param("PALINDROME.gaplimit", $gaplimit);
872 $config->param("PALINDROME.nummismatches", $nummismatches);
873 $config->param("PALINDROME.overlap", $overlap);
874 $config -> save();
875 $palin_button -> configure(-background => "$confcolour");
876 destroy $top;
877 });
878 my $close = $top -> Button(-text=>"Close", -command => sub { destroy $top; });
879 my $rtfm = $top -> Button(-text=>"palindrome documentation", -command => sub { &rtfm("xterm -e \"$tfm palindrome\"") });
880
881 # labels
882 my $lab1 = $top -> Label(-text=>"Palindrome configuration",-relief=>"groove");
883 my $lab2 = $top -> Label(-text=>"Minpallen");
884 my $lab3 = $top -> Label(-text=>"Maxpallen");
885 my $lab4 = $top -> Label(-text=>"Gaplimit");
886 my $lab5 = $top -> Label(-text=>"Nummismatches");
887 my $lab6 = $top -> Label(-text=>"overlap");
888
889 # geometry
890 $ent1 -> grid(-row=>1,-column=>1);
891 $ent2 -> grid(-row=>2,-column=>1);
892 $ent3 -> grid(-row=>3,-column=>1);
893 $ent4 -> grid(-row=>4,-column=>1);
894 $ent5 -> grid(-row=>5,-column=>1);
895 $rtfm -> grid(-row=>6,-column=>0,-columnspan=>2,-sticky=>"ew");
896 $save -> grid(-row=>7,-column=>0,-sticky=>"w");
897 $close -> grid(-row=>7,-column=>1,-sticky=>"e");
898 $lab1 -> grid(-row=>0,-column=>0,-columnspan=>2);
899 $lab2 -> grid(-row=>1,-column=>0);
900 $lab3 -> grid(-row=>2,-column=>0);
901 $lab4 -> grid(-row=>3,-column=>0);
902 $lab5 -> grid(-row=>4,-column=>0);
903 $lab6 -> grid(-row=>5,-column=>0);
904
905 }
906 # TRNASCAN
907 sub trna_conf
908 {
909 # vars
910 my $tconf = $config->param(-block=>'TRNASCAN');
911 my $searchmode = $tconf->{searchmode};
912 my $covariance = $tconf->{covariance};
913 my $showall = $tconf->{showall};
914 my $other_opts = $tconf->{other_opts};
915
916 # new window, buttons &c.
917 my $top = $mw -> Toplevel();
918 $top->title('trnascan');
919
920 # radio buttons
921 my $rad1 = $top -> Radiobutton(-text => 'Bacterial mode',
922 -value => "Bacterial",
923 -variable => \$searchmode);
924 my $rad2 = $top -> Radiobutton(-text => 'Archeal mode',
925 -value => "Archeal",
926 -variable => \$searchmode);
927 my $rad3 = $top -> Radiobutton(-text => 'Organellar mode',
928 -value => "Organellar",
929 -variable => \$searchmode);
930 my $rad4 = $top -> Radiobutton(-text => 'Eukaryotic mode',
931 -value => "Eukaryotic",
932 -variable => \$searchmode);
933 my $rad5 = $top -> Radiobutton(-text => 'General mode',
934 -value => "General",
935 -variable => \$searchmode);
936
937 # checkboxes
938 # most of this stuff is to translate from Y/N to 1/0
939 my %covar = ("Y" => 1, "N" => 0);
940 my %show = ("Y" => 1, "N" => 0);
941 my %revcovar = (1 => "Y", 0 => "N");
942 my %revshow = (1 => "Y", 0 => "N");
943 my $run_covar = $covar{$covariance};
944 my $run_show = $show{$showall};
945
946 my $check1 = $top -> Checkbutton(-text=>"Use covariance model", -variable=>\$run_covar);
947 my $check2 = $top -> Checkbutton(-text=>"Show pri. and sec. structure", -variable=>\$run_show);
948
949 # save the information
950 my $save = $top -> Button(-text=>"Save", -command => sub {
951 $config->param("TRNASCAN.searchmode", $searchmode);
952 $config->param("TRNASCAN.covariance", $revcovar{$run_covar});
953 $config->param("TRNASCAN.showall", $revshow{$run_show});
954 $config->param("TRNASCAN.other_opts", $other_opts);
955 $config -> save();
956 $trna_button -> configure(-background => "$confcolour");
957 destroy $top;
958 })->pack();
959 my $close = $top -> Button(-text=>"Close", -command => sub { destroy $top; });
960 my $rtfm = $top -> Button(-text=>"tRNAscan-SE documentation", -command => sub { &rtfm("xterm -e \"man /usr/share/man/man1/man1/tRNAscan-SE.1\"") });
961
962 # entries
963 my $ent2 = $top -> Entry(-textvariable=>\$other_opts);
964
965 # labels
966 my $lab1 = $top -> Label(-text=>"tRNAscan-SE configuration",-relief=>"groove");
967 my $lab2 = $top -> Label(-text=>"Other options");
968
969 # geometry
970 $lab1 -> grid(-row=>0,-column=>0,-columnspan=>2);
971 $rad1 -> grid(-row=>1,-column=>0,-columnspan=>2, -sticky=>"w");
972 $rad2 -> grid(-row=>2,-column=>0,-columnspan=>2, -sticky=>"w");
973 $rad3 -> grid(-row=>3,-column=>0,-columnspan=>2, -sticky=>"w");
974 $rad4 -> grid(-row=>4,-column=>0,-columnspan=>2, -sticky=>"w");
975 $rad5 -> grid(-row=>5,-column=>0,-columnspan=>2, -sticky=>"w");
976 $check1 -> grid(-row=>6,-column=>0,-columnspan=>2, -sticky=>"w");
977 $check2 -> grid(-row=>7,-column=>0,-columnspan=>2, -sticky=>"w");
978 $lab2 -> grid(-row=>8,-column=>0);
979 $ent2 -> grid(-row=>8,-column=>1);
980 $rtfm -> grid(-row=>9,-column=>0,-columnspan=>2,-sticky=>"ew");
981 $save -> grid(-row=>10,-column=>0,-sticky=>"w");
982 $close -> grid(-row=>10,-column=>1,-sticky=>"e");
983 }
984 # MSATFINDER
985 sub msat_conf
986 {
987 # vars
988 my $mconf = $config->param(-block=>'MSATFINDER');
989 my $flank_size = $mconf->{flank_size};
990 my $mrange = $mconf->{mrange};
991 my $engine = $mconf->{engine};
992 my $interrupts = $mconf->{interrupts};
993
994 # match the engine to the number
995 my %motor = (1 => "regex",
996 2 => "multipass",
997 3 => "iterative");
998 my %rotom = ("regex" => 1,
999 "multipass" => 2,
1000 "iterative" => 3);
1001 my $eng = $motor{$engine};
1002
1003
1004 # set up msats to search in order that they
1005 # may be written back to the config file
1006 my %detect=(1 => 0,
1007 2 => 0,
1008 3 => 0,
1009 4 => 0,
1010 5 => 0,
1011 6 => 0);
1012 my %thresh=(1 => 0,
1013 2 => 0,
1014 3 => 0,
1015 4 => 0,
1016 5 => 0,
1017 6 => 0);
1018 my @parts = (split/\|/, $mrange);
1019 foreach my $part (@parts)
1020 {
1021 my ($type,$thr) = split(/\+/,$part);
1022 $detect{$type} = 1;
1023 $thresh{$type} = $thr;
1024 }
1025
1026 # prepare the widgets
1027 # radio buttons
1028 my $top = $mw -> Toplevel();
1029 $top->title('msatfinder');
1030 my $rad1 = $top -> Radiobutton(-text => 'Regex',
1031 -value => "regex",
1032 -variable => \$eng);
1033 my $rad2 = $top -> Radiobutton(-text => 'Multipass',
1034 -value => "multipass",
1035 -variable => \$eng);
1036 my $rad3 = $top -> Radiobutton(-text => 'Iterative',
1037 -value => "iterative",
1038 -variable => \$eng);
1039 # Checkbuttons
1040 my $find_int = $top -> Checkbutton(-text=>"Find interrupted", -variable=>\$interrupts);
1041 my $b_mono = $top -> Checkbutton(-text=>"Mono", -variable=>\$detect{1});
1042 my $b_di = $top -> Checkbutton(-text=>"Di", -variable=>\$detect{2});
1043 my $b_tri = $top -> Checkbutton(-text=>"Tri", -variable=>\$detect{3});
1044 my $b_tetra = $top -> Checkbutton(-text=>"Tetra", -variable=>\$detect{4});
1045 my $b_penta = $top -> Checkbutton(-text=>"Penta", -variable=>\$detect{5});
1046 my $b_hexa = $top -> Checkbutton(-text=>"Hexa", -variable=>\$detect{6});
1047
1048 # text boxes
1049 my $t_flank = $top -> Entry(-textvariable=>\$flank_size);
1050 my $t_mono = $top -> Entry(-textvariable=>\$thresh{1});
1051 my $t_di = $top -> Entry(-textvariable=>\$thresh{2});
1052 my $t_tri = $top -> Entry(-textvariable=>\$thresh{3});
1053 my $t_tetra = $top -> Entry(-textvariable=>\$thresh{4});
1054 my $t_penta = $top -> Entry(-textvariable=>\$thresh{5});
1055 my $t_hexa = $top -> Entry(-textvariable=>\$thresh{6});
1056
1057 # labels
1058 my $mainlabel = $top -> Label(-text=>"Msatfinder configuration",-relief=>"groove");
1059 my $flanklabel = $top -> Label(-text=>"Flank size");
1060 my $englab = $top -> Label(-text=>"Msat finding engine");
1061
1062 # save files when save pressed
1063 # save the information
1064 my $save = $top -> Button(-text=>"Save", -command => sub {
1065 # re-form the string passed to $mconf
1066 my @newranges;
1067 foreach (my $i=1;$i<=6;$i++)
1068 {
1069 if (defined $detect{$i})
1070 {
1071 push (@newranges,"$i+$thresh{$i}");
1072 }
1073 }
1074 my $newmrange = join("|",@newranges);
1075 $config->param("MSATFINDER.interrupts", $interrupts);
1076 $config->param("MSATFINDER.engine", $rotom{$eng});
1077 $config->param("MSATFINDER.flank_size", $flank_size);
1078 $config->param("MSATFINDER.mrange", "\"$newmrange\"");
1079 $config -> save();
1080 $msat_button -> configure(-background => "$confcolour");
1081 destroy $top;
1082 })->pack();
1083 my $close = $top -> Button(-text=>"Close", -command => sub { destroy $top; });
1084 my $rtfm = $top -> Button(-text=>"msatfinder documentation (html)", -command => sub { &rtfm("xterm -e \"lynx $installdir/etc/msatfinder_manual.html\"") });
1085
1086 # configure the layout
1087 $mainlabel -> grid(-row=>0,-column=>0,-columnspan=>2);
1088 $b_mono -> grid(-row=>1,-column=>0,-sticky=>"w");
1089 $b_di -> grid(-row=>2,-column=>0,-sticky=>"w");
1090 $b_tri -> grid(-row=>3,-column=>0,-sticky=>"w");
1091 $b_tetra -> grid(-row=>4,-column=>0,-sticky=>"w");
1092 $b_penta -> grid(-row=>5,-column=>0,-sticky=>"w");
1093 $b_hexa -> grid(-row=>6,-column=>0,-sticky=>"w");
1094 $t_mono -> grid(-row=>1,-column=>1);
1095 $t_di -> grid(-row=>2,-column=>1);
1096 $t_tri -> grid(-row=>3,-column=>1);
1097 $t_tetra -> grid(-row=>4,-column=>1);
1098 $t_penta -> grid(-row=>5,-column=>1);
1099 $t_hexa -> grid(-row=>6,-column=>1);
1100 $find_int -> grid(-row=>7,-column=>0,-sticky=>"w");
1101 $flanklabel -> grid(-row=>8,-column=>0,-sticky=>"w");
1102 $t_flank -> grid(-row=>8,-column=>1);
1103 $englab -> grid(-row=>9,-column=>0);
1104 $rad1 -> grid(-row=>9,-column=>1);
1105 $rad2 -> grid(-row=>10,-column=>0);
1106 $rad3 -> grid(-row=>10,-column=>1);
1107
1108 $rtfm -> grid(-row=>11,-column=>0,-columnspan=>2,-sticky=>"ew");
1109 $save -> grid(-row=>12,-column=>0,-sticky=>"w");
1110 $close -> grid(-row=>12,-column=>1,-sticky=>"e");
1111
1112 }
1113 # PFAM
1114 sub pfam_conf
1115 {
1116 my $pconf = $config->param(-block=>'PFAM');
1117 my $fast = $pconf->{fast};
1118 my $overlap = $pconf->{overlap};
1119 my $database = $pconf->{database};
1120 my $other_opts = $pconf->{other_opts};
1121
1122 # new window
1123 my $top = $mw -> Toplevel();
1124 $top->title('pfam scan');
1125
1126 # radio buttons
1127 my $fast_but = $top -> Radiobutton(-text => 'Fast',
1128 -value => "fast",
1129 -variable => \$fast);
1130 my $olap_but = $top -> Radiobutton(-text => 'Overlap',
1131 -value => "overlap",
1132 -variable => \$overlap);
1133 my $ent_db = $top -> Entry(-textvariable=>\$database);
1134 my $ent_oo = $top -> Entry(-textvariable=>\$other_opts);
1135 my $save = $top -> Button(-text=>"Save", -command => sub {
1136 $config->param("PFAM.fast", $fast);
1137 $config->param("PFAM.database", $database);
1138 $config->param("PFAM.overlap", $overlap);
1139 $config->param("PFAM.other_opts", $other_opts);
1140 $config -> save();
1141 $pfam_button -> configure(-background => "$confcolour");
1142 destroy $top;
1143 });
1144 my $close = $top -> Button(-text=>"Close", -command => sub { destroy $top; });
1145 my $rtfm = $top -> Button(-text=>"pfam-scan documentation (html)", -command => sub { &rtfm("xterm -e \"lynx $installdir/etc/pfam_scan.html\"") });
1146
1147
1148 # labels
1149 my $lab_top = $top -> Label(-text=>"Pfam configuration",-relief=>"groove");
1150 my $lab_db = $top -> Label(-text=>"Database");
1151 my $lab_oo = $top -> Label(-text=>"Other options");
1152
1153 # geometry
1154 $lab_top -> grid(-row=>0,-column=>0,-columnspan=>2);
1155 $fast_but -> grid(-row=>1,-column=>0,-columnspan=>2);
1156 $olap_but -> grid(-row=>2,-column=>0,-columnspan=>2);
1157 $lab_db -> grid(-row=>3,-column=>0);
1158 $lab_oo -> grid(-row=>4,-column=>0);
1159 $ent_db -> grid(-row=>3,-column=>1);
1160 $ent_oo -> grid(-row=>4,-column=>1);
1161 $rtfm -> grid(-row=>5,-column=>0,-columnspan=>2,-sticky=>"ew");
1162 $save -> grid(-row=>6,-column=>0,-sticky=>"w");
1163 $close -> grid(-row=>6,-column=>1,-sticky=>"e");
1164
1165 }
1166
1167 # awesome rtfm facility
1168 sub rtfm
1169 {
1170 my $string = shift;
1171
1172 # non blocking execution of whatever
1173 # shell command is passed
1174 my $proc = Proc::Simple->new();
1175 return $proc->start("$string");
1176 }
1177
1178 # blast upon the database that's downloaded
1179 # from Newcastle
1180 # CONSBLAST
1181 sub consblast_conf
1182 {
1183 # vars
1184 my $confs = $config->param(-block=>'CONSBLAST');
1185 my $program = $confs->{program};
1186 my $database = $confs->{database};
1187 my $other_opts = $confs->{other_opts};
1188
1189 # new window
1190 my $top = $mw -> Toplevel();
1191 $top->title('consblast');
1192
1193 # radio buttons
1194 my $rad1 = $top -> Radiobutton(-text => 'blastn',
1195 -value => "blastn",
1196 -variable => \$program);
1197 my $rad3 = $top -> Radiobutton(-text => 'tblastx',
1198 -value => "tblastx",
1199 -variable => \$program);
1200
1201
1202 my $ent3 = $top -> Entry(-textvariable=>\$other_opts);
1203 my $dbent = $top -> Entry(-textvariable=>\$database);
1204 my $save = $top -> Button(-text=>"Save", -command => sub {
1205 $config->param("CONSBLAST.program", $program);
1206 $config->param("CONSBLAST.database", $database);
1207 $config->param("CONSBLAST.other_opts", $other_opts);
1208 $config -> save();
1209 $consblast_button -> configure(-background => "$confcolour");
1210 destroy $top;
1211 });
1212 my $close = $top -> Button(-text=>"Close", -command => sub { destroy $top; });
1213 my $rtfm = $top -> Button(-text=>"blastall documentation", -command => sub { &rtfm("xterm -e \"man blastall\"") });
1214
1215 # labels
1216 my $lab1 = $top -> Label(-text=>"Self-blast configuration",-relief=>"groove");
1217 my $lab2 = $top -> Label(-text=>"Expect");
1218 my $dblab = $top -> Label(-text=>"Database");
1219 my $lab3 = $top -> Label(-text=>"Other options");
1220
1221 # geometry
1222 $lab1 -> grid(-row=>0,-column=>0,-columnspan=>2);
1223 $rad1 -> grid(-row=>1,-column=>0,-columnspan=>2);
1224 $rad3 -> grid(-row=>2,-column=>0,-columnspan=>2);
1225 $lab3 -> grid(-row=>4,-column=>0);
1226 $ent3 -> grid(-row=>4,-column=>1);
1227 $dblab -> grid(-row=>3,-column=>0);
1228 $dbent -> grid(-row=>3,-column=>1);
1229 $rtfm -> grid(-row=>5,-column=>0,-columnspan=>2,-sticky=>"ew");
1230 $save -> grid(-row=>6,-column=>0,-sticky=>"w");
1231 $close -> grid(-row=>6,-column=>1,-sticky=>"e");
1232 }
1233
1234 # BIGBLAST
1235 sub bigblast_conf
1236 {
1237 # vars
1238 my $confs = $config->param(-block=>'BIGBLAST');
1239 my $program = $confs->{program};
1240 my $database = $confs->{database};
1241 my $jobs = $confs->{jobs};
1242 my $other_opts = $confs->{other_opts};
1243 # new window
1244 my $top = $mw -> Toplevel();
1245 $top->title('bigblast');
1246
1247 # radio buttons
1248 my $rad1 = $top -> Radiobutton(-text => 'blastn',
1249 -value => "blastn",
1250 -variable => \$program);
1251 my $rad2 = $top -> Radiobutton(-text => 'blastx',
1252 -value => "blastx",
1253 -variable => \$program);
1254 my $rad3 = $top -> Radiobutton(-text => 'tblastx',
1255 -value => "tblastx",
1256 -variable => \$program);
1257
1258 my $ent2 = $top -> Entry(-textvariable=>\$database);
1259 my $ent3 = $top -> Entry(-textvariable=>\$jobs);
1260 my $ent4 = $top -> Entry(-textvariable=>\$other_opts);
1261 my $save = $top -> Button(-text=>"Save", -command => sub {
1262 $config->param("BIGBLAST.program", $program);
1263 $config->param("BIGBLAST.database", $database);
1264 $config->param("BIGBLAST.jobs", $jobs);
1265 $config->param("BIGBLAST.other_opts", $other_opts);
1266 $config -> save();
1267 $bigblast_button -> configure(-background => "$confcolour");
1268 destroy $top;
1269 });
1270 my $close = $top -> Button(-text=>"Close", -command => sub { destroy $top; });
1271 my $rtfm = $top -> Button(-text=>"big_blast.pl usage", -command => sub { &rtfm("xterm -e \"less /usr/local/bioinf/yamap/yamap/etc/big_blast.txt\"") });
1272
1273
1274 # labels
1275 my $lab1 = $top -> Label(-text=>"Big-blast configuration",-relief=>"groove");
1276 my $lab2 = $top -> Label(-text=>"Database");
1277 my $lab3 = $top -> Label(-text=>"Number of jobs");
1278 my $lab4 = $top -> Label(-text=>"Other options");
1279
1280 # geometry
1281 $lab1 -> grid(-row=>0,-column=>0,-columnspan=>2);
1282 $rad1 -> grid(-row=>1,-column=>0,-columnspan=>2);
1283 $rad2 -> grid(-row=>2,-column=>0,-columnspan=>2);
1284 $rad3 -> grid(-row=>3,-column=>0,-columnspan=>2);
1285 $lab2 -> grid(-row=>4,-column=>0);
1286 $lab3 -> grid(-row=>5,-column=>0);
1287 $lab4 -> grid(-row=>6,-column=>0);
1288 $ent2 -> grid(-row=>4,-column=>1);
1289 $ent3 -> grid(-row=>5,-column=>1);
1290 $ent4 -> grid(-row=>6,-column=>1);
1291 $rtfm -> grid(-row=>7,-column=>0,-columnspan=>2,-sticky=>"ew");
1292 $save -> grid(-row=>8,-column=>0,-sticky=>"w");
1293 $close -> grid(-row=>8,-column=>1,-sticky=>"e");
1294
1295 }
1296 # TRANSTERM
1297 sub trans_conf
1298 {
1299 # vars
1300 my $tconf = $config->param(-block=>'TRANSTERM');
1301 my $version = $tconf->{version};
1302 my $other_opts = $tconf->{other_opts};
1303
1304 # new window, buttons &c.
1305 my $top = $mw -> Toplevel();
1306 $top->title('transterm');
1307
1308 # radio buttons
1309 my $rad1 = $top -> Radiobutton(-text => 'V. 1.0 confidence',
1310 -value => 1,
1311 -variable => \$version);
1312 my $rad2 = $top -> Radiobutton(-text => 'V. 2.0 confidence',
1313 -value => 2,
1314 -variable => \$version);
1315
1316 # save the information
1317 my $save = $top -> Button(-text=>"Save", -command => sub {
1318 $config->param("TRANSTERM.version", $version);
1319 $config->param("TRANSTERM.other_opts", $other_opts);
1320 $config -> save();
1321 $trna_button -> configure(-background => "$confcolour");
1322 destroy $top;
1323 })->pack();
1324 my $close = $top -> Button(-text=>"Close", -command => sub { destroy $top; });
1325 my $rtfm = $top -> Button(-text=>"TransTerm documentation", -command => sub { &rtfm("xterm -e \"less /usr/local/bioinf/transterm/transterm/USAGE.txt\"") });
1326
1327 # entries
1328 my $ent2 = $top -> Entry(-textvariable=>\$other_opts);
1329
1330 # labels
1331 my $lab1 = $top -> Label(-text=>"TransTerm configuration",-relief=>"groove");
1332 my $lab2 = $top -> Label(-text=>"Other options");
1333
1334 # geometry
1335 $lab1 -> grid(-row=>0,-column=>0,-columnspan=>2);
1336 $rad1 -> grid(-row=>1,-column=>0,-columnspan=>2, -sticky=>"w");
1337 $rad2 -> grid(-row=>2,-column=>0,-columnspan=>2, -sticky=>"w");
1338 $lab2 -> grid(-row=>3,-column=>0);
1339 $ent2 -> grid(-row=>3,-column=>1);
1340 $rtfm -> grid(-row=>4,-column=>0,-columnspan=>2,-sticky=>"ew");
1341 $save -> grid(-row=>5,-column=>0,-sticky=>"w");
1342 $close -> grid(-row=>5,-column=>1,-sticky=>"e");
1343 }
1344 # QUICKMINE
1345 sub quickmine_conf
1346 {
1347 # vars
1348 my $cfg = new Config::Simple($quickmine_file);
1349 #my $path2proteins = $cfg->param('path2proteins');
1350 #my $ext = $cfg->param('ext');
1351 my $path2scripts = "$installdir/bin";
1352 my $outdirpath = "$basedir/$outdir";
1353 my $formatdb = $cfg->param("PARAMS.formatdb");
1354 ##my $end = $cfg->param('end');
1355 #my $condor_output = $cfg->param('condor_output');
1356 #my $record_separator = $cfg->param('record_separator');
1357 my $write_fasta_files = $cfg->param("LEAVE_ALONE.write_fasta_files");
1358 my $sig_thresh = $cfg->param("PARAMS.sig_thresh");
1359 my $self_blast = $cfg->param("PARAMS.self_hit");
1360
1361 my $parse = $cfg->param("RUN.parse");
1362 my $format = $cfg->param("RUN.format");
1363 my $quickmine = $cfg->param("RUN.quickmine");
1364 my $split = $cfg->param("RUN.split");
1365 my $orphans = $cfg->param("RUN.orphans");
1366 my $hits = $cfg->param("RUN.hits");
1367 my $genetable = $cfg->param("RUN.genetable");
1368 my $orphan_count = $cfg->param("RUN.orphan_count");
1369 my $orphan_size = $cfg->param("RUN.orphan_size");
1370 my $paralogue_count = $cfg->param("RUN.paralogue_count");
1371 my $increment = $cfg->param("RUN.increment");
1372 my $time = $cfg->param("RUN.time");
1373 my $binary = $cfg->param("RUN.binary");
1374 my $plots = $cfg->param("RUN.plots");
1375 my $indiv_plot = $cfg->param("RUN.indiv_plot");
1376 my $dot_plot = $cfg->param("RUN.dot_plot");
1377 my $summarizer = $cfg->param("RUN.summarizer");
1378
1379 my $default = $cfg->param("PARAMS.advanced");
1380 # prepare the widgets
1381
1382 my $top = $mw -> Toplevel();
1383 $top->title('QuickMine');
1384
1385 #frames
1386 my $fra1 = $top -> Frame()->pack(-side => 'top', -fill=>'x');
1387 my $fra2 = $top -> Frame()->pack(-side => 'top',-fill=>'x');
1388 my $fra3 = $top -> Frame(-borderwidth => '3')->pack(-side => 'top',-fill=>'x');
1389
1390 # notebook tabs
1391 my $n = $top->NoteBook(qw/-ipadx 6 -ipady 6/)->pack(-fill=>'x');
1392 my $basic = $n->add(qw/basic -label Basic
1393 -underline 0/);
1394 my $advance = $n->add(qw/advance -label Advanced
1395 -underline 0/);
1396
1397
1398
1399
1400 #more frames
1401 my $fra4 = $top -> Frame(-relief => 'groove', -borderwidth => '3')->pack(-side => 'top',-fill=>'x');
1402
1403 #frames within tabs
1404 my $tabfra1 = $basic -> Frame(-borderwidth => '3')->pack(-side => 'top',-fill=>'x');
1405 my $tabfra2 = $basic -> Frame(-relief => 'groove', -borderwidth => '5')->pack(-side => 'top',-fill=>'both');
1406 my $tabfra3 = $advance -> Frame(-relief => 'groove', -borderwidth => '3')->pack(-side => 'top',-fill=>'x');
1407 my $tabfra4 = $advance -> Frame(-relief => 'groove', -borderwidth => '5')->pack(-side => 'top',-fill=>'x');
1408
1409 # radio buttons
1410 my $rad1 = $fra1 -> Radiobutton(-text => 'Self-Blast', -value => '1', -variable =>\$self_blast);
1411 my $rad2 = $fra2 -> Radiobutton(-text => 'Database Blast', -value => '0', -variable =>\$self_blast);
1412 my $rad3 = $tabfra2 -> Radiobutton(-text => 'Use Default Settings', -value => '1', -variable =>\$default);
1413 my $rad4 = $tabfra2 -> Radiobutton(-text => 'Use Advanced Settings', -value => '0', -variable =>\$default);
1414
1415 # Checkbuttons
1416 my $parseb = $tabfra4 -> Checkbutton(-text=>"Parse input files", -variable =>\$parse);
1417 my $quick_blastb = $tabfra4 -> Checkbutton(-text=>"Perform BLASTs", -variable =>\$quickmine);
1418 my $get_orphansb = $tabfra4 -> Checkbutton(-text=>"Parse BLAST reports", -variable =>\$orphans);
1419 my $orphan_countb = $tabfra4 -> Checkbutton(-text=>"Count orphans", -variable =>\$orphan_count);
1420 my $syntenyb = $tabfra4 -> Checkbutton(-text=>"Plot synteny maps", -variable =>\$dot_plot);
1421
1422 # text boxes
1423 my $quick_thresh = $fra3 -> Entry(-textvariable=>\$sig_thresh);
1424
1425 # blast button
1426 $sblastb = $fra1 -> Button(-text=>"Configure", -command =>\&quick_selfblast_conf);
1427 $dblastb = $fra2 -> Button(-text=>"Configure", -command =>\&quick_dbblast_conf);
1428
1429 # labels
1430 my $quick_description = $tabfra1 -> Label(-text=>"Quickmine is a computational pipeline comprised \nof several scripts. Advanced settings allow you to\n choose which parts of the pipeline to run. Its \nrecommended that you use the default settings");
1431 my $mainlabel = $top -> Label(-text=>"QuickMine configuration",-relief=>"groove");
1432 my $threshlabel = $fra3 -> Label(-text=>"Threshold Score");
1433 #my $englab = $top -> Label(-text=>"Msat finding engine");
1434
1435 #check for default values
1436 if ($default == 1)
1437 {
1438 $parse = 1;
1439 $quickmine = 1;
1440 $orphans = 1;
1441 $orphan_count = 0;
1442 $dot_plot = 0;
1443 }
1444
1445 # save files when save pressed
1446 # save the information
1447 my $save = $fra4 -> Button(-text=>"Save", -command => sub {
1448 # create new instance of the config file so can keep the changes made by the blast subroutines
1449 my $cfg2 = new Config::Simple($quickmine_file);
1450 # re-form the string passed to $mconf
1451 $cfg2->param("PARAMS.sig_thresh", $sig_thresh);
1452 $cfg2->param("LEAVE_ALONE.write_fasta_files", $write_fasta_files);
1453 $cfg2->param("RUN.parse", $parse);
1454 $cfg2->param("RUN.format", $self_blast);
1455
1456 $cfg2->param("RUN.quickmine", $quickmine);
1457 $cfg2->param("RUN.split", $quickmine);
1458
1459 $cfg2->param("RUN.orphans", $orphans);
1460 $cfg2->param("RUN.binary", $orphans);
1461 $cfg2->param("RUN.hits", $orphans);
1462 $cfg2->param("RUN.genetable", $orphans);
1463
1464 $cfg2->param("RUN.orphan_count", $orphan_count);
1465 $cfg2->param("RUN.orphan_size", $orphan_count);
1466 $cfg2->param("RUN.paralogue_count", $orphan_count);
1467 $cfg2->param("RUN.increment", $orphan_count);
1468 $cfg2->param("RUN.time", $orphan_count);
1469 $cfg2->param("RUN.plots", $orphan_count);
1470 $cfg2->param("RUN.indiv_plot", $orphan_count);
1471
1472 $cfg2->param("RUN.dot_plot", $dot_plot);
1473 $cfg2->param("PARAMS.self_hit", $self_blast);
1474
1475 $cfg2->param("PATHS.path2scripts", $path2scripts);
1476
1477 $cfg2->param("PARAMS.advanced", $default);
1478
1479 $cfg2 -> save();
1480 $quickmine_button -> configure(-background => "$confcolour");
1481 destroy $top;
1482 });
1483 my $close = $fra4 -> Button(-text=>"Close", -command => sub { destroy $top; });
1484 my $rtfm = $fra4 -> Button(-text=>"QuickMine Documentation (html)", -command => sub { &rtfm("xterm -e \"lynx $installdir/etc/quickmine_manual.html\"") });
1485
1486
1487 # configure the layout
1488 #$mainlabel -> pack(-side=>'top',-anchor =>'n', -fill=>'x');
1489 $quick_description -> pack(-side=>'left', -anchor=>'w', -fill=>'y');
1490 $rad3 -> pack(-side=>'top', -anchor=>'w', -fill=>'y');
1491 $rad4 -> pack(-side=>'top', -anchor=>'w', -fill=>'y');
1492 $rad1 -> pack(-side=>'left',-anchor =>'w', -fill=>'y');
1493 $sblastb -> pack(-side=>'right',-anchor =>'e',-fill=>'y');
1494 $rad2 -> pack(-side=>'left',-anchor =>'w',-fill=>'y');
1495 $dblastb -> pack(-side=>'right',-anchor =>'e',-fill=>'y');
1496 $parseb-> pack(-side=>'top',-anchor =>'w', -fill=>'y');
1497 $quick_blastb-> pack(-side=>'top',-anchor =>'w', -fill=>'y');
1498 $get_orphansb-> pack(-side=>'top',-anchor =>'w', -fill=>'y');
1499 $orphan_countb-> pack(-side=>'top',-anchor =>'w', -fill=>'y');
1500 $syntenyb-> pack(-side=>'top',-anchor =>'w', -fill=>'y');
1501 $threshlabel-> pack(-side=>'left',-anchor =>'w',-fill=>'y');
1502 $quick_thresh-> pack(-side=>'right',-anchor =>'e',-fill=>'y');
1503
1504 $rtfm -> pack(-side=>'top',-fill=>'x');
1505 $save -> pack(-side=>'left',-anchor =>'w',-fill=>'y');
1506 $close -> pack(-side=>'right',-anchor =>'e',-fill=>'y');
1507 }
1508 # DBBLAST FOR QUICKMINE
1509 sub quick_dbblast_conf
1510 {
1511 # vars
1512 my $cfg = new Config::Simple($quickmine_file);
1513 my $program = $cfg->param("PARAMS.blast_programme");
1514 my $blast_command = $cfg->param("PARAMS.blast_command");
1515 my $database;
1516 my $other_opts;
1517 my $proc = $paths->param(-block=>'PROCESSING');
1518 my $blast_exec = $proc->{dbblast};
1519 #regexp on blast command to obtain individual parts
1520 $blast_command =~m/-d (.*)/;
1521 my $temp_command = $1;
1522 if ($temp_command =~m/\s-.\s/)
1523 {
1524 $temp_command =~m/(.*?)\s(-.*)/;
1525 $database = $1;
1526 $other_opts = $2;
1527 }
1528 else
1529 {
1530 $database = $temp_command;
1531 }
1532 #replace \ with quotes
1533 $other_opts =~s/\\/\"/g;
1534 # new window
1535 my $top = $mw -> Toplevel();
1536 $top->title('dbblast');
1537
1538 # radio buttons
1539 my $rad0 = $top -> Radiobutton(-text => 'blastn',-value => "blastn",-variable => \$program);
1540 my $rad1 = $top -> Radiobutton(-text => 'blastx',-value => "blastx",-variable => \$program);
1541 my $rad2 = $top -> Radiobutton(-text => 'tblastx',-value => "tblastx",-variable => \$program);
1542 my $rad3 = $top -> Radiobutton(-text => 'blastp',-value => "blastp",-variable => \$program);
1543
1544 my $ent2 = $top -> Entry(-textvariable=>\$database);
1545 my $ent4 = $top -> Entry(-textvariable=>\$other_opts);
1546 my $save = $top -> Button(-text=>"Save", -command => sub {
1547 $cfg->param("PARAMS.blast_programme", $program);
1548 # put the quotes back in
1549 $other_opts =~s/\"/\\/g;
1550 $blast_command = "$blast_exec -p $program -d $database $other_opts";
1551 $cfg->param("PARAMS.blast_command", $blast_command);
1552 my $count_end = "_SELF_"."$program"."_overview.html";
1553 $cfg->param("ENDINGS.count_end",$count_end);
1554 my $time_end = "_orphan_increment.html";
1555 $cfg->param("ENDINGS.time_end", $time_end);
1556 my $matrix_end = "_SELF_"."$program"."_matrix.html";
1557 $cfg->param("ENDINGS.matrix_end", $matrix_end);
1558 my $end = "_SELF_"."$program"."_overview.html.hits.html";
1559 $cfg->param("ENDINGS.end",$end);
1560 $cfg -> save();
1561 $dblastb -> configure(-background => "$confcolour");
1562 destroy $top;
1563 });
1564 my $close = $top -> Button(-text=>"Close", -command => sub { destroy $top; });
1565 my $rtfm = $top -> Button(-text=>"blastall documentation", -command => sub { &rtfm("xterm -e \"man blastall\"") });
1566
1567 # labels
1568 my $lab1 = $top -> Label(-text=>"DB-blast configuration",-relief=>"groove");
1569 my $lab2 = $top -> Label(-text=>"Database");
1570 my $lab4 = $top -> Label(-text=>"Other options");
1571
1572 # geometry
1573 $lab1 -> grid(-row=>0,-column=>0,-columnspan=>2);
1574 $rad0 -> grid(-row=>1,-column=>0,-columnspan=>2,-sticky=>"w");
1575 $rad1 -> grid(-row=>2,-column=>0,-columnspan=>2,-sticky=>"w");
1576 $rad2 -> grid(-row=>3,-column=>0,-columnspan=>2,-sticky=>"w");
1577 $rad3 -> grid(-row=>4,-column=>0,-columnspan=>2,-sticky=>"w");
1578 $lab2 -> grid(-row=>5,-column=>0,-sticky=>"w");
1579 $lab4 -> grid(-row=>6,-column=>0,-sticky=>"w");
1580 $ent2 -> grid(-row=>5,-column=>1,-sticky=>"w");
1581 $ent4 -> grid(-row=>6,-column=>1,-sticky=>"w");
1582 $rtfm -> grid(-row=>9,-column=>0,-columnspan=>2,-sticky=>"ew");
1583 $save -> grid(-row=>10,-column=>0,-sticky=>"w");
1584 $close -> grid(-row=>10,-column=>1,-sticky=>"e");
1585
1586 }
1587 # SELFBLAST
1588 sub quick_selfblast_conf
1589 {
1590 # vars
1591 # vars
1592 my $cfg = new Config::Simple($quickmine_file);
1593 my $program = $cfg->param("PARAMS.blast_programme");
1594 my $blast_command = $cfg->param("PARAMS.blast_command");
1595 my $formatdb = $cfg->param("PARAMS.formatdb");
1596 my $database;
1597 my $other_opts;
1598 my $proc = $paths->param(-block=>'PROCESSING');
1599 my $blast_exec = $proc->{dbblast};
1600 my $format_exec = $proc->{formatdb};
1601 #regexp on blast command to obtain individual parts
1602 $blast_command =~m/-d (.*)/;
1603 my $temp_command = $1;
1604 if ($temp_command =~m/\s-.\s/)
1605 {
1606 $temp_command =~m/(.*?)\s(-.*)/;
1607 $database = $1;
1608 $other_opts = $2;
1609 }
1610 else
1611 {
1612 $database = $temp_command;
1613 }
1614 $database = "$outdir/SELF_blast_database";
1615 #replace \ with quotes
1616 $other_opts =~s/\\/\"/g;
1617
1618 #regex on formatdb to get sequence type
1619 $formatdb =~m/-p\s([T|F])/;
1620 my $sequence_type = $1;
1621 # new window
1622 my $top = $mw -> Toplevel();
1623 $top->title('dbblast');
1624
1625 # Tried using frames to create better looking window.
1626 # Takes time and would need to do for all windows. Large operation. Do when have chance.
1627
1628 # frames
1629 my $fra5 = $top -> Frame(-relief => 'groove', -borderwidth => '3')->pack(-side => 'top', -fill => 'x');
1630 my $fra0 = $top -> Frame(-relief => 'groove', -borderwidth => '3')->pack(-side => 'top', -fill => 'x');
1631 my $fra1 = $top -> Frame(-relief => 'groove', -borderwidth => '3')->pack(-side => 'top', -fill => 'x');
1632 my $fra2 = $top -> Frame(-relief => 'groove', -borderwidth => '3')->pack(-side => 'top', -fill => 'x');
1633 my $fra3 = $top -> Frame(-relief => 'groove', -borderwidth => '3')->pack(-side => 'top', -fill => 'x');
1634 # radio buttons
1635 my $rad0 = $fra0 -> Radiobutton(-text => 'blastn',-value => "blastn",-variable => \$program);
1636 my $rad1 = $fra0 -> Radiobutton(-text => 'blastx',-value => "blastx",-variable => \$program);
1637 my $rad2 = $fra0 -> Radiobutton(-text => 'tblastx',-value => "tblastx",-variable => \$program);
1638 my $rad3 = $fra0 -> Radiobutton(-text => 'blastp',-value => "blastp",-variable => \$program);
1639 my $rad4 = $fra1 -> Radiobutton(-text => 'DNA',-value => "F",-variable => \$sequence_type);
1640 my $rad5 = $fra1 -> Radiobutton(-text => 'Protein',-value => "T",-variable => \$sequence_type);
1641 my $ent4 = $fra2 -> Entry(-textvariable=>\$other_opts);
1642 my $save = $fra3 -> Button(-text=>"Save", -command => sub {
1643 $cfg->param("PARAMS.blast_programme", $program);
1644 # put the quotes back in
1645 $other_opts =~s/\"/\\/g;
1646 $blast_command = "$blast_exec -p $program -d $database $other_opts";
1647 $cfg->param("PARAMS.blast_command", $blast_command);
1648 $formatdb = "$format_exec -i $database -p $sequence_type -o F";
1649 $cfg->param("PARAMS.formatdb", $formatdb);
1650 my $count_end = "_SELF_"."$program"."_overview.html";
1651 $cfg->param("ENDINGS.count_end",$count_end);
1652 my $time_end = "_orphan_increment.html";
1653 $cfg->param("ENDINGS.time_end", $time_end);
1654 my $matrix_end = "_SELF_"."$program"."_matrix.html";
1655 $cfg->param("ENDINGS.matrix_end", $matrix_end);
1656 my $end = "_SELF_"."$program"."_overview.html.hits.html";
1657 $cfg->param("ENDINGS.end",$end);
1658 $cfg -> save();
1659 $sblastb -> configure(-background => "$confcolour");
1660 destroy $top;
1661 });
1662 my $close = $fra3 -> Button(-text=>"Close", -command => sub { destroy $top; });
1663 my $rtfm = $fra3 -> Button(-text=>"blastall documentation", -command => sub { &rtfm("xterm -e \"man blastall\"") });
1664
1665 # labels
1666 my $lab1 = $fra5 -> Label(-text=>"Self-Blast configuration");
1667 my $lab3 = $fra1 -> Label(-text=>"Input type");
1668 my $lab4 = $fra2 -> Label(-text=>"BLAST options");
1669
1670 # pack the widgets
1671 $lab1 -> pack();
1672 $rad0 -> pack(-side=>'left');
1673 $rad1 -> pack(-side=>'left');
1674 $rad2 -> pack(-side=>'left');
1675 $rad3 -> pack(-side=>'left');
1676 $lab3 -> pack();
1677 $rad4 -> pack(-side=>'left');
1678 $rad5 -> pack(-side=>'left');
1679 $lab4 -> pack(-side=>'left');
1680 $ent4 -> pack(-side=>'right');
1681 $rtfm -> pack();
1682 $save -> pack(-side=>'left');
1683 $close -> pack(-side=>'right');
1684 # geometry
1685 #$lab1 -> grid(-row=>0,-column=>0,-columnspan=>2,-sticky=>"w");
1686 #$rad0 -> grid(-row=>1,-column=>0,-columnspan=>2,-sticky=>"w");
1687 #$rad1 -> grid(-row=>2,-column=>0,-columnspan=>2,-sticky=>"w");
1688 #$rad2 -> grid(-row=>3,-column=>0,-columnspan=>2,-sticky=>"w");
1689 #$rad3 -> grid(-row=>4,-column=>0,-columnspan=>2,-sticky=>"w");
1690 #$lab3 -> grid(-row=>5,-column=>0,-columnspan=>2,-sticky=>"w");
1691 #$rad4 -> grid(-row=>6,-column=>0,-columnspan=>2,-sticky=>"w");
1692 #$rad5 -> grid(-row=>7,-column=>0,-columnspan=>2,-sticky=>"w");
1693 #$lab4 -> grid(-row=>9,-column=>0,-sticky=>"w");
1694 #$ent4 -> grid(-row=>9,-column=>1,-sticky=>"w");
1695 #$rtfm -> grid(-row=>12,-column=>0,-columnspan=>2,-sticky=>"ew");
1696 #$save -> grid(-row=>13,-column=>0,-sticky=>"w");
1697 #$close -> grid(-row=>13,-column=>1,-sticky=>"e");
1698
1699 }