location

 Title   : location
 Usage   : my $location = $seqfeature->location()
 Function: returns a location object suitable for identifying location
	   of feature on sequence or parent feature
 Returns : Bio::LocationI object
 Args    : none

NAME

Bio::Graphics::Feature - A simple feature object for use with Bio::Graphics::Panel

SYNOPSIS

use Bio::Graphics::Feature;

# create a simple feature with no internal structure
$f = Bio::Graphics::Feature->new(-start => 1000,
                                 -stop  => 2000,
                                 -type  => 'transcript',
                                 -name  => 'alpha-1 antitrypsin'
                                );

# create a feature composed of multiple segments, all of type "similarity"
$f = Bio::Graphics::Feature->new(-segments => [[1000,1100],[1500,1550],[1800,2000]],
                                 -name     => 'ABC-3',
                                 -type     => 'gapped_alignment',
                                 -subtype  => 'similarity');

# build up a gene exon by exon
$e1 = Bio::Graphics::Feature->new(-start=>1,-stop=>100,-type=>'exon');
$e2 = Bio::Graphics::Feature->new(-start=>150,-stop=>200,-type=>'exon');
$e3 = Bio::Graphics::Feature->new(-start=>300,-stop=>500,-type=>'exon');
$f  = Bio::Graphics::Feature->new(-segments=>[$e1,$e2,$e3],-type=>'gene');

DESCRIPTION

This is a simple Bio::SeqFeatureI-compliant object that is compatible with Bio::Graphics::Panel. With it you can create lightweight feature objects for drawing.

All methods are as described in Bio::SeqFeatureI with the following additions:

The new() Constructor

$feature = Bio::Graphics::Feature->new(@args);

This method creates a new feature object. You can create a simple feature that contains no subfeatures, or a hierarchically nested object.

Arguments are as follows:

-start       the start position of the feature
-stop        the stop position of the feature
-end         an alias for stop
-name        the feature name (returned by seqname())
-type        the feature type (returned by primary_tag())
-source      the source tag
-segments    a list of subfeatures (see below)
-subtype     the type to use when creating subfeatures

The subfeatures passed in -segments may be an array of Bio::Graphics::Feature objects, or an array of [$start,$stop] pairs. Each pair should be a two-element array reference. In the latter case, the feature type passed in -subtype will be used when creating the subfeatures.

If no feature type is passed, then it defaults to "feature".

Non-SeqFeatureI methods

A number of new methods are provided for compatibility with Ace::Sequence, which has a slightly different API from SeqFeatureI:

add_segment(@segments)

Add one or more segments (a subfeature). Segments can either be Feature objects, or [start,stop] arrays, as in the -segments argument to new(). The feature endpoints are automatically adjusted.

segments()

An alias for sub_SeqFeature().

merged_segments()

Another alias for sub_SeqFeature().

stop()

An alias for end().

name()

An alias for seqname().

exons()

An alias for sub_SeqFeature() (you don't want to know why!)

SEE ALSO

Bio::Graphics::Panel,Bio::Graphics::Glyph, GD

AUTHOR

Lincoln Stein <lstein@cshl.org>.

Copyright (c) 2001 Cold Spring Harbor Laboratory

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty.