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

View of /FigKernelScripts/relevant_pchsG.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (download) (as text) (annotate)
Fri Sep 9 17:21:51 2005 UTC (14 years, 10 months ago) by olson
Branch: MAIN
CVS Tags: caBIG-dataload-0, caBIG-00-00-00
Changes since 1.2: +17 -0 lines
Fixes for coupling scripts.

use FIG;
my $fig = new FIG;

use DBrtns;
my $dbh = $fig->db_handle;

$usage = "usage: relevant_pchs Genome";

(
 ($genome = shift @ARGV)
 )
    || die $usage;

if ($genome =~ /^\d+\.\d+$/)
{
    my $mg = $fig->map_genome_to_id($genome);
    print STDERR "Mapped $genome to $mg\n";
    $genome = $mg;
}
elsif ($genome =~ /^\d+$/)
{
    my $g = $fig->map_id_to_genome($genome);
    print STDERR "Using mapped genome $g\n";
}
else
{
    die "Invalid genome identifier\n";
}


my $qry = qq(SELECT r1.g1, r1.p1,
	         r1.g2, r1.p2,
	         r2.g2, r2.p2,
	         r3.g2, r3.p2,
	         r2.iden, r3.iden, r2.paraN, r3.paraN
	     FROM close_pegs r1, condensed_sims r2, condensed_sims r3, close_pegs r4
	     WHERE (r1.g1 = $genome AND
		    r1.g1 = r2.g1 AND
		    r1.p1 = r2.p1 AND

		    r1.g2 = r3.g1 AND
		    r1.p2 = r3.p1 AND

		    r4.g1 = r2.g2 AND
		    r4.p1 = r2.p2 AND

		    r4.g2 = r3.g2 AND
		    r4.p2 = r3.p2)
	     );

if (($res = $dbh->SQL($qry)) && 
    (@$res > 0))
{
    foreach $x (sort { ($a->[0] <=> $b->[0]) or ($a->[1] <=> $b->[1]) or ($a->[2] <=> $b->[2]) or
			   ($a->[3] <=> $b->[3]) or ($b->[8] <=> $a->[8]) }  @$res)
    {
	print join("\t",@$x),"\n";
    }
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3