[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.3 - (download) (annotate)
Tue Sep 12 18:07:05 2006 UTC (13 years, 3 months ago) by hwang
Branch: MAIN
Changes since 1.2: +24 -3 lines
Added PMID attributes  to the journals returned.

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

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

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'},
				]
			  );

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

if (!$id_string) {
	print "PubMed journals found for this peg were not specific to this peg<p>";
	exit;
	}	


print "<table>";
print "<tr><td bgcolor=#6666FF>Peg</td><td> $peg</td></tr>";
my $role = $fig->function_of($peg);
print "<tr><td bgcolor=#6666FF>Functional Role</td><td> $role</td></tr></table>";

print $cgi->hr();
print "<I>Getting PubMed journals for  $id_string ...</I><p>";

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

my @journals_list = split(/ /, $pmid_output);
my %journals_list_seen = ();

foreach (@journals_list) {
 	$journals_list_seen{$_} = $_;
	#print "journals here are $_\n";
}

#Add PubMed Attributes here
my @pubmed_attributes = $fig->get_attributes($peg, "PUBMED");
foreach (@pubmed_attributes) {

	my @line = @{$_};
	#print "id is $line[2]\n";
	if (! $journals_list_seen{$line[2]} ) {
	        #print "pushing\n";
		push (@journals_list, $line[2]);
	}
}


my @new_journals = &FigWebServices::SeedComponents::PubMed::sort_journals(\@journals_list);
my $journal_htmltable = &FigWebServices::SeedComponents::PubMed::journals_as_htmltable(\@new_journals);

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

my $journal_info;
my %journals_seen = ();

foreach (@new_journals) {
	my($pmid, $year,$month,$date,$title) = split(/\t/,$_);
	my $j = "$pmid|$title";
	$journal_info .= $j.";";
	$journals_seen{$pmid} = $title;
}

my @attributes = $fig->get_attributes($peg);
my @relevant;
my @notrelevant;
my @notcurated;

foreach (@attributes) {
	my @att_line = @{$_};
	my $key = $att_line[1];
	my ($pmid, $title)  = split(/\,/,$att_line[2]);
	
	if ($key =~ m/\_RELEVANT\_CURATED\_BY\_(.*)/) {
	my $anno_name = $1;
	my $pmid_name = "$pmid($anno_name)";
	push (@relevant, $pmid_name);
	delete $journals_seen{$pmid};
	}	
	
	if ($key =~ m/\_NOTRELEVANT\_CURATED\_BY\_(.*)/) {
	my $anno_name = $1;
	my $pmid_name = "$pmid($anno_name)";
	push (@notrelevant, $pmid_name);
	delete $journals_seen{$pmid};
	}	

	if ($key =~ m/\_NOT\_CURATED\_/) {
		if($journals_seen{$pmid}) {
		  delete $journals_seen{$pmid};
		}	
		else {	
	  	$journals_seen{$pmid};
  		}
	}	
}
#original div
my $journal_div;
my $journal_relevant_div;
my $journal_notrelevant_div;

foreach (@notrelevant) {
    $journal_notrelevant_div .= "<li id=\"$_\">$_</li>";
}

foreach (@relevant) {
    $journal_relevant_div .= "<li id=\"$_\">$_</li>";
}

while( my($k,$v) = each(%journals_seen)) {
	$journal_div .=	"<li id=\"$k\">$k</li>";	
}

#not curated div


print $journal_htmltable;

if ($#journals_list < 0) {
	print "PubMed journals found for this peg were not specific to this functional role<p>";
	
	}	


print $cgi->hr();

print "

This section allows you to curate the journals. 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 journal information by 
<ul>
<li> Adding your own journal for this peg</li>

<input type=\"hidden\" name=\"listOfItems\" value=\"\">
<input type=\"hidden\" name=\"all_journals\" value=\"$journal_info\">
<input type=\"hidden\" name=\"peg\" value=\"$peg\">
<input type=\"textbox\" size=10 name=\"PMID\" value=\"\"> Journal Identifier (ie PMID)
<p><input type=\"textbox\" size=50  name=\"title\" value=\"\"> Title of the Journal Article
<p><input type=\"textbox\" size=50  name=\"url\" value=\"\"> URL of the Journal

</form>

<li> Drag and drop the PMID to the appropriate containers (Relevant Journal(s)/ Not Relevant Journal(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\">$journal_div</ul></div>
	</div>	
	<div id=\"dhtmlgoodies_mainContainer\">
		<div><p>RELEVANT Journal(s) (curated by)</p><ul id=\"PUBMED_RELEVANT_CURATED\">$journal_relevant_div</ul></div>
		<div><p>NOT RELEVANT Journal(s) (curated by)</p><ul id=\"PUBMED_NOTRELEVANT_CURATED\">$journal_notrelevant_div</ul></div>
	</div>
</div>
</ul>
<ul id=\"dragContent\"></ul>
<div id=\"dragDropIndicator\"><img src=\"images/insert.gif\"></div>
<div id=\"saveContent\"><div>
";

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3