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

Annotation of /FigWebServices/aliases_to_pubmed.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (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 : hwang 1.2
10 : hwang 1.1 my $id_string = $cgi->param("ids");
11 :     my $peg = $cgi->param("peg");
12 :    
13 : hwang 1.5 &print_header;
14 :     &print_verbiage;
15 :    
16 : hwang 1.1 if (!$id_string) {
17 : hwang 1.5 print "PubMed publication(s) found for this PEG were not specific to this PEG<p>";
18 : hwang 1.1 exit;
19 :     }
20 :    
21 : hwang 1.5 &print_peg_info;
22 :    
23 :     my $pmid_output = &FIG::run_gathering_output("$FIG_Config::bin/get_pubmed_journals", $id_string);
24 :    
25 :     my @publications_list = split(/ /, $pmid_output);
26 :     my %publications_list_seen = ();
27 :     my %publications_to_pegs = ();
28 :    
29 : hwang 1.1
30 : hwang 1.5 foreach (@publications_list) {
31 :     $publications_list_seen{$_} = "$peg\t$_";
32 :     $publications_to_pegs{$_} = $peg;
33 :     }
34 : hwang 1.1
35 : hwang 1.5 my (@show_notr_publications, @show_r_publications);
36 :     my ($publication_div, $publication_relevant_div, $publication_notrelevant_div);
37 : hwang 1.1
38 : hwang 1.5 my @pubmed_rel_attributes = $fig->get_attributes($peg,"PUBMED_CURATED_RELEVANT",undef,undef);
39 :     my @pubmed_notrel_attributes = $fig->get_attributes($peg,"PUBMED_CURATED_NOTRELEVANT",undef,undef);
40 :     my @pubmed_attributes = $fig->get_attributes($peg,"PUBMED",undef,undef);
41 : hwang 1.1
42 : hwang 1.5 &process_attributes(\@pubmed_attributes, "pubmed_plain");
43 :     &process_attributes(\@pubmed_rel_attributes, "relevant");
44 :     &process_attributes(\@pubmed_notrel_attributes, "notrelevant");
45 : hwang 1.3
46 : hwang 1.5 my @filtered_publications;
47 :     while( my($k,$v) = each(%publications_list_seen)) {
48 :     if ($k ne "") {
49 :     $publication_div .= "<li id=\"$k\">$k</li>";
50 :     push(@filtered_publications,$v);
51 : hwang 1.3 }
52 :     }
53 :    
54 : hwang 1.5 my $peg_list;
55 :     while( my($k,$v) = each(%publications_to_pegs)) {
56 :     $peg_list .= "$k-$v\;";
57 :     }
58 :    
59 : hwang 1.3
60 : hwang 1.1
61 : hwang 1.5 my $column_table = &FigWebServices::SeedComponents::PubMed::column_title;
62 :     my $not_curated_htmltable = &FigWebServices::SeedComponents::PubMed::journals_as_htmltable(\@filtered_publications);
63 :     my $r_publication_htmltable = &FigWebServices::SeedComponents::PubMed::journals_as_htmltable(\@show_r_publications);
64 :     my $notr_publication_htmltable = &FigWebServices::SeedComponents::PubMed::journals_as_htmltable(\@show_notr_publications);
65 : hwang 1.1
66 : hwang 1.5 #Put publications as a string to be passed the next cgi
67 : hwang 1.1
68 : hwang 1.5 print "<table>";
69 :     print $column_table;
70 : hwang 1.2
71 : hwang 1.5 if ($not_curated_htmltable) {
72 :     print $not_curated_htmltable;
73 :     }
74 :     if ($r_publication_htmltable) {
75 :     print "<tr><td colspan=3><ul><li>Curated to be relevant publication(s):</li></ul></td></tr>";
76 :     print $r_publication_htmltable;
77 : hwang 1.2 }
78 : hwang 1.1
79 : hwang 1.5 if ($notr_publication_htmltable) {
80 :     print "<tr><td colspan=3><ul><li>Curated to be not relevant publication(s):</li></ul></td></tr>";
81 :     print $notr_publication_htmltable;
82 :     print "</table>";
83 : hwang 1.2 }
84 : hwang 1.1
85 : hwang 1.5 if ((! $notr_publication_htmltable) || ( ! $r_publication_htmltable) ) {
86 :     print "</table>";
87 : hwang 1.2 }
88 : hwang 1.1
89 : hwang 1.5 my $publication_info;
90 :     print $cgi->hr();
91 :     &print_form;
92 : hwang 1.1
93 : hwang 1.2
94 : hwang 1.5 ###############
95 :     # Subroutines
96 :     ###############
97 : hwang 1.2
98 : hwang 1.5 sub print_header {
99 :    
100 :     print $cgi->header;
101 :     print $cgi->start_html( -title=>'PubMed for PEG',
102 :     -style=>{ -src => 'Html/dnd.css'},
103 :     -script=> [
104 :     {-language => 'JAVASCRIPT',
105 :     -src => 'Html/drag_and_drop.js'},
106 :     ]
107 :     );
108 : hwang 1.1
109 : hwang 1.3
110 : hwang 1.5 }
111 :    
112 :     sub print_verbiage {
113 :    
114 :     print "<table><tr><td bgcolor=#D2E6F0>Introduction</td></tr></table>";
115 :     print "This website automates the process of finding relevant publications associated with a protein encoded gene (PEG). Aliases associated with the PEG are used as the search terms to query the PubMed database to find publications. Our tool does not get all journals associated with the PEG. A filter is used to remove publications that may be genome papers, and other publications that may not be relevant to the PEG. <p> Since this tool is an automated tool to query PubMed database and automated tools can not replace human knowledge, relevant and not relevant papers may be returned with the search. It is up to the curator to deem the publications as relevant and not relevant publications.";
116 : hwang 1.1
117 : hwang 1.5 }
118 : hwang 1.1
119 : hwang 1.5 sub print_peg_info {
120 :     my $role = $fig->function_of($peg);
121 :     print $cgi->hr();
122 :     print "<table>";
123 :     print "<tr><td bgcolor=#D2E6F0>Functional Role</td><td> $role</td></tr></table>";
124 :     print "<I>Getting PubMed publication(s) for $id_string ...</I><p>";
125 : hwang 1.1 print $cgi->hr();
126 : hwang 1.5 }
127 :    
128 :    
129 :     sub print_form {
130 : hwang 1.1
131 :     print "
132 :    
133 : hwang 1.5 This section allows you to curate the publications. You must be on the annotator's machine and specify your name. Press the \"Save to Attributes\" button for your changes to take effect.
134 : hwang 1.1
135 : hwang 1.2 <div>
136 : hwang 1.1 <form name=\"myForm\" method=\"post\" action=\"save_to_attributes.cgi\" onsubmit=\"saveDragDropNodes()\">
137 : hwang 1.2 <p><input type=\"textbox\" name=\"master\" value=\"Name\"> Your name
138 :     <p><input type=\"submit\" value=\"Save to attributes\" name=\"save\">
139 :     <p>
140 : hwang 1.5 You may curate the publication information by
141 : hwang 1.2 <ul>
142 : hwang 1.5 <li> Adding your own publication for this peg</li>
143 : hwang 1.2
144 : hwang 1.1 <input type=\"hidden\" name=\"listOfItems\" value=\"\">
145 : hwang 1.5 <input type=\"hidden\" name=\"all_publications\" value=\"$publication_info\">
146 :     <input type=\"hidden\" name=\"listOfPeg\" value=\"$peg_list\">
147 :     <input type=\"hidden\" name=\"purpose\" value=\"peg\">
148 :     <input type=\"hidden\" name=\"purpose_peg\" value=\"$peg\">
149 :     <input type=\"textbox\" size=50 name=\"PMID\" value=\"PMID1 PMID2 PMID3\"> Publication Identifier (Multiple PMIDs should be separated by a space)
150 :     PMID
151 : hwang 1.1 </form>
152 : hwang 1.5 <p>
153 :     <li> Drag and drop the PMID to the appropriate containers (Relevant Publication(s)/ Not Relevant Publication(s)).
154 : hwang 1.3 Containers will be empty if there are no pmid found for this peg.</li>
155 : hwang 1.1 </div>
156 :     <div id=\"dhtmlgoodies_dragDropContainer\">
157 :     <div id=\"topBar\">
158 :     </div>
159 :     <div id=\"dhtmlgoodies_listOfItems\">
160 : hwang 1.5 <div><p>PUBMED NOT CURATED </p><ul id=\"PUBMED_NOT_CURATED\">$publication_div</ul></div>
161 : hwang 1.1 </div>
162 :     <div id=\"dhtmlgoodies_mainContainer\">
163 : hwang 1.5 <div><p>RELEVANT Publication(s) (curated by)</p><ul id=\"PUBMED_CURATED_RELEVANT\">$publication_relevant_div</ul></div>
164 :     <div><p>NOT RELEVANT Publication(s) (curated by)</p><ul id=\"PUBMED_CURATED_NOTRELEVANT\">$publication_notrelevant_div</ul></div>
165 : hwang 1.1 </div>
166 :     </div>
167 : hwang 1.2 </ul>
168 : hwang 1.1 <ul id=\"dragContent\"></ul>
169 : hwang 1.4 <div id=\"dragDropIndicator\"></div>
170 : hwang 1.1 <div id=\"saveContent\"><div>
171 :     ";
172 : hwang 1.5
173 :     }
174 :    
175 :     sub process_attributes {
176 :     my ($attribute_in, $what) = @_;
177 :     my @att_in = @{$attribute_in};
178 :    
179 :     foreach(@att_in) {
180 :     my @line = @{$_};
181 :     my $peg = $line[0];
182 :     my $key = $line[1];
183 :     my $value = $line[2];
184 :     my ($curator,$pmid,$title) = split(/,/,$value);
185 :    
186 :     if($what eq 'pubmed_plain') {
187 :     $pmid = $value;
188 :    
189 :     }
190 :    
191 :     $publications_to_pegs{$pmid} = $peg;
192 :    
193 :     #delete existing pmids from all publication_list
194 :     if($what eq 'relevant') {
195 :     delete $publications_list_seen{$pmid};
196 :     push(@show_r_publications, "$peg\t$pmid");
197 :     $publication_relevant_div .= "<li id=\"$pmid($curator)\">$pmid($curator)</li>";
198 :    
199 :     }
200 :     if($what eq 'notrelevant') {
201 :     delete $publications_list_seen{$pmid};
202 :     push(@show_notr_publications, "$peg\t$pmid");
203 :     $publication_notrelevant_div .= "<li id=\"$pmid($curator)\">$pmid($curator)</li>";
204 :     }
205 :    
206 :     if(($what eq 'pubmed_plain') && (! $publications_list_seen{$pmid})) {
207 :    
208 :     $publications_list_seen{$pmid} = "$peg\t$pmid";
209 :     }
210 :     }
211 :     }
212 :    
213 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3