GBrowse

 view release on metacpan or  search on metacpan

contrib/TextDumper/TextDumper.pm  view on Meta::CPAN

  while (my $f = $iterator->next_seq) {
      foreach my $attr (@active_attribs) {
	  if (defined $f->$attr) {
	      print $f->$attr;
	  }
	  else {
	      print "NA";
	  }
	  print "\t";
      }
      print "\n";
  }
}

sub mime_type {
  my $self = shift;
  my $config = $self->configuration;

  if ( param('textdump_format') eq 'excel') {
      return 'application/vnd.ms-excel';
  }
  else {
      return 'text/plain';
  }
}

sub active_tracks {
    my ($self, $tracklist, $featdata) = @_;


    my @active;

    foreach my $track (@$tracklist) {
	push(@active, $track) if ($featdata->{$track}->{'visible'});
    }
    return @active;
			      
}


sub configure_form {
    my ($self) = shift;
    # select which attributes are shown
    my @choices = TR( th({-colspan => 2, -align => 'CENTER'}, 'Select columns to include from the list below.  Only tracks displayed in the browser will be included.') );

    foreach my $attrib ( $self->attributes ) {
	push(@choices, 
	     TR({-class => 'searchtitle'},
		th({-align => 'RIGHT'}, $attrib),
  		td( checkbox( -name 	=> "show_$attrib",
  			      -override => 1,
			      -label	=> '',
			      -checked 	=> 1,
  			      ),
		    ),
		)
	     );
    }
    # offer choice of output
    push(@choices, TR( th({-align => 'RIGHT'}, 'Return results to:'),
		       td( popup_menu( -name	=> 'textdump_format',
				       -values	=> [qw(browser excel)],
				       -override=> 1, ) ),
		       ) );

    return table({-cellpadding=>2}, @choices);
}

sub attributes {
    return @attrs;
}

sub active_attribs {
    my ($self) = shift;

    my @active_attribs;
    
    foreach my $att ($self->attributes) {
	push(@active_attribs, $att) if ( param("show_$att") );
    }
    # are any attribs active? if not, return all
    if (@active_attribs) {
	return @active_attribs;
    }
    else {
	return $self->attributes;
    }
}

1;



( run in 1.195 second using v1.01-cache-2.11-cpan-364913b4093 )