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

View of /FigKernelScripts/svr_pegs_in_subsystems.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Wed Jul 15 23:36:53 2009 UTC (10 years, 5 months ago) by parrello
Branch: MAIN
New scripts for operon pipeline.

#!/usr/bin/perl -w 

use LWP;
use Data::Dumper;
use SSserver;
use Getopt::Long;


# This is a SAS Component


my $noroles = 0;
my $group = 0;
my $show_owner = 0;
my $oldid = "";

$0 =~ m/([^\/]+)$/;
my $self = $1;
my $usage = "$self [--noroles --group GenomeF < SubsystemIDs]";

my $rc = GetOptions("noroles" => \$noroles, "group" => \$group);

if (!$rc) {
    die "\n   usage: $usage\n\n";
}


my $roles = $noroles ? 0 : 1;
my $ss = SSserver->new();

open GENOMES, "<" . $ARGV[$#ARGV] || die "Genome file error: $!";

my @genomes;
my @subs;
while (<GENOMES>) {
	chomp;
	push (@genomes, $_);
}
while (<STDIN>) {
	chomp;
	push (@subs, $_);
}

#print Dumper @genomes;
my $pegs_inss = $ss->pegs_in_subsystems(\@genomes, \@subs);
if ($roles) {
	foreach my $pegs (@{$pegs_inss}) {
		#ss, role, peg
		if ($group) {
			print $pegs->[0], "\t", $pegs->[1]->[0], "\t", join (",", @{$pegs->[1]->[1]}), "\n";
		} else {
			foreach my $peg (@{$pegs->[1]->[1]}) {
				print join("\t", ($pegs->[0], $pegs->[1]->[0], $peg)), "\n";
			}
		}
	}

} else { # do group here
	my %ss_pegs;
	foreach my $pegs (@{$pegs_inss}) {
		foreach my $peg (@{$pegs->[1]->[1]}) {
			push (@{$ss_pegs{$pegs->[0]}}, $peg);
		}
	}
	for my $k (keys %ss_pegs) {
		print $k, "\t", join(",", @{$ss_pegs{$k}}), "\n";

	}
}
exit;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3