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

View of /FigWebServices/display_role_literature.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (download) (annotate)
Mon Jan 7 19:21:42 2013 UTC (6 years, 10 months ago) by golsen
Branch: MAIN
CVS Tags: rast_rel_2014_0912, rast_rel_2014_0729, HEAD
Changes since 1.5: +1 -1 lines
Missed the key change. Fixed it now I hope.

#/usr/bin/perl
use strict;
use FIG;
use CGI;
use FigWebServices::SeedComponents::PubMed;
use FigWebServices::WebApplicationComponents::Table3;

my $cgi = new CGI;
my $fig = new FIG;

&print_header( $cgi );
&print_verbiage;

my $subsys_name = $cgi->param("subsys");
my $role = $cgi->param("role");

if (!$subsys_name) {
	print "Can not find subsystem";
	exit;
	}	

&print_peg_info( $cgi );
my @publications_nc = $fig->get_attributes("Role:$role", "ROLE_PUBMED_NOTCURATED");
my @publications_cr = $fig->get_attributes("Role:$role", "ROLE_PUBMED_CURATED_RELEVANT");
my @peg_publications_cr = $fig->get_attributes("Role:$role", "ROLE_FROM_PEG_RELEVANT");

my $publication_nc_htmltable; 
my $publication_cr_htmltable;
if(@publications_cr) {
	$publication_cr_htmltable =  &get_pmid_info( $cgi, \@publications_cr, "curated_role_relevant");
}

if(@publications_nc) {
	$publication_nc_htmltable =  &get_pmid_info($cgi, \@publications_nc, "not_curated_role");
}

my $peg_publications_cr_htmltable;
if (@peg_publications_cr) {
	$peg_publications_cr_htmltable =  &get_pmid_info( $cgi, \@peg_publications_cr, "role_relevant_peg");
}


print "<form name=functional_role_form method=post action=save_roles_to_attributes.cgi>"; 
print "<table>";
print "<tr><td>Curation of literature will only be saved if you specify  <input type=\"textbox\" name=\"curator\" value=\"your name\">";
print "<input type=\"submit\" value=\"Save\" name=\"save\"></td></tr>";
print "<tr><td><I><B><H3>Add your own publications by specifying  PubMed Publication Identifier (PMID):</H3></B></I></td></tr>";
print "<tr><td>Multiple PMIDs should be separated by a space <input type=\"textbox\" size=50 name=\"PMID\" value=\"PMID1 PMID2 PMID3\"></td></tr>"; 
print "<input type=\"hidden\" name=\"role\" value=\"$role\">";
print "<input type=\"hidden\" name=\"subsystem\" value=\"$subsys_name\">";
print "</form>";

print "<form name=functional_role_form method=post action=save_roles_test.cgi>"; 

if($publication_cr_htmltable) {
	print "<tr><td><I><B><H3>Annotator Curated Relevant Publications:</H3></B></I></td></tr>";
	print "<tr><td><I>These PEG publication(s) were curated revelant by annotator(s). You may check not relevant to delete publication(s) for this functional role. Relevant publication(s) will be part of the Subsystem Literature page.</I></td></tr>";
	print $publication_cr_htmltable;
}

if($peg_publications_cr_htmltable) {
	print "<tr><td><I><B><H3>PEG Curated Relevant Publications:</H3></B></I></td></tr>";
	print "<tr><td><I>These publication(s) are deemed relevant by annotator(s) for PEGs that belonged to this functional role. You may check publication(s) as relevant for this functional role. Relevant publication(s) will be part of the Subsystem Literature page.</I></td></tr>";
	print $peg_publications_cr_htmltable ;
}

if($publication_nc_htmltable) {
print "<tr><td><I><B><H3>Pre-Computed Publication(s):</H3></B></I></td></tr>";
print "<tr><td><I>Check the publications that are relevant for this functional role. Relevant publications
will be shown for the Subsystem Literature page.</I></td></tr>";
print $publication_nc_htmltable;
}

print "</form>";


###############
# Subroutines
###############

sub print_header {
    my ( $cgi ) = @_;
	print $cgi->header;
	print $cgi->start_html( -title=>'PubMed for Functional Role',
				-style=>{ -src => 'Html/seedviewer.css'},
				-script=> [
				   {-language => 'JAVASCRIPT',
				    -src => './Html/layout.js'},
					]
				  	);

	
}

sub print_verbiage {

	print "<table><tr><td bgcolor=#D2E6F0>Introduction</td><td> This is a literature curation page for Functional Roles. Publications were retrieved from PubMed using Protein Encoded Gene (PEG) aliases. The aliases included gene ids, swiss prot ids, and uniprot ids. In addition, the names of the functional roles were used as a query to PubMed. A filter was used to remove genome papers. Use this page to curate relevant publications by adding your own Pubmed Identifiers (PMIDs) and/or take advantage of the existing precomputations to find relevant publications.<p>
 </td></tr></table>";

}

sub print_peg_info {
    my ( $cgi ) = @_;
	print $cgi->hr();
	print "<table>";
	print "<tr><td bgcolor=#D2E6F0>Subsystem</td><td> $subsys_name</td></tr>";
	print "<tr><td bgcolor=#D2E6F0>Functional Role</td><td> $role</td></tr></table>";
	print $cgi->hr();
}

sub get_pmid_info {
    my ( $cgi, $attribute_in, $what) = @_;
	# print STDERR "attribute is $attribute_in\n";
	# print STDERR "what is $what\n";
		
	my @att_in = @{$attribute_in};
	my $output_table;
	my @publication_table;
	my $data_table;
	my $pmid_base = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=PubMed&term=";
	my $columns;
	my $pmid_url;
	my @sorted_data;

	if ($what eq "not_curated_role") {
		foreach (@att_in) {
			my @att =  @$_;
			my ($role,$key,$value) = @att;
			my ($pmid,$authors,$date,$title) = split(/;/,$value);
			$pmid_url = "$pmid_base$pmid";
			push(@$data_table, ["<input type=checkbox name=$pmid value=\"$pmid\">",
					"<a href=$pmid_url target=_blank>$pmid</a>",
					$authors,$date,$title]);		
		}
		$columns = [ "Relevant", "PMID", "Author (First,Last)", "Date", "Title"];
	}

	if ($what eq "role_relevant_peg") {
		foreach (@att_in) {
			my @att =  @$_;
			my ($role,$key,$value) = @att;
			my ($pmid,$curator,$authors,$date,$title) = split(/;/,$value);
			$pmid_url = "$pmid_base$pmid";
			push(@$data_table, ["<input type=checkbox name=$pmid value=\"$pmid\">",
					"<a href=$pmid_url target=_blank>$pmid</a>",
					$curator,$authors,$date,$title]);		
		}
		$columns = [ "Relevant", "PMID", "Curator", "Author (First,Last)", "Date", "Title"];
	}

	if ($what eq "curated_role_relevant") {
		foreach (@att_in) {
			my @att =  @$_;
			my ($role,$key,$value) = @att;
			my ($pmid,$curator,$authors,$date,$title) = split(/;/,$value);
			$pmid_url = "$pmid_base$pmid";
			push(@$data_table, ["<input type=checkbox name=not-$pmid value=\"$pmid\">",
					"<a href=$pmid_url target=_blank>$pmid</a>",
					$curator,$authors,$date,$title]);		
		}
		$columns = [ "Not Relevant", "PMID", "Curator", "Author (First,Last)", "Date", "Title"];
	}

	
	#@sorted_data = (sort sort_info_by_date @$data_table);	
	$output_table = Table3::new( { id => $what,
                               data => \@$data_table,
                               columns => $columns,
                               show_filter => 1,
                               perpage => 5,
                               show_perpage => 1,
                               show_topbrowse => 1, 
				});

	return $output_table;
}

sub sort_info_by_date {
 my $a_date = $a->[3];
 my $b_date = $b->[3]; 	
 my ($year_a, $month_a, $day_a) = split(/\s/,$a_date);
 my ($year_b, $month_b, $day_b) = split(/\s/,$b_date); 		 	


	my %month2num = (
	"jan" => '1',
	"feb" => '2',
	"mar" => '3',
	"apr" => '4',
	"may" => '5',
	"june" => '6',
	"jun" => '6',
	"july" => '7',
	"jul" => '7',
	"aug" => '8',
	"sep" => '9',
	"oct" => '10',
	"nov" => '11',
	"dec" => '12',
	);
 
 ($year_b) <=> ($year_a) 
 || ($month2num{$month_a}) <=> ($month2num{$month_b}) 
 || ($day_a) <=> ($day_b);

 
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3