Say I have 5 sequences that are 5 nucleotides long: AAAAA, AAAAC, AAGGC, AGGGG, CCCCC, which represent elements 0 through 4. The similarity matrix would look like this:
100 80 40 20 0
80 100 60 20 20
40 60 100 60 20
20 20 60 100 0
0 20 20 0 100

Because there are 5 pieces of data (0 through 4), the matrix has 25 elements. I already wrote a program that extracts the coordinates and corresponding values of the matrix when this value is greater than 60. Since the matrix is symmetrical, I only extracted values when columns > rows. This is what my program extracts and puts in a text file:

0 1 80
1 2 60
2 3 60

So, there are two clusters. Cluster#1 is 0,1,2,3 and Cluster#2 is 4. Just as data for 4 and 9 are not in the table of the previous example, the data for sequence 4 in this example is not in the table above, which represents the text file that I am working from, but I still have to use these lonely elements as cluster singularities. Anyway, I am working with a huge matrix that is much more complex than this, and I have to figure out a clustering algorithm for it.

 $cluster_60[2]{0} = 2; $cluster_60[0]{1} = 4

Thanks for your help, everyone. I am doing my best to explain my problem. This is a small part of a class project. Its due in over a week. So, I'm not stressed out about it. I don't care about my grade in this class because I am a grad student who really only cares about papers, but I get obsessed when I can't figure something out related to writing code. I use crude perl scripts to analyze biological data and might actually get a paper out of it here soon. I learned Perl over a year ago on my own, and now, my advisor makes me use it everyday and take bioinformatic classes where I have to write scripts. I am really delerious right now because I am tired. The most recent Bill Maher episode with Michael Moore, that Princeton economic nobel laureate, former NY gov Elliot Spitzer, and John Waters was hilarious. I hope that I can become a Perl Monk someday, but I still suck at references and subroutines and have very limited experience with MySQL unlike tye.


In reply to Re^2: Pair-Wise Clustering by cutcopy11
in thread Pair-Wise Clustering by cutcopy11

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.