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

View of /FigKernelScripts/FFB2_make_family_vector.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Fri Apr 8 20:09:14 2011 UTC (8 years, 7 months ago) by olson
Branch: MAIN
CVS Tags: mgrast_dev_08112011, mgrast_release_3_0_4, mgrast_dev_06072011, mgrast_dev_08022011, rast_rel_2014_0912, myrast_rel40, rast_rel_2014_0729, mgrast_dev_05262011, mgrast_release_3_1_2, mgrast_release_3_1_1, rast_rel_2011_0928, mgrast_dev_04132011, mgrast_version_3_2, mgrast_dev_12152011, mgrast_dev_10262011, mgrast_release_3_1_0, HEAD
compute family.vector.def for a figfam direcotry.

#
# Create the family.vector.def file for the vector processing.
#

use FIG_Config;
use FIG;
use Data::Dumper;
use strict;

my $fig = new FIG;

my $usage = "usage: FFB2_make_family_vector FigfamRelDir";
my($ff_dir);

(
 ($ff_dir = shift @ARGV) && (-s "$ff_dir/families.2c") && (-s "$ff_dir/family.functions")
)
    || die $usage;


#
# We extract the set of roles from the subsystem index to be the set of functions in the
# vector. We use this to construct the basis vector; we keep the roles in the same
# order they were in in the function index (by reading the function index to generate
# the output).
#


open(FUNCS,"<$ff_dir/family.functions") || die "could not open $ff_dir/family.functions";
open(FIDX, "<$ff_dir/function.index") || die "could not open $ff_dir/function.index";
open(INDEX,">$ff_dir/family.vector.def") or die "Cannot write $ff_dir/family.vector.def: $!";

my $ss_roles = $fig->subsystem_roles();

my %funcH;

while (defined($_ = <FUNCS>))
{
    chomp;
    my($ff,$func) = split(/\t/,$_);
    push(@{$funcH{$func}},$ff);
}
close(FUNCS);

my $indexI = 1;

while (<FIDX>)
{
    chomp;
    my($x, $func) = split(/\t/);

    next unless $ss_roles->{$func};

    my @ffs = sort @{$funcH{$func}};
    
    print INDEX join("\t", $indexI, $func, @ffs), "\n";

    $indexI++;

}
close(INDEX);
    
    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3