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

Annotation of /DrugTargets/peg_pdb_dist.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (view) (download) (as text)

1 : fangfang 1.1 use FIG;
2 :     use FIG_Config;
3 :    
4 :     $| = 1;
5 :    
6 :     $usage = "peg_pdb_dist [-len] [-align] fig_id pdb_id \n";
7 :    
8 :     my $fig = new FIG;
9 :     my $peg;
10 :     my $pdb;
11 :    
12 :     while ($ARGV[0] =~ /-\S/) {
13 :     if ($ARGV[0] =~ /-len/) {
14 :     $showlen = 1;
15 :     } elsif ($ARGV[0] =~ /-align/) {
16 :     $showalign = 1;
17 :     } else {
18 :     die "Usage: $usage";
19 :     }
20 :     shift @ARGV;
21 :     }
22 :    
23 :     (
24 :     ($peg = shift @ARGV) &&
25 :     ($pdb = shift @ARGV)
26 :     ) || die "Usage: $usage";
27 :    
28 :     $peg =~ s/'(.*)'/$1/;
29 :     $peg =~ s/fig\|//;
30 :     $peg = "fig|" . $peg;
31 :    
32 :     $pdb =~ /(\d\w{3})/;
33 :     $pdb = "pdb$1.ent";
34 :     #print $peg . "\n";
35 :     #print $pdb . "\n";
36 :    
37 :     #my $db = "$FIG_Config::data/PDB/fasta.free";
38 : fangfang 1.2 #my $db = "/Users/fangfang/FIGdisk/DATA/PDB/fasta.free";
39 : hwang 1.4 my $db = "$FIG_Config::fig/var/DrugTargets/fasta.free";
40 : fangfang 1.1 my $pdbs = `grep $pdb $db -A 1` || die "BAD INPUT: no such PDB entry.\n";
41 :     my $pegs = $fig->get_translation($peg);
42 :    
43 :     #print $pegs;
44 :     #print $pdbs;
45 :    
46 :     $pdbs =~ s/^.*/>pdb/;
47 :    
48 :     my $temp_dir = $FIG_Config::temp;
49 :     my $file = "$temp_dir/tmp$$";
50 :    
51 :     open(TMP,">$file.fasta") || die "could not open $file";
52 :    
53 :     print TMP ">peg\n$pegs\n";
54 :     print TMP $pdbs;
55 :     close(TMP);
56 :    
57 :     $nseq = `$FIG_Config::ext_bin/clustalw -infile=$file.fasta -align -outorder=aligned | grep aa`;
58 :     $nseq =~ /.* (\d+) aa\n.* (\d+) aa/;
59 :     $nseq = join("\t", $1, $2);
60 :    
61 :     print "$nseq\t" unless !$showlen;
62 : fangfang 1.3 system "$FIG_Config::bin/clustal_to_fasta < \"$file.aln\" | $FIG_Config::bin/fasta_to_phylip > infile ";
63 : fangfang 1.1
64 :     (!-e "outfile") || unlink("outfile");
65 : fangfang 1.2 open(DIST, "| $FIG_Config::ext_bin/protdist > /dev/null") || die "Could not run protdist, aborted.\n";
66 : fangfang 1.1 print DIST "Y\n";
67 :     close(DIST);
68 :     $dist =`cat outfile | tail -n 2 | head -n 1`;
69 :     $dist =~ s/.*\s+(\S+)$/$1/g;
70 :    
71 :     print $dist;
72 :     system "cat $file.aln" unless !$showalign;
73 :    
74 :     #unlink("$file.fasta","$file.aln","$file.dnd");
75 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3