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

Annotation of /FigWebServices/save_to_attributes.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download)

1 : hwang 1.1
2 :     #/usr/bin/perl
3 :     use FIG;
4 :     use strict;
5 :     use CGI;
6 :     use FigWebServices::SeedComponents::PubMed;
7 :    
8 :     my $cgi = new CGI;
9 :     my $fig = new FIG;
10 :    
11 :     print $cgi->header;
12 :     my @params = $cgi->param;
13 :    
14 :     my $curated_journals = $cgi->param("listOfItems");
15 :     my $all_journals = $cgi->param("all_journals");
16 :     my $peg = $cgi->param ("peg");
17 :     my $name = $cgi->param ("master");
18 :     my $server_name = $ENV{'SERVER_NAME'};
19 :     my %pmid2title = ();
20 :     my %att_pmid_anno = ();
21 :     my %att_pmid_status = ();
22 :    
23 :     my $add_pmid = $cgi->param ("PMID");
24 :     my $add_date = $cgi->param ("date");
25 :     my $add_title = $cgi->param ("title");
26 :     my $add_url = $cgi->param ("url");
27 :    
28 :     #Only allow the user to add to attributes if the user specify his/her name
29 :     if (($name eq "Name") || ($name eq "")) {
30 :    
31 :     print "You must specify your name. <p>";
32 :     print "Press the back button <p>";
33 :     exit;
34 :     }
35 :    
36 :    
37 :     if ($add_pmid ne "") {
38 :     $fig->add_attribute($peg, "JOURNAL_CURATED_BY_$name", "$add_pmid, $add_title", $add_url);
39 :     print "Added to attributes as JOURNAL_CURATED_BY_$name, $add_pmid, $add_title<p>";
40 :     }
41 :    
42 :    
43 :    
44 :     my @curated = split(/\;/, $curated_journals);
45 :     my @journal_title = split(/\;/, $all_journals);
46 :    
47 :     #print "@curated<p>";
48 :     my @attributes = $fig->get_attributes($peg);
49 :    
50 :     #Get what has been curated alreay. So we don't duplicate work.
51 :     foreach (@attributes) {
52 :     my @entry = @{$_};
53 :     my ($peg, $key, $value, $url) = @entry;
54 :     if ($key =~ m/CURATED/) {
55 :     $key =~ m/(.*BY_)(.*)/;
56 :     my $curation_name = $2;
57 :     my ($attribute_pmid, @attribute_title) = split(/,/, $value);
58 :     #print "-->$attribute_pmid<-->$curation_name<--<p>";
59 :    
60 :     #my $attribute_key = "$attribute_pmid"."_"."$curation_name";
61 :    
62 :     $att_pmid_anno{$attribute_pmid} = $curation_name;
63 :     my $key_no_name = $key;
64 :     $key_no_name =~ s/(_BY_.*)//;
65 :     $att_pmid_status{$attribute_pmid} = $key_no_name;
66 :     #print "This line $key $attribute_pmid $key_no_name<p>";
67 :     }
68 :     }
69 :    
70 :    
71 :     # Put in values as id to journal title
72 :     foreach (@journal_title) {
73 :     my ($id, $title) = split(/\|/,$_);
74 :    
75 :     $id =~ s/\(.*\)//;
76 :     $pmid2title{$id} = $title;
77 :    
78 :     }
79 :    
80 :    
81 :     foreach (@curated) {
82 :     my ($key, $pmid) = split(/\|/, $_);
83 :     $pmid =~ s/\(.*//;
84 :     my $value = "$pmid,$pmid2title{$pmid}";
85 :     #print "Add to attributes as Key:$key Value:$value<p>";
86 :    
87 :     #print "-------------------------------<p>";
88 :     #print "-->$pmid<-- $att_pmid_anno{$pmid} versus $name, key is $key<p>";
89 :     #print "$att_pmid_status{$pmid} key is: $key<p>";
90 :     if (($att_pmid_status{$pmid} ne $key) && ($att_pmid_anno{$pmid} ne $name)
91 :     && ($key !~ /\_NOT\_/)){
92 :    
93 :     $key = $key."_BY_$name";
94 :     my $url = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=pubmed&dopt=Abstract&list_uids=".$pmid;
95 :     print "Added to attributes as Key:$key Value:$value<p>";
96 :     #print "DONE -------------- <p>";
97 :     $fig->add_attribute($peg, $key, $value, $url);
98 :    
99 :     }
100 :     }
101 :    
102 :     print "Please refresh protein page and press Attributes button to see the changes<p>";
103 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3