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

View of /FigKernelScripts/FFB2_make_subsys_based_families.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Mon Nov 16 21:52:22 2009 UTC (10 years, 8 months ago) by overbeek
Branch: MAIN
CVS Tags: rast_rel_2010_0526, rast_rel_2010_0118
new scripts for updating FIGfams and Kmer tables

########################################################################
#
# Copyright (c) 2003-2006 University of Chicago and Fellowship
# for Interpretations of Genomes. All Rights Reserved.
#
# This file is part of the SEED Toolkit.
# 
# The SEED Toolkit is free software. You can redistribute
# it and/or modify it under the terms of the SEED Toolkit
# Public License. 
#
# You should have received a copy of the SEED Toolkit Public License
# along with this program; if not write to the University of Chicago
# at info@ci.uchicago.edu or the Fellowship for Interpretation of
# Genomes at veronika@thefig.info or download a copy from
# http://www.theseed.org/LICENSE.TXT.
#
########################################################################


use FIG;
my $fig = new FIG;

# usage: FFB2_make_subsys_based_families > subsys.based.families

my $pairsF = "$FIG_Config::temp/peg-func.$$";
open(TMP1,"pegs_in_subsystems | cut -f2,3 | sort -u | function_of |")
    || die "could not get pegs";
open(TMP2,"| sort -u > $pairsF") || die "could not open $pairsF";

while (defined($_ = <TMP1>))
{
    chomp;
    my($role,$peg,$func) = split(/\t/,$_);
    next if ((! $func) || (length($func) < 2));
    my @roles = $fig->roles_of_function($func);
    my $i;
    for ($i=0; ($i < @roles) && ($roles[$i] ne $role); $i++) {}
    if ($i < @roles)
    {
	if ($func !~ /\#.*((trunca)|(framesh)|(fragment))/)
	{
	    $func =~ s/\s*\#.*$//;
	    print TMP2 "$func\t$peg\n";
	}
    }
}
close(TMP1);
close(TMP2);

my $n = 1;
open(TMP2,"<$pairsF") || die "could not open $pairsF";
my $x = <TMP2>;
while ($x && ($x =~ /(\S.*\S)\t(fig\|\d+\.\d+\.peg\.\d+)/))
{
    my $func = $1;
    my @set = ();
    while ($x && ($x =~ /(\S.*\S)\t(fig\|\d+\.\d+\.peg\.\d+)/) && ($1 eq $func))
    {
	push(@set,$2);
	$x = <TMP2>;
    }

    if (@set > 1)
    {
	foreach $_ (@set)
	{
	    print "$n\t$_\n";
	}
	$n++;
    }
}
unlink($pairsF);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3