package MenuMain; =head1 NAME MenuMain -- A Main Menu to run extropy =head1 SYNOPSIS MenuMain -> run; =head1 DESCRIPTION This package creates the Main Menu for extropy. The user interacts with Main Menu in order to run the extropy system. The only method is run(). =head1 VERSION 0.001 (last update: 6/30/04) =head1 AUTHOR Chet Langin, clangin@siu.edu SIU Plant Biotechnology and Genomics Core-facility =head1 BUGS None known. =head1 SEE ALSO extropy ExtropyConstants ExtropyUtils Extropy::Configuration Extropy::ConRead Extropy::CountCloneAnchors Extropy::CountContigAnchors Extropy::CrosscheckLocusNames Extropy::DBManager Extropy::EndMatchesRead Extropy::EstRead Extropy::FpcRead Extropy::Gff Extropy::Help Extropy::LocusRead Extropy::Menu Extropy::MenuGff Extropy::MenuProject Extropy::MtpRead Extropy::MlgRead Extropy::Project Extropy::ProjectCreate Extropy::ProjectPick Extropy::QtlRead Extropy::RelRead Extropy::SeqRead Extropy::Status Extropy::UpdateCloneAnchors Extropy::UpdateContigAnchors Extropy::UpdateLocusNames =head1 COPYRIGHT Copyright 2004, Chet Langin, All Rights Reserved. This program is free software. You may copy or redistribute it under the same terms as Perl itself. =head1 METHODS The remainder of this document describes the methods available to the programmer. =cut # load the pragmas use warnings; use strict; # load other modules use ExtropyConstants; use ExtropyUtils; use Extropy::Configuration; use Extropy::ConRead; use Extropy::CountCloneAnchors; use Extropy::CountContigAnchors; use Extropy::CrosscheckLocusNames; use Extropy::DBManager; use Extropy::EndMatchesRead; use Extropy::EstRead; use Extropy::FpcRead; use Extropy::Gff; use Extropy::Help; use Extropy::LocusRead; use Extropy::Menu; use Extropy::MenuGff; use Extropy::MenuProject; use Extropy::MtpRead; use Extropy::MlgRead; use Extropy::Project; use Extropy::ProjectCreate; use Extropy::ProjectPick; use Extropy::QtlRead; use Extropy::RelRead; use Extropy::SeqRead; use Extropy::Status; use Extropy::UpdateCloneAnchors; use Extropy::UpdateContigAnchors; use Extropy::UpdateLocusNames; # package variables my $configuration; my $db_manager; my $command = NONE; my $project; my $gff; my $help_message_number = 0; # ******************************** run ****************************** =head2 run MenuMain->run; Run the Main Menu. The entire extropy system runs from the Main Menu created by this method. =cut # --------------------------------------------------------------------- sub run { my $everything_ok = TRUE; # scroll the screen up for a clear work area my $lines_to_clear = 100; for(my $lcv = 0; $lcv < $lines_to_clear; $lcv++) { print "\n"; } # for system "clear"; # instantiate the DBManager object $db_manager = DBManager->new(); # instantiate the Project object if($everything_ok) { if(!($project = Project->new)) { $everything_ok = FALSE; } # if } # if # instantiate the Configuration object if($everything_ok) { if(!($configuration = Configuration->new)) { $everything_ok = FALSE; } # if } # if # instantiate the Gff object if($everything_ok) { if(!($gff = Gff->new)) { $everything_ok = FALSE; } # if } # if $command = QUIT if(!$everything_ok); # get Main Menu input while($command != QUIT) { &print_main; if($command == MENU_PROJECT) { MenuProject->run($configuration, $db_manager, $project); } # if elsif($command == MLG_READ) { MlgRead->new($configuration, $db_manager, $project); } # elsif elsif($command == LOCUS_READ) { LocusRead->new($configuration, $db_manager, $project); } # elsif elsif($command == FPC_READ) { FpcRead->new($configuration, $db_manager, $project); } # elsif elsif($command == QTL_READ) { QtlRead->new($configuration, $db_manager, $project); } # elsif elsif($command == END_MATCHES_READ) { EndMatchesRead->new($configuration, $db_manager, $project); } # elsif elsif($command == MTP_READ) { MtpRead->new($configuration, $db_manager, $project); } # elsif elsif($command == EST_READ) { EstRead->new($configuration, $db_manager, $project); } # elsif elsif($command == SEQ_READ) { SeqRead->new($configuration, $db_manager, $project); } # elsif elsif($command == REL_READ) { RelRead->new($configuration, $db_manager, $project); } # elsif elsif($command == CON_READ) { ConRead->new($configuration, $db_manager, $project); } # elsif elsif($command == CROSSCHECK_LOCUS_NAMES) { CrosscheckLocusNames->new($configuration, $db_manager, $project); } # elsif elsif($command == UPDATE_LOCUS_NAMES) { UpdateLocusNames->new($configuration, $db_manager, $project); } # elsif elsif($command == COUNT_CLONE_ANCHORS) { CountCloneAnchors->new($configuration, $db_manager, $project); } # elsif elsif($command == UPDATE_CLONE_ANCHORS) { UpdateCloneAnchors->new($configuration, $db_manager, $project); } # elsif elsif($command == COUNT_CONTIG_ANCHORS) { CountContigAnchors->new($configuration, $db_manager, $project); } # elsif elsif($command == UPDATE_CONTIG_ANCHORS) { UpdateContigAnchors->new($configuration, $db_manager, $project); } # elsif elsif($command == GFF_FILE_MENU) { MenuGff->run($configuration, $db_manager, $project, $gff); } # elsif elsif($command == STATUS) { Status->run($configuration, $db_manager, $project); } # elsif elsif($command == RESET) { message_start; if($project->{current_project} eq "") { message("A project must be active before it can be reset."); } # if else { message("You will have to start all over."); if(yes("Are you sure you want to reset the project?")) { $project->reset; message("Project reset."); $configuration->save($project); } # if else { message("Project not reset."); } # else } # else press_enter; } # elsif elsif($command == HELP) { Help->display($help_message_number); } # elsif } # while if($project->{current_project} ne "") { message_start; $configuration->save($project); print "\n"; } # if } # run =head2 print_main() print_main(); Display the Main Menu. =cut # ******************************* print_main() ********************** sub print_main() { my $menu_project_str = ""; my $mlg_read_str = ""; my $locus_read_str = ""; my $fpc_read_str = ""; my $qtl_read_str = ""; my $end_matches_read_str = ""; my $mtp_read_str = ""; my $est_read_str = ""; my $seq_read_str = ""; my $rel_read_str = ""; my $con_read_str = ""; my $crosscheck_locus_names_str = ""; my $update_locus_names_str = ""; my $count_clone_anchors_str = ""; my $update_clone_anchors_str = ""; my $count_contig_anchors_str = ""; my $update_contig_anchors_str = ""; my $create_gff_file_str = ""; my $reset_str = ""; if($project->{current_project} eq "") { $menu_project_str = "(A)ctivate a project"; $mlg_read_str = "- Read (M)LG File"; $locus_read_str = "- Read (L)ocus File"; $fpc_read_str = "- Read (F)PC File"; $qtl_read_str = "- Read Q(T)L File"; $end_matches_read_str = "- Read (E)nd Matches File"; $mtp_read_str = "- Read MT(P) File"; $est_read_str = "- Read EST File"; $seq_read_str = "- Read Sequence File"; $rel_read_str = "- Read Related Genes File"; $con_read_str = "- Read Confirmed File"; $crosscheck_locus_names_str = "- (C)rosscheck Locus Names"; $update_locus_names_str = "- (U)pdate Locus Names"; $count_clone_anchors_str ="- C(o)unt Clone Anchors"; $update_clone_anchors_str = "- Up(d)ate Clone Anchors"; $count_contig_anchors_str ="- Cou(n)t Contig Anchors"; $update_contig_anchors_str = "- Update Cont(i)g Anchors"; $create_gff_file_str = "- (G)FF File Menu"; $reset_str = "- (R)eset Project"; } # if else { $menu_project_str = "+ (A)ctivate a project"; if($project->{mlg_file} eq "") { $mlg_read_str = "Read (M)LG File"; } # if else { $mlg_read_str = "+ Read (M)LG File"; } # else if($project->{locus_file} eq "") { $locus_read_str = "Read (L)ocus File"; } # if else { $locus_read_str = "+ Read (L)ocus File"; } # else if($project->{mlg_file} eq "") { $fpc_read_str = "- Read (F)PC File"; } # if else { if($project->{fpc_file} eq "") { $fpc_read_str = "Read (F)PC File"; } # if else { $fpc_read_str = "+ Read (F)PC File"; } # else } # else if($project->{qtl_file} eq "") { $qtl_read_str = "Read Q(T)L File"; } # if else { $qtl_read_str = "+ Read Q(T)L File"; } # else if($project->{end_matches_file} eq "") { $end_matches_read_str = "Read (E)nd Matches File"; } # if else { $end_matches_read_str = "+ Read (E)nd Matches File"; } # else if($project->{mtp_file} eq "") { $mtp_read_str = "Read MT(P) File"; } # if else { $mtp_read_str = "+ Read MT(P) File"; } # else if($project->{est_file} eq "") { $est_read_str = "Read EST File"; } # if else { $est_read_str = "+ Read EST File"; } # else if($project->{seq_file} eq "") { $seq_read_str = "Read Sequence File"; } # if else { $seq_read_str = "+ Read Sequence File"; } # else if($project->{rel_file} eq "") { $rel_read_str = "Read Related Genes File"; } # if else { $rel_read_str = "+ Read Related Genes File"; } # else if($project->{con_file} eq "") { $con_read_str = "Read Confirmed File"; } # if else { $con_read_str = "+ Read Confirmed File"; } # else if($project->{locus_names_crosschecked} == TRUE) { $crosscheck_locus_names_str = "+ (C)rosscheck Locus Names"; } # if else { if(($project->{locus_file} ne "") && ($project->{fpc_file} ne "")) { $crosscheck_locus_names_str = "(C)rosscheck Locus Names"; } # if else { $crosscheck_locus_names_str = "- (C)rosscheck Locus Names"; } # else } # else if($project->{locus_names_updated} == TRUE) { $update_locus_names_str = "+ (U)pdate Locus Names"; } # if else { if($project->{locus_names_crosschecked} == TRUE) { $update_locus_names_str = "(U)pdate Locus Names"; } # if else { $update_locus_names_str = "- (U)pdate Locus Names"; } # else } # else if($project->{clone_anchors_counted} == TRUE) { $count_clone_anchors_str = "+ C(o)unt Clone Anchors"; } # if else { if($project->{locus_names_updated} == TRUE) { $count_clone_anchors_str = "C(o)unt Clone Anchors"; } # if else { $count_clone_anchors_str = "- C(o)unt Clone Anchors"; } # else } # else if($project->{clone_anchors_updated} == TRUE) { $update_clone_anchors_str = "+ Up(d)ate Clone Anchors"; } # if else { if($project->{clone_anchors_counted} == TRUE) { $update_clone_anchors_str = "Up(d)ate Clone Anchors"; } # if else { $update_clone_anchors_str = "- Up(d)ate Clone Anchors"; } # else } # else if($project->{contig_anchors_counted} == TRUE) { $count_contig_anchors_str = "+ Cou(n)t Contig Anchors"; } # if else { if($project->{clone_anchors_counted} == TRUE) { $count_contig_anchors_str = "Cou(n)t Contig Anchors"; } # if else { $count_contig_anchors_str = "- Cou(n)t Contig Anchors"; } # else } # else if($project->{contig_anchors_updated} == TRUE) { $update_contig_anchors_str = "+ Update Cont(i)g Anchors"; } # if else { if($project->{contig_anchors_counted} == TRUE) { $update_contig_anchors_str = "Update Cont(i)g Anchors"; } # if else { $update_contig_anchors_str = "- Update Cont(i)g Anchors"; } # else } # else if($project->{gff_file_created} == TRUE) { $create_gff_file_str = "+ (G)FF File Menu"; } # if else { if($project->{contig_anchors_updated}== TRUE) { $create_gff_file_str = "(G)FF File Menu"; } # if else { $create_gff_file_str = "- (G)FF File Menu"; } # else } # else $reset_str = "(R)eset Project"; } # else $command = Menu->menu($menu_project_str, MENU_PROJECT, $mlg_read_str, MLG_READ, $locus_read_str, LOCUS_READ, $fpc_read_str, FPC_READ, $qtl_read_str, QTL_READ, $end_matches_read_str, END_MATCHES_READ, $mtp_read_str, MTP_READ, $est_read_str, EST_READ, $seq_read_str, SEQ_READ, $rel_read_str, REL_READ, $con_read_str, CON_READ, $crosscheck_locus_names_str, CROSSCHECK_LOCUS_NAMES, $update_locus_names_str, UPDATE_LOCUS_NAMES, $count_clone_anchors_str, COUNT_CLONE_ANCHORS, $update_clone_anchors_str, UPDATE_CLONE_ANCHORS, $count_contig_anchors_str, COUNT_CONTIG_ANCHORS, $update_contig_anchors_str, UPDATE_CONTIG_ANCHORS, $create_gff_file_str, GFF_FILE_MENU, "(S)tatus", STATUS, $reset_str, RESET, "(H)elp", HELP, "(Q)uit", QUIT); $help_message_number = 1 if($command == HELP); } # print_main 1