in reply to Re^3: Perl tk - How to integrate external scripts
in thread Perl tk - How to integrate external scripts
Thank for your answer but unfortunately it still doesn't work.
The code with your suggestions is:
It say me (after load the $open file in the scrolled window and push the get_statistic button) : "No file name supplied". Where i need to correct the script to make it works ? Thanks# the firs button : $mw-> Button (-text =>'Open', -command =>\&open_file)->place(-x=>240, + -y=>35); #The seocnd button: $mw-> Button (-text =>'Get Statistics',-command =>\&get_statistics)->p +lace(-x=>320, -y=>35); # The sub open : sub open_file {my $open = $mw->getOpenFile( -filetypes => $types_OPEN, -defaultextension => '.sff'); $te->Load( "$open");} if (defined $open and -e $open){ $te->Load( "$open"); $current_file = $open; } # the sub get statistic: sub get_statistics {my $stat = Statistics::Descriptive::Full->new(); my (%distrib); my @bins = qw/18 19 20 21 22 23 24 25 26 27 28/; my $fastaFile = shift; unless (defined $fastaFile){ warn "No file name supplied.\n"; return; } open my $FASTA, '<', $fastaFile or warn "Couldn't open file: $!\n"; my $junkFirstOne = <FASTA>; while (<$FASTA>) {chomp; my ($def,@seqlines) = split /\n/, $_; my $seq = join '', @seqlines; $stat->add_data(length($seq));} %distrib = $stat->frequency_distribution(\@bins); print "Total reads:\t" . $stat->count() . "\n"; print "Total nt:\t" . $stat->sum() . "\n"; print "Mean length:\t" . $stat->mean() . "\n"; print "Median length:\t" . $stat->median() . "\n"; print "Mode length:\t" . $stat->mode() . "\n"; print "Max length:\t" . $stat->max() . "\n"; print "Min length:\t" . $stat->min() . "\n"; print "Length\t# Seqs\n"; foreach (sort {$a <=> $b} keys %distrib) { print "$_\t$distrib{$_}\n"; }}; # The scrolled window: $te = $mw->Scrolled( q/TextUndo/, -scrollbars => 'se', -background => +'white', -font => [-family =>'arial',-size => '12',-weight=> 'bold'], +-wrap => 'none',)->pack(-anchor =>'n',-side=>'right',-fill=>'none');
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Perl tk - How to integrate external scripts
by Eliya (Vicar) on Jan 30, 2012 at 12:19 UTC | |
by Giorgio C (Novice) on Jan 31, 2012 at 10:26 UTC | |
by Eliya (Vicar) on Jan 31, 2012 at 12:26 UTC | |
by Giorgio C (Novice) on Jan 31, 2012 at 12:53 UTC | |
by Eliya (Vicar) on Jan 31, 2012 at 14:06 UTC | |
| |
Re^5: Perl tk - How to integrate external scripts
by chessgui (Scribe) on Jan 30, 2012 at 10:40 UTC | |
by Giorgio C (Novice) on Jan 30, 2012 at 12:03 UTC | |
by chessgui (Scribe) on Jan 30, 2012 at 13:45 UTC |
In Section
Seekers of Perl Wisdom