Bio-MAGE

 view release on metacpan or  search on metacpan

MAGE/BioSequence/SeqFeatureLocation.pm  view on Meta::CPAN

##############################
#
# Bio::MAGE::BioSequence::SeqFeatureLocation
#
##############################
# C O P Y R I G H T   N O T I C E
#  Copyright (c) 2001-2006 by:
#    * The MicroArray Gene Expression Database Society (MGED)
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.



package Bio::MAGE::BioSequence::SeqFeatureLocation;
use strict;
use Carp;

use base qw(Bio::MAGE::Extendable);

use Bio::MAGE::Association;

use vars qw($__ASSOCIATIONS
	    $__CLASS_NAME
	    $__PACKAGE_NAME
	    $__SUBCLASSES
	    $__SUPERCLASSES
	    $__ATTRIBUTE_NAMES
	    $__ASSOCIATION_NAMES
	   );


=head1 NAME

Bio::MAGE::BioSequence::SeqFeatureLocation - Class for the MAGE-OM API

=head1 SYNOPSIS

  use Bio::MAGE::BioSequence::SeqFeatureLocation

  # creating an empty instance
  my $seqfeaturelocation = Bio::MAGE::BioSequence::SeqFeatureLocation->new();

  # creating an instance with existing data
  my $seqfeaturelocation = Bio::MAGE::BioSequence::SeqFeatureLocation->new(
        strandType=>$strandtype_val,
        subregions=>\@seqfeaturelocation_list,
        propertySets=>\@namevaluetype_list,
        coordinate=>$sequenceposition_ref,
  );


  # 'strandType' attribute
  my $strandType_val = $seqfeaturelocation->strandType(); # getter
  $seqfeaturelocation->strandType($value); # setter


  # 'subregions' association
  my $seqfeaturelocation_array_ref = $seqfeaturelocation->subregions(); # getter
  $seqfeaturelocation->subregions(\@seqfeaturelocation_list); # setter

  # 'propertySets' association
  my $namevaluetype_array_ref = $seqfeaturelocation->propertySets(); # getter
  $seqfeaturelocation->propertySets(\@namevaluetype_list); # setter

  # 'coordinate' association
  my $sequenceposition_ref = $seqfeaturelocation->coordinate(); # getter
  $seqfeaturelocation->coordinate($sequenceposition_ref); # setter



=head1 DESCRIPTION

From the MAGE-OM documentation for the C<SeqFeatureLocation> class:

The location of the SeqFeature annotation.



=cut

=head1 INHERITANCE


Bio::MAGE::BioSequence::SeqFeatureLocation has the following superclasses:

=over


=item * Bio::MAGE::Extendable


=back



=cut

BEGIN {
  $__CLASS_NAME        = q[Bio::MAGE::BioSequence::SeqFeatureLocation];
  $__PACKAGE_NAME      = q[BioSequence];
  $__SUBCLASSES        = [];
  $__SUPERCLASSES      = ['Bio::MAGE::Extendable'];
  $__ATTRIBUTE_NAMES   = ['strandType'];
  $__ASSOCIATION_NAMES = ['propertySets', 'subregions', 'coordinate'];
  $__ASSOCIATIONS      = [
          'subregions',
          bless( {
                   '__SELF' => bless( {
                                        '__NAME' => undef,
                                        '__IS_REF' => 0,
                                        '__CARDINALITY' => '1',
                                        '__DOCUMENTATION' => 'Regions within the SeqFeature.',
                                        '__CLASS_NAME' => 'SeqFeatureLocation',
                                        '__RANK' => undef,
                                        '__ORDERED' => undef
                                      }, 'Bio::MAGE::Association::End' ),
                   '__OTHER' => bless( {
                                         '__NAME' => 'subregions',
                                         '__IS_REF' => 1,
                                         '__CARDINALITY' => '0..N',
                                         '__DOCUMENTATION' => 'Regions within the SeqFeature.',
                                         '__CLASS_NAME' => 'SeqFeatureLocation',
                                         '__RANK' => '1',
                                         '__ORDERED' => 0
                                       }, 'Bio::MAGE::Association::End' )
                 }, 'Bio::MAGE::Association' ),
          'coordinate',

MAGE/BioSequence/SeqFeatureLocation.pm  view on Meta::CPAN

#
# code for get_slots() inherited from Base.pm
#

=item $val = $obj->set_slot($name,$val)

The C<set_slot()> method sets the slot C<$name> to the value C<$val>

B<Return value>: the new value of the slot, i.e. C<$val>

B<Side effects>: none

=cut

#
# code for set_slot() inherited from Base.pm
#

=item $val = $obj->get_slot($name)

The C<get_slot()> method is used to get the values of a number of
slots at the same time.

B<Return value>: a single slot value, or undef if the slot has not been
initialized.

B<Side effects>: none

=cut

#
# code for get_slot() inherited from Base.pm
#


=head2 ATTRIBUTES

Attributes are simple data types that belong to a single instance of a
class. In the Perl implementation of the MAGE-OM classes, the
interface to attributes is implemented using separate setter and
getter methods for each attribute.

C<Bio::MAGE::BioSequence::SeqFeatureLocation> has the following attribute accessor methods:

=over


=item strandType

Methods for the C<strandType> attribute.


From the MAGE-OM documentation:

Indicates the direction and/or type of the SeqFeature, i.e. whether it is in the 5' or 3' direction, is double stranded, etc.


=over


=item $val = $seqfeaturelocation->setStrandType($val)

The restricted setter method for the C<strandType> attribute.


Input parameters: the value to which the C<strandType> attribute will be set 

Return value: the current value of the C<strandType> attribute 

Side effects: none

Exceptions: will call C<croak()> if no input parameters are specified, or
if too many input parameters are specified

=cut


sub setStrandType {
  my $self = shift;
  croak(__PACKAGE__ . "::setStrandType: no arguments passed to setter")
    unless @_;
  croak(__PACKAGE__ . "::setStrandType: too many arguments passed to setter")
    if @_ > 1;
  my $val = shift;
  
  return $self->{__STRANDTYPE} = $val;
}


=item $val = $seqfeaturelocation->getStrandType()

The restricted getter method for the C<strandType> attribute.

Input parameters: none

Return value: the current value of the C<strandType> attribute 

Side effects: none

Exceptions: will call C<croak()> if any input parameters are specified

=cut


sub getStrandType {
  my $self = shift;
  croak(__PACKAGE__ . "::getStrandType: arguments passed to getter")
    if @_;
  my $val = shift;
  return $self->{__STRANDTYPE};
}





=back


=back


=head2 ASSOCIATIONS

Associations are references to other classes. Associations in MAGE-OM have a cardinality that determines the minimum and
maximum number of instances of the 'other' class that maybe included
in the association:

=over

=item 1

There B<must> be exactly one item in the association, i.e. this is a
mandatory data field.

=item 0..1

There B<may> be one item in the association, i.e. this is an optional
data field.

=item 1..N

There B<must> be one or more items in the association, i.e. this is a
mandatory data field, with list cardinality.

=item 0..N

There B<may> be one or more items in the association, i.e. this is an
optional data field, with list cardinality.

=back

Bio::MAGE::BioSequence::SeqFeatureLocation has the following association accessor methods:

=over


=item propertySets

Methods for the C<propertySets> association.


From the MAGE-OM documentation:

Allows specification of name/value pairs.  Meant to primarily help in-house, pipeline processing of instances by providing a place for values that aren't part of the specification proper.


=over


=item $array_ref = $seqfeaturelocation->setPropertySets($array_ref)

The restricted setter method for the C<propertySets> association.


Input parameters: the value to which the C<propertySets> association will be set : a reference to an array of objects of type C<Bio::MAGE::NameValueType>

Return value: the current value of the C<propertySets> association : a reference to an array of objects of type C<Bio::MAGE::NameValueType>

Side effects: none

Exceptions: will call C<croak()> if no input parameters are specified, or
if too many input parameters are specified, or if C<$array_ref> is not a reference to an array class C<Bio::MAGE::NameValueType> instances

=cut


sub setPropertySets {
  my $self = shift;
  croak(__PACKAGE__ . "::setPropertySets: no arguments passed to setter")
    unless @_;
  croak(__PACKAGE__ . "::setPropertySets: too many arguments passed to setter")
    if @_ > 1;
  my $val = shift;
    croak(__PACKAGE__ . "::setPropertySets: expected array reference, got $self")
    unless (not defined $val) or UNIVERSAL::isa($val,'ARRAY');
  if (defined $val) {
    foreach my $val_ent (@{$val}) {
      croak(__PACKAGE__ . "::setPropertySets: wrong type: " . ref($val_ent) . " expected Bio::MAGE::NameValueType")
        unless UNIVERSAL::isa($val_ent,'Bio::MAGE::NameValueType');
    }
  }

  return $self->{__PROPERTYSETS} = $val;
}


=item $array_ref = $seqfeaturelocation->getPropertySets()

The restricted getter method for the C<propertySets> association.

Input parameters: none

Return value: the current value of the C<propertySets> association : a reference to an array of objects of type C<Bio::MAGE::NameValueType>

Side effects: none

Exceptions: will call C<croak()> if any input parameters are specified

=cut


sub getPropertySets {
  my $self = shift;
  croak(__PACKAGE__ . "::getPropertySets: arguments passed to getter")
    if @_;
  my $val = shift;
  return $self->{__PROPERTYSETS};
}




=item $val = $seqfeaturelocation->addPropertySets(@vals)

Because the propertySets association has list cardinality, it may store more
than one value. This method adds the current list of objects in the propertySets association.

Input parameters: the list of values C<@vals> to add to the propertySets association. B<NOTE>: submitting a single value is permitted.

Return value: the number of items stored in the slot B<after> adding C<@vals>

Side effects: none

Exceptions: will call C<croak()> if no input parameters are specified, or if any of the objects in @vals is not an instance of class C<Bio::MAGE::NameValueType>

=cut


sub addPropertySets {
  my $self = shift;
  croak(__PACKAGE__ . "::addPropertySets: no arguments passed to adder")
    unless @_;
  my @vals = @_;
    foreach my $val (@vals) {
    croak(__PACKAGE__ . "::addPropertySets: wrong type: " . ref($val) . " expected Bio::MAGE::NameValueType")
      unless UNIVERSAL::isa($val,'Bio::MAGE::NameValueType');
  }

  return push(@{$self->{__PROPERTYSETS}},@vals);
}





=back


=item subregions

Methods for the C<subregions> association.


From the MAGE-OM documentation:

Regions within the SeqFeature.


=over


=item $array_ref = $seqfeaturelocation->setSubregions($array_ref)

The restricted setter method for the C<subregions> association.


Input parameters: the value to which the C<subregions> association will be set : a reference to an array of objects of type C<Bio::MAGE::BioSequence::SeqFeatureLocation>

Return value: the current value of the C<subregions> association : a reference to an array of objects of type C<Bio::MAGE::BioSequence::SeqFeatureLocation>

Side effects: none

Exceptions: will call C<croak()> if no input parameters are specified, or
if too many input parameters are specified, or if C<$array_ref> is not a reference to an array class C<Bio::MAGE::BioSequence::SeqFeatureLocation> instances

=cut


sub setSubregions {
  my $self = shift;
  croak(__PACKAGE__ . "::setSubregions: no arguments passed to setter")
    unless @_;
  croak(__PACKAGE__ . "::setSubregions: too many arguments passed to setter")
    if @_ > 1;
  my $val = shift;
    croak(__PACKAGE__ . "::setSubregions: expected array reference, got $self")
    unless (not defined $val) or UNIVERSAL::isa($val,'ARRAY');
  if (defined $val) {
    foreach my $val_ent (@{$val}) {
      croak(__PACKAGE__ . "::setSubregions: wrong type: " . ref($val_ent) . " expected Bio::MAGE::BioSequence::SeqFeatureLocation")
        unless UNIVERSAL::isa($val_ent,'Bio::MAGE::BioSequence::SeqFeatureLocation');
    }
  }

  return $self->{__SUBREGIONS} = $val;
}


=item $array_ref = $seqfeaturelocation->getSubregions()

The restricted getter method for the C<subregions> association.

Input parameters: none

Return value: the current value of the C<subregions> association : a reference to an array of objects of type C<Bio::MAGE::BioSequence::SeqFeatureLocation>

Side effects: none

Exceptions: will call C<croak()> if any input parameters are specified

=cut


sub getSubregions {
  my $self = shift;
  croak(__PACKAGE__ . "::getSubregions: arguments passed to getter")
    if @_;
  my $val = shift;
  return $self->{__SUBREGIONS};
}




=item $val = $seqfeaturelocation->addSubregions(@vals)

Because the subregions association has list cardinality, it may store more
than one value. This method adds the current list of objects in the subregions association.

Input parameters: the list of values C<@vals> to add to the subregions association. B<NOTE>: submitting a single value is permitted.

Return value: the number of items stored in the slot B<after> adding C<@vals>

Side effects: none

Exceptions: will call C<croak()> if no input parameters are specified, or if any of the objects in @vals is not an instance of class C<Bio::MAGE::BioSequence::SeqFeatureLocation>

=cut


sub addSubregions {
  my $self = shift;
  croak(__PACKAGE__ . "::addSubregions: no arguments passed to adder")
    unless @_;
  my @vals = @_;
    foreach my $val (@vals) {
    croak(__PACKAGE__ . "::addSubregions: wrong type: " . ref($val) . " expected Bio::MAGE::BioSequence::SeqFeatureLocation")
      unless UNIVERSAL::isa($val,'Bio::MAGE::BioSequence::SeqFeatureLocation');
  }

  return push(@{$self->{__SUBREGIONS}},@vals);
}





=back


=item coordinate

Methods for the C<coordinate> association.


From the MAGE-OM documentation:

At which base pairs or amino acid this SeqFeature begins and ends.


=over


=item $val = $seqfeaturelocation->setCoordinate($val)

The restricted setter method for the C<coordinate> association.


Input parameters: the value to which the C<coordinate> association will be set : one of the accepted enumerated values.

Return value: the current value of the C<coordinate> association : one of the accepted enumerated values.

Side effects: none

Exceptions: will call C<croak()> if no input parameters are specified, or
if too many input parameters are specified, or if C<$val> is not an instance of class C<Bio::MAGE::BioSequence::SequencePosition>

=cut


sub setCoordinate {
  my $self = shift;
  croak(__PACKAGE__ . "::setCoordinate: no arguments passed to setter")
    unless @_;
  croak(__PACKAGE__ . "::setCoordinate: too many arguments passed to setter")
    if @_ > 1;
  my $val = shift;
  croak(__PACKAGE__ . "::setCoordinate: wrong type: " . ref($val) . " expected Bio::MAGE::BioSequence::SequencePosition") unless (not defined $val) or UNIVERSAL::isa($val,'Bio::MAGE::BioSequence::SequencePosition');
  return $self->{__COORDINATE} = $val;
}


=item $val = $seqfeaturelocation->getCoordinate()

The restricted getter method for the C<coordinate> association.

Input parameters: none

Return value: the current value of the C<coordinate> association : an instance of type C<Bio::MAGE::BioSequence::SequencePosition>.

Side effects: none

Exceptions: will call C<croak()> if any input parameters are specified

=cut


sub getCoordinate {
  my $self = shift;
  croak(__PACKAGE__ . "::getCoordinate: arguments passed to getter")
    if @_;
  my $val = shift;
  return $self->{__COORDINATE};
}





=back


sub initialize {


  my $self = shift;
  return 1;


}

=back


=cut


=head1 SLOTS, ATTRIBUTES, AND ASSOCIATIONS

In the Perl implementation of MAGE-OM classes, there are
three types of class data members: C<slots>, C<attributes>, and
C<associations>.

=head2 SLOTS

This API uses the term C<slot> to indicate a data member of the class
that was not present in the UML model and is used for mainly internal
purposes - use only if you understand the inner workings of the
API. Most often slots are used by generic methods such as those in the
XML writing and reading classes.

Slots are implemented using unified getter/setter methods:



( run in 1.529 second using v1.01-cache-2.11-cpan-71847e10f99 )