Parent Directory
|
Revision Log
Revision 1.3 - (view) (download) (as text)
1 : | overbeek | 1.1 | # |
2 : | overbeek | 1.2 | # This is a SAS Component |
3 : | # | ||
4 : | # | ||
5 : | overbeek | 1.1 | # Copyright (c) 2003-2006 University of Chicago and Fellowship |
6 : | # for Interpretations of Genomes. All Rights Reserved. | ||
7 : | # | ||
8 : | # This file is part of the SEED Toolkit. | ||
9 : | parrello | 1.3 | # |
10 : | overbeek | 1.1 | # The SEED Toolkit is free software. You can redistribute |
11 : | # it and/or modify it under the terms of the SEED Toolkit | ||
12 : | parrello | 1.3 | # Public License. |
13 : | overbeek | 1.1 | # |
14 : | # You should have received a copy of the SEED Toolkit Public License | ||
15 : | # along with this program; if not write to the University of Chicago | ||
16 : | # at info@ci.uchicago.edu or the Fellowship for Interpretation of | ||
17 : | # Genomes at veronika@thefig.info or download a copy from | ||
18 : | # http://www.theseed.org/LICENSE.TXT. | ||
19 : | # | ||
20 : | |||
21 : | parrello | 1.3 | =head1 Convert Tabbed Representation of Sets to Numbered Relational Representation |
22 : | |||
23 : | This script takes as input a two-column tab-delimited file of numbered sets, | ||
24 : | each record containing (0) the set number and (1) a set element. It collapses | ||
25 : | each set onto a single output line, with each set being one | ||
26 : | record in the file. Thus, if the input file is | ||
27 : | |||
28 : | 1 a | ||
29 : | 1 b | ||
30 : | 1 c | ||
31 : | 2 d | ||
32 : | 2 e | ||
33 : | 3 f | ||
34 : | 4 g | ||
35 : | 4 h | ||
36 : | |||
37 : | the output would be | ||
38 : | |||
39 : | a b c | ||
40 : | d e | ||
41 : | f | ||
42 : | g h | ||
43 : | |||
44 : | |||
45 : | =cut | ||
46 : | overbeek | 1.1 | |
47 : | |||
48 : | $_ = <STDIN>; | ||
49 : | while (defined($_) && ($_ =~ /^(\S+)/)) | ||
50 : | { | ||
51 : | my @set = (); | ||
52 : | my $curr = $1; | ||
53 : | while ($_ && ($_ =~ /^(\S+)\t(\S+)/) && ($1 eq $curr)) | ||
54 : | { | ||
55 : | parrello | 1.3 | push(@set,$2); |
56 : | $_ = <STDIN>; | ||
57 : | overbeek | 1.1 | } |
58 : | print join("\t", @set),"\n"; | ||
59 : | } | ||
60 : |
MCS Webmaster | ViewVC Help |
Powered by ViewVC 1.0.3 |