pp --gui -o gui.exe your_fixed_script.pl #### #!/usr/bin/perl use strict; use warnings; use Cwd; use GD; use Encode::Unicode; use Tk; use Tk::JPEG; use Tk::PNG; use Tk::Pane; use Tk::StayOnTop; use Tk::BrowseEntry; use Tk::widgets qw/JPEG PNG/; my $number_of_cpus = $ENV{NUMBER_OF_PROCESSORS}; my $cwd = getcwd; my $operation_mode_selected = "compare sequence 1 with sequence 2"; my $window_size = 10; my $max_mismatch = 5; my $bold_for_perfect_match = "semi-bold (4 pixel)"; my $output_picture = 1; my $output_text = 1; my $picture_size = 800; my $fixed_picture_size = 1; my $mw = MainWindow->new; $mw->title("Chromatic Dot Plot"); $mw->geometry("852x852"); $mw->maxsize(qw(852 1500)); $mw->Scrolled('Pane',-scrollbars=>'osoe',-background=>'White',-sticky=>'nw',-gridded=>'y')->pack(-fill=>'both',-expand=>1); $mw->Label(-background=>'White',-height=>107,-width=>138)->pack; $mw->Label(-background=>'White',-font=>"Courier 14",-background=>"cornflower blue",-text=>"C")->place(-width=>30,-x=>25,-y=>10); $mw->Label(-background=>'White',-font=>"Courier 14",-background=>"dark slate blue",-text=>"h")->place(-width=>30,-x=>55,-y=>10); $mw->Label(-background=>'White',-font=>"Courier 14",-background=>"MediumSeaGreen",-text=>"r")->place(-width=>30,-x=>85,-y=>10); $mw->Label(-background=>'White',-font=>"Courier 14",-background=>"khaki",-text=>"o")->place(-width=>30,-x=>115,-y=>10); $mw->Label(-background=>'White',-font=>"Courier 14",-background=>"IndianRed",-text=>"m")->place(-width=>30,-x=>145,-y=>10); $mw->Label(-background=>'White',-font=>"Courier 14",-background=>"SpringGreen4",-text=>"a")->place(-width=>30,-x=>175,-y=>10); $mw->Label(-background=>'White',-font=>"Courier 14",-background=>"goldenrod2",-text=>"t")->place(-width=>30,-x=>205,-y=>10); $mw->Label(-background=>'White',-font=>"Courier 14",-background=>"MediumOrchid1",-text=>"i")->place(-width=>30,-x=>235,-y=>10); $mw->Label(-background=>'White',-font=>"Courier 14",-background=>"SteelBlue2",-text=>"c")->place(-width=>30,-x=>265,-y=>10); $mw->Label(-background=>'White',-font=>"Courier 14",-background=>"seashell2",-text=>"D")->place(-width=>30,-x=>333,-y=>10); $mw->Label(-background=>'White',-font=>"Courier 14",-background=>"seashell2",-text=>"O")->place(-width=>30,-x=>367,-y=>10); $mw->Label(-background=>'White',-font=>"Courier 14",-background=>"seashell2",-text=>"T")->place(-width=>30,-x=>400,-y=>10); $mw->Label(-background=>'White',-font=>"Courier 14",-background=>"seashell2",-text=>"P")->place(-width=>30,-x=>467,-y=>10); $mw->Label(-background=>'White',-font=>"Courier 14",-background=>"seashell2",-text=>"L")->place(-width=>30,-x=>500,-y=>10); $mw->Label(-background=>'White',-font=>"Courier 14",-background=>"seashell2",-text=>"O")->place(-width=>30,-x=>533,-y=>10); $mw->Label(-background=>'White',-font=>"Courier 14",-background=>"seashell2",-text=>"T")->place(-width=>30,-x=>567,-y=>10); $mw->Label(-background=>'White',-font=>"Courier 8",-background=>"PeachPuff4",-foreground=>"AntiqueWhite2",-text=>"by David Rosenkranz\nUniversity Mainz, 2011")->place(-width=>183,-height=>27,-x=>630,-y=>10); $mw->Label(-background=>'White',-font=>"Arial 8",-background=>"floral white",-text=>"CHROMATIC DOT PLOT draws dot plots with colors encoding similarity.\nYou can choose to compare 2 sequences by pasting or loading them into\nthe boxes below or to process an abitrary number of sequence files. In the\nlatter case, each sequence will be plotted against itself. Beside a graphical\noutput CHROMATIC DOT PLOT can output the plot as text matrix. The results\ncan optionally be saved in a folder named /CDP_results[date+time]. ")->place(-width=>414,-height=>150,-x=>400,-y=>60); $mw->Label(-background=>'White',-text=>"mode of operation")->place(-x=>25,-y=>60); $mw->Label(-background=>'White',-text=>"window size [nt]")->place(-x=>25,-y=>85); $mw->Label(-background=>'White',-text=>"maximum mismatch [nt]")->place(-x=>25,-y=>110); $mw->Label(-background=>'White',-text=>"print perfect match")->place(-x=>25,-y=>135); $mw->Label(-background=>'White',-text=>"save dotplot(s) as picture")->place(-x=>25,-y=>160); $mw->Label(-background=>'White',-text=>"save dotplot(s) as text matrix")->place(-x=>25,-y=>185); $mw->Label(-background=>'White',-text=>"Sequence 1")->place(-x=>25,-y=>230); $mw->Label(-background=>'White',-text=>"Sequence 2")->place(-x=>300,-y=>230); $mw->Label(-background=>'White',-text=>"Sequence files to process")->place(-x=>615,-y=>230); $mw->Label(-background=>"grey50")->place(-width=>1000,-height=>2,-x=>2,-y=>500); my $be_operation_mode = $mw->BrowseEntry(-variable=>\$operation_mode_selected,-font=>"Arial 8",-width=>32,-listwidth=>214,-listheight=>2,-state=>'readonly')->place(-x=>150,-y=>60); $be_operation_mode->insert('end',"compare sequence 1 with sequence 2","process sequence files from list"); $mw->Entry(-width=>5,-justify=>'right',-font=>"Arial 8",-textvariable=>\$window_size)->place(-height=>20,-x=>150,-y=>85); $mw->Entry(-width=>5,-justify=>'right',-font=>"Arial 8",-textvariable=>\$max_mismatch)->place(-height=>20,-x=>150,-y=>110); my $be_bold_for_perfect_match = $mw->BrowseEntry(-variable=>\$bold_for_perfect_match,-font=>"Arial 8",-width=>32,-listwidth=>214,-listheight=>3,-state=>'readonly')->place(-x=>150,-y=>135); $be_bold_for_perfect_match->insert('end',"regular (1 pixel)","semi-bold (4 pixel)","bold (9 pixel)"); $mw->Checkbutton(-background=>'White',-activebackground=>'White',-variable=>\$output_picture)->place(-height=>14,-width=>26,-x=>170,-y=>165); $mw->Checkbutton(-background=>'White',-activebackground=>'White',-variable=>\$output_text)->place(-height=>14,-width=>26,-x=>170,-y=>190); my $seq; my $seq1; my $seq2; my $copy_text; my $sequence_1_box = $mw->Scrolled("Text",-scrollbars=>'oe')->place(-x=>25,-y=>250,-width=>200,-height=>200); my $sequence_2_box = $mw->Scrolled("Text",-scrollbars=>'oe')->place(-x=>300,-y=>250,-width=>200,-height=>200); $mw->Button(-font=>"Arial 8",-text=>"clear seq.",-command=>sub{$sequence_1_box->delete("1.0",'end');})->place(-width=>70,-x=>40,-y=>460); $mw->Button(-font=>"Arial 8",-text=>"clear seq.",-command=>sub{$sequence_2_box->delete("1.0",'end');})->place(-width=>70,-x=>315,-y=>460); $mw->Button(-font=>"Arial 8",-text=>"load file",-command=>sub{sequence_from_file();$sequence_1_box->delete("1.0",'end');$sequence_1_box->insert("1.0",$seq);})->place(-width=>70,-x=>130,-y=>460); $mw->Button(-font=>"Arial 8",-text=>"load file",-command=>sub{sequence_from_file();$sequence_2_box->delete("1.0",'end');$sequence_2_box->insert("1.0",$seq);})->place(-width=>70,-x=>405,-y=>460); $mw->Button(-font=>"Arial 8",-text=>"use demo",-command=>sub{$sequence_1_box->delete("1.0",'end');$sequence_2_box->delete("1.0",'end');demo_seq();$sequence_1_box->insert("1.0",$seq1);$sequence_2_box->insert("1.0",$seq2);})->place(-width=>60,-x=>232,-y=>320); $mw->Button(-font=>"Arial 8",-text=>"copy seq.",-command=>sub{$sequence_2_box->delete("1.0",'end');$copy_text=$sequence_1_box->get("1.0",'end');$sequence_2_box->insert("1.0",$copy_text);})->place(-width=>60,-x=>232,-y=>350); $mw->Button(-font=>"Arial 8",-text=>"rotate",-command=>sub{$seq1=$sequence_1_box->get("1.0",'end');$seq2=$sequence_2_box->get("1.0",'end');$sequence_1_box->delete("1.0",'end');$sequence_2_box->delete("1.0",'end');$seq1=~s/\n+$//;$seq2=~s/\n+$//;$sequence_1_box->insert("1.0",$seq2);$sequence_2_box->insert("1.0",$seq1);})->place(-width=>60,-x=>232,-y=>380); my $files_box = $mw->Scrolled("Listbox",-scrollbars=>'se',-selectmode=>"extended")->place(-x=>615,-y=>250,-width=>200,-height=>200); $mw->Button(-font=>"Arial 8",-text=>"browse & add",-command=>\&open_files)->place(-width=>85,-x=>625,-y=>460); $mw->Button(-font=>"Arial 8",-text=>"remove files",-command=>\&remove_files)->place(-width=>85,-x=>720,-y=>460); my $display_label = $mw->Label(-background=>"grey10")->place(-width=>802,-height=>802,-x=>18,-y=>570); my $start_button = $mw->Button(-font=>"Arial 8",-text=>"START",-command=>\&check_settings)->place(-width=>50,-x=>400,-y=>520); my $exit_button = $mw->Button(-font=>"Arial 8",-text=>"EXIT",-command=>sub{exit;})->place(-width=>50,-x=>465,-y=>520); $mw->Label(-relief=>'groove',-font=>"Arial 8",-background=>'White',-text=>"color code [ID]")->place(-width=>82,-height=>25,-x=>18,-y=>520); $mw->Label(-font=>"Arial 8",-background=>'RoyalBlue3',-text=>"100%")->place(-width=>40,-height=>24,-x=>100,-y=>520); $mw->Label(-font=>"Arial 8",-background=>'RoyalBlue1',-text=>">90%")->place(-width=>40,-height=>24,-x=>140,-y=>520); $mw->Label(-font=>"Arial 8",-background=>'SteelBlue2',-text=>">80%")->place(-width=>40,-height=>24,-x=>180,-y=>520); $mw->Label(-font=>"Arial 8",-background=>'DarkSeaGreen1',-text=>">70%")->place(-width=>40,-height=>24,-x=>220,-y=>520); $mw->Label(-font=>"Arial 8",-background=>'khaki2',-text=>">60%")->place(-width=>40,-height=>24,-x=>260,-y=>520); $mw->Label(-font=>"Arial 8",-background=>'goldenrod2',-text=>">50%")->place(-width=>40,-height=>24,-x=>300,-y=>520); $mw->Label(-font=>"Arial 8",-background=>'brown2',-text=>">40%")->place(-width=>40,-height=>24,-x=>340,-y=>520); my $sequence_1_length = ""; my $sequence_2_length = ""; my $seq_info_label = $mw->Label(-font=>"Arial 7",-justify=>'left',-anchor=>'w',-background=>'White',-text=>"sequence 1 (horizontal) length: $sequence_1_length\nsequence 2 (vertical) length: $sequence_2_length")->place(-width=>200,-height=>24,-x=>530,-y=>520); MainLoop;