BioPerl

 view release on metacpan or  search on metacpan

examples/tk/gsequence.pl  view on Meta::CPAN

#!/usr/bin/perl
# gSequence - Protein Sequence Control Panel
# by Lorenz Pollsk
#
# this is work in progress! use this only for testing

use Gtk;
use strict;
use Bio::Seq;
use Bio::SeqIO;
use Bio::Tools::SeqStats;
use Bio::SeqFeature::Generic;
use Bio::Index::Abstract;
use Bio::DB::GenBank;
use Bio::DB::GenPept;

init Gtk;

# constant
my $false = 0;
my $true = 1;

# global widgets
my ($main_notebook,@main_label,@seq_edit);
my $about_dialog;
my ($import_dialog,$import_entry,@import_buttons,$import_from);
my ($description_window,$description_edit);
my ($comment_window,$comment_edit,$current_comment,$comment_frame);
my ($seqstats_window,$seqstats_edit);
my ($dblink_window,@dblink_entry,$current_dblink,$dblink_clist,$dblink_handler_id);
my ($ref_window,@ref_entry,$current_ref,$ref_clist,$ref_handler_id);
my ($feature_window,@feature_entry,$current_feature_item,@feature_spinner,
    $feature_handler_id,$feature_tree);
my ($pref_window,@pref_entry);

# global file data
my @seq;
my @filename;
my @modified;
my @locked; # locked sequence for editing ?
my $current;

# menu
my @menu_items = ( { path        => '/_File',
		     type        => '<Branch>' },
		   { path        => '/File/_New',
		     accelerator => '<control>N',
		     callback    => \&new },
		   { path        => '/File/_Open SwissProt',
		     accelerator => '<control>O',
		     callback    => \&open_dialog },
		   { path        => '/File/_Save SwissProt',
		     accelerator => '<control>S',
		     callback    => \&save },
		   { path        => '/File/Save _As...',
		     callback    => \&saveas_dialog },
		   { path        => '/File/Close',
		     callback    => \&close },
		   { path        => '/File/sep1',
		     type        => '<Separator>' },
		   { path        => '/File/_Import from...',
		     type        => '<Branch>' },
                   { path        => '/File/Import from.../Remote DB',
		     type        => '<Branch>' },
                   { path        => '/File/Import from.../Remote DB/AceDB',
		     callback    => sub { &seq_import("ace"); } },
                   { path        => '/File/Import from.../Remote DB/GenPept',
		     callback    => sub { &seq_import("genpept"); } },
                   { path        => '/File/Import from.../Flat File Index',
		     type        => '<Branch>' },
                   { path        => '/File/Import from.../Flat File Index/Fasta',
		     callback    => sub { &seq_import("fasta"); } },
                   { path        => '/File/Import from.../Flat File Index/SwissProt',
		     callback    => sub { &seq_import("swissprot"); } },
                   { path        => '/File/Import from.../Flat File Index/SwissPfam',
		     callback    => sub { &seq_import("swisspfam"); } },
		   { path        => '/File/_Export to...' },
		   { path        => '/File/sep2',
		     type        => '<Separator>' },
		   { path        => '/File/_Quit',
		     callback    => sub { Gtk->exit( 0 ); } },

		   { path        => '/_Edit',
		     type        => '<Branch>' },
		   { path        => '/Edit/C_ut',
		     callback    => sub { $seq_edit[$current]->cut_clipboard(); },
		     accelerator => '<control>X' },
		   { path        => '/Edit/_Copy',
		     callback    => sub { $seq_edit[$current]->copy_clipboard(); },
		     accelerator => '<control>C' },
		   { path        => '/Edit/_Paste',
		     callback    => sub { $seq_edit[$current]->paste_clipboard(); },
		     accelerator => '<control>V' },
		   { path        => '/Edit/Select All',
		     callback    => sub { $seq_edit[$current]->select_region(0,-1); } },

		   { path        => '/_Specs',
		     type        => '<Branch>' },
		   { path        => '/Specs/_Sequence Stats',
		     callback    => sub {&update_seqstats_window(1);} },



( run in 0.721 second using v1.01-cache-2.11-cpan-39bf76dae61 )