use strict; use warnings; use CGI; use Table; use DBMaster; my $dbmaster = DBMaster->new('GBBergeyDB'); my $cgi = new CGI; my $spec_name = $cgi->param('spec'); my $species = $dbmaster->Species->get_objects({ name => $spec_name })->[0]; my $genomes = $dbmaster->Genome->get_objects( { Species => $species } ); my $content = ""; my $dbmaster2 = DBMaster->new('FortyEight_WebApplication'); my $user_object = $dbmaster2->User->get_objects( { _id => $cgi->param('uid') } )->[0]; my $user = $user_object->firstName . " " . $user_object->lastName; # check if a new not was added if ($cgi->param('submitted')) { # get the parameters my $description = $cgi->param('comment') || ""; my $timestamp = time(); my $passed_strain = $cgi->param('strain') || ""; my $strain; unless ($passed_strain =~ /the species/) { $strain = $dbmaster->Genome->get_objects( { name => $passed_strain } )->[0]; } # create the note object $dbmaster->Note->create( { user => $user, description => $description, timestamp => time(), Species => $species, Strain => $strain } ); } # check for ncbi link my $ncbi_link = ""; if ($species->taxid) { $ncbi_link = " (NCBI)"; } # check for bacterio link my $bacterio_link = ""; if ($species->getBacterioLink) { $bacterio_link = " LPSN"; } # print Species information $content .= "

Species: " . $species->name . "

"; my $genus = $species->Genus; my $family = $genus->Family; my $order = $family->GOrder; my $class = $order->Class; my $phyla = $class->Phyla; my $domain = $phyla->Domain; $content .= ""; $content .= ""; $content .= "
Bergey Taxonomy" . $domain->name . "; " .$phyla->name . "; " . $class->name . "; " . $order->name . "; " . $family->name . "; " . $genus->name . "
"; # print list of strains $content .= ""; my $first = 1; my $i = 1; foreach my $genome (@$genomes) { unless ($first) { $content .= ""; } else { $first = 0; } # check for gold link my $gold_link = ""; if ($genome->goldstamp) { $gold_link = $genome->goldstamp; $gold_link =~ s/\s\(.*\)//; $gold_link = " (GOLD)"; } # check for ncbi link $ncbi_link = ""; if ($genome->taxid) { $ncbi_link = " (NCBI)"; } # check for 16s my $sixTeenS = ""; if ($genome->sixTeenS) { $sixTeenS = $genome->sixTeenS; $sixTeenS =~ s/(.{50})/$1\/g; $sixTeenS = " "; } # create entry $content .= ""; $i++; } $content .= "
Strains
" . $sixTeenS . "
" . $genome->name . $ncbi_link . $gold_link . $sixTeenS . "
"; # print note-form $content .= "
"; $content .= "

Add your comment

"; $content .= "
"; $content .= ""; $content .= ""; if (scalar(@$genomes) > 1) { $content .= "This note refers to "; } # $content .= "
I vote for this species to be "; # $content .= "
My confidence about this vote is "; $content .= "
"; $content .= "
"; $content .= ""; $content .= "
"; $content .= "

Current Notes

"; my $notes = $dbmaster->Note->get_objects( { Species => $species } ); if (scalar(@$notes)) { foreach my $note (@$notes) { # get time of note my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($note->timestamp); my @abbr = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ); my $time = "$hour:$min"; $time =~ s/\:(\d)$/\:0$1/; my $date = "$abbr[$mon] $mday $time"; # contruct note headline $content .= "" . $date . " " . $note->user . ":
"; # check for reference to strain if ($note->Strain) { $content .= "Referred Strain: " . $note->Strain->name . "
"; } # check for voting if ($note->voting) { # check confidence my $confidence; if ($note->confidence == 1) { $confidence = " high"; } elsif ($note->confidence == 2) { $confidence = "n average"; } else { $confidence = " low"; } # check voting my $voting; if ($note->voting == 1) { $voting = "be in the top 100 to be sequenced."; } elsif ($note->voting == 2) { $voting = "be in the top 200 to be sequenced."; } elsif ($note->voting == 3) { $voting = "be in the top 300 to be sequenced."; } else { $voting = "not be sequenced."; } # construct voting sentence $content .= "Vote:
I have a" . $confidence . " confidence that this species should " . $voting . "
"; } # print description $content .= "Note:
" . $note->description . "

"; } } else { $content .= "There are currently no notes for this species."; } print $cgi->header(); print "" . $species->name . ""; print ''; print "
"; print $content; print "
";