[Bio] / FigWebServices / nmpdr_aliases_to_pubmed.cgi Repository:
ViewVC logotype

Annotation of /FigWebServices/nmpdr_aliases_to_pubmed.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (view) (download)

1 : hwang 1.1 #/usr/bin/perl
2 :     use FIG;
3 :     use strict;
4 :     use CGI;
5 :     use FigWebServices::SeedComponents::PubMed;
6 :    
7 :     my $cgi = new CGI;
8 :     my $fig = new FIG;
9 :    
10 :     print $cgi->header;
11 : hwang 1.2 print $cgi->start_html( -title=>'Literature for peg',
12 : hwang 1.1 -style=>{ -src => 'Html/dnd.css'},
13 :     );
14 :    
15 :    
16 :     my $id_string = $cgi->param("ids");
17 :     my $peg = $cgi->param("peg");
18 :    
19 :     if (!$id_string) {
20 : hwang 1.4 print "Literature found for this peg was not specific to this peg<p>";
21 : hwang 1.1 exit;
22 :     }
23 :    
24 :    
25 :     print "<table>";
26 :     print "<tr><td bgcolor=#D2E6F0>Peg</td><td> $peg</td></tr>";
27 :     my $role = $fig->function_of($peg);
28 :     print "<tr><td bgcolor=#D2E6F0>Functional Role</td><td> $role</td></tr></table>";
29 :    
30 :     print $cgi->hr();
31 : hwang 1.4 print "<I>Getting PubMed literature for $id_string ...</I><p>";
32 : hwang 1.1
33 :     my $pmid_output = &FIG::run_gathering_output("$FIG_Config::bin/get_pubmed_journals", $id_string);
34 :    
35 :     my @journals_list = split(/ /, $pmid_output);
36 :     my %journals_list_seen = ();
37 :    
38 :     foreach (@journals_list) {
39 :     $journals_list_seen{$_} = $_;
40 :     #print "journals here are $_\n";
41 :     }
42 :    
43 :     #Add PubMed Attributes here
44 :     my @pubmed_attributes = $fig->get_attributes($peg, "PUBMED");
45 :     foreach (@pubmed_attributes) {
46 :    
47 :     my @line = @{$_};
48 :     #print "id is $line[2]\n";
49 :     if (! $journals_list_seen{$line[2]} ) {
50 :     #print "pushing\n";
51 :     push (@journals_list, $line[2]);
52 :     }
53 :     }
54 :    
55 :    
56 :     my @new_journals = &FigWebServices::SeedComponents::PubMed::sort_journals(\@journals_list);
57 :     my $journal_htmltable = &FigWebServices::SeedComponents::PubMed::journals_as_htmltable(\@new_journals);
58 :    
59 :     #Put journals as a string to be passed the next cgi
60 :    
61 :     my $journal_info;
62 :     my %journals_seen = ();
63 :    
64 :     foreach (@new_journals) {
65 :     my($pmid, $year,$month,$date,$title) = split(/\t/,$_);
66 :     my $j = "$pmid|$title";
67 :     $journal_info .= $j.";";
68 :     $journals_seen{$pmid} = $title;
69 :     }
70 :    
71 :     my @attributes = $fig->get_attributes($peg);
72 :     my @relevant;
73 :     my @notrelevant;
74 :     my @notcurated;
75 :    
76 :     foreach (@attributes) {
77 :     my @att_line = @{$_};
78 :     my $key = $att_line[1];
79 :     my ($pmid, $title) = split(/\,/,$att_line[2]);
80 :    
81 :     if ($key =~ m/\_RELEVANT\_CURATED\_BY\_(.*)/) {
82 :     my $anno_name = $1;
83 :     my $pmid_name = "$pmid($anno_name)";
84 :     push (@relevant, $pmid_name);
85 :     delete $journals_seen{$pmid};
86 :     }
87 :    
88 :     if ($key =~ m/\_NOTRELEVANT\_CURATED\_BY\_(.*)/) {
89 :     my $anno_name = $1;
90 :     my $pmid_name = "$pmid($anno_name)";
91 :     push (@notrelevant, $pmid_name);
92 :     delete $journals_seen{$pmid};
93 :     }
94 :    
95 :     if ($key =~ m/\_NOT\_CURATED\_/) {
96 :     if($journals_seen{$pmid}) {
97 :     delete $journals_seen{$pmid};
98 :     }
99 :     else {
100 :     $journals_seen{$pmid};
101 :     }
102 :     }
103 :     }
104 :     #original div
105 :     my $journal_div;
106 :     my $journal_relevant_div;
107 :     my $journal_notrelevant_div;
108 :    
109 :     foreach (@notrelevant) {
110 :     $journal_notrelevant_div .= "<li id=\"$_\">$_</li>";
111 :     }
112 :    
113 :     foreach (@relevant) {
114 :     $journal_relevant_div .= "<li id=\"$_\">$_</li>";
115 :     }
116 :    
117 :     while( my($k,$v) = each(%journals_seen)) {
118 :     $journal_div .= "<li id=\"$k\">$k</li>";
119 :     }
120 :    
121 :     #not curated div
122 :    
123 :    
124 :     print $journal_htmltable;
125 :    
126 :     if ($#journals_list < 0) {
127 : hwang 1.4 print "Literature found for this peg was not specific to this peg<p>";
128 : hwang 1.1
129 :     }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3