Hi dear monkes, i have protein file in fasta format and i ve written folloing code for finding frequency of each amino acid (alphabet), but there is a problem. the result file is very big. i mean i expect a very smaller file. please take a look at my code.

#!/usr/bin/perl -w use bio::seqIO; my $outputfile; #protein file bringing in. $outputfile="countaa"; unless(open(IN,">>$outputfile")) {print" cant open file \"$outputfile\ to write to !!\n\n"; exit;} my $proteinio=Bio::SeqIO->new (-file=>"ec 1.1.1.fasta",-format=>'fasta +'); while(my $seq=$proteinio ->next_seq() ){ foreach(my $protein=$seq->seq){ $count_A=0;$count_C=0;$count_D=0;$count_E=0;$count_F=0;$count_G=0;$cou +nt_H=0;$count_I=0; $count_K=0;$count_L=0;$count_M=0;$count_N=0;$count_P=0;$count_Q=0;$cou +nt_R=0;$count_S=0; $count_T=0;$count_V=0;$count_W=0;$count_Y=0; my @protein=split('',$protein); foreach (@protein){ if (/A/) {++$count_A;} elsif (/C/) {++$count_C;} elsif (/D/) {++$count_D;} elsif (/E/) {++$count_E;} elsif (/F/) {++$count_F;} elsif (/G/) {++$count_G;} elsif (/H/) {++$count_H;} elsif (/I/) {++$count_I;} elsif (/K/) {++$count_K;} elsif (/L/) {++$count_L;} elsif (/M/) {++$count_M;} elsif (/N/) {++$count_N;} elsif (/P/) {++$count_P;} elsif (/Q/) {++$count_Q;} elsif (/R/) {++$count_R;} elsif (/S/) {++$count_S;} elsif (/T/) {++$count_T;} elsif (/V/) {++$count_V;} elsif (/W/) {++$count_W;} elsif (/Y/) {++$count_Y;} print IN "$count_A $count_C $count_D $count_E $count_F $count_G $count +_H $count_I $count_K $count_L $count_M $count_N $count_P $count_Q $count_R $count_S $count_ +T $count_V $count_W $count_Y\n";} }} close IN;

In reply to alphabet counting by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.