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

Diff of /FigWebServices/aliases_to_pubmed.cgi

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

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

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3