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

View of /FigWebServices/organisms.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.32 - (download) (annotate)
Fri Feb 10 00:39:30 2006 UTC (14 years ago) by overbeek
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_2008_07_21, rast_rel_2010_0928, rast_2008_0924, mgrast_version_3_2, mgrast_dev_12152011, rast_rel_2008_04_23, 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
Changes since 1.31: +5 -0 lines
RAE: Updating organisms.cgi for more information per organim

# -*- perl -*-
#
# Copyright (c) 2003-2006 University of Chicago and Fellowship
# for Interpretations of Genomes. All Rights Reserved.
#
# This file is part of the SEED Toolkit.
# 
# The SEED Toolkit is free software. You can redistribute
# it and/or modify it under the terms of the SEED Toolkit
# Public License. 
#
# You should have received a copy of the SEED Toolkit Public License
# along with this program; if not write to the University of Chicago
# at info@ci.uchicago.edu or the Fellowship for Interpretation of
# Genomes at veronika@thefig.info or download a copy from
# http://www.theseed.org/LICENSE.TXT.
#


use FIG;
use HTML;
use strict;
use CGI;
use raelib;
my $raelib=new raelib; # there are a couple of functions that we are using here that we should probably transpose into FIG.pm
my $cgi=new CGI;

my $fig;
eval {
    $fig = new FIG;
};

if ($@ ne "")
{
    my $err = $@;

    my(@html);

    push(@html, $cgi->p("Error connecting to SEED database."));
    if ($err =~ /Could not connect to DBI:.*could not connect to server/)
    {
        push(@html, $cgi->p("Could not connect to relational database of type $FIG_Config::dbms named $FIG_Config::db on port $FIG_Config::dbport."));
    }   
    else
    {
        push(@html, $cgi->pre($err));
    }   
    &HTML::show_page($cgi, \@html, 1);
    exit;
}   


$ENV{"PATH"} = "$FIG_Config::bin:$FIG_Config::ext_bin:" . $ENV{"PATH"};

my $html = [];

# Create a general webpage for different uses. The basic idea is that we will define everything near the start, and then have organism/group specific
# pages that we can quickly call up for whatever we want. In general we will be working off key/value pairs.
#

# If no type is chosen we will create a "my seed" page


if (!$cgi->param("show") || $cgi->param('submit') eq "Update List") {  
 &my_seed($cgi, $html);
 exit(0);
}


################################################  BEGIN DATA TO EDIT TO ADD SITE SPECIFIC PAGES ######################################

# If you want to add a new organism or group of organisms, edit these hashes
#
# in every case, 'all' is the default, and if you do not set a type default will be used as your type.

# TITLES - titles that will be used throughout

my $titles=
	{
		'all'	        => 'The Special SEED Site',
		'myseed'	=> 'My SEED',
		'cyano'		=> 'Cyanobacteria',
		'marine'	=> 'Marine Microbes',
		'motile'	=> 'Swimmy things',
		'rohwer'	=> 'Rohwer Lab',
		'delong'	=> 'DeLong Lab',
                'hp'            => 'Higher Plants',
                'ep'            => 'Eukaryotic Photosynthetics',
                'np'            => 'Nonoxygenic Photosynthetics',
	};

# LINKS - general links will be included for all pages. Add specific links here as a reference to an array
my $links=
	{
		'all'		=> [	
					'<a href="http://theseed.uchicago.edu/FIG/index.cgi">The SEED</a>',
			   	],
		'cyano'		=> [
					'<a href="http://www.kazusa.or.jp/cyano/cyano.html">CyanoBase</a>',
					'<a href="http://www.people.vcu.edu/%7Eelhaij/cyanonews/">CyanoNews</a>',
					'<a href="http://www-cyanosite.bio.purdue.edu/">CyanoSite</a>',
			   	],
        	'marine'	=> [
					'<a href="http://www.moore.org/marinemicro">Moore Foundation</a>',
					'<a href="http://www.sorcerer2expedition.org">Sorcerer II</a>',
					"<br>\n",
					'<a href="http://web.mit.edu/chisholm/www/">Chisholm</a>',
					'<a href="http://cee.mit.edu/index.pl?iid=7059">DeLong</a>',
					'<a href="http://oregonstate.edu/dept/microbiology/">Giovannoni</a>',
					'<a href="http://alpha.marsci.uga.edu/directory/mmoran.htm">Moran</a>',
					'<a href="http://phage.sdsu.edu">Rohwer</a>',
			   	],
		'rohwer'	=> [
					'<a href="http://phage.sdsu.edu/">Rohwer Lab HomePage</a>',
					'<a href="http://phage.sdsu.edu/blast/">FABULOUS</a>',
					'<a href="http://phage.sdsu.edu/tree/">Phage Tree</a>',
					'<a href="http://phage.sdsu.edu/phaccs/">PHACCS</a>',
					'<a href="http://146.244.226.100/Metagenomes/enzymes.html">Enzymes in metagenomes</a>',
				   ],
	        'delong'	=> [
					'<a href="http://urkaryote.mit.edu/Metagenomes/FIG/index.cgi">SEED</a> with metagenomes',
					'Original <a href="http://urkaryote.mit.edu/FIG/index.cgi">SEED</a>',
					'<a href="http://urkaryote.mit.edu/Metagenomes/Comparisons/">Comparisons</a> between metagenomes',
				   ],
                'hp'            => [
                                        '<a href="http://www.arabidopsis.org/">tair</a>',
                                   ],
	};

# CSS - Default css sheet for the pages
# these are a reference to a hash. Per the docs in HTML.pm, the stylesheet called Default is the default that is used, and others are alternate stylesheets
# css sheeets should end up in CGI/Html/css
my $css=
	{
		'all'		=> {"default"=>"default.css"},
		'cyano'		=> {"default"=>"CyanoGeorgia.css"},
		'marine'	=> {"default"=>"Marine.css", "Search"=>"MarineClean.css", "Barracudas"=>"MarineBackgrounded.css"},
		'motile'	=> {"default" =>"SwimmyGeorgia.css"},
		'myseed'	=> {"default"=>"myseed.css", "Search"=>"myseedsearch.css"},
		'rohwer'	=> {"default"=>"Labs.css", "Search"=>"MarineClean.css", "Barracudas"=>"MarineBackgrounded.css"},
		'delong'	=> {"default"=>"Labs.css", "Search"=>"MarineClean.css", "Barracudas"=>"MarineBackgrounded.css"},
                'hp'            => {"default"=>"GreenGeorgia.css"},
                'np'            => {"default"=>"GreenGeorgia.css"},
                'ep'            => {"default"=>"GreenGeorgia.css"},
	};


# LIMITS - How to find organisms. This is a single key/value pair. At the moment we understand two different things here
# 	1. 'phylogeny=Cyanobacteria' to get just those organisms with that phylogeny. This will be translated into active_subsetR=Cyanobacteria
#	 	for the subsystem page
#	2. tag/value pairs in the form tag=value. If a valid tag is used this will be translated into active_key for the subsystem
#	3. a couple of special cases (all and 'my seed') are chosen on the fly below

my $limits=
	{
		'cyano'		=> "phylogeny=Cyanobacteria",
		'marine'	=> "environment=marine",
		'motile'	=> "motile=motile",
		'rohwer'	=> "Contact=Rohwer F",
		'delong'	=> "Contact=DeLong E",
                'hp'            => "higher_plants=1",
                'ep'            => "eukaryotic_ps=1",
                'np'            => "nonoxygenic_ps=1",
	};


# BANNER - should we use our own banner or the seed default. If this is true we will use the seed default

my $figbanner=
 	{
		'myseed'	=> 1,
	};


# TRAILERS - HTML Content that will be added at the bottom of the page (e.g. thanking people for $$).
# This can either be a path to a file or some html text.

my $trailers=
	{
		'all'		=> "<p>Please visit <a href=\"http://theseed.uchcicago.edu/FIG/index.cgi\">the SEED</a></p>",
		'cyano'		=> "Html/cyanoseed_tail.html",
		'motile'	=> "<p>SwimmySEED is a special FIGwest production as we like things that swim</p><center><h1>DO NOT USE THIS PAGE FOR ANYTHING. I AM TRYING IDEAS OUT</h1></center>",
                'hp'            => "Because even small plants can be higher",
	};

$trailers->{'marine'}=<<EOF;
<p>&nbsp;<p>
<p>This page was created by <a href=\"mailto:RobE\@thefig.info\">Rob Edwards</a>. It is still under development, and I haven't had a chance to test everything yet. Please send me feedback on things that are broken or you would like changed.<p>
<br />The image on this page is some barracudas taken by Forest Rohwer. Please check his <a href="http://phage.sdsu.edu">image gallery</a>
for more really cool images.</p>

EOF

$trailers->{'myseed'}=<<EOF;
<p>&nbsp;<p>
<p>This page was created just for you by <a href=\"mailto:RobE\@thefig.info\">Rob Edwards</a>. It is still under development, and I haven't had a chance to test everything yet. Please send me feedback on things that are broken or you would like changed.<p>

EOF


$trailers->{'rohwer'}=<<EOF;
<p> <hr> <p>
<p>The data on this website is preliminary and may be subject to change. Please contact Forest or a member of his lab before using any of this data. Please do not use this data without prior consent, as the quality of this data is not guaranteed. This page was created just for people in the Rohwer Lab</p>

EOF

$trailers->{'delong'}=<<EOF;
<p> <hr> <p>
<p>The data on this website is preliminary and may be subject to change. Please contact Ed or a member of his lab before using any of this data. Please do not use this data without prior consent, as the quality of this data is not guaranteed. This page was created just for people in the DeLong Lab</p>

EOF

# FIRST PEG
# In the organisms information, should we show the first peg in the organism as a link.
# Actually this will just show fig|xxxxx.x.peg.1 as a link into protein.cgi, at least to get people started.

my $firstpeg=
	{
		'rohwer' => 1,
		'delong' => 1,
                'cyano'  => 1,
	};
        
# COMPLETE
# We get taxonomic groups or lists of genomes for different things. Sometimes we want all genomes, even those that are not complete. Sometimes we don't.

my $complete=
    {
            'all' => 1,
    };

################################################  END DATA TO EDIT TO ADD SITE SPECIFIC PAGES ######################################


# Define the page.
# Do we have a group of organisms:
my $selected=$cgi->param('show');
unless ($selected) {$selected='all'}
my ($tag, $value)=split /\=/, $limits->{$selected};
# table_options - these are the default table options, and borders should be set by the css.
my %table_options=(
  border=>0,
  width=>'100%',
);

# Add a title to the html
unless (exists $titles->{$selected}) {$titles->{$selected}=$titles->{'all'}}
unshift @$html, "<title>".$titles->{$selected}."</title>";

# find the organisms that we are interested in, and get some data for them
my $orgs;
if ($selected eq "all") 
{
 $orgs=[$fig->genomes('complete', undef, 'Bacteria')]; # at the moment just limit this a little.
}
elsif ($selected eq "myseed") {
 my @selected = $cgi->param('korgs');
 $orgs = \@selected;
}
elsif ($limits->{$selected}) 
{
 if ($tag eq "phylogeny") 
 {
   my $taxonomic_groups;
   if ($complete->{$selected}) {$taxonomic_groups = $fig->taxonomic_groups_of_complete(10)}
   else {$taxonomic_groups = $fig->taxonomic_groups_of_all(10)}
   foreach my $pair (@$taxonomic_groups)
   {
     push @$orgs, @{$pair->[1]} if ($pair->[0] eq "$value");
   }
 }
 else
 {
   # get the organisms that have the value
   my @orgs=map {$_->[0]} $fig->get_attributes(undef, $tag, $value);
   $orgs=\@orgs;
 }
}
else
{
 die "Can't define either all or a type from -->$selected<--. HELP!";
}

# check for things we need, and if we don't have them use the defaults.
$links->{$selected}   = $links->{'all'} unless (exists $links->{$selected});



# now work through the page, creating what we need.


#################### PAGE SECTION : STYLE SWITCHERS


# if we have more than one style sheet we will add a link to it
if (scalar keys %{$css->{$selected}} > 1 ) {
 my $link;
 foreach my $style (keys %{$css->{$selected}}) {
  $link .= "<span class=\"styleswitcher\"><a href='#' onclick='javascript: setActiveStyleSheet(\"$style\"); return false;'>$style</a></span>\n";
 }

 push @$html, $cgi->div({class=>"styleswitcher"}, "Alternate styles: ", $link, "\n");
}



#################### PAGE SECTION : HEAD BANNER

# HEAD BANNER
# here I define the banner in $banner, and then use make table to make the html table

my ($banner, $alt_header)=('','');
if (!$figbanner->{$selected}) {

  $banner=	
	$cgi->p({class=>"header"}, $titles->{$selected} . " SEED Entry Page") . 
	$cgi->p({class=>"navLink imagebg", style=>"text-align: center;"}, 
	'
		| <a href="http://subsys.info">Subsystem Forum</a> |
		<a href="http://theseed.uchicago.edu/FIG/Html/tutorials.html">Tutorials</a> |
		<a href="http://www-unix.mcs.anl.gov/SEEDWiki/">SEED Wiki</a> |
		<br>
		| <a href="http://www.genomesonline.org/">GOLD</a> |
		<a href="http://www.ncbi.nlm.nih.gov/">NCBI</a> |
		<a href="http://www.genome.jp/kegg/kegg2.html">KEGG</a> |
		<a href="http://au.expasy.org/">ExPASy</a> |
		<a href="http://www.tigr.org/tigr-scripts/CMR2/CMRGenomes.spl">TIGR cmr</a> |
		<a href="http://www.pir.uniprot.org/">UniProt</a> | <br>
		|
	'. (join " | ", @{$links->{$selected}}) . '|');


  $alt_header=["<table width=100%><tr><td>$banner</td><td width=105><img src=\"Html/FIGsmall.gif\"></td></tr></table>"];
}



################### PAGE SECTION : Search field

#push @$html, "\n", $cgi->div({class=>"search imagebg center"}, "<form method=\"post\" action=\"index.cgi\" enctype=\"application/x-www-form-urlencoded\">

# the radio labels are going to take advantage of some of GJOs code. The rationale is this:
# if we have "Search genome selected below" and korgs then we limit the search.
# if we have "Search" we don't limit the search, regardless of korgs.
my $radiolabels={"1"=>"Only in ". $titles->{$selected}, "0"=>"All organisms in SEED"};

my $korgs;
foreach my $org (@$orgs) {$korgs .= $cgi->hidden(-name=>"korgs", -value=>$org) . "\n"}

push @$html, "\n",  $cgi->div(
		{class=>"search imagebg"}, 
		$cgi->start_form(-action=>'index.cgi'), 
		"Search for: &nbsp ", $cgi->textfield(-name=>'pattern'), $cgi->br,
		$cgi->radio_group(-name=>'Search Selected Organisms', -values=>[1, 0], -labels=>$radiolabels, -default=>1), 
		$cgi->hidden(-name=>"maxpeg", -value=>"100"), $cgi->hidden(-name=>"maxrole", -value=>"100"),
		$cgi->hidden(-name=>"search_from", -value=>$selected),
		$korgs, "\n", $cgi->br,
		$cgi->submit("Search"), $cgi->reset, 
		$cgi->end_form,
	     ); 

################### PAGE SECTION : Intro text

push @$html, "\n", $cgi->div({class=>"intro imagebg"}, "<p>This unique entry point into the <a href=\"http://theseed.uchicago.edu/FIG/index.cgi\">SEED</a> engine focuses on " . $titles->{$selected} .". The SEED is developed by the <a href=\"http://www.thefig.info\">Fellowship for Interpretation of Genomes</a> and is maintained and curated by collaborating groups all over the world. Researchers interested in participating in the curation effort are encouraged to become members of the <a href=\"http://subsys.info\">FIG forum</a>, a site for the open exchange of ideas, problems, and suggestions related to genome annotation and analysis.</p>\n<p>In the list below you can see all the genomes in the " . $titles->{$selected} ." project.</p>");


################### PAGE SECTION : TABLE WITH ORGS AND SUBSYSTEMS

#### ORGANISM INFORMATION
my $orgtab=[];
foreach my $org (sort {$fig->genus_species($a) cmp $fig->genus_species($b)} @$orgs) {
 push @$orgtab, [[$fig->genus_species($org), "td style=\"text-align: center; font-weight: bolder;\" colspan=2"]];
 foreach my $key ('Institution', 'Publication', 'Funding', 'Genome_Database', 'Status', 'Contact', 'Links')
 {
  my @allattributes=$fig->get_attributes($org, $key);
  foreach my $eachattr (@allattributes) {
   my ($gotpeg,$gottag,$val, $url)=@$eachattr;
   my $tag = $key;
   $tag =~ s/_/ /g;
   if ($val) {
    if ($url) {push @$orgtab, [$tag, "<a href=\"$url\">$val</a>"]}
    else {push @$orgtab, [$tag, $val]}
   }
  }
 }
 
  my $sz=$raelib->commify($fig->genome_szdna($org));
  my $nc=$raelib->commify($fig->number_of_contigs($org));
  push @$orgtab, ["Size", "$sz bp"], ["Number of contigs", $nc];
 
 if ($firstpeg->{$selected} && $fig->is_real_feature("fig|$org.peg.1"))
 {
  push @$orgtab, ["First PEG", "<a href='protein.cgi?prot=fig|$org.peg.1;user='>Peg 1</a>"];
 }
 elsif ($firstpeg->{$selected}) {push @$orgtab, ["First PEG", "No proteins"]}
}

#push @$orgtab, [["<p>Some of this data was extracted from the <a href=\"http://www.genomesonline.org/\">GOLD</a> Database.</p>", "td colspan=2"]];
push @$html, "\n", $cgi->div({class=>"available_genomes box1 imagebg"}, &HTML::make_table(undef, $orgtab, "<p class=\"boxheader\">". $titles->{$selected} . " Complete and Nearly-Complete Genomes</p>", %table_options));

################### PAGE SECTION : Intro text

if ($cgi->param('show') eq "cyano")
{
    push @$html, "\n", $cgi->div({class=>"intro2 imagebg"}, $cgi->p("Subsystems currently available in SEED are listed below in alphabetical order. Those that contain cyanobacterial genomes (listed above) are links that will take you to the corresponding  subsystem pages.  Only cyanobacterial genomes are displayed by default, please chose 'all' and press 'show spreadsheet' button to view all organisms encoded.  Those subsystems that do not have any cyanobacterial genomes are not currently links, but you can view them from the <a href=\"index.cgi\">SEED Search Page</a>.  Please note, that SEED is actively growing: new subsystems are added regularly, existing ones are being improved."));
}
else
{
push @$html, "\n", $cgi->div({class=>"intro2 imagebg"}, "<p>" . "In the list below, we have summarized the subsystems that have been annotated for the " .  $titles->{$selected} ." project. Those subsystems that contain " .  $titles->{$selected} ." genomes (listed above) are links that will take you to the partial subsystem. Those subsystems that do not have any " .  $titles->{$selected} ." genomes are not currently links, but you can view them from the <a href=\"index.cgi\">SEED Search Page</a></p>\n");
}

### SUBSYSTEM INFORMATION
my $allss;
my $need={map {$_=>1} @$orgs};
foreach my $ssid ($fig->all_subsystems) {
 my $sscount=0;

 # using get_subsystem is really slow, and so I am probably not going to use it.
 # the alternate is to use the FIG.pm methods that should be faster as we are not loading the whole subsystem
 	foreach my $ssgen (@{$fig->subsystem_genomes($ssid)})
	{
		if ($need->{$ssgen->[0]}) {$sscount=1; last}
                
	}
    	my $ssidspaced=$ssid;
	$ssidspaced =~ s/_/ /g; $ssidspaced =~ s/\s+/ /g;
	my $link=$ssidspaced;
	if ($sscount)
	{
		$link="<a href=\"subsys.cgi?user=&can_alter=&request=show_ssa&ssa_name=$ssid";
    		if ($tag eq "phylogeny") {$link .= "&active_subsetR=$value"}
    		else {$link .= "&active_key=$tag&active_value=$value"}
    		$link .= "\">$ssidspaced</a>\n";
 	}
  	
	my ($class1, $class2)=(@{$fig->subsystem_classification($ssid)});
	unless (defined $class1) {$class1='Unclassified'}
	unless (defined $class2) {$class2=' &nbsp; '}
	next if ($class1 eq "Retired" || $class1 eq "Experimental Subsystems" || $class1 eq "Test");
	#push @$allss, [$class1, $class2, $link]; # classification deprecated at Sveta's request
	push @$allss, [$link];
}

#@$allss=sort {$a->[0] cmp $b->[0] || $a->[1] cmp $b->[1] || $a->[2] cmp $b->[2]} @$allss;
@$allss=sort {uc($a->[0]) cmp uc($b->[0])} @$allss;
 
push @$html, "\n", $cgi->div({class=>"subsystems box1 imagebg"}, &HTML::make_table(undef, $allss, "<p class=\"boxheader\">Subsystems</p>", %table_options));


################### PAGE SECTION : TAIL INFORMATION

if ($trailers->{$selected}) {
 if (-e $trailers->{$selected}) { 
  # if it is a file, read it in and just replace the file name with the text. Otherwise use the default
  open(IN, $trailers->{$selected}) || die "Can't open $trailers->{$selected}";
  my $tailtxt;
  while (<IN>) {$tailtxt .= $_}
  $trailers->{$selected}=$tailtxt;
 }
 push @$html, "\n", $cgi->div({class=>"footer"}, $trailers->{$selected});
}



################## PAGE SECTION : Clean up

push @$html, $cgi->end_form(), $cgi->end_html();

# define the css that we want to use, and the alternate style sheets too
unless ($css->{$selected}) {$css->{$selected}=$css->{'all'}}
unless ($css->{$selected}->{'default'}) {$css->{$selected}->{'default'}=$css->{'all'}->{'default'}}
# and now just change the names of all the css to add the appropriate path
foreach my $ss (keys %{$css->{$selected}}) {
 unless (-e $css->{$selected}->{$ss}) {$css->{$selected}->{$ss} = "Html/css/" . $css->{$selected}->{$ss}}
}



&HTML::show_page($cgi,$html,1, $alt_header, $css->{$selected}, ["Html/css/styleswitcher.js"]);





sub my_seed {
 my ($cgi, $html)=@_;

 unshift @$html, "<title>My SEED Organism Selection</title>\n";
 
 push @$html, $cgi->div({class=>'header'}, "Please choose some organisms from the list below. You can choose multiple organisms from this list:"), 
  $cgi->start_form(), $cgi->hidden(-name=>'show', -value=>'myseed'),
  $raelib->scrolling_org_list($cgi, 1), $cgi->submit('Show My SEED'), $cgi->reset, $cgi->end_form;

 &HTML::show_page($cgi,$html,1,undef,{"default"=>"Html/css/myseed.css"});
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3