in reply to alphabet counting

What have you done to get to the cause of your problem?

Please describe in your own words what your program should do, and how many lines of output you expect. Then also describe in your own words what your program does. As a hint, it likely helps if you properly indent your source code so that for each loop, you put four spaces before all statements contained in the loop body:

foreach( @protein) { if (...) { ... } elsif (...) { ... } ... };

That way, it will likely become more clear to you where your error happens.

Also, using a different data structure, like a hash, will make your program much shorter:

my %count; foreach( @protein ) { $count{ $_ }++; ... };

Replies are listed 'Best First'.
Re^2: alphabet counting
by Anonymous Monk on Jun 02, 2012 at 13:27 UTC

    thank you. i have 428 KB fasta file such as text.there are 1000 protein in it.so, i have to have 1000 line in result which give me the ferequency of each amino acid ( alphabet), but my result file is 14 MB which cannot handle with notepad.

      Instead of always testing with the whole set, I recommend testing with only two or three proteins. That way, your tests should run quicker and you should be able to inspect the results with notepad (for example). You can also print the results to the console instead of a file to see them.

        thank you for your help. i did that, but now i see , there is an error in counting. code has error.

        >tr|F5HB16|F5HB16_HUMAN Alcohol dehydrogenase 1B OS=Homo sapiens GN=AD +H1B PE=2 SV=1 MSTAGKVIKCKAAVLWEVKKPFSIEDVEVAPPKAYEVRIKMVAVGICHTDDHVVSGNLVT PLPVILGHEAAGIVESVGEGVTTVKPGDKVIPLFTPQCGKCRVCKNPESNYCLKNDLGNP RGKPIHHFLGTSTFSQYTVVDENAVAKIDAASPLEKVCLIGCGFSTGYGSAVNVAKVTPG STCAVFGLGGVGLSAVMGCKAAGAARIIAVDINKDKFAKAKELGATECINPQDYKKPIQE VLKEMTDGGVDFSFEVIGRLDTMMASLLCCHEACGTSVIVGVPPASQNLSINPMLLLTGR TWKGAVYGGFKSKEGIPKLVADFMAKKFSLDALITHVLPFEKINEGFDLLHSGKSIRTVL TF >sp|P00325|ADH1B_HUMAN Alcohol dehydrogenase 1B OS=Homo sapiens GN=ADH +1B PE=1 SV=2 MSTAGKVIKCKAAVLWEVKKPFSIEDVEVAPPKAYEVRIKMVAVGICRTDDHVVSGNLVT PLPVILGHEAAGIVESVGEGVTTVKPGDKVIPLFTPQCGKCRVCKNPESNYCLKNDLGNP RGTLQDGTRRFTCRGKPIHHFLGTSTFSQYTVVDENAVAKIDAASPLEKVCLIGCGFSTG YGSAVNVAKVTPGSTCAVFGLGGVGLSAVMGCKAAGAARIIAVDINKDKFAKAKELGATE CINPQDYKKPIQEVLKEMTDGGVDFSFEVIGRLDTMMASLLCCHEACGTSVIVGVPPASQ NLSINPMLLLTGRTWKGAVYGGFKSKEGIPKLVADFMAKKFSLDALITHVLPFEKINEGF DLLHSGKSIRTVLTF