[Bio] / FigKernelScripts / svr_pegs_in_subsystems.pl Repository:
ViewVC logotype

Annotation of /FigKernelScripts/svr_pegs_in_subsystems.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (view) (download) (as text)

1 : parrello 1.1 #!/usr/bin/perl -w
2 :    
3 :     use LWP;
4 :     use Data::Dumper;
5 :     use SSserver;
6 :     use Getopt::Long;
7 :    
8 :    
9 :     # This is a SAS Component
10 :    
11 :    
12 :     my $noroles = 0;
13 :     my $group = 0;
14 :     my $show_owner = 0;
15 :     my $oldid = "";
16 :    
17 :     $0 =~ m/([^\/]+)$/;
18 :     my $self = $1;
19 : parrello 1.3 my $usage = "$self [--noroles --group] GenomeF < SubsystemIDs";
20 : parrello 1.1
21 :     my $rc = GetOptions("noroles" => \$noroles, "group" => \$group);
22 :    
23 :     if (!$rc) {
24 :     die "\n usage: $usage\n\n";
25 :     }
26 :    
27 :    
28 :     my $roles = $noroles ? 0 : 1;
29 :     my $ss = SSserver->new();
30 :    
31 :     open GENOMES, "<" . $ARGV[$#ARGV] || die "Genome file error: $!";
32 :    
33 :     my @genomes;
34 :     my @subs;
35 :     while (<GENOMES>) {
36 :     chomp;
37 :     push (@genomes, $_);
38 :     }
39 :     while (<STDIN>) {
40 :     chomp;
41 :     push (@subs, $_);
42 :     }
43 :    
44 : parrello 1.3 my $pegs_inss = $ss->pegs_in_subsystem(\@genomes, \@subs);
45 : parrello 1.1 if ($roles) {
46 : disz 1.2 foreach my $ss_role (@{$pegs_inss}) { #foreach subsystem/role
47 :     #(ss, role, (peg))
48 :     if ($group) {
49 :     print $ss_role->[0], "\t", $ss_role->[1]->[0], "\t", join (",", @{$ss_role->[1]->[1]}), "\n";
50 :     } else {
51 :     foreach my $peg (@{$ss_role->[1]->[1]}) { #foreach peg in this peg list
52 :     print join("\t", ($ss_role->[0], $ss_role->[1]->[0], $peg)), "\n";
53 :     }
54 :     }
55 :     }
56 : parrello 1.1
57 : disz 1.2 } else { # no roles
58 :     my %ss_pegs;
59 :     foreach my $ss_role (@{$pegs_inss}) {
60 :     foreach my $peg (@{$ss_role->[1]->[1]}) {
61 :     $ss_pegs{$ss_role->[0]}{$peg} = 1;
62 :     }
63 :     }
64 :     for my $ss (keys %ss_pegs) {
65 :     if ($group) {
66 :     print $ss, "\t", join(",", keys %{$ss_pegs{$ss}}), "\n";
67 :     } else {
68 :     foreach my $peg (keys %{$ss_pegs{$ss}}) {
69 :     print join("\t", $ss, $peg), "\n";
70 :     }
71 :     }
72 :     }
73 :     }
74 : parrello 1.1
75 :     exit;
76 : disz 1.2

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3