[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.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 : 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 : hwang 1.3 my %journals_list_seen = ();
41 :    
42 :     foreach (@journals_list) {
43 :     $journals_list_seen{$_} = $_;
44 :     #print "journals here are $_\n";
45 :     }
46 :    
47 :     #Add PubMed Attributes here
48 :     my @pubmed_attributes = $fig->get_attributes($peg, "PUBMED");
49 :     foreach (@pubmed_attributes) {
50 :    
51 :     my @line = @{$_};
52 :     #print "id is $line[2]\n";
53 :     if (! $journals_list_seen{$line[2]} ) {
54 :     #print "pushing\n";
55 :     push (@journals_list, $line[2]);
56 :     }
57 :     }
58 :    
59 :    
60 : hwang 1.1 my @new_journals = &FigWebServices::SeedComponents::PubMed::sort_journals(\@journals_list);
61 :     my $journal_htmltable = &FigWebServices::SeedComponents::PubMed::journals_as_htmltable(\@new_journals);
62 :    
63 :     #Put journals as a string to be passed the next cgi
64 :    
65 :     my $journal_info;
66 : hwang 1.2 my %journals_seen = ();
67 : hwang 1.1
68 :     foreach (@new_journals) {
69 :     my($pmid, $year,$month,$date,$title) = split(/\t/,$_);
70 :     my $j = "$pmid|$title";
71 :     $journal_info .= $j.";";
72 : hwang 1.2 $journals_seen{$pmid} = $title;
73 : hwang 1.1 }
74 :    
75 : hwang 1.2 my @attributes = $fig->get_attributes($peg);
76 :     my @relevant;
77 :     my @notrelevant;
78 :     my @notcurated;
79 :    
80 :     foreach (@attributes) {
81 :     my @att_line = @{$_};
82 :     my $key = $att_line[1];
83 :     my ($pmid, $title) = split(/\,/,$att_line[2]);
84 :    
85 :     if ($key =~ m/\_RELEVANT\_CURATED\_BY\_(.*)/) {
86 :     my $anno_name = $1;
87 :     my $pmid_name = "$pmid($anno_name)";
88 :     push (@relevant, $pmid_name);
89 :     delete $journals_seen{$pmid};
90 :     }
91 :    
92 :     if ($key =~ m/\_NOTRELEVANT\_CURATED\_BY\_(.*)/) {
93 :     my $anno_name = $1;
94 :     my $pmid_name = "$pmid($anno_name)";
95 :     push (@notrelevant, $pmid_name);
96 :     delete $journals_seen{$pmid};
97 :     }
98 :    
99 :     if ($key =~ m/\_NOT\_CURATED\_/) {
100 :     if($journals_seen{$pmid}) {
101 :     delete $journals_seen{$pmid};
102 :     }
103 :     else {
104 :     $journals_seen{$pmid};
105 :     }
106 :     }
107 :     }
108 :     #original div
109 :     my $journal_div;
110 :     my $journal_relevant_div;
111 :     my $journal_notrelevant_div;
112 : hwang 1.1
113 : hwang 1.2 foreach (@notrelevant) {
114 :     $journal_notrelevant_div .= "<li id=\"$_\">$_</li>";
115 :     }
116 : hwang 1.1
117 : hwang 1.2 foreach (@relevant) {
118 :     $journal_relevant_div .= "<li id=\"$_\">$_</li>";
119 :     }
120 : hwang 1.1
121 : hwang 1.2 while( my($k,$v) = each(%journals_seen)) {
122 :     $journal_div .= "<li id=\"$k\">$k</li>";
123 : hwang 1.1 }
124 :    
125 : hwang 1.2 #not curated div
126 :    
127 :    
128 : hwang 1.1 print $journal_htmltable;
129 :    
130 : hwang 1.3 if ($#journals_list < 0) {
131 : hwang 1.1 print "PubMed journals found for this peg were not specific to this functional role<p>";
132 : hwang 1.3
133 : hwang 1.1 }
134 :    
135 :    
136 :     print $cgi->hr();
137 :    
138 :     print "
139 :    
140 : 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.
141 : hwang 1.1
142 : hwang 1.2 <div>
143 : hwang 1.1 <form name=\"myForm\" method=\"post\" action=\"save_to_attributes.cgi\" onsubmit=\"saveDragDropNodes()\">
144 : hwang 1.2 <p><input type=\"textbox\" name=\"master\" value=\"Name\"> Your name
145 :     <p><input type=\"submit\" value=\"Save to attributes\" name=\"save\">
146 :     <p>
147 :     You may curate the journal information by
148 :     <ul>
149 :     <li> Adding your own journal for this peg</li>
150 :    
151 : hwang 1.1 <input type=\"hidden\" name=\"listOfItems\" value=\"\">
152 :     <input type=\"hidden\" name=\"all_journals\" value=\"$journal_info\">
153 :     <input type=\"hidden\" name=\"peg\" value=\"$peg\">
154 : hwang 1.2 <input type=\"textbox\" size=10 name=\"PMID\" value=\"\"> Journal Identifier (ie PMID)
155 :     <p><input type=\"textbox\" size=50 name=\"title\" value=\"\"> Title of the Journal Article
156 :     <p><input type=\"textbox\" size=50 name=\"url\" value=\"\"> URL of the Journal
157 :    
158 : hwang 1.1 </form>
159 : hwang 1.2
160 : hwang 1.3 <li> Drag and drop the PMID to the appropriate containers (Relevant Journal(s)/ Not Relevant Journal(s)).
161 :     Containers will be empty if there are no pmid found for this peg.</li>
162 : hwang 1.1 </div>
163 :     <div id=\"dhtmlgoodies_dragDropContainer\">
164 :     <div id=\"topBar\">
165 :     </div>
166 :     <div id=\"dhtmlgoodies_listOfItems\">
167 : hwang 1.2 <div><p>PUBMED NOT CURATED </p><ul id=\"PUBMED_NOT_CURATED\">$journal_div</ul></div>
168 : hwang 1.1 </div>
169 :     <div id=\"dhtmlgoodies_mainContainer\">
170 : hwang 1.2 <div><p>RELEVANT Journal(s) (curated by)</p><ul id=\"PUBMED_RELEVANT_CURATED\">$journal_relevant_div</ul></div>
171 :     <div><p>NOT RELEVANT Journal(s) (curated by)</p><ul id=\"PUBMED_NOTRELEVANT_CURATED\">$journal_notrelevant_div</ul></div>
172 : hwang 1.1 </div>
173 :     </div>
174 : hwang 1.2 </ul>
175 : hwang 1.1 <ul id=\"dragContent\"></ul>
176 : hwang 1.4 <div id=\"dragDropIndicator\"></div>
177 : hwang 1.1 <div id=\"saveContent\"><div>
178 :     ";

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3