Hello Monks. I have a number of arrays containing 9 character elements (peptides). Here are a few of those arrays

@array1 =(TTVVRRRDR KFRQLLWFH RSQSPRRRR CSPHHTALR WIRTPPAYR VVRRRDRGR +HISCLTFGR RTPSPRRRR NTNMGLKFR LVSFGVWIR); @array2 = (AILCWGELM TVLEYLVSF GLKFRQLLW LSFLPSDFF LLSFLPSDF LLWFHISCL + MQLFHLCLI QLFHLCLII ATVELLSFL ALRQAILCW); @array3 = (TTVVRRRDR CSPHHTALR WIRTPPAYR NVNMGLKIR LVSFGVWIR HISCLTFGR +); @array4 = (CSPHHTALR YVNTNMGLK WIRTPPAYR TLPETTVVR HISCLTFGR NTNMGLKIR + WGMDIDPYK LVSFGVWIR);

I would like to sort the elements of these arrays according to the frequency that each peptides occurs. I am storing that frequency in a hash, which when I print part of it, looks like this

MQLFHLCLI = 36 FLPSDFFPS = 32 YLVSFGVWI = 32 LLWFHISCL = 31 QLFHLCLII = 28 IISCSCPTV = 23 ELMNLATWV = 18 HISCLTFGR = 16 ATVELLSFL = 15

E.g. if the peptide 'MQLFHLCLI' appears in an array, it should be shown as the first element

I would be very grateful if any the brethren have a solution to this. Many thanks in advance.


In reply to Sort array using a ranking system from separate hash by Sandy_Bio_Perl

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.