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

Diff of /FigKernelScripts/to_prodom.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1, Thu Jun 1 16:11:26 2006 UTC revision 1.4, Tue Jun 6 15:14:26 2006 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl -w  #!/usr/bin/perl -w
2    
3  use strict;  use strict;
4  use CGI qw(:standard);  #use CGI qw(:standard);
5  use CGI::Carp qw(warningsToBrowser fatalsToBrowser);  #use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
6  use Data::Dumper;  use Data::Dumper;
7  use LWP;  use LWP;
8  use HTTP::Request::Common;  use HTTP::Request::Common;
# Line 10  Line 11 
11    
12  my $fig = new FIG;  my $fig = new FIG;
13  my $user_agent = LWP::UserAgent->new;  my $user_agent = LWP::UserAgent->new;
14    my $usage = "usage: to_prodom [peg pegID]";
15    my @arguments_in;
16    
17  if (@ARGV < 1) {  if (@ARGV > 0)
18      die "A PegID was not provided. usage: to_prodom.pl PegID";  {
19        @arguments_in = @ARGV;
20    }
21    else
22    {
23        die $usage;
24      }      }
25    
26  print header;  my %arg_pairs = ();
27  my $peg = $ARGV[0];  
28    foreach (@arguments_in)
29    {
30        my ($name,$val) = split(/\t/,$_);
31        $arg_pairs{$name} = $val;
32    }
33    
34    my @keys = keys %arg_pairs;
35    
36    my $peg = $arg_pairs{'peg'};
37    
 $peg =~ s/peg\=//g;  
38  $peg =~ s/\%7C/\|/g;  $peg =~ s/\%7C/\|/g;
39    
40  my $seq = $fig->get_translation($peg);  my $seq = $fig->get_translation($peg);
41  my @aliases=$fig->feature_aliases($peg);  my @aliases=$fig->feature_aliases($peg);
42    
# Line 32  Line 49 
49  # Order of importance is sp, tr, uni  # Order of importance is sp, tr, uni
50    
51  my @all_ids;  my @all_ids;
   
52  &add_to_array (\@uni_ids);  &add_to_array (\@uni_ids);
53  &add_to_array (\@tr_ids);  &add_to_array (\@tr_ids);
54  &add_to_array (\@sp_ids);  &add_to_array (\@sp_ids);
55    
56    
57  foreach (@all_ids) {  foreach (@all_ids) {
58    
59      &to_prodom_by_id($_);      &to_prodom_by_id($_);
60  }  }
61    
# Line 83  Line 101 
101          if(! ($response->content =~ m/Sorry/i) ) {          if(! ($response->content =~ m/Sorry/i) ) {
102              my $result = $response->content;              my $result = $response->content;
103              # Replace relative paths with absolute paths              # Replace relative paths with absolute paths
104              $result =~ s/\.\./http:\/\/prodes\.toulouse\.inra\.fr\/prodom\/current\//g;              $result =~ s/\.\./http:\/\/prodes\.toulouse\.inra\.fr\/prodom\/current/g;
105    
106                $result =~ s/<\!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4\.0 Transitional\/\/EN\"//;
107                $result =~ s/"http\:\/\/www\.w3\.org\/TR\/REC-html40\/loose\.dtd\">//;
108                $result =~ s/<HTML>//;
109                $result =~ s/<HEAD>//;
110                $result =~ s/<\/HEAD>//;
111                $result =~ s/<\/HTML>//;
112                #Get rid of css reference because it breaks the FIG header
113                $result =~ s/<link rel=.*?>//g;
114              print $result;              print $result;
115              exit;              exit;
116          }          }
# Line 108  Line 135 
135    
136      my $response = $user_agent->request($request);      my $response = $user_agent->request($request);
137      my $result = $response->content;      my $result = $response->content;
138    
139        $result =~ s/<\!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4\.0 Transitional\/\/EN\"//;
140        $result =~ s/"http\:\/\/www\.w3\.org\/TR\/REC-html40\/loose\.dtd\">//;
141        $result =~ s/<HTML>//;
142        $result =~ s/<HEAD>//;
143        $result =~ s/<\/HEAD>//;
144        $result =~ s/<\/HTML>//;
145    
146      # Replace relative paths with absolute paths      # Replace relative paths with absolute paths
147      $result =~ s/\.\./http:\/\/prodes\.toulouse\.inra\.fr\/prodom\/current\//g;      $result =~ s/\.\./http:\/\/prodes\.toulouse\.inra\.fr\/prodom\/current/g;
148        $result =~ s/<link rel=.*?>//g;
149      print $result;      print $result;
150    
151  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.4

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3