#!/usr/bin/perl -w use strict; use CGI qw(:standard); use CGI qw(param); # GENECENSUS TREEDISPLAY 2000 # ----------------------------- # Yale Gerstein Bioinformatics : Jimmy Lin # # A program to display different trees # and information associated with organisms # on the nodes of the trees # USER SPECIFICATIONS #my $treename='ribosome'; # name of order #my @treeorder=qw(Mgen Hinf); # specification of order my $input= param("type"); # types of trees: e.g. trad20, ribo_ssu, fold_a my $viewnum= param("view"); # which tab is being pressed 1-6 my $big= param("bigview"); my $tabnum; # which tab is being pressed 1,2,3... my $found=0; # label whether name is found in datafile my $treename; # tree name, picture file - tree-$treename.gif my $treedescrip; # name description of tree my @treeorder; # specification of order in tree my @otherorder; # specification of order not in tree my $treenode; # number of nodes in tree my $othernode; # number of nodes not in tree my $i; # counter my $j; # counter 2 my @treeorder2; # second tree order my $markfortree=-1; # shows a second tree if (!param("type")){ $input="20-ribo-ssu"; } if (!param("view")){ $viewnum=1; } # DEFINITIONS # species number assignment from TIGR my %treenum=( 'Hinf'=>1, 'Mgen'=>2, 'Mjan'=>3, 'Syne'=>4, 'Mpne'=>5, 'Scer'=>6, 'Hpyl'=>7, 'Ecol'=>8, 'Mthe'=>9, 'Bsub'=>10, 'Aful'=>11, 'Bbur'=>12, 'Aaeo'=>13, 'Phor'=>14, 'Mtub'=>15, 'Tpal'=>16, 'Ctra'=>17, 'Pfa2'=>18, 'Rpro'=>19, 'Hpy2'=>20, 'Lei1'=>21, 'Cpne'=>22, 'Aper'=>23, 'Tmar'=>24, 'Pfa3'=>25, 'Drad'=>26, 'Cjej'=>27, 'Nmen'=>28, 'Nme2'=>29, 'Ctr2'=>30, 'Cpn2'=>31, 'Cele'=>32, 'Dmel'=>33, 'Hsap'=>34); # print "treenum:$treenum{'Mpne'}\n"; # exit; #names of datafiles my %dataname=('treearray'=>1, 'treebasicdata'=>2, 'treeoverall'=>3, 'treesfamdata'=>4, 'tree-cog-21'=>5); my @treedata; #$treedata[$dataname{'treesfamdata'}] my @treepresence; for ($i=0; $i<35; $i++){ $treepresence[$i]=0; } # array designating functions for different organisms read_matrix("tree-cog-21"); #name, info, cell, meta, poor, JKLDOMNPTCGEFHIRS read_matrix("treesfamdata"); #name, number, total, a,b,a+b,a/b,multi,sfam read_matrix("treearray");# NAME, NUMBER,RESOURCE, size, FOLD TOTAL /1/2/3/4/5 COG TOTAL I/C/M read_matrix("treebasicdata"); #Name, Number, Size (kbp), Proteins read_matrix("treeoverall"); # name, #%AT, %At{nc},[code], (g-c)/g+c-0.50%, [nc]%,[code]%,size,#genes,%transcribed,longestnc,x=,datepublished # print "Mgen-num2:$treedata[$dataname{'treearray'}][2][1]\n"; # READ TREEDATA.TXT open (DATA, "./datafiles/treedata2.txt") or die "cannot open treedata2.txt"; my $line; while (defined ($line = )&&!$found) { chomp $line; if ($line =~ $input) { $found=1; # When type found in datafile $treename=$line; chomp ($line = ); $treedescrip=$line; chomp ($line=); my $i; for ($i=0; $line !~ "END"; $i++){ # Read array order of tree $treeorder[$i]=$line; $treepresence[$treenum{$line}]=1; chomp ($line=); } chomp ($line=); $j=0; for ($i=1; $i<35; $i++){ # Read array order not in tree if ($treepresence[$i]==1){} else { $otherorder[$j]=$treedata[$dataname{'treebasicdata'}][$i][0]; $j++; } } } } close DATA; if (!$found){;} #$treedescrip="Phylogenetic Tree Based on 16S Ribosomal Subunit"; #$treename='trad20'; # tree name, picture file - tree-$treename.gif #@treeorder=qw(Cele Scer); # specification of order in tree #@otherorder=qw(Mgen Mgen); # specification of order not in tree $treenode=scalar(@treeorder); # number of nodes in tree $othernode=scalar(@otherorder); # number of nodes not in tree my $pictreenode=$treenode+1; #names of tabs my %tabnames=(1=>'blank', 2=>'ribo', 3=>'fold', 4=>'sfam', 5=>'cog', 6=>'comp', 7=>'orf'); # links to Yale Resources # when adding new resource, make sure to change resource in genome matrix to 1 my %yalelink=( 'Cele'=>"http://bioinfo.mbb.yale.edu/genome/worm_yeast/", 'Mgen'=>"http://bioinfo.mbb.yale.edu/genome/MG/" ); #$treedata[$dataname{'treesfamdata'}] # START print <GeneCensus TreeServer EndOfStart my $hvar = `perl /web/genecensus/header/header.cgi tree`; print "$hvar"; print <
"; print ""; print "
EndOfStart2 #READ TREENAME AND ASSIGN TAB NUMBER if ($treename =~ /ribo/){$tabnum=2;} elsif ($treename =~ /fold/){$tabnum=3;} elsif ($treename =~ /sfam/){$tabnum=4;} elsif ($treename =~ /cog/){$tabnum=5;} elsif ($treename =~ /comp/){$tabnum=6;} elsif ($treename =~ /dint/){$tabnum=6;} elsif ($treename =~ /aa/){$tabnum=6;} elsif ($treename =~ /orf/){$tabnum=7;} print ""; print ""; # SUBTABS my $stabref=""; print ""; print ""; # ---------- # TREE TITLE # ---------- print ""; # ----------- # VIEW SELECT # ----------- my %viewname=('1'=>'taxonomy', '2'=>'composition','3'=>'fold','4'=>'superfamily','5'=>'oldCOG','7'=>'rRNAtree','6'=>'newCOG'); print ""; print ""; print ""; if ($viewnum == 1){ print "$TA>Yale Resources"; print "$TA>Superkingdom "; print "$TA>Kingdom"; print "$TA>Phylum"; print "$TA>Class"; } if ($viewnum == 2){ print "$TA>Yale Resources"; print "$TA>Genome Size Mb"; print "$TA>Size"; print "$TA>Number Genes"; print "$TA>AT Content %"; print "$TA>(G-C)/(G+C) %"; # print "$TA>Transcription %"; } elsif ($viewnum == 3){ print "$TA>Yale Resources"; print "$TA>All Folds"; print "$TA>All A Folds"; print "$TA>All B Folds"; print "$TA>A+B Folds"; print "$TA>A/B Folds"; print "$TA>Multi Folds"; } elsif ($viewnum == 4){ print "$TA>Yale Resources"; print "$TA>All Sfams"; print "$TA>All A Sfams"; print "$TA>All B Sfams"; print "$TA>A+B Sfams"; print "$TA>A/B Sfams"; print "$TA>Multi Sfams"; print "$TA>Small Sfams"; } if ($viewnum == 5){ print "$TA>Yale Resources"; print "$TA>All COGs"; print "$TA>Metabolism [CGEFHI]"; print "$TA>Cellular [OMNP]"; print "$TA>Information [JKL]"; } if ($viewnum == 7){ print ""; print "$TA>Organisms"; } if ($viewnum == 6){ print "$TA>Yale Resources"; print "$TA>All COGs"; print "$TA>Metabolism [CGEFHI]"; print "$TA>Cellular [OMNP]"; print "$TA>Information [JKL]"; print "$TA>Poor"; } print ""; print ""; print ""; print ""; print ""; # ------------ # TREE PROGRAM # ------------ my $nodes; foreach $nodes (@treeorder) { print ""; displayline($nodes); } # NOT IN PHYLOGENETIC TREE my $nontreenode; print ""; foreach $nontreenode (@otherorder) { print ""; displayline($nontreenode); } print "
"; for ($i=1; $i<8; $i++){ if ($i == $tabnum) { print ""; } else { print ""; } } print "
"; if ($tabnum == 1){ print " "; } elsif ($tabnum ==2){ print "$stabref\&type=8-ribo-lsu\">$stabfont>LSU rRNA _ "; print "$stabref\&type=8-ribo-ssu\">$stabfont>8 SSU rRNA _"; print "$stabref\&type=20-ribo-ssu\">$stabfont>20 SSU rRNA _ "; } elsif ($tabnum ==3){ print "$stabref\&type=8-fold-all\">$stabfont>All Folds _ "; print "$stabref\&type=8-fold-a\"> $stabfont>All Alpha _ "; print "$stabref\&type=8-fold-b\"> $stabfont>All Beta _ "; print "$stabref\&type=8-fold-apb\">$stabfont>A+B _"; print "$stabref\&type=8-fold-ab\"> $stabfont>A/B _"; print "
"; print "$stabref\&type=20-fold-pars\">$stabfont>All Folds 20 Parsimony _"; print "$stabref\&type=20-fold-dist\"> $stabfont>All Folds 20 Distance _"; } elsif ($tabnum ==4){ print "$stabref\&type=20-sfam-dist\">$stabfont>20 Distance _ "; print "$stabref\&type=20-sfam-pars\">$stabfont>20 Parsimony _ "; print "$stabref\&type=8-sfam-dist\">$stabfont>8 Distance _ "; print "$stabref\&type=8-sfam-pars\">$stabfont>8 Parsimony _ "; } elsif ($tabnum ==5){ print "$stabref\&type=8-cog-all\"> $stabfont>All Cogs _ "; print "$stabref\&type=8-cog-meta\"> $stabfont>Metabolism _ "; print "$stabref\&type=8-cog-cell\"> $stabfont>Cellular Proc. _ "; print "$stabref\&type=8-cog-info\"> $stabfont>Info S & P _ "; print "
"; print "$stabref\&type=8-cog-c\"> $stabfont>C _"; print "$stabref\&type=8-cog-e\"> $stabfont>E _"; print "$stabref\&type=8-cog-f\"> $stabfont>F _"; print "$stabref\&type=8-cog-g\"> $stabfont>G _"; print "$stabref\&type=8-cog-h\"> $stabfont>H _"; print "$stabref\&type=8-cog-i\"> $stabfont>I _"; print "$stabref\&type=8-cog-j\"> $stabfont>J _"; print "$stabref\&type=8-cog-k\"> $stabfont>K _"; print "$stabref\&type=8-cog-l\"> $stabfont>L _"; print "$stabref\&type=8-cog-m\"> $stabfont>M _"; print "$stabref\&type=8-cog-n\"> $stabfont>N _"; print "$stabref\&type=8-cog-o\"> $stabfont>O _"; print "$stabref\&type=8-cog-p\"> $stabfont>P _"; print "$stabref\&type=8-cog-r\"> $stabfont>R _"; } elsif ($tabnum ==6){ print "$stabref\&type=comp-dint-per\">$stabfont>Dinucleotide 20A _"; print "$stabref\&type=comp-aa-per\"> $stabfont>Amino Acid 20A _"; print "$stabref\&type=20-dint-per\">$stabfont>Dinucleotide 20 _"; print "$stabref\&type=20-aa-per\"> $stabfont>Amino Acid 20"; print "
"; print "$stabref\&type=20-dint-freq\">$stabfont>20 Dint raw _"; print "$stabref\&type=20-aa-freq\"> $stabfont>20 AA 20 raw _"; print "$stabref\&type=8-aa-freq\"> $stabfont>8 AA raw _"; print "$stabref\&type=8-aa-per\"> $stabfont>8 AA per _"; print "$stabref\&type=8-dint-freq\"> $stabfont>8 dint raw _"; print "$stabref\&type=8-dint-per\"> $stabfont>8 dint _"; } elsif ($tabnum ==7){ print "$stabref\&type=8-orf-0030\">$stabfont>Orf 30 _"; print "$stabref\&type=8-orf-0072\">$stabfont>Orf 72 _"; print "$stabref\&type=8-orf-0089\">$stabfont>Orf 89 _"; print "$stabref\&type=8-orf-0092\">$stabfont>Orf 92 _"; print "$stabref\&type=8-orf-0125\">$stabfont>Orf 125 _"; print "$stabref\&type=8-orf-0126\">$stabfont>Orf 126 _"; print "$stabref\&type=8-orf-0149\">$stabfont>Orf 149 _"; print "
"; print "$stabref\&type=8-orf-0166\">$stabfont>Orf 166 _"; print "$stabref\&type=8-orf-0200\">$stabfont>Orf 200 _"; print "$stabref\&type=8-orf-0250\">$stabfont>Orf 250 _"; print "$stabref\&type=8-orf-0256\">$stabfont>Orf 256 _"; print "$stabref\&type=8-orf-0525\">$stabfont>Orf 525 _"; print "$stabref\&type=8-orf-0552\">$stabfont>Orf 552 _"; } print "

Tree Based On $treedescrip
."; print ""; print ""; for ($i=1; $i<8; $i++){ if ($i == $viewnum) { # print ""; print ""; } else { print ""; } } print "
[B] SelectView:"; print ""; print "$viewname{$i}"; print ""; print ""; print ""; print "\">"; print ""; print "$viewname{$i}"; print ""; print "
"; # -------------------- # TREE COLUMN HEADINGS # -------------------- my $TA="
"; print "
Tree [download]Organism
Traditional Tree
"; print "Organisms that are not in the Tree

"; print "
Click here to mail questions
"; for ($i=1; $i<8; $i++){ print ""; } print "
"; # ----------------- # DISPLAY LINE TOOL # ----------------- sub displayline { my ($node)=@_; print ""; # print "$node"; print "$node"; print ""; #names of tabs my %superkingdomcolor=('Bacteria'=>'#FF0000', 'Eukaryota'=>'#339933', 'Archaea'=>'#0000FF'); my %superkingdomlink=('Bacteria'=>'2', 'Eukaryota'=>'2759', 'Archaea'=>'2157'); my %taxonomycolor=('Euryarchaeota'=>'#0000FF', 'Methanococcales'=>'#00CCCC', 'Methanococcaceae'=>'#00CCCC', 'Thermococcales'=>'#0000CC', 'Thermococcaceae'=>'#0000CC', 'MethanoBacteriales'=>'#0055FF','MethanoBacteriaceae'=>'#0055FF', 'Archaeoglobales'=>'#000055', 'Archaeoglobaceae'=>'#000055', 'Metazoa'=>'#007766','Nematoda'=>'#007766','Chromadorea'=>'#007766', 'Fungi'=>'#00CC00','Ascomycota'=>'#00CC00','Hemiascomycetes'=>'#00CC00', 'Aquificales'=>'#CC00CC','Aquificaceae'=>'#CC00CC','Aquifex'=>'#CC00CC', 'Firmicutes'=>'#990000', 'Bacillus/Clostridium_group'=>'#770022', 'Bacillus/Staphylococcus_group'=>'#770022', 'Mollicutes'=>'#440022', 'ActinoBacteria'=>'#881111', 'Actinobacteridae'=>'#881111', 'ProteoBacteria'=>'#FF0000', 'gamma_subdivision'=>'#BB0044', 'epsilon_subdivision'=>'#FF00CC','Helicobacter_group'=>'#FF00CC', 'alpha_subdivision'=>'#FF00FF','Rickettsiales'=>'#FF00FF', 'Spirochaetales'=>'#CC0000', 'Spirochaetaceae'=>'#CC0000', 'Borrelia'=>'#DD1188', 'Treponema'=>'#CC1177', 'EnteroBacteriaceae'=>'#BB0022', 'Pasteurellaceae'=>'#BB0077', 'CyanoBacteria'=>'#550022', 'Chroococcales'=>'#550022', 'Synechocystis'=>'#550022', 'Chlamydiales'=>'#FF6666', 'Chlamydiaceae'=>'#FF6666', 'Chlamydophila'=>'#DD77AA', 'Chlamydia'=>'#DD88AA', 'Arthropoda'=> '#007733','Tracheata'=>'#007733', 'Alveolata'=>'#006611', 'Apicomplexa'=>'#006611', 'Haemosporida'=>'#006611', 'Euglenozoa'=>'#009900', 'Kinetoplastida'=>'#009900', 'Trypanosomatidae'=>'#009900', 'Crenarchaeota'=>'#000077','Desulfurococcales'=>'#000077', 'Desulfurococcaceae'=>'#000077', 'Thermotogales'=>'#881111', 'Thermotoga'=>'#881111', 'N/A'=>'#000000', 'Campylobacter_group'=>'#FF0088', 'beta_subdivision'=>'#EE0011', 'Neisseriaceae'=>'#EE0011', 'Chordata'=>'#22CC22','Craniata'=>'#22CC22' ); if ($viewnum==1){ #SUPERKINGDOM displayresource($node); print "
"; print ""; #print ""; #print "$treedata[$dataname{'treebasicdata'}][$treenum{$node}][6]"; ##print ""; print ""; print "
"; for ($i=8;$i<11;$i++){ print "
"; # print "";# print ""; print ""; print "$treedata[$dataname{'treebasicdata'}][$treenum{$node}][$i]
"; print ""; } } # DISPLAY LINE FOR RIBOSOME elsif ($viewnum==2){ displayresource($node); print "
"; print "$treedata[$dataname{'treearray'}][$treenum{$node}][3]
"; print "
$treedata[$dataname{'treeoverall'}][$treenum{$node}][8]
"; print "
$treedata[$dataname{'treeoverall'}][$treenum{$node}][9]
"; print "
$treedata[$dataname{'treeoverall'}][$treenum{$node}][2]
"; print "
$treedata[$dataname{'treeoverall'}][$treenum{$node}][5]
"; # print "$TA=cog-meta\">$F2 Transcription %"; } # DISPLAY LINE FOR FOLD elsif ($viewnum==3){ displayresource($node); for ($i=4;$i<10;$i++){ print "
"; print "$treedata[$dataname{'treearray'}][$treenum{$node}][$i]
"; } } elsif ($viewnum==4){ displayresource($node); for ($i=2;$i<9;$i++){ print "
"; print "$treedata[$dataname{'treesfamdata'}][$treenum{$node}][$i]
"; } } elsif ($viewnum==6){ displayresource($node); for ($i=1;$i<6;$i++){ print "
"; print "$treedata[$dataname{'tree-cog-21'}][$treenum{$node}][$i]
"; } } elsif ($viewnum==7){ if ($markfortree==-1){ if ( $treenode==8 ){ $treename="8-ribo-ssu"; @treeorder2=qw(Scer Mjan Mpne Mgen Syne Hpyl Hinf Ecol); print ""; # print ""; print ""; $markfortree=0; } if ( $treenode == 20){ $treename="20-ribo-ssu"; @treeorder2=qw(Cele Scer Mjan Phor Mthe Aful Aaeo Mtub Bsub Mpne Mgen Hpyl Rpro Ecol Hinf Bbur Tpal Syne Cpne Ctra); print ""; print ""; $markfortree=0; } } else { $markfortree++; } print ""; print ""; print "$treeorder2[$markfortree]"; # print ""; print ""; } elsif ($viewnum==5){ displayresource($node); for ($i=10;$i<14;$i++){ print "
"; print "$treedata[$dataname{'treearray'}][$treenum{$node}][$i]
"; } #this level is for fold view only } # this level is for all views } # DISPLAY WHETHER RESOURCES OR NOT sub displayresource { my ($nodeA)=@_; print "
"; print ""; print ""; if ($treedata[$dataname{'treearray'}][$treenum{$nodeA}][2] == 0){ print "
";} #print space when no present elsif ($treedata[$dataname{'treearray'}][$treenum{$nodeA}][2] == 1){ print ""; print ""; print " ";} else{ print "matrix element not 0 or 1";} } sub read_matrix { my ($filename)=@_; open (DATA, "./datafiles/$filename.txt") or die "cannot open $filename.txt"; my $tree_chunk; my @store_array; my $x=0; my $y=0; while () { $y=0; for $tree_chunk (split()){ # print "$tree_chunk "; $treedata[$dataname{$filename}][$x][$y]=$tree_chunk; #store_array[$x][$y]=$tree_chunk; $y++; } # print "\n"; $x++; } close DATA; }