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

View of /FigKernelScripts/make_PHOBs_for_subsystems.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Tue May 3 00:09:39 2005 UTC (14 years, 8 months ago) by overbeek
Branch: MAIN
add make_PHOBs_for subsystems

use FIG;
my $fig = new FIG;

$usage = "usage: make_PHOBs_for_subsystems Dir < FileOf_SS-Role-PEG-Func";

(
 ($dir = shift @ARGV) && (! -d $dir)
)
    || die $usage;

mkdir($dir,0777) || die "could not make $dir";
while (defined($_ = <STDIN>))
{
    chop;
    ($ss,$role,$peg) = split(/\t/,$_);
    push(@{$subH{$ss}->{$role}},$peg);
}

$tmpF = "/tmp/pegs$$.fasta";

open(INDEXSS,">$dir/index") || die "could not open $dir/index";
$ssN = 0;
foreach $ss (sort keys(%subH))
{
    ++$ssN;
    mkdir("$dir/$ssN",0777) || die "could not make $dir/$ssN";
    print INDEXSS "$ssN\t$ss\n";

    open(INDEXR,">$dir/$ssN/index") || die "could not open $dir/$ssN/index";
    $roleN = 0;
    foreach $role (sort keys(%{$subH{$ss}}))
    {
	++$roleN;
	print INDEXR "$roleN\t$role\n";

	$pegs = $subH{$ss}->{$role};
	open(TMP,">$tmpF") || die "could not open $tmpF";
	foreach $peg (@$pegs)
	{
	    if ($pseq = $fig->get_translation($peg))
	    {
		print TMP ">$peg\n$pseq\n";
	    }
	    else
	    {
		print STDERR "failed to get translation for $peg\n";
	    }
	}
	close(TMP);
	
	mkdir("$dir/$ssN/$roleN",0777) || die "could not make $dir/$ssN/$roleN";
	&FIG::run("split_and_trim_sequences $dir/$ssN/$roleN/split_info < $tmpF");
	
	open(SZ,"<$dir/$ssN/$roleN/split_info/set.sizes") || die " could not open $dir/$ssN/$roleN/split_info";
	while (defined($_ = <SZ>))
	{
	    if (($_ =~ /^(\d+)\t(\d+)/) && ($2 > 3))
	    {
		$n = $1;
		&FIG::run("make_phob_from_seqs $dir/$ssN/$roleN/$n < $dir/$ssN/$roleN/split_info/$n");
	    }
	}
	close(SZ);
    }
    close(INDEXR);
}
close(INDEXSS);
unlink($tmpF);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3