NAME

Bio::Gonzales::Feat - a sequence feature

SYNOPSIS

Bio::Gonzales::Feat->new(
    seq_id => 'chr01',
    source => 'glimmerhmm',
    type   => 'exon',
    start  => 324,
    end    => 6342,
    strand => -1,
    attributes => { ID => [ 'exon01' ], Parent => [ 'gene01', 'gene02' ] },
);

DESCRIPTION

Represents a sequence feature. The field attributes is not required to create an object of class Bio::Gonzales::Feat. This class is based on the Sequence Ontology GFF3 specification

METHODS

\%attributes = $f->attr
\%attributes = $f->attributes
$sequence_id = $f->seq_id
$souce = $f->source
$f->source($new_source)

Gets and sets the source attribute of the feature.

$type = $f->type
$f->type($new_type)

Gets and sets the type attribute of the feature.

$start_coord = $f->start
$start_coord = $f->begin
$f->start($start_1_based_coord)
$f->begin($start_1_baed_coord)

Get or set the start coord of the feature.

$f->end

The same syntax as $f-start>, only for the end coordianate.

$f->strand($strand)
$strand = $f->strand

Set or get the strand. The strand can be -1 (minus strand), 0 (strand unknown) or 1 (plus strand).

$phase = $f->phase
$f->phase($phase)

Gets or sets the phase.

$score = $f->score
$f->score($score)

Gets or sets the score.

$f->attributes
$f->attr

Get or set the attributes of the feature. Structure:

{
    ID => [ 'id01' ],
    Parent => [ 'parent1', 'parent2', ... ]
    ...
}
$f->subfeats

Gives access to a general container for subfeature objects. Makes grouping easier, e.g. for BED output format. An example would be an 'mRNA'-object that has several exons as subfeatures.

$f->parentfeats

The same as $f-subfeats>, only with parent relation. This function is completely unrelated to the $f-parent_id> function. $f-parent_id> only accesses the attributes, not the parentfeature container.

$f->scf_id

This is a synonym for $f-seq_id>.

$first_value = $f->attr_first($attribute_key)
$first_value = $f->first_attr($attribute_key)

The functions attr_first and first_attr retrieve the value of the first element of the given attribute. An example would be

my $id = $f->attr_first("ID");

# in case of multiple parents only the first entry/parent will be returned.
my $parent = $f->attr_first("Parent");
$id = $f->id

Retrieve the value of the "ID" attribute. If a feature has multiple ids, a warning will be printed. Effectively a shortcut for $f-attributes->{ID}[0]>.

@ids = $f->ids
\@ids = $f->ids

A shortcut for $f-attributes->{ID}>. Returns a list of IDs in list context, a reference to the ID list in scalar context.

@parent_ids = $f->parent_ids
\@parent_ids = $f->parent_ids

A shortcut for $f-attributes->{Parent}>. Returns a list of parent IDs in list context, a reference to the parent ID list in scalar context.

$parent_id = $f->parent_id

A shortcut for $f-attributes->{Parent}[0]>. Gives a warning if multiple parent ids are present.

$f->add_attr(%attributes)

To add an attribute, call add_attr with either a hash of the form

%attributes = (
  ID => "mrna_01",
  Parent => "gene_01"
);

or

%attributes = (
  ID => "exon_01",
  Parent => [ "gene_01", "gene_02" ],
);
\@deleted_attributes = $f->del_attr(@attribute_names)
$deleted_attribute = $f->del_attr($attribute_name)

Deletes all attributes in @attribute_names.

Bio::Gonzales::Feat->Convert_strand($strand)

Convert between numeric and character strand respresentation.

$cloned_f = $f->clone

Clone the feature, deeply (incl. subfeatures and parentfeatures).

$length = $f->length

The length (end -start +1)

SEE ALSO

AUTHOR

jw bargsten, <joachim.bargsten at wur.nl>