[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.2 - (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 print $cgi->header;
11 :     print $cgi->start_html( -title=>'PubMed for peg',
12 :     -style=>{ -src => 'Html/dnd.css'},
13 : hwang 1.2 -script=> [
14 :     {-language => 'JAVASCRIPT',
15 :     -src => 'Html/drag_and_drop.js'},
16 :     ]
17 :     );
18 : hwang 1.1
19 :    
20 :     my $id_string = $cgi->param("ids");
21 :     my $peg = $cgi->param("peg");
22 :    
23 :     if (!$id_string) {
24 :     print "PubMed journals found for this peg were not specific to this peg<p>";
25 :     exit;
26 :     }
27 :    
28 :    
29 :     print "<table>";
30 :     print "<tr><td bgcolor=#6666FF>Peg</td><td> $peg</td></tr>";
31 :     my $role = $fig->function_of($peg);
32 :     print "<tr><td bgcolor=#6666FF>Functional Role</td><td> $role</td></tr></table>";
33 :    
34 :     print $cgi->hr();
35 : hwang 1.2 print "<I>Getting PubMed journals for $id_string ...</I><p>";
36 : hwang 1.1
37 :     my $pmid_output = &FIG::run_gathering_output("$FIG_Config::bin/get_pubmed_journals", $id_string);
38 :    
39 :     my @journals_list = split(/ /, $pmid_output);
40 :     my @new_journals = &FigWebServices::SeedComponents::PubMed::sort_journals(\@journals_list);
41 :     my $journal_htmltable = &FigWebServices::SeedComponents::PubMed::journals_as_htmltable(\@new_journals);
42 :    
43 :     #Put journals as a string to be passed the next cgi
44 :    
45 :     my $journal_info;
46 : hwang 1.2 my %journals_seen = ();
47 : hwang 1.1
48 :     foreach (@new_journals) {
49 :     my($pmid, $year,$month,$date,$title) = split(/\t/,$_);
50 :     my $j = "$pmid|$title";
51 :     $journal_info .= $j.";";
52 : hwang 1.2 $journals_seen{$pmid} = $title;
53 : hwang 1.1 }
54 :    
55 : hwang 1.2 my @attributes = $fig->get_attributes($peg);
56 :     my @relevant;
57 :     my @notrelevant;
58 :     my @notcurated;
59 :    
60 :     foreach (@attributes) {
61 :     my @att_line = @{$_};
62 :     my $key = $att_line[1];
63 :     my ($pmid, $title) = split(/\,/,$att_line[2]);
64 :    
65 :     if ($key =~ m/\_RELEVANT\_CURATED\_BY\_(.*)/) {
66 :     my $anno_name = $1;
67 :     my $pmid_name = "$pmid($anno_name)";
68 :     push (@relevant, $pmid_name);
69 :     delete $journals_seen{$pmid};
70 :     }
71 :    
72 :     if ($key =~ m/\_NOTRELEVANT\_CURATED\_BY\_(.*)/) {
73 :     my $anno_name = $1;
74 :     my $pmid_name = "$pmid($anno_name)";
75 :     push (@notrelevant, $pmid_name);
76 :     delete $journals_seen{$pmid};
77 :     }
78 :    
79 :     if ($key =~ m/\_NOT\_CURATED\_/) {
80 :     if($journals_seen{$pmid}) {
81 :     delete $journals_seen{$pmid};
82 :     }
83 :     else {
84 :     $journals_seen{$pmid};
85 :     }
86 :     }
87 :     }
88 :     #original div
89 :     my $journal_div;
90 :     my $journal_relevant_div;
91 :     my $journal_notrelevant_div;
92 : hwang 1.1
93 : hwang 1.2 foreach (@notrelevant) {
94 :     $journal_notrelevant_div .= "<li id=\"$_\">$_</li>";
95 :     }
96 : hwang 1.1
97 : hwang 1.2 foreach (@relevant) {
98 :     $journal_relevant_div .= "<li id=\"$_\">$_</li>";
99 :     }
100 : hwang 1.1
101 : hwang 1.2 while( my($k,$v) = each(%journals_seen)) {
102 :     $journal_div .= "<li id=\"$k\">$k</li>";
103 : hwang 1.1 }
104 :    
105 : hwang 1.2 #not curated div
106 :    
107 :    
108 : hwang 1.1 print $journal_htmltable;
109 :    
110 :     if (!$pmid_output) {
111 :     print "PubMed journals found for this peg were not specific to this functional role<p>";
112 :     return;
113 :     }
114 :    
115 :    
116 :     print $cgi->hr();
117 :    
118 :     print "
119 :    
120 : hwang 1.2 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.
121 : hwang 1.1
122 : hwang 1.2 <div>
123 : hwang 1.1 <form name=\"myForm\" method=\"post\" action=\"save_to_attributes.cgi\" onsubmit=\"saveDragDropNodes()\">
124 : hwang 1.2 <p><input type=\"textbox\" name=\"master\" value=\"Name\"> Your name
125 :     <p><input type=\"submit\" value=\"Save to attributes\" name=\"save\">
126 :     <p>
127 :     You may curate the journal information by
128 :     <ul>
129 :     <li> Adding your own journal for this peg</li>
130 :    
131 : hwang 1.1 <input type=\"hidden\" name=\"listOfItems\" value=\"\">
132 :     <input type=\"hidden\" name=\"all_journals\" value=\"$journal_info\">
133 :     <input type=\"hidden\" name=\"peg\" value=\"$peg\">
134 : hwang 1.2 <input type=\"textbox\" size=10 name=\"PMID\" value=\"\"> Journal Identifier (ie PMID)
135 :     <p><input type=\"textbox\" size=50 name=\"title\" value=\"\"> Title of the Journal Article
136 :     <p><input type=\"textbox\" size=50 name=\"url\" value=\"\"> URL of the Journal
137 :    
138 : hwang 1.1 </form>
139 : hwang 1.2
140 :     <li> Drag and drop the PMID to the appropriate containers (Relevant Journal(s)/ Not Relevant Journal(s)). </li>
141 : hwang 1.1 </div>
142 :     <div id=\"dhtmlgoodies_dragDropContainer\">
143 :     <div id=\"topBar\">
144 :     </div>
145 :     <div id=\"dhtmlgoodies_listOfItems\">
146 : hwang 1.2 <div><p>PUBMED NOT CURATED </p><ul id=\"PUBMED_NOT_CURATED\">$journal_div</ul></div>
147 : hwang 1.1 </div>
148 :     <div id=\"dhtmlgoodies_mainContainer\">
149 : hwang 1.2 <div><p>RELEVANT Journal(s) (curated by)</p><ul id=\"PUBMED_RELEVANT_CURATED\">$journal_relevant_div</ul></div>
150 :     <div><p>NOT RELEVANT Journal(s) (curated by)</p><ul id=\"PUBMED_NOTRELEVANT_CURATED\">$journal_notrelevant_div</ul></div>
151 : hwang 1.1 </div>
152 :     </div>
153 : hwang 1.2 </ul>
154 : hwang 1.1 <ul id=\"dragContent\"></ul>
155 :     <div id=\"dragDropIndicator\"><img src=\"images/insert.gif\"></div>
156 :     <div id=\"saveContent\"><div>
157 :     ";

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3