69 
push @$html, ( 
push @$html, ( 
70 
$cgi>start_form(), 
$cgi>start_form(), 
71 
$cgi>h2("Heat Map NQ"), 
$cgi>h2("Heat Map NQ"), 
72 
$cgi>p("Heat Map NQ is designed to show relationships between subsystems in different environmental samples. Each subsystem that is present in a sample gets a score. The score is calculated by counting the number of sequences that are similar to a protein in each subsystem. This number is divided by the total number of sequences from the sample that are similar to any protein in a subsystem, so it is the fraction of sequences in subsystems. Therefore the size of the sample should not necessarily affect the number that you see. Please note that these numbers are only approximate and \"for entertainment purposes only\". We will integrate our statistical comparison package <a href='http://sourceforge.net/projects/xipetotec' target='_new'>xipetotec</a> into this analysis so that you can identify those subsystems that are present at unlikely levels."), 
$cgi>p("Heat Map NQ is designed to show relationships between subsystems in different environmental samples. Each subsystem that is present in a sample gets a score. The score is calculated by counting the number of sequences that are similar to a protein in each subsystem. This number is divided by the total number of sequences from the sample that are similar to any protein in a subsystem, so it is the fraction of sequences in subsystems. Therefore the size of the sample should not necessarily affect the number that you see. Please note that these numbers are only approximate and \"for entertainment purposes only\"."), 
73 

$cgi>p("We have also integrated our statistical comparison package <a href='http://sourceforge.net/projects/xipetotec' target='_new'>xipetotec</a> into this analysis so that you can identify those subsystems that are present at unlikely levels. These comparisons are precomputed since they take about an hour per comparison, and so for a 4x4 table you'd have to wait 6 hours for the page to render. The standard protocol is to provide differences at 90%, 95%, and 99% confidence."), 
74 
$cgi>p("The raw numbers mean that if there are 10 sequences that hit all subsystems in total, then a subsystem that has two sequences that hit it will get a score of 0.2 (2/10). However, these numbers tend to be 2 and 100000, so the number is very small in most cases. Therefore, the multiplier allows you to multiply all scores by a number to make them 2 instead of 0.0000002. The nonquantitative analysis gets biased by one or two outliers, so you can also overcome the outlier effect by trimming off the maximums  anything above your chosen value is set as the maximum. Note that the maximum value is from the unmodified raw score."), 
$cgi>p("The raw numbers mean that if there are 10 sequences that hit all subsystems in total, then a subsystem that has two sequences that hit it will get a score of 0.2 (2/10). However, these numbers tend to be 2 and 100000, so the number is very small in most cases. Therefore, the multiplier allows you to multiply all scores by a number to make them 2 instead of 0.0000002. The nonquantitative analysis gets biased by one or two outliers, so you can also overcome the outlier effect by trimming off the maximums  anything above your chosen value is set as the maximum. Note that the maximum value is from the unmodified raw score."), 
75 
$cgi>p("The raw scores may not mean that 2 is twice as much as 1, just that 2 is more than one. Because of that, and because it is easier to visualize groups of data, you can aggregate all the data into chunks. This will take all scores and split them into however many groups you tell it to. That is the nonquantitative analysis."), 
$cgi>p("The raw scores may not mean that 2 is twice as much as 1, just that 2 is more than one. Because of that, and because it is easier to visualize groups of data, you can aggregate all the data into chunks. This will take all scores and split them into however many groups you tell it to. That is the nonquantitative analysis."), 
76 
$cgi>p("My reccommendation is that you display different areas of metabolism, with nonquantitative differences grouped in either 5 or 10 groups. You can also see the raw data by using the quantitative analysis checkbox, but I am not certain how much you can infer from these numbers  does 2 mean twice as much as 1?"), 
$cgi>p("My reccommendation is that you display different areas of metabolism, with nonquantitative differences grouped in either 5 or 10 groups. You can also see the raw data by using the quantitative analysis checkbox, but I am not certain how much you can infer from these numbers  does 2 mean twice as much as 1?"), 
91 
$cgi>p("Quantitive analysis will show you the number of subsystems in each sample. This is the ratio of the number of times that subsystem is hit to the total number of subsystems that are found in the sample.\n The ratio is multiplied by a fiddle factor to normalize the data. Set the multiplier here, or use the default\n"), 
$cgi>p("Quantitive analysis will show you the number of subsystems in each sample. This is the ratio of the number of times that subsystem is hit to the total number of subsystems that are found in the sample.\n The ratio is multiplied by a fiddle factor to normalize the data. Set the multiplier here, or use the default\n"), 
92 
$cgi>br($cgi>checkbox(name=>"quant", label=>"Use quantitative analysis")," Multiplier: ", $cgi>textfield(name=>"fiddle", default=>5000, size=>5)), 
$cgi>br($cgi>checkbox(name=>"quant", label=>"Use quantitative analysis")," Multiplier: ", $cgi>textfield(name=>"fiddle", default=>5000, size=>5)), 
93 
), 
), 
94 

$cgi>h2("XipeTotec"), 
95 

$cgi>p( 
96 

$cgi>p("<a href='http://sourceforge.net/projects/xipetotec' target='_new'>Xipetotec</a> is our statistical comparison of the presence of subsystems in different samples. This will show the results of those analyses."), 
97 

$cgi>br($cgi>checkbox(name=>"xipe", label=>"", checked=>1), "Include a table of the xipe statistical comparison in the output", " Confidence: ", $cgi>popup_menu(name=>"xipe_conf", values=>[0.90, 0.95, 0.99], default=>"0.95")), 
98 

), 
99 
$cgi>h2("Display"), 
$cgi>h2("Display"), 
100 
$cgi>p( 
$cgi>p( 
101 
"The default is to use a blue color as the extreme, but you can change that to red or green\n", 
"The default is to use a blue color as the extreme, but you can change that to red or green\n", 
210 
# skip the data columns 
# skip the data columns 
211 
my $skip; 
my $skip; 
212 
map {$skip>{$_}=1} (2..10); 
map {$skip>{$_}=1} (2..10); 
213 
$tab=&HTML::merge_table_rows($tab, $skip); 
$tab=&HTML::merge_table_rows($tab, $skip) unless ($cgi>param('create_excel')); 
214 


215 
# generate the table of significant differences; 
# generate the table of significant differences; 
216 
my $sigtab=&significant_difference(); 
my $sigtab; 
217 

if ($cgi>param("xipe")) 
218 

{ 
219 

$sigtab=$cgi>hr . "\n" .&significant_difference() . $cgi>submit("create_excel", "Create excel file of this table"); 
220 

} 
221 


222 
# finally make the HTML 
# finally make the HTML 
223 


244 
&HTML::make_table([], &control_color_table(), ""), 
&HTML::make_table([], &control_color_table(), ""), 
245 
&HTML::make_table(\@headers, $tab, "", %options), 
&HTML::make_table(\@headers, $tab, "", %options), 
246 
$cgi>submit("create_excel", "Create excel file of this table"), 
$cgi>submit("create_excel", "Create excel file of this table"), 

$cgi>hr, 

247 
$sigtab, 
$sigtab, 

$cgi>submit("create_excel", "Create excel file of this table"), 

248 
); 
); 
249 


250 
&HTML::show_page($cgi, $html, 1, undef, {"default"=>"Html/css/heatmap.css"}); 
&HTML::show_page($cgi, $html, 1, undef, {"default"=>"Html/css/heatmap.css"}); 
297 
{ 
{ 
298 
foreach my $attr (sort {lc($a>[2]) cmp lc($b>[2])} $fig>get_attributes($genomes[$i], "xipe")) 
foreach my $attr (sort {lc($a>[2]) cmp lc($b>[2])} $fig>get_attributes($genomes[$i], "xipe")) 
299 
{ 
{ 
300 

$attr>[2] =~ /c=(\d+\.\d+)/; 
301 

next unless ($1 > $cgi>param("xipe_conf")); 
302 
my @pieces=split /\:/, $attr>[2]; 
my @pieces=split /\:/, $attr>[2]; 
303 


304 
next unless ($idx>{$pieces[0]}); 
next unless ($idx>{$pieces[0]}); 