[Bioperl-l] GFF, seq features and Bio::Graphics

Fernan Aguero fernan@iib.unsam.edu.ar
Fri, 19 Jul 2002 18:56:59 -0300


Hi!

After a hard time trying to make sense of internal relationships
between bioperl (I haven't had worked much with seqfeatures before in
bioperl) ... I basically got things working, but there are some
gotchas still around.

Basically I have some contigs, blast info summarized into GFF files
and sequences independently stored as fasta files.

Contig1.gff
Contig1.fa


With this I drawed a nice graphic using Bio::Graphics::Panel (see
Script 1 below).

However, I'd like to have more control on the output (and draw
features on their corresponding strands and translation frames,
perhaps). 

I'm trying to:

read the whole GFF file like this:
while (<GFF>) {
	$feat = new Bio::SeqFeature::Generic (-gff_string	=> $_ );
	$seq->add_SeqFeature($feat);
}

I then get an array of features for each strand and,
foreach feature on each strand
	if $frame = 0 -> add_track (\@features)
	if $frame = 1 -> add_track ...
	...
	and so on.

The idea is to have 3 tracks above and 3 tracks below the sequence
(the sequence itself is the track in the middle).

The problem I'm having is that empty tracks don't get drawed in the
graphic (i.e. if there are no features in a particular strand/frame).
Personally it is a lot clearer if all strands/frames are in the
graphic (no glyphs in case there are no features).

Is is possible to draw a thin line without glyphs for an empty
strand/frame? (Is it possible to create an empty or fake seq feature
object? Currently I don't imagine how to do it ...)

Thanks in advance for any tip or suggestion,

Fernan


===========
=-Script1-=
===========

use Bio::Graphics::FeatureFile;
use Bio::Graphics::Panel;
use Bio::SeqIO;

my $seqio = new Bio::SeqIO ( -file => $seqFile, -format => 'fasta');
my $seq   = $seqio->next_seq();
															
# create the panel
my $panel = new Bio::Graphics::Panel ( -segment			=> $seq,
                                       -key_style		=> 'between',
																			 -key_color		=> '#cccccc',
																			 -pad_top			=> 5,
																			 -pad_bottom	=> 5,
																			 -pad_left		=> 5,
																			 -pad_right		=> 95,
																			 -grid				=> 1,
																			 -grid_color	=> '#ff0000',
																			 -width				=> 500);
																			 
# add the sequence first to the panel
$panel->add_track(  generic => $seq,
    								-glyph  => 'arrow',
    								-tick   => 2,
    								-label  => 1,
    								-key    => $seq->id() );

my $data  = Bio::Graphics::FeatureFile->new(-file => $gffFile);
$data->render($panel);
# print the image
open PNG, ">$pngFile";
print PNG $panel->png;
close PNG;


-- 

|  F e r n a n   A g u e r o  |  B i o i n f o r m a t i c s  |
|   fernan@iib.unsam.edu.ar   |      genoma.unsam.edu.ar      |