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

View of /FigWebServices/aliases_to_pubmed.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (download) (annotate)
Wed Oct 29 16:01:15 2008 UTC (11 years, 1 month ago) by wilke
Branch: MAIN
CVS Tags: mgrast_dev_08112011, rast_rel_2009_05_18, mgrast_dev_08022011, rast_rel_2014_0912, myrast_rel40, mgrast_dev_05262011, rast_rel_2008_12_18, mgrast_dev_04082011, rast_rel_2010_0928, mgrast_version_3_2, mgrast_dev_12152011, mgrast_dev_06072011, 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_1110_v2, rast_rel_2009_02_05, rast_rel_2011_0119, 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, mgrast_dev_04012011, rast_rel_2009_07_09, rast_rel_2010_0827, mgrast_rel_2008_1110, myrast_33, rast_rel_2011_0928, mgrast_dev_04052011, mgrast_dev_02222011, rast_rel_2009_03_26, mgrast_dev_10262011, rast_rel_2008_11_24, HEAD
Changes since 1.8: +1 -1 lines
removed exit statement. Script proceeds now even if no ids are submitted.

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

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

my $id_string = $cgi->param("ids");
my $peg = $cgi->param("peg");
my $role;

&print_header;
&print_verbiage;

if (!$id_string) {
	print "PubMed publication(s) found for this PEG  were not specific to this PEG<p>";
	#exit;
	}	

&print_peg_info;

my $pmid_output = &FIG::run_gathering_output("$FIG_Config::bin/get_pubmed_journals", $id_string);

my @publications_list = split(/ /, $pmid_output);
my %publications_list_seen = ();
my %publications_to_pegs = ();


foreach (@publications_list) {
 	$publications_list_seen{$_} = "$peg\t$_";
	$publications_to_pegs{$_} = $peg;
}

my (@show_notr_publications, @show_r_publications);
my ($publication_div, $publication_relevant_div, $publication_notrelevant_div);

my @pubmed_rel_attributes = $fig->get_attributes($peg,"PUBMED_CURATED_RELEVANT");
my @pubmed_notrel_attributes = $fig->get_attributes($peg,"PUBMED_CURATED_NOTRELEVANT");
my @pubmed_attributes = $fig->get_attributes($peg,"PUBMED");

&process_attributes(\@pubmed_attributes, "pubmed_plain");
&process_attributes(\@pubmed_rel_attributes, "relevant");
&process_attributes(\@pubmed_notrel_attributes, "notrelevant");

my @filtered_publications;
while( my($k,$v) = each(%publications_list_seen)) {
	if ($k ne "") {
	$publication_div .= "<li id=\"$k\">$k</li>";
	push(@filtered_publications,$v);
	}
}

my $peg_list;
while( my($k,$v) = each(%publications_to_pegs)) {
	$peg_list .= "$k-$v\;";
}



my $column_table = &FigWebServices::SeedComponents::PubMed::column_title;			
my $not_curated_htmltable = &FigWebServices::SeedComponents::PubMed::journals_as_htmltable(\@filtered_publications);
my $r_publication_htmltable = &FigWebServices::SeedComponents::PubMed::journals_as_htmltable(\@show_r_publications);		
my $notr_publication_htmltable = &FigWebServices::SeedComponents::PubMed::journals_as_htmltable(\@show_notr_publications);	

#Put publications as a string to be passed the next cgi 

print "<table>";
print $column_table;

if ($not_curated_htmltable) {		
	print $not_curated_htmltable;	
}
if ($r_publication_htmltable) {
	print "<tr><td colspan=3><ul><li>Curated to be relevant publication(s):</li></ul></td></tr>";
	print $r_publication_htmltable;
}

if ($notr_publication_htmltable) {
	print "<tr><td colspan=3><ul><li>Curated to be not relevant publication(s):</li></ul></td></tr>";
	print $notr_publication_htmltable;
	print "</table>";
}

if ((! $notr_publication_htmltable) || ( ! $r_publication_htmltable) ) {
	print "</table>";
}

my $publication_info;
print $cgi->hr();
&print_form;


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

sub print_header {

print $cgi->header;
print $cgi->start_html( -title=>'PubMed for PEG',
			-style=>{ -src => 'Html/dnd.css'},
			-script=> [
				   {-language => 'JAVASCRIPT',
				    -src => 'Html/drag_and_drop.js'},
				]
			  );

	
}

sub print_verbiage {

print "<table><tr><td bgcolor=#D2E6F0>Introduction</td></tr></table>";
print "This website automates the process of finding relevant publications associated with a protein encoded gene (PEG). Aliases associated with the PEG are used as the search terms to query the PubMed database to find publications. Our tool does not get all journals associated with the PEG. A filter is used to remove publications that may be genome papers, and other publications that may not be relevant to the PEG. <p> Since this tool is an automated tool  to query PubMed database and automated tools can not replace human knowledge, relevant and not relevant papers may be returned with the search.  It is up to the curator to deem the  publications as relevant and not relevant publications."; 

}


sub print_peg_info {
$role = $fig->function_of($peg);
print $cgi->hr();
print "<table>";
print "<tr><td bgcolor=#D2E6F0>Functional Role</td><td> $role</td></tr></table>";
print "<I>Getting PubMed publication(s) for $id_string ...</I><p>";
print $cgi->hr();
}


sub print_form {

print "

This section allows you to curate the publications. You must be on the annotator's machine and specify your name. Press the \"Save to Attributes\" button for your changes to take effect.

<div>
<form name=\"myForm\" method=\"post\" action=\"save_to_attributes.cgi\" onsubmit=\"saveDragDropNodes()\">
<p><input type=\"textbox\" name=\"master\" value=\"Name\"> Your name
<p><input type=\"submit\" value=\"Save to attributes\" name=\"save\">
<p>
You may curate the publication information by 
<ul>
<li> Adding your own publication for this peg</li>

<input type=\"hidden\" name=\"listOfItems\" value=\"\">
<input type=\"hidden\" name=\"all_publications\" value=\"$publication_info\">
<input type=\"hidden\" name=\"purpose_peg\" value=\"$peg\">
<input type=\"hidden\" name=\"functional_role\" value=\"$role\">
<input type=\"textbox\" size=50 name=\"PMID\" value=\"PMID1 PMID2 PMID3\"> Publication Identifier (Multiple PMIDs should be separated by a space)
PMID
</form>
<p>
<li> Drag and drop the PMID to the appropriate containers (Relevant Publication(s)/ Not Relevant Publication(s)). 
Containers will be empty if there are no pmid found for this peg.</li>
</div>
<div id=\"dhtmlgoodies_dragDropContainer\">
	<div id=\"topBar\">
	</div>
	<div id=\"dhtmlgoodies_listOfItems\">
		<div><p>PUBMED NOT CURATED </p><ul id=\"PUBMED_NOT_CURATED\">$publication_div</ul></div>
	</div>	
	<div id=\"dhtmlgoodies_mainContainer\">
		<div><p>RELEVANT Publication(s) (curated by)</p><ul id=\"PUBMED_CURATED_RELEVANT\">$publication_relevant_div</ul></div>
		<div><p>NOT RELEVANT Publication(s) (curated by)</p><ul id=\"PUBMED_CURATED_NOTRELEVANT\">$publication_notrelevant_div</ul></div>
	</div>
</div>
</ul>
<ul id=\"dragContent\"></ul>
<div id=\"dragDropIndicator\"></div>
<div id=\"saveContent\"><div>
";

}

sub process_attributes {
	my ($attribute_in, $what) = @_;
	my @att_in = @{$attribute_in};

	foreach(@att_in) {
		my @line = @{$_};
		my $peg  = $line[0];	
		my $key  = $line[1];	
		my $value = $line[2];	
		my ($curator,$pmid,$title) = split(/,/,$value);

		if($what eq 'pubmed_plain') {
			$pmid = $value;
			
		}	

		$publications_to_pegs{$pmid} = $peg;		

		#delete existing pmids from all publication_list
		if($what eq 'relevant') {
			delete $publications_list_seen{$pmid};
			push(@show_r_publications, "$peg\t$pmid");
			$publication_relevant_div .= "<li id=\"$pmid($curator)\">$pmid($curator)</li>";
			
		}
		if($what eq 'notrelevant') {
			delete $publications_list_seen{$pmid};
			push(@show_notr_publications, "$peg\t$pmid");
			$publication_notrelevant_div .= "<li id=\"$pmid($curator)\">$pmid($curator)</li>";
		}

		if(($what eq 'pubmed_plain') && (! $publications_list_seen{$pmid})) {
			
			$publications_list_seen{$pmid} = "$peg\t$pmid";	
		}
	}	
}



MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3