Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have a dataset that consists of a bunch of elements (DNA sequences) that are compared in an all-against-all manner. In case it is relevant, the matches are not necessarily symmetric, so just because A matches B does not guarantee that B will match A. The output looks like this, where each line indicates a match between the sequence in column A and the sequence in column B based on my search criteria:
Contig1 Contig2 Contig1 Contig3 Contig2 Contig1 Contig2 Contig3 Contig3 Contig1 Contig3 Contig2 Contig3 Contig4 Contig4 Contig3 Contig4 Contig5 Contig6 Contig7 Contig7 Contig6 Contig8 Contig9 Contig9 Contig10 Contig10 Contig8 Contig10 Contig11 Contig11 Contig10
I want to divide this list into groups where a group consists of all the elements that are connected by at least one edge (including non-reciprocal edges). So in the example data, I would have three groups:
Group1: Contig1 Contig2 Contig3 Contig4 Contig5 Group2: Contig6 Contig7 Group3: Contig8 Contig9 Contig10 Contig11
I am at a lost to figure out an efficient way to do this in Perl, and any help would be greatly appreciated.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Finding all connected nodes in an all-against-all comparison
by lamprecht (Friar) on May 06, 2010 at 22:00 UTC | |
by LanX (Saint) on May 07, 2010 at 14:15 UTC | |
Re: Finding all connected nodes in an all-against-all comparison
by rubasov (Friar) on May 06, 2010 at 21:26 UTC | |
Re: Finding all connected nodes in an all-against-all comparison
by BrowserUk (Patriarch) on May 06, 2010 at 22:52 UTC | |
by GrandFather (Saint) on May 08, 2010 at 01:41 UTC | |
by BrowserUk (Patriarch) on May 08, 2010 at 02:20 UTC | |
Re: Finding all connected nodes in an all-against-all comparison
by GrandFather (Saint) on May 08, 2010 at 02:24 UTC | |
Re: Finding all connected nodes in an all-against-all comparison
by LanX (Saint) on May 07, 2010 at 14:52 UTC |