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

View of /DrugTargets/peg_pdb_dist.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (download) (as text) (annotate)
Fri Sep 2 19:15:45 2005 UTC (14 years, 3 months ago) by hwang
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -1 lines
changed to fasta.bound/fasta.free instead of fasta.bound.txt/fasta.free.txt

use FIG;
use FIG_Config;

$| = 1;

$usage = "peg_pdb_dist [-len] [-align] fig_id pdb_id \n";

my $fig = new FIG;
my $peg;
my $pdb;

while ($ARGV[0] =~ /-\S/) {
    if ($ARGV[0] =~ /-len/) {
	$showlen = 1;
    } elsif ($ARGV[0] =~ /-align/) {
	$showalign = 1;
    } else {
	die "Usage: $usage";
    }
    shift @ARGV;
}

(
 ($peg = shift @ARGV) &&
 ($pdb = shift @ARGV)
) || die "Usage: $usage";

$peg =~ s/'(.*)'/$1/;
$peg =~ s/fig\|//;
$peg = "fig|" . $peg;

$pdb =~ /(\d\w{3})/;
$pdb = "pdb$1.ent";
#print $peg . "\n";
#print $pdb . "\n";

#my $db = "$FIG_Config::data/PDB/fasta.free";
#my $db = "/Users/fangfang/FIGdisk/DATA/PDB/fasta.free";
my $db = "$FIG_Config::fig/var/DrugTargets/fasta.free";
my $pdbs = `grep $pdb $db -A 1` || die "BAD INPUT: no such PDB entry.\n";
my $pegs = $fig->get_translation($peg);

#print $pegs;
#print $pdbs;

$pdbs =~ s/^.*/>pdb/;

my $temp_dir = $FIG_Config::temp;
my $file     = "$temp_dir/tmp$$";

open(TMP,">$file.fasta") || die "could not open $file";

print TMP ">peg\n$pegs\n";
print TMP $pdbs;
close(TMP);

$nseq = `$FIG_Config::ext_bin/clustalw -infile=$file.fasta -align -outorder=aligned | grep aa`;
$nseq =~ /.* (\d+) aa\n.* (\d+) aa/;
$nseq = join("\t", $1, $2);

print "$nseq\t" unless !$showlen;
system "$FIG_Config::bin/clustal_to_fasta < \"$file.aln\" | $FIG_Config::bin/fasta_to_phylip > infile ";

(!-e "outfile") || unlink("outfile");
open(DIST, "| $FIG_Config::ext_bin/protdist > /dev/null") || die "Could not run protdist, aborted.\n";
print DIST "Y\n";
close(DIST);
$dist =`cat outfile | tail -n 2 | head -n 1`;
$dist =~ s/.*\s+(\S+)$/$1/g;

print $dist;
system "cat $file.aln" unless !$showalign;

#unlink("$file.fasta","$file.aln","$file.dnd");


MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3