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

View of /FigWebServices/display_subsystem_literature.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (annotate)
Fri May 23 15:21:31 2008 UTC (11 years, 5 months ago) by wilke
Branch: MAIN
CVS Tags: mgrast_dev_08112011, rast_rel_2009_05_18, mgrast_dev_08022011, rast_rel_2014_0912, rast_rel_2008_06_18, myrast_rel40, rast_rel_2008_06_16, mgrast_dev_05262011, rast_rel_2008_12_18, mgrast_dev_04082011, rast_rel_2010_0928, rast_2008_0924, mgrast_version_3_2, mgrast_dev_12152011, mgrast_dev_06072011, rast_rel_2008_09_30, rast_rel_2009_0925, rast_rel_2010_0526, rast_rel_2014_0729, mgrast_dev_02212011, rast_rel_2010_1206, mgrast_release_3_0, mgrast_dev_03252011, rast_rel_2010_0118, mgrast_rel_2008_0924, mgrast_rel_2008_1110_v2, rast_rel_2009_02_05, rast_rel_2011_0119, mgrast_rel_2008_0625, mgrast_release_3_0_4, mgrast_release_3_0_2, mgrast_release_3_0_3, mgrast_release_3_0_1, mgrast_dev_03312011, mgrast_release_3_1_2, mgrast_release_3_1_1, mgrast_release_3_1_0, mgrast_dev_04132011, rast_rel_2008_10_09, mgrast_dev_04012011, rast_release_2008_09_29, mgrast_rel_2008_0806, mgrast_rel_2008_0923, mgrast_rel_2008_0919, rast_rel_2009_07_09, rast_rel_2010_0827, mgrast_rel_2008_1110, myrast_33, rast_rel_2011_0928, rast_rel_2008_09_29, mgrast_rel_2008_0917, rast_rel_2008_10_29, mgrast_dev_04052011, mgrast_dev_02222011, rast_rel_2009_03_26, mgrast_dev_10262011, rast_rel_2008_11_24, rast_rel_2008_08_07, HEAD
similar to display_role_literature

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

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

&print_header;
&print_verbiage;

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

my $display_option = "display_all";
$display_option = $cgi->param("display_option") if $cgi->param("display_option");

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

my $subsystem = Subsystem->new($subsys_name, $fig, 0);	

&print_peg_info;

my @roles = $subsystem->get_roles;
my @publications_nc;
my @publications_cr;
my @peg_publications_cr;
my @publications_list;


my @publications_subsystem = $fig->get_attributes("Subsystem:$subsys_name", "SUBSYSTEM_PUBMED_RELEVANT");

#unless ( @publications_subsystem ) {
push  @publications_list , $fig->get_attributes("Subsystem:$subsys_name", "SUBSYSTEM_PUBMED_RELEVANT");

foreach my $role (@roles){
    
#    my @array = $fig->get_attributes("Role:$role", "ROLE_PUBMED_NOTCURATED"),"\n";
#     foreach my $ary (@array){
# 	print join (" ",@$ary),"<br>";
#     }
#     exit;

    push  @publications_list , $fig->get_attributes("Role:$role", "ROLE_PUBMED_NOTCURATED");
    push  @publications_list , $fig->get_attributes("Role:$role", "ROLE_PUBMED_CURATED_RELEVANT");
    push  @publications_list , $fig->get_attributes("Role:$role", "ROLE_FROM_PEG_RELEVANT");
 #    push @publications_nc , $fig->get_attributes("Role:$role", "ROLE_PUBMED_NOTCURATED");
#     push @publications_cr , $fig->get_attributes("Role:$role", "ROLE_PUBMED_CURATED_RELEVANT");
#     push @peg_publications_cr , $fig->get_attributes("Role:$role", "ROLE_FROM_PEG_RELEVANT");
}

#}

my $publication_nc_htmltable; 
my $publication_cr_htmltable;

my $publications_table;

 $publications_table =  &get_pmid_info(\@publications_list, $display_option);

# if(@publications_subsystem) {
# 	$publication_cr_htmltable =  &get_pmid_info(\@publications_subsystem, "curated_role_relevant");
# }

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

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

# my $peg_publications_cr_htmltable;
# if (@peg_publications_cr) {
# 	$peg_publications_cr_htmltable =  &get_pmid_info(\@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\"></td></tr>";

print "<p> Show Literature for: <br>
    <input type=\"radio\" name=\"display_option\" value=\"display_all\" checked=\"checked\" onchange=\"document.forms.functional_role_form.submit();\">All 
    <input type=\"radio\" name=\"display_option\" value=\"display_relevant_for_role\">Relevant for roles 
    <input type=\"radio\" name=\"display_option\" value=\"display_relevant_for_subsystem\">Relevant for subsystem
    <input type=\"radio\" name=\"display_option\" value=\"display_precomputed\">Pre-Computed
  </p>";

print "<script>
function next () {
  if (document.functional_role_form.display_option[0].onchange == true) {
    document_functional_role_form_submit();
  } else if (document.Testform.Art[1].changed == true) {
      document_functional_role_form_submit();
  } else {
    alert(\"Oooops\");
  }
}
</script>";

if ($curate_subsystem) {
    print "<tr><td>Mark selected literature as <b>not relevant for</b> <input type=\"submit\" value=\"Subsystem\" name=\"relevant_subsytem\"></td></tr>";
#print "<input type=\"submit\" value=\"Save\" name=\"save\"></td></tr>";
#    print "<tr><td>Mark selected literature as <b>relevant for</b> <input type=\"submit\" value=\"Functional Role\" name=\"relevant_role\"></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\">";
}
else{
  print "<tr><td>Mark selected literature as <b>relevant for</b> <input type=\"submit\" value=\"Subsystem\" name=\"relevant_subsytem\"></td></tr>";
#print "<input type=\"submit\" value=\"Save\" name=\"save\"></td></tr>";
    print "<tr><td>Mark selected literature as <b>relevant for</b> <input type=\"submit\" value=\"Functional Role\" name=\"relevant_role\"></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($publications_table) {
	print "<tr><td><I><B><H3>Publications:</H3></B></I></td></tr>";
	print "<tr><td><I>Some 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 $publications_table;
}
else{
    print "<p>Sorry, no table available. Please select a view option.</p>\n";
}


# 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 {

	print $cgi->header;
	print $cgi->start_html( -title=>'PubMed for complete Subsystem',
				-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 the Subsystem. 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 {

	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 ($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 "display_all") {
		foreach (@att_in) {
			my @att =  @$_;
			my ($role,$key,$value) = @att;
			my ($pmid,$curator,$authors,$date,$title);	
			#my ($pmid,$authors,$date,$title) = split(/;/,$value);

			$pmid_url = "$pmid_base$pmid";
			my $class = "undef";

			if ($key eq "ROLE_PUBMED_NOTCURATED"){
			    $class = $role;
			    $curator = "pre-computed";
			    ($pmid,$authors,$date,$title) = split(/;/,$value);
			}
			elsif ($key eq "ROLE_PUBMED_CURATED_RELEVANT"){
			    $class = $role;
			    ($pmid,$curator,$authors,$date,$title) = split(/;/,$value);
			}
			elsif ( $key eq "ROLE_FROM_PEG_RELEVANT"){
			    $class = $role;
			    ($pmid,$curator,$authors,$date,$title) = split(/;/,$value);
			}
			elsif ( $key eq "SUBSYSTEM_PUBMED_RELEVANT" ) { 
			    $class = $role;
			    ($pmid,$curator,$authors,$date,$title) = split(/;/,$value);
			}

			if ( ($what eq "display_all") 
			     or ($what eq "display_relevant_for_role" and $key eq  "ROLE_PUBMED_CURATED_RELEVANT") 
			     or ($what eq "display_relevant_for_subsystem" and $key eq  "SUBSYSTEM_PUBMED_RELEVANT") 
			     or ($what eq "display_precomputed" and $key eq  "ROLE_PUBMED_NOTCURATED") 
			     )
			{
			    push(@$data_table, ["<input type=checkbox name=$pmid value=\"$pmid\">",
						"$class","<a href=$pmid_url target=_blank>$pmid</a>","$curator",
						$authors,$date,$title]);
			}
			else{
			    print STDERR "NO key to display!\n";
			    print "<h1> ERROR: NO OPTION SELECTED </h1>";
			}
			
			    
		}
		$columns = [ "Select","Relevant for", "PMID", "Curator","Author (First,Last)", "Date", "Title"];
	}


	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\">",
					"$role","<a href=$pmid_url target=_blank>$pmid</a>","pre-computed",
					$authors,$date,$title]);		
		}
		$columns = [ "Select","Relevant for", "PMID", "Curator","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