Permalink
Browse files

Merge branch 'master' of github.com:GMOD/GBrowse

  • Loading branch information...
2 parents e7aa43b + d62f377 commit d4027627774c0883d13e3709e28d38bc3b68103b @lstein lstein committed Oct 30, 2012
Showing with 37 additions and 1 deletion.
  1. +37 −1 conf/plugins/SequenceDumper.pm
@@ -72,6 +72,7 @@ my @FORMATS = ( 'fasta' => ['Fasta', undef],
'gcg' => ['GCG', undef],
'raw' => ['Raw sequence', undef],
'bsml' => ['BSML (XML)', 'xml'],
+ 'featurefasta'=>['Feature Fasta', undef],
'gff' => ['GFF3', undef],
);
@@ -85,13 +86,14 @@ my @ORDER = grep {
}
grep { ! /gff/i } map { $FORMATS[2*$_] } (0..@FORMATS/2-1);
+unshift @ORDER,'featurefasta';
unshift @ORDER,'gff';
# initialize %FORMATS and %LABELS from @FORMATS
my %FORMATS = @FORMATS;
my %LABELS = map { $_ => $FORMATS{$_}[0] } keys %FORMATS;
-$VERSION = '0.13';
+$VERSION = '0.14';
@ISA = qw(Bio::Graphics::Browser2::Plugin);
@@ -117,6 +119,11 @@ sub dump {
$self->gff_dump($segment);
return;
}
+ # special case for feature fasta
+ if ($config->{'fileformat'} eq 'featurefasta') {
+ $self->feature_fasta_dump($segment);
+ return;
+ }
my @filter = $self->selected_features;
my $iterator = $segment->get_seq_stream(-types => \@filter);
my $seq = Bio::Graphics::Browser2::TrackDumper::RichSeqMaker->stream_to_rich_seq($segment,$iterator);
@@ -228,4 +235,33 @@ sub gff_dump {
print end_html() if $html;
}
+sub feature_fasta_dump {
+ my $self = shift;
+ my $segment = shift;
+ my $page_settings = $self->page_settings;
+ my $conf = $self->browser_config;
+ my $date = localtime;
+
+ my $mime_type = $self->mime_type;
+ my $html = $mime_type =~ /html/;
+ print start_html($segment) if $html;
+
+ print h1($segment),start_pre() if $html;
+ print "##date $date\n";
+ print "##source gbrowse SequenceDumper\n";
+ print "##$segment\n";
+ print "##NOTE: Selected features dumped.\n";
+ my @feature_types = $self->selected_features;
+ $segment->absolute(0);
+ my $iterator = $segment->get_seq_stream(-types => \@feature_types) or return;
+ while (my $f = $iterator->next_seq) {
+ my $out = new Bio::SeqIO(-format =>'fasta',-fh=>\*STDOUT);
+ $out->write_seq($f->seq);
+ }
+
+ print end_pre() if $html;
+ print end_html() if $html;
+}
+
+
1;

0 comments on commit d402762

Please sign in to comment.