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

Annotation of /FigWebServices/save_roles_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 :     my $role = $cgi->param("role");
14 :     my $curator = $cgi->param("curator");
15 :     my $subsystem = $cgi->param("subsystem");
16 :    
17 :     my @all_pmids;
18 :     my @delete_pmid;
19 :    
20 :     if((!$curator ) || ($curator eq 'your name')) {
21 :    
22 :     print "You did not specify your name. Press the back button<p>";
23 :     exit;
24 :     }
25 :    
26 :     foreach (@params) {
27 :     if ($_ =~ m/not/) {
28 :     $_ =~ s/not-//;
29 :     push (@delete_pmid, $_);
30 :     }
31 :     else {
32 :     next if ($_ !~ m/\d+/);
33 :     my $pmid = $cgi->param($_);
34 :     push (@all_pmids, $pmid);
35 :    
36 :     }
37 :     }
38 :    
39 :     my $curator_list = $cgi->param("PMID");
40 :     my @curator_pmids = split(/\s/,$curator_list);
41 :     foreach (@curator_pmids) {
42 :     next if ($_ =~ m/PMID/);
43 :     $_ =~ s/://;
44 :     push (@all_pmids, $_);
45 :    
46 :     }
47 :    
48 :     foreach (@delete_pmid) {
49 :     $fig->delete_matching_attributes("Role:$role", "ROLE_PUBMED_CURATED_RELEVANT", "$_%");
50 :     $fig->delete_matching_attributes("Role:$role", "ROLE_FROM_PEG_RELEVANT", "$_%");
51 :     }
52 :    
53 :     #Add relevant pmids to the attribute database
54 :     foreach (@all_pmids) {
55 :     my $pmid = $_;
56 :     $fig->delete_matching_attributes("Role:$role", "ROLE_PUBMED_CURATED_RELEVANT", "$pmid%");
57 :    
58 :     my $pmid_author_date_title_output = &FigWebServices::SeedComponents::PubMed::get_author_date_title($pmid);
59 :    
60 :     my ($add_pmid, $add_author, $add_date, $add_title) = split(/;/,$pmid_author_date_title_output);
61 :     my $add_value = "$add_pmid\;$curator\;$add_author\;$add_date\;$add_title";
62 :     print "Add Role:$role $add_value<p>";
63 :     $fig->add_attribute("Role:$role", "ROLE_PUBMED_CURATED_RELEVANT", "$add_value");
64 :     $fig->delete_matching_attributes("Role:$role", "ROLE_PUBMED_NOTCURATED", "$pmid%");
65 :     }
66 :     print "Information have been updated. Go to <a href=\"display_role_literature.cgi?subsys=$subsystem&role=$role\">functional role page</a><p>";
67 :    
68 :    
69 :    
70 :    
71 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3