The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Bio::Polloc::LocusI - Interface of Bio::Polloc::Locus::* objects

AUTHOR - Luis M. Rodriguez-R

Email lmrodriguezr at gmail dot com

IMPLEMENTS OR EXTENDS

PUBLIC METHODS

Methods provided by the package

new

The basic initialization method

type

Gets/sets the type of rule

Arguments

Value (str). Can be: pattern, profile, repeat, similarity, coding. composition, crispr Some variations can be introduced, like case variations or short versions like patt or rep.

Return

Value (str). The type of the rule, or null if undefined. The value returned is undef or a string from the above list, regardless of the input variations.

Throws

Bio::Polloc::Polloc::Error if an unsupported type is received.

genome

Sets/gets the source genome as a Bio::Polloc::Genome object.

Throws

Bio::Polloc::Polloc::Error if unexpected type.

name

Sets/gets the name of the locus

Arguments

Name (str), the name to set

Returns

The name (str or undef)

aliases

Gets the alias names

Returns

Aliases (arr reference or undef)

add_alias

Arguments

One or more alias names (str)

parents

Gets the parent features or loci

Returns

Parents (arr reference or undef)

add_parent

Arguments

One or more parent object (Bio::Polloc::LocusI)

Throws

Bio::Polloc::Polloc::Error if some argument is not Bio::Polloc::LocusI

target

Gets/sets the target of the alignment, if the feature is some alignment

Arguments

-id

The ID of the target sequence

-from

The start on the target sequence

-to

The end on the target sequence

-strand

The strand of the target sequence

Returns

A hash reference like {id=>id, from=>from, to=>to, strand=>strand}

comments

Gets/sets the comments on the locus, newline-separated

Arguments

New comments to add (str)

Returns

Comments (str)

xrefs

Gets the cross references of the locus

Returns

Array reference or undef

add_xref

Adds a cross reference

Arguments

One or more cross references in GFF3 format

ontology_terms_str

Gets the ontology terms as explicit strings

Returns

Array reference or undef

add_ontology_term_str

Adds an ontology term by string

Arguments

One or more strings

from

Gets/sets the from position

Arguments

Position (int, optional)

Returns

The from position (int, -1 if undefined)

to

Gets/sets the to position

Arguments

Position (int, optional)

Returns

The to position (int, -1 if undefined)

length

Gets the length of the locus.

Returns

int or undef.

id

Gets/sets the ID of the locus

Arguments

ID (str)

Returns

ID (str)

family

Sets/gets the family of features. I.e., a name identifying the type of locus. A common family is CDS, but other families can be defined. Note that the family is not qualified by the software used for the prediction (use source() for that).

Arguments

The family (str, optional)

Returns

The family (str)

Note

This method tries to locate the family by looking (in that order) at:

  1. The explicitly defined family.

  2. The prefix of the ID (asuming it was produced by some Bio::Polloc::RuleI object).

  3. The type of the rule (if the rule is defined).

  4. If any of the former options work, returns unknown.

source

Sets/gets the source of the feature. For example, the software used.

Arguments

The source (str, optional).

Returns

The source (str).

Note

This method tries to locate the source looking (in that order) at:

  1. The explicitly defined value.

  2. The source of the rule (if defined).

  3. If any of the above, returns polloc.

strand

Gets/sets the strand

Arguments

Strand (str: +, - or .)

Returns

The strand (str)

rule

Gets/sets the origin rule

Arguments

A Bio::Polloc::RuleI object

Returns

A Bio::Polloc::RuleI object

Throws

Bio::Polloc::Polloc::Error if the argument is not of the proper class

score

Sets/gets the score of the feature. Most loci implement different score functions, and it's often read-only.

Returns

The score (float)

Throws

Bio::Polloc::Polloc::NotImplementedException if not implemented

seq

Sets/gets the sequence

Arguments

The sequence (Bio::Seq object, optional)

Returns

The sequence (Bio::Seq object or undef)

Throws

Bio::Polloc::Polloc::Error if the sequence is not Bio::Seq

Note

This method returns the full original sequence, not the piece of sequence with the target

seq_name

Gets/sets the name of the sequence

Arguments

The name of the sequence (str, optional).

Returns

The name of the sequence (str or undef).

stringify

Purpose

To provide an easy method for the (str) description of any Bio::Polloc::LocusI object.

Returns

The stringified object (str, off course)

context_seq

Extracts a sequence from the context of the locus

Arguments

All the following arguments are mandatory, and must be passed in that order:

  • ref int : -1 to use the start as reference (useful for upstream sequences), +1 to use the end as reference (useful for downstream sequences), 0 to use the start as start reference and the end as end reference

  • from int : The relative start position.

  • to int : The relative end position.

Returns

A Bio::Seq object.

distance

Calculates the distance (referring to diversity, not genomic position) with the given locus.

Arguments

-locus Bio::Polloc::LocusI object

The locus to compare with. Most of the locus types require this locus to be of the same type.

-locusref Bio::Polloc::LocusI object

The reference locus. If set, replaces the loaded object as reference.

Returns

Float. The distance with the given locus. Most types will return a distance ranging from one to zero.

Note

See the documentation for additional arguments and precisions.

Throws

Bio::Polloc::Polloc::NotImplementedException if not implemented by the correspondig class.

INTERNAL METHODS

Methods intended to be used only within the scope of Bio::Polloc::*

_qualify_type

Uniformizes the distinct names that every type can receive

Arguments

The requested type (str)

Returns

The qualified type (str or undef)

_initialize