[Bio] / RegSubMa / SVFigfam.pm Repository:
ViewVC logotype

View of /RegSubMa/SVFigfam.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (download) (as text) (annotate) (vendor branch)
Wed Apr 4 17:08:51 2007 UTC (13 years, 3 months ago) by mkubal
Branch: MAIN, fig
CVS Tags: v_1_0_0, HEAD
Changes since 1.1: +0 -0 lines
initial checkin

package SVFigfam;

use URI::Escape;
use HTML;
use strict;
use warnings;
use Data::Dumper;

use FIG;

use FFMethods;

use PieChart;
use BarChart;

1;

sub get_data {
  my ($fig, $cgi) = @_;

  if ($cgi->param('tobitest') eq 'tobi') {
    return &BarChart::new( { data   => [ [22,57], [33,40], [15,20], [33,40], [15,20], [33,40], [15,20], [33,40], [15,20], [33,40], [15,20], [47, 11] ],
			     scale  => 1,
			     show_values => 1,
			     bar_type => 'split',
			     bar_padding => 10,
			     width => 800,
			     percent => 1,
			     bar_frames => 1,
			     titles => ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ]
			   } );
  }

  my $content = "";

  my $gene_count    = &FFMethods::getGeneCountHash('./Html/GeneCountDump.gif');
  my $fig_fams      = &FFMethods::getGeneCountHash('./Html/FigFamsDump.gif');
  my $ffannotations = &FFMethods::getGeneCountHash('./Html/FFAnnotationsDump.gif');
  unless (defined($gene_count)) {
    return "could not read gene count file";
  }
  my $data = [];
  my $titles;
  my $i = 0;
  foreach my $val ( sort { $a <=> $b } keys(%$gene_count) ) {
    $i++;
    
    # check for cutoffs
    if ($cgi->param('cutoff')) {
      my $x_top = $cgi->param('x_top_cutoff');
      my $x_low = $cgi->param('x_low_cutoff');
      my $y_top = $cgi->param('y_top_cutoff');
      my $y_low = $cgi->param('y_low_cutoff');
      if ($x_low) { if ($i < $x_low) { next; } }
      if ($x_top) { if ($i > $x_top) { next; } }
      if ($y_low) { if (scalar(@{$gene_count->{$val}}) < $y_low) { next; } }
      if ($y_top) { if (scalar(@{$gene_count->{$val}}) > $y_top) { next; } }
    }

    push(@$data, scalar(@{$gene_count->{$val}}));
    push(@$titles, $val);
  }

  my $form = "<form action='index.cgi'><input type='hidden' name='action' value='ShowFigfam'><input type='hidden' name='cutoff' value='1'>";
  $form .= "<table>";
  $form .= "<tr><td>first X to show:</td><td><input type='text' name='x_low_cutoff' value='" . ($cgi->param('x_low_cutoff') || '') . "'></td>";
  $form .= "<td>last X to show:</td><td><input type='text' name='x_top_cutoff' value='" . ($cgi->param('x_top_cutoff') || '') . "'></td></tr>";
  $form .= "<tr><td>Y top cutoff:</td><td><input type='text' name='y_top_cutoff' value='" . ($cgi->param('y_top_cutoff') || '') . "'></td>";
  $form .= "<td>Y low cutoff:</td><td><input type='text' name='y_low_cutoff' value='" . ($cgi->param('y_low_cutoff') || '') . "'></td></tr>";
  $form .= "<tr><td>Consistency:</td><td><input type='radio' name='consistent'>only consistent</td><td><input type='radio' name='consistent'>only inconsistent</td><td><input type='radio' name='consistent' CHECKED>both</td></tr>";
  $form .= "</table>";
  $form .= "<input type='submit' value='redraw'>";
  $form .= "</form>";

  my $bar_chart = 'No values left to display';

  if (scalar(@$data) > 0) {
    $bar_chart = &BarChart::new( {
				  titles => $titles,
				  data   => $data,
				  scale  => 1,
				  show_values => 1
				 } );
  }

  my $fronttext = "<H1>FIGfam analysis</H1>\n";
  $fronttext .= "<P>The following chart shows the number of proteins in a FIGfam (x-axis) vs. how many FIGfams consist of as many proteins (y-axis).</P>";
  $content .= $fronttext . $form . "<br/><br/>" . $bar_chart;

  return $content;
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3