1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
| #!/usr/bin/perl
use strict;
use warnings;
use Tk;
use Tk::EntryCheck;
use Bio::SeqIO;
# sequence des transcripts
my $fasta_file ='nanos.fasta';
my $value;
my $in = Bio::SeqIO->new( -file => $fasta_file, '-format' => 'Fasta' );
open(my $trans_cx, "<", "gene_trans_max_cx.txt") ;
my $FBgn_entry;
my(%hash_cx,%hash_sequence);
# creation d'un hash avec FBgn => FBtr associé de façon a trouver le transcript du gène en entrée
while(<$trans_cx>){
chomp;
my($FBgn_cx,$FBtr_cx)=split /\t/,$_;
$hash_cx{$FBgn_cx}->{'transcript'}=$FBtr_cx;
}
# creation d'un hash avec id transcript > sequence
while ( my $seq = $in->next_seq()){
my $id = $seq->primary_id ;
my($FBgn,$FBtr,$name,$length)=split /;/,$id;
my $sequence = $seq->seq ;
$hash_sequence{$FBtr}->{'sequence'} =$sequence;
}
my $fenetre_principale = MainWindow->new( -title => 'Tk::EntryCheck' );
$fenetre_principale->Label( -text => 'Gene (FBgn) : ')->pack();
my $entry = $fenetre_principale->Entry(
-background => 'white',
-textvariable => \$FBgn_entry,
);
my $mycanvas = $fenetre_principale->Scrolled('Canvas',
-scrollbars=>'oe',
);
my $widget_texte = $fenetre_principale->Scrolled('Text',
-scrollbars => 'oe',
-setgrid=>'single',
);
# sequence du transcript
my $bouton = $fenetre_principale->Button(
-text => 'Sequence',
# que faire quand on appuie sur Afficher
-command => sub {
my $current_FBtr=$hash_cx{$FBgn_entry}->{'transcript'};
#print "$hash_cx{$FBgn_entry}->{'transcript'}\n";
$widget_texte->insert('end', $hash_sequence{$current_FBtr}->{'sequence'});
# Mutation à mettre en rouge dans la séquence
my @PositionsMutation = (10,25,30);
my @PositionPi =(55,56,57,58,59,60,61,62,63,64,65,66,1001,1002,1003,1004,1005,1006,1007);
foreach my $position ( @PositionsMutation ) {
$widget_texte->tagAdd('ROUGE',"1.$position");
}
foreach my $value(@PositionPi){
$widget_texte->tagAdd('bold',"1.$value");
}
},
);
$entry->pack();
$bouton->pack();
$mycanvas->pack();
$widget_texte->pack();
$widget_texte->tagConfigure('ROUGE',
-foreground => 'red',
-font => 'arial',
);
$widget_texte->tagConfigure('YELLOW',
-foreground => 'BLACK',
-font => 'FontSequence',
-underline => 1,
);
$widget_texte->tagConfigure('bold',
-font => "helvetica 10 bold"
);
MainLoop; |