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

View of /FigKernelScripts/FFB2_make_FF_index.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (download) (as text) (annotate)
Tue Apr 23 20:31:41 2013 UTC (6 years, 6 months ago) by olson
Branch: MAIN
CVS Tags: rast_rel_2014_0912, rast_rel_2014_0729, HEAD
Changes since 1.2: +4 -76 lines
Update to figfam processing

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

my $usage = "usage: make_FF_index FigfamRelDir IndexFile ";
my($ff_dir,$indexF);

(
 ($ff_dir = shift @ARGV) && (-s "$ff_dir/families.2c") && (-s "$ff_dir/family.functions") &&
 ($indexF = shift @ARGV)

)
    || die $usage;


my %funcH;
open(FUNCS,"<$ff_dir/family.functions") || die "could not open $ff_dir/family.functions";
open(PEGS,"<$ff_dir/families.2c")       || die "could not open $ff_dir/families.2c";
open(INDEX,">$indexF")                  || die "could not open $indexF";

my %ff_to_pegs;
my %genomes;
while (defined($_ = <PEGS>))
{
    chomp;

    if (my($ff, $peg, $genome) = /^(FIG\d+)\t(fig\|(\d+\.\d+)\S+)/)
    {
	push(@{$ff_to_pegs{$ff}},$peg);
	$genomes{$genome}->{$peg} = 1;
    }
}
close(PEGS);

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

my $indexI = 1;

my %index;
my @func_list = sort { @{$funcH{$b}} <=> @{$funcH{$a}} } keys(%funcH);
foreach my $func (@func_list)
{
    my $subI = $indexI % 1000;
    my @ffs = sort @{$funcH{$func}};
    foreach my $ff (@ffs)
    {
	print INDEX join("\t",($indexI,$ff,$func)),"\n";
    }
    $index{$func} = $indexI;
    $indexI++;

}
close(INDEX);
    
    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3