[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.5, Tue Nov 28 20:11:41 2006 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    
13    &print_header;
14    &print_verbiage;
15    
16  if (!$id_string) {  if (!$id_string) {
17          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>";
18          exit;          exit;
19          }          }
20    
21    &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>";  
22    
23  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);
24    
25  my @journals_list = split(/ /, $pmid_output);  my @publications_list = split(/ /, $pmid_output);
26  my %journals_list_seen = ();  my %publications_list_seen = ();
27    my %publications_to_pegs = ();
 foreach (@journals_list) {  
         $journals_list_seen{$_} = $_;  
         #print "journals here are $_\n";  
 }  
28    
 #Add PubMed Attributes here  
 my @pubmed_attributes = $fig->get_attributes($peg, "PUBMED");  
 foreach (@pubmed_attributes) {  
29    
30          my @line = @{$_};  foreach (@publications_list) {
31          #print "id is $line[2]\n";          $publications_list_seen{$_} = "$peg\t$_";
32          if (! $journals_list_seen{$line[2]} ) {          $publications_to_pegs{$_} = $peg;
                 #print "pushing\n";  
                 push (@journals_list, $line[2]);  
         }  
33  }  }
34    
35    my (@show_notr_publications, @show_r_publications);
36    my ($publication_div, $publication_relevant_div, $publication_notrelevant_div);
37    
38  my @new_journals = &FigWebServices::SeedComponents::PubMed::sort_journals(\@journals_list);  my @pubmed_rel_attributes = $fig->get_attributes($peg,"PUBMED_CURATED_RELEVANT",undef,undef);
39  my $journal_htmltable = &FigWebServices::SeedComponents::PubMed::journals_as_htmltable(\@new_journals);  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    
42  #Put journals as a string to be passed the next cgi  &process_attributes(\@pubmed_attributes, "pubmed_plain");
43    &process_attributes(\@pubmed_rel_attributes, "relevant");
44    &process_attributes(\@pubmed_notrel_attributes, "notrelevant");
45    
46  my $journal_info;  my @filtered_publications;
47  my %journals_seen = ();  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            }
52    }
53    
54  foreach (@new_journals) {  my $peg_list;
55          my($pmid, $year,$month,$date,$title) = split(/\t/,$_);  while( my($k,$v) = each(%publications_to_pegs)) {
56          my $j = "$pmid|$title";          $peg_list .= "$k-$v\;";
         $journal_info .= $j.";";  
         $journals_seen{$pmid} = $title;  
57  }  }
58    
 my @attributes = $fig->get_attributes($peg);  
 my @relevant;  
 my @notrelevant;  
 my @notcurated;  
59    
 foreach (@attributes) {  
         my @att_line = @{$_};  
         my $key = $att_line[1];  
         my ($pmid, $title)  = split(/\,/,$att_line[2]);  
60    
61          if ($key =~ m/\_RELEVANT\_CURATED\_BY\_(.*)/) {  my $column_table = &FigWebServices::SeedComponents::PubMed::column_title;
62          my $anno_name = $1;  my $not_curated_htmltable = &FigWebServices::SeedComponents::PubMed::journals_as_htmltable(\@filtered_publications);
63          my $pmid_name = "$pmid($anno_name)";  my $r_publication_htmltable = &FigWebServices::SeedComponents::PubMed::journals_as_htmltable(\@show_r_publications);
64          push (@relevant, $pmid_name);  my $notr_publication_htmltable = &FigWebServices::SeedComponents::PubMed::journals_as_htmltable(\@show_notr_publications);
         delete $journals_seen{$pmid};  
         }  
65    
66          if ($key =~ m/\_NOTRELEVANT\_CURATED\_BY\_(.*)/) {  #Put publications as a string to be passed the next cgi
         my $anno_name = $1;  
         my $pmid_name = "$pmid($anno_name)";  
         push (@notrelevant, $pmid_name);  
         delete $journals_seen{$pmid};  
         }  
67    
68          if ($key =~ m/\_NOT\_CURATED\_/) {  print "<table>";
69                  if($journals_seen{$pmid}) {  print $column_table;
70                    delete $journals_seen{$pmid};  
71                  }  if ($not_curated_htmltable) {
72                  else {          print $not_curated_htmltable;
                 $journals_seen{$pmid};  
                 }  
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  }  }
 #original div  
 my $journal_div;  
 my $journal_relevant_div;  
 my $journal_notrelevant_div;  
78    
79  foreach (@notrelevant) {  if ($notr_publication_htmltable) {
80      $journal_notrelevant_div .= "<li id=\"$_\">$_</li>";          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  }  }
84    
85  foreach (@relevant) {  if ((! $notr_publication_htmltable) || ( ! $r_publication_htmltable) ) {
86      $journal_relevant_div .= "<li id=\"$_\">$_</li>";          print "</table>";
87  }  }
88    
89  while( my($k,$v) = each(%journals_seen)) {  my $publication_info;
90          $journal_div .= "<li id=\"$k\">$k</li>";  print $cgi->hr();
91  }  &print_form;
92    
 #not curated div  
93    
94    ###############
95    # Subroutines
96    ###############
97    
98  print $journal_htmltable;  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    
 if ($#journals_list < 0) {  
         print "PubMed journals found for this peg were not specific to this functional role<p>";  
109    
110          }          }
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    
117    }
118    
119    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  print $cgi->hr();  print $cgi->hr();
126    }
127    
128    
129    sub print_form {
130    
131  print "  print "
132    
133  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.
134    
135  <div>  <div>
136  <form name=\"myForm\" method=\"post\" action=\"save_to_attributes.cgi\" onsubmit=\"saveDragDropNodes()\">  <form name=\"myForm\" method=\"post\" action=\"save_to_attributes.cgi\" onsubmit=\"saveDragDropNodes()\">
137  <p><input type=\"textbox\" name=\"master\" value=\"Name\"> Your name  <p><input type=\"textbox\" name=\"master\" value=\"Name\"> Your name
138  <p><input type=\"submit\" value=\"Save to attributes\" name=\"save\">  <p><input type=\"submit\" value=\"Save to attributes\" name=\"save\">
139  <p>  <p>
140  You may curate the journal information by  You may curate the publication information by
141  <ul>  <ul>
142  <li> Adding your own journal for this peg</li>  <li> Adding your own publication for this peg</li>
143    
144  <input type=\"hidden\" name=\"listOfItems\" value=\"\">  <input type=\"hidden\" name=\"listOfItems\" value=\"\">
145  <input type=\"hidden\" name=\"all_journals\" value=\"$journal_info\">  <input type=\"hidden\" name=\"all_publications\" value=\"$publication_info\">
146  <input type=\"hidden\" name=\"peg\" value=\"$peg\">  <input type=\"hidden\" name=\"listOfPeg\" value=\"$peg_list\">
147  <input type=\"textbox\" size=10 name=\"PMID\" value=\"\"> Journal Identifier (ie PMID)  <input type=\"hidden\" name=\"purpose\" value=\"peg\">
148  <p><input type=\"textbox\" size=50  name=\"title\" value=\"\"> Title of the Journal Article  <input type=\"hidden\" name=\"purpose_peg\" value=\"$peg\">
149  <p><input type=\"textbox\" size=50  name=\"url\" value=\"\"> URL of the Journal  <input type=\"textbox\" size=50 name=\"PMID\" value=\"PMID1 PMID2 PMID3\"> Publication Identifier (Multiple PMIDs should be separated by a space)
150    PMID
151  </form>  </form>
152    <p>
153  <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)).
154  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>
155  </div>  </div>
156  <div id=\"dhtmlgoodies_dragDropContainer\">  <div id=\"dhtmlgoodies_dragDropContainer\">
157          <div id=\"topBar\">          <div id=\"topBar\">
158          </div>          </div>
159          <div id=\"dhtmlgoodies_listOfItems\">          <div id=\"dhtmlgoodies_listOfItems\">
160                  <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>
161          </div>          </div>
162          <div id=\"dhtmlgoodies_mainContainer\">          <div id=\"dhtmlgoodies_mainContainer\">
163                  <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>
164                  <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>
165          </div>          </div>
166  </div>  </div>
167  </ul>  </ul>
# Line 176  Line 169 
169  <div id=\"dragDropIndicator\"></div>  <div id=\"dragDropIndicator\"></div>
170  <div id=\"saveContent\"><div>  <div id=\"saveContent\"><div>
171  ";  ";
172    
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    

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3