Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: perlkhan 77

by Anonymous Monk
on Apr 22, 2009 at 12:10 UTC ( #759256=note: print w/ replies, xml ) Need Help??


in reply to Re: perlkhan 77
in thread perlkhan 77

sub Passref { my ( $define, $seq, $count, $outfh ) = @_; chomp($define); my $len = length($$seq); my %count = ( Miss => 0+( $$seq =~ m/^YCWLPHQIMTNKSRVADEGF/ig ) ); # YCWLPHQIMTNKSRVADEGF doesn't appear in test file my %ratio = ( Miss => 0+( $count{Miss} / $len ) ); for my $letter (qw[ E D A V R S K N T M I Q H P L W C Y F ]) { $count{$letter} = ( $$seq =~ m/$letter/g ); $ratio{$letter} = $count{$letter} / $len; } print {$outfh} join "\t", $define, $len, @ratio{qw[ E D A V R S K N T M I Q H P L W C Y F Miss ]}, "\n"; }


Comment on Re^2: perlkhan 77
Download Code
Re^3: perlkhan 77
by Anonymous Monk on Apr 22, 2009 at 12:34 UTC
    For count you need
    $count{$letter} = ()= $$seq =~ m/$letter/g;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://759256]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2014-09-17 04:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (57 votes), past polls