in reply to Re^9: Perl tk - How to integrate external scripts
in thread Perl tk - How to integrate external scripts
It works fine and correctly. Do you know how to print this result in a GUI windows and not only in the terminal? Thanks you !!!#all global variable set well ! ........ $mw-> Button (-text =>'Open', -command =>\&open_file)->place(-x=>240, +-y=>35); $mw-> Button (-text =>'Get Statistics', -command =>\&get_statistics)-> +place(-x=>320, -y=>35); sub open_file {$open = $mw->getOpenFile( -filetypes => $types_OPEN, -defaultextension => '.sff'); $te->Load( "$open");} sub get_statistics { my $fastafile= $open; open (FASTA, "<$fastafile"); $/ = ">"; 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";}}; #This is the result in the terminal for an example $open file: Total reads: 4981 Total nt: 104724 Mean length: 21.024693836579 Median length: 21 Mode length: 21 Max length: 27 Min length: 18 Length # Seqs 18 290 19 456 20 874 21 1974 22 626 23 281 24 373 25 69 26 32 27 6 28 0
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^11: Perl tk - How to integrate external scripts
by Anonymous Monk on Feb 01, 2012 at 11:38 UTC | |
by Giorgio C (Novice) on Feb 01, 2012 at 12:20 UTC | |
by Eliya (Vicar) on Feb 01, 2012 at 14:01 UTC | |
by Giorgio C (Novice) on Feb 01, 2012 at 15:14 UTC |