Bio-MCPrimers

 view release on metacpan or  search on metacpan

mcprimers_gui.bat  view on Meta::CPAN

my %re_name;                   # names of restriction enzymes
my @ecut_loc;                  # cut location in enzyme
my @vcut_loc;                  # cut location in vector
my @sites = ();                # recognition sites array
my @result = ();               # from MCPrimers
my $seq_name = '';             # sequence file
my $p3_name = '';              # primer3 file
my $num_solns = 0;             # number of solutions
my @seq = ();                  # sequence (FASTA)
my $mcprimers_dir;             # mcprimers.pl directory

####################################################################

BEGIN {

    # check MCPRIMERS_DIR
    if (defined $ENV{MCPRIMERS_DIR}) {
        $mcprimers_dir = $ENV{MCPRIMERS_DIR};  
    }  
    else {
        $mcprimers_dir = '.';
    }
}

END {
    # intentionally empty       
}

###################################################################
######                 ######
###### Main code block ######
######                 ######
#############################

&set_wd();

$mw = MainWindow->new(-title => $app_title);
$filedialog=$mw->FileSelect(-title     => 'Select File', 
                            -width     => 40, 
                            -takefocus => 1);
&define_help_text();
&create_text();
&create_buttons();
&create_right();
&create_seq();

$mw->resizable(0,0);
$mw->configure(-takefocus);

MainLoop;


###################################################################

sub create_text {
        
    $text_frame = $mw->Frame->pack(-pady=>5, -side=>'top', -anchor=>'nw');
    $text_message = $text_frame->Message(
        -width => 600,
        -text  => "First load a vector file and a DNA nucleotide sequence in FASTA format",
        -font  => 'Helvetica 12 bold');
    $text_message->pack(-anchor=>'nw', -padx=>20);
}

###################################################################

sub create_right {

    $right_frame = $mw->Frame->pack(-pady=>10, -side=>'right', -anchor=>'nw');
    
    
    $fname_frame = $right_frame->Frame->pack(-padx=>5, -pady=>2, -anchor=>'nw');
    $fname_message = $fname_frame->Message(
        -width => 200,
        -text  => "FASTA: undefined",
        -font  => 'Helvetica 10 bold')->pack(-anchor=>'nw');    
                                               

    $start_scale_frame = $right_frame->Frame->pack(-padx=>5, -pady=>2, -anchor=>'nw');
    $start_scale_frame->Message(
        -text  => "Search NTs past start codon",
        -font  => 'Helvetica 10 bold',
        -width => 200)->pack(-anchor=>'nw');  
    $start_scale_frame->Scale(
        -resolution   => 1,
        -from         => 60,
        -to           => 0,
        -variable     => \$searchpaststart,
        -sliderlength => 10,
        -length       => 180,
        -orient       => 'horizontal',
        -showvalue    => 1,
        -state        => 'active',
        -font         => 'Helvetica 10 bold',)->pack(-padx => 5, -anchor=>'nw');                                         
    
    
    $stop_scale_frame = $right_frame->Frame->pack(-padx=>5, -pady=>2, -anchor=>'nw');                                          
    $stop_scale_frame->Message(
        -text  => "Search NTs before stop codon",
        -font  => 'Helvetica 10 bold',
        -width => 200)->pack(-anchor=>'nw');  
    $stop_scale_frame->Scale(
        -resolution   => 1,
        -from         => 60,
        -to           => 0,
        -variable     => \$searchbeforestop,
        -sliderlength => 10,
        -length       => 180,
        -orient       => 'horizontal',
        -showvalue    => 1,
        -state        => 'active',
        -font         => 'Helvetica 10 bold',)->pack(-padx => 5, -anchor=>'nw');

    
    $maxchanges_frame = $right_frame->Frame->pack(-padx=>5, -pady=>2, -anchor=>'nw');                                          
    $maxchanges_frame->Message(
        -text  => "Maximum changes per primer",
        -font  => 'Helvetica 10 bold',
        -width => 200,
        )->pack(-anchor=>'nw');  
    $maxchanges_frame->Scale(
        -resolution   => 1,
        -from         => 3,
        -to           => 0,
        -variable     => \$maxchanges,
        -sliderlength => 10,
        -length       => 180,
        -orient       => 'horizontal',
        -showvalue    => 1,
        -state        => 'active',
        -font         => 'Helvetica 10 bold',)->pack(-padx => 5, -anchor=>'nw');


    $para_frame = $right_frame->Frame->pack(-padx=>5, -pady=>2, -anchor=>'nw');
    $para_frame->Message(
        -text  => "GC clamping",
        -font  => 'Helvetica 10 bold',
        -width => 160)->pack(-anchor=>'nw');
    $para_frame->Radiobutton (
        -text     => 'GC clamp 3\' and 5\'',
        -variable => \$clamp,
        -value    => 'both',
        -font => 'SmallItem')->pack(-padx => 5, -anchor=>'nw');
    $para_frame->Radiobutton (
        -text     => 'GC clamp 3\' only  ',
        -variable => \$clamp,
        -value    => '3prime',
        -font => 'SmallItem')->pack(-padx => 5, -anchor=>'nw');
 
 
    $p3_frame = $right_frame->Frame->pack(-padx=>5, -pady=>2, -anchor=>'nw');        
    $p3_frame->Message(
        -text  => "Primer3 file",
        -font  => 'Helvetica 10 bold',
        -width => 200)->pack(-anchor=>'nw');
    $p3_check = $p3_frame->Checkbutton (
        -text     => 'Unspecified',
        -variable => \$p3_used,
        -state    => 'disabled',
        -font => 'SmallItem')->pack(-padx => 5, -anchor=>'nw');

                    
    $vec_frame = $right_frame->Frame->pack(-padx=>5, -pady=>2, -anchor=>'nw');   
    $vec_message = $vec_frame->Message(
        -width => 200,
        -text  => "\n",
        -font  => 'Helvetica 10 bold')->pack(-anchor=>'nw'); 
        
}

###################################################################

sub create_buttons {
    
    $bottom_frame = $mw->Frame->pack(-pady=>15, 
                                     -padx=>15,
                                     -side=>'bottom',
                                     -anchor=>'w');
    
    $bottom_frame->Button(
        -text    => 'Load Vector',
        -bg      => 'light green',
        -command => \&load_vector_file,
        )->pack(-anchor=>'w', -side=>'left', -padx=>4);
        
    $bottom_frame->Button(
        -text    => 'Load FASTA',
        -bg      => 'light green',
        -command => \&load_seq_file,
        )->pack(-anchor=>'w', -side=>'left', -padx=>4);
        
    $bottom_frame->Button(
        -text    => 'Select Primer3',
        -bg      => 'light green',
        -command => \&load_primer3,
        )->pack(-anchor=>'w', -side=>'left', -padx=>4);        
          
    $sub_button = $bottom_frame->Button(
        -text    => 'Execute',
        -bg      => 'light gray',
        -command => \&execute_mcprimers,
        )->pack(-anchor=>'w', -side=>'left', -padx=>4);
        
    $bottom_frame->Button(
        -text    => 'Save',
        -bg      => 'light green',
        -command => \&save_window,
        )->pack(-anchor=>'w', -side=>'left', -padx=>4);
                 
    $bottom_frame->Button(
        -text    => 'Help',
        -bg      => 'light green',
        -command => \&help,
        )->pack(-anchor=>'w', -side=>'left', -padx=>4); 
        
    $bottom_frame->Button(
        -text    => 'About',
        -bg      => 'light green',
        -command => \&about,
        )->pack(-anchor=>'w', -side=>'left', -padx=>4);        

    $bottom_frame->Button(
        -text    => 'Exit',
        -bg      => 'light green',
        -command => sub { exit; },
        )->pack(-anchor=>'w', -side=>'left', -padx=>4);            
}



( run in 0.611 second using v1.01-cache-2.11-cpan-97f6503c9c8 )