[Bioperl-l] Connecting Bio::DB::GFF::Features on a Bio::Graphics::Panel

Lincoln Stein lstein at cshl.edu
Tue Sep 9 16:31:46 EDT 2003


You beat me to it, but I wanted to warn everyone away from creating 
Bio::DB::GFF::Feature objects directly.  This class is intended for 
features that are tied to a Bio::DB::GFF database and it will probably 
not do what you want if you create it in memory.

To do what Philip wants you can either create a Bio::Graphics::Feature 
using the new() constructor with nested coordinates, or do something like 
the following with Bio::SeqFeature::Generic:

	my $feature1 = Bio::SeqFeature::Generic->new(-start=>$KKstart,-end=>$KKstop);
	my $feature2 = Bio::SeqFeature::Generic->new(-start=>$KKstopStop-1,-end=>$KKstopStop);
	my $feature = Bio::SeqFeature::Generic->new(-primary=>'group');
	$feature->add_SeqFeature($feature1, 'EXPAND');
	$feature->add_SeqFeature($feature2,'EXPAND');

and then add $feature to the track.  There is default behavior that any feature
of type "group" is rendered with a dotted line connecting the two features.  This
can be overridden.

I leave it as an exercise to the readers how to join two features that themselves
contain subfeatures or split locations.

Lincoln


On Monday 08 September 2003 02:47 pm, Philip MacMenamin wrote:
> Apologies for previous question. I realised the solution to the problem
> just after I sent the question. Very simple, very silly of me. Always the
> way, stare at it for ages, then show some one else the code, and the answer
> instantly becomes painfully obvious.
>
> Use a Bio::Graphics::Feature object, and just tell it the segments in the
> constructor at the start. Works fine. No aggregator, no
> Bio::DB::GFF::Features, all very simple and above board.
>
> $joinedFeatureRef = Bio::Graphics::Feature->new(-segments =>[
> [$KKstart,$KKstop],[($KKstopStop-1),$KKstopStop]]);
>
> and
>
> if ( scalar @KKs > 0 )
> {
>    $panel->add_track(group =>$joinedFeatureRef,
> 		    -bgcolor   =>  'blue',
> 		    -height     =>  4,
> 		    -fgcolor   =>  'darkgreen',
> 		    -key       => 'SuchAndSuch',
> 		    -connect   => 1,
> 		    -connector => 'dashed',
> 		    -bump      =>  +1,
> 		    -connect_color => 'lightpurple',
> 		   );
> }
>
> All the best.
> Philip.
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l

-- 
Lincoln Stein
lstein at cshl.edu
Cold Spring Harbor Laboratory
1 Bungtown Road
Cold Spring Harbor, NY 11724
(516) 367-8380 (voice)
(516) 367-8389 (fax)


More information about the Bioperl-l mailing list