[Bio] / DrugTargets / find_homologs_in.pl Repository:
ViewVC logotype

View of /DrugTargets/find_homologs_in.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Tue Aug 23 03:32:58 2005 UTC (14 years, 3 months ago) by fangfang
Branch: MAIN
CVS Tags: HEAD
Added new algorithm for computing degree of sequence conservation.

The algorithm looks for the homologs of one peg in 10 fixed organisms,
and uses clustalw to align the 10 sequences. Conservation value is then
calculated based on the aligned fasta file.

The algorithm decides which 10 organisms to compare based on whether
this peg belongs to a gram positive bacteria or not.

cons_orgs_list1.txt: Firmicutes
cons_orgs_list2.txt: Proteobacteria

use FIG;
use FIG_Config;

$usage = "find_homologs_in [-all] peg org1 org2 ...\n\n";

if ($ARGV[0] =~ /-all/i) {
    shift @ARGV;
    $all = 1;
}

(
    ($peg = shift @ARGV) &&
    (@org = @ARGV, $org[0]) 
) || die "Usage: $usage";

my $fig      = new FIG;
my $temp_dir = $FIG_Config::temp;
my $seqFile  = "$temp_dir/tmp$$";

if (! $ENV{"BLASTMAT"}) { $ENV{"BLASTMAT"} = "$FIG_Config::blastmat" }
my $blastall = "$FIG_Config::ext_bin/blastall";

for $org (@org) {
    my $db = "$FIG_Config::data/Organisms/$org/Features/peg/fasta";

    (-e $db) || die "Could not find: $db\n\n";

    my $seq = $fig->get_translation($peg);
    open(SEQ, ">$seqFile") || die "Could not open file $seqFile.\n\n";
    print SEQ $seq;
    close(SEQ);

    &verify_db($db, "p");
    my $blastout = `$blastall -i $seqFile -d $db -p blastp`;
    if (!$all) {
	$blastout =~ /(fig\|\d+\.\d+\.peg\.\d+)\s+(\d+)\s+(\S+)/;
	$homo   = $1;
	$evalue = $3;
	print join("\t", $homo, $evalue) . "\n";
    } else {
	for (split(/\n/, $blastout)) {
	    if (/(fig\|\d+\.\d+\.peg\.\d+)\s+(\d+)\s+(\S+)/) {
		$homo   = $1;
		$evalue = $3;
		print join("\t", $homo, $evalue) . "\n";
	    }
	}
    }
}
 
sub verify_db {
    my($db,$type) = @_;

    if ($type =~ /^p/i)
    {
	if ((! -s "$db.psq") || (-M "$db.psq" > -M $db))
	{
	    system "$FIG_Config::ext_bin/formatdb -p T -i $db";
	}
    }
    else
    {
	if ((! -s "$db.nsq") || (-M "$db.nsq" > -M $db))
	{
	    system "$FIG_Config::ext_bin/formatdb -p F -i $db";
	}
    }
}	





MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3