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

View of /FigKernelScripts/make_subsystems_from_clusters.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (download) (as text) (annotate)
Fri Jun 3 23:09:10 2005 UTC (15 years ago) by overbeek
Branch: MAIN
Changes since 1.2: +3 -3 lines
fix bug in compare_regions

use FIG;

$usage = "usage: make_subsystems_from_clusters KernelCSSs CouplingF DisambiguationPrefix SubsysDirectory User ProposedAssignmentsDirectory";

(
 ($cssD      = shift @ARGV) && opendir(CSS,$cssD) &&
 ($couplingF = shift @ARGV) &&
 ($prefix    = shift @ARGV) &&
 ($subsysD   = shift @ARGV) &&
 ($user      = shift @ARGV) &&
 ($assignD   = shift @ARGV)
)
    || die "aborted";

@css = grep { $_ !~ /^\./ } readdir(CSS);
closedir(CSS);

&FIG::verify_dir($assignD);

$tmpD = "/tmp/Tmp$$";

&FIG::verify_dir($tmpD);

$N = 1;
foreach $css (@css)
{
    if ($css =~ /^(\d+)-\.\.\.(\d+)\.\.\.-(\d+)/)
    {
	($beg,$n,$end) = ($1,$2,$3);
	open(CSS,"<$cssD/$css") || die "could not open $cssD/$css";
	$/ = "\n//\n";
	$_ = <CSS>;
	$/ = "\n";
	if (defined($_ = <CSS>) && ($_ =~ /^(\d+\.\d+)/))
	{
	    $main_genome = $1;
	    $name = "$main_genome-$beg-$n-$end";
	    &FIG::run("fill_in_roles $assignD/$name < $cssD/$css > $tmpD/with.roles");
	    open(TMP,"<$tmpD/with.roles") || die "could not open $tmpD/with.roles";
	    $/ = "\n//\n";
	    if (defined($_ = <STDIN>) && defined($_ = <STDIN>))
	    {
		$/ = "\n";
		chomp;
		@lines = map { $_ =~ /^(\S+)\t(\S.*\S)/; [$1,$2] } split(/\n/,$_);
		@hypos = ();
		foreach $x (@lines)
		{
		    if (&FIG::hypo($x->[1]))
		    {
			push(@hypos,$x->[0]);
		    }
		}

		$abbreviations = join(" ",@hypos);
		&FIG::run("make_assignments_fit_initial_css $prefix\_$N $assignD/$name $abbreviations < $tmpD/with.roles > $tmpD/hypos.prefixed");
		&FIG::run("expand_multifunctional_roles < $tmpD/hypos.prefixed > $tmpD/expanded.multifunctionals");
		&FIG::run("make_spreadsheet_and_notes $couplingF $subsysD $user < $tmpD/expanded.multifunctionals");
		$N++;
	    }
	    close(TMP);
	}
	else
	{
	    die "bad spreadsheet: $css";
	}
    }
    else
    {
	die "bad name: $css";
    }
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3