view release on metacpan or search on metacpan
MAGE/BioSequence/SeqFeature.pm view on Meta::CPAN
use Bio::MAGE::BioSequence::SeqFeature
# creating an empty instance
my $seqfeature = Bio::MAGE::BioSequence::SeqFeature->new();
# creating an instance with existing data
my $seqfeature = Bio::MAGE::BioSequence::SeqFeature->new(
basis=>$basis_val,
auditTrail=>\@audit_list,
propertySets=>\@namevaluetype_list,
regions=>\@seqfeaturelocation_list,
descriptions=>\@description_list,
security=>$security_ref,
);
# 'basis' attribute
my $basis_val = $seqfeature->basis(); # getter
$seqfeature->basis($value); # setter
# 'auditTrail' association
my $audit_array_ref = $seqfeature->auditTrail(); # getter
$seqfeature->auditTrail(\@audit_list); # setter
# 'propertySets' association
my $namevaluetype_array_ref = $seqfeature->propertySets(); # getter
$seqfeature->propertySets(\@namevaluetype_list); # setter
# 'regions' association
my $seqfeaturelocation_array_ref = $seqfeature->regions(); # getter
$seqfeature->regions(\@seqfeaturelocation_list); # setter
# 'descriptions' association
my $description_array_ref = $seqfeature->descriptions(); # getter
$seqfeature->descriptions(\@description_list); # setter
# 'security' association
my $security_ref = $seqfeature->security(); # getter
$seqfeature->security($security_ref); # setter
MAGE/BioSequence/SeqFeatureLocation.pm view on Meta::CPAN
=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.
MAGE/BioSequence/SeqFeatureLocation.pm view on Meta::CPAN
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
MAGE/BioSequence/SeqFeatureLocation.pm view on Meta::CPAN
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
MAGE/BioSequence/SeqFeatureLocation.pm view on Meta::CPAN
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
MAGE/BioSequence/SeqFeatureLocation.pm view on Meta::CPAN
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
MAGE/BioSequence/SeqFeatureLocation.pm view on Meta::CPAN
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
MAGE/BioSequence/SeqFeatureLocation.pm view on Meta::CPAN
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
MAGE/BioSequence/SeqFeatureLocation.pm view on Meta::CPAN
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
MAGE/BioSequence/SeqFeatureLocation.pm view on Meta::CPAN
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
MAGE/BioSequence/SeqFeatureLocation.pm view on Meta::CPAN
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
MAGE/BioSequence/SeqFeatureLocation.pm view on Meta::CPAN
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
MAGE/DesignElement/Feature.pm view on Meta::CPAN
identifier=>$identifier_val,
controlType=>$ontologyentry_ref,
zone=>$zone_ref,
controlledFeatures=>\@feature_list,
position=>$position_ref,
auditTrail=>\@audit_list,
propertySets=>\@namevaluetype_list,
descriptions=>\@description_list,
security=>$security_ref,
featureGroup=>$featuregroup_ref,
featureLocation=>$featurelocation_ref,
controlFeatures=>\@feature_list,
);
# 'name' attribute
my $name_val = $feature->name(); # getter
$feature->name($value); # setter
# 'identifier' attribute
my $identifier_val = $feature->identifier(); # getter
MAGE/DesignElement/Feature.pm view on Meta::CPAN
# 'security' association
my $security_ref = $feature->security(); # getter
$feature->security($security_ref); # setter
# 'featureGroup' association
my $featuregroup_ref = $feature->featureGroup(); # getter
$feature->featureGroup($featuregroup_ref); # setter
# 'featureLocation' association
my $featurelocation_ref = $feature->featureLocation(); # getter
$feature->featureLocation($featurelocation_ref); # setter
# 'controlFeatures' association
my $feature_array_ref = $feature->controlFeatures(); # getter
$feature->controlFeatures(\@feature_list); # setter
=head1 DESCRIPTION
From the MAGE-OM documentation for the C<Feature> class:
MAGE/DesignElement/FeatureLocation.pm view on Meta::CPAN
=head1 NAME
Bio::MAGE::DesignElement::FeatureLocation - Class for the MAGE-OM API
=head1 SYNOPSIS
use Bio::MAGE::DesignElement::FeatureLocation
# creating an empty instance
my $featurelocation = Bio::MAGE::DesignElement::FeatureLocation->new();
# creating an instance with existing data
my $featurelocation = Bio::MAGE::DesignElement::FeatureLocation->new(
row=>$row_val,
column=>$column_val,
propertySets=>\@namevaluetype_list,
);
# 'row' attribute
my $row_val = $featurelocation->row(); # getter
$featurelocation->row($value); # setter
# 'column' attribute
my $column_val = $featurelocation->column(); # getter
$featurelocation->column($value); # setter
# 'propertySets' association
my $namevaluetype_array_ref = $featurelocation->propertySets(); # getter
$featurelocation->propertySets(\@namevaluetype_list); # setter
=head1 DESCRIPTION
From the MAGE-OM documentation for the C<FeatureLocation> class:
Specifies where a feature is located relative to a grid.
MAGE/DesignElement/FeatureLocation.pm view on Meta::CPAN
From the MAGE-OM documentation:
row position in the Zone
=over
=item $val = $featurelocation->setRow($val)
The restricted setter method for the C<row> attribute.
Input parameters: the value to which the C<row> attribute will be set
Return value: the current value of the C<row> attribute
Side effects: none
MAGE/DesignElement/FeatureLocation.pm view on Meta::CPAN
croak(__PACKAGE__ . "::setRow: no arguments passed to setter")
unless @_;
croak(__PACKAGE__ . "::setRow: too many arguments passed to setter")
if @_ > 1;
my $val = shift;
return $self->{__ROW} = $val;
}
=item $val = $featurelocation->getRow()
The restricted getter method for the C<row> attribute.
Input parameters: none
Return value: the current value of the C<row> attribute
Side effects: none
Exceptions: will call C<croak()> if any input parameters are specified
MAGE/DesignElement/FeatureLocation.pm view on Meta::CPAN
From the MAGE-OM documentation:
column position in the Zone.
=over
=item $val = $featurelocation->setColumn($val)
The restricted setter method for the C<column> attribute.
Input parameters: the value to which the C<column> attribute will be set
Return value: the current value of the C<column> attribute
Side effects: none
MAGE/DesignElement/FeatureLocation.pm view on Meta::CPAN
croak(__PACKAGE__ . "::setColumn: no arguments passed to setter")
unless @_;
croak(__PACKAGE__ . "::setColumn: too many arguments passed to setter")
if @_ > 1;
my $val = shift;
return $self->{__COLUMN} = $val;
}
=item $val = $featurelocation->getColumn()
The restricted getter method for the C<column> attribute.
Input parameters: none
Return value: the current value of the C<column> attribute
Side effects: none
Exceptions: will call C<croak()> if any input parameters are specified
MAGE/DesignElement/FeatureLocation.pm view on Meta::CPAN
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 = $featurelocation->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
MAGE/DesignElement/FeatureLocation.pm view on Meta::CPAN
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 = $featurelocation->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
MAGE/DesignElement/FeatureLocation.pm view on Meta::CPAN
my $self = shift;
croak(__PACKAGE__ . "::getPropertySets: arguments passed to getter")
if @_;
my $val = shift;
return $self->{__PROPERTYSETS};
}
=item $val = $featurelocation->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
t/Extendable.t view on Meta::CPAN
# create a subclass
my $designelementmapping = Bio::MAGE::BioAssayData::DesignElementMapping->new();
# testing subclass DesignElementMapping
isa_ok($designelementmapping, q[Bio::MAGE::BioAssayData::DesignElementMapping]);
isa_ok($designelementmapping, q[Bio::MAGE::Extendable]);
# create a subclass
my $featurelocation = Bio::MAGE::DesignElement::FeatureLocation->new();
# testing subclass FeatureLocation
isa_ok($featurelocation, q[Bio::MAGE::DesignElement::FeatureLocation]);
isa_ok($featurelocation, q[Bio::MAGE::Extendable]);
# create a subclass
my $featuredefect = Bio::MAGE::Array::FeatureDefect->new();
# testing subclass FeatureDefect
isa_ok($featuredefect, q[Bio::MAGE::Array::FeatureDefect]);
isa_ok($featuredefect, q[Bio::MAGE::Extendable]);
t/Extendable.t view on Meta::CPAN
# create a subclass
my $parametervalue = Bio::MAGE::Protocol::ParameterValue->new();
# testing subclass ParameterValue
isa_ok($parametervalue, q[Bio::MAGE::Protocol::ParameterValue]);
isa_ok($parametervalue, q[Bio::MAGE::Extendable]);
# create a subclass
my $seqfeaturelocation = Bio::MAGE::BioSequence::SeqFeatureLocation->new();
# testing subclass SeqFeatureLocation
isa_ok($seqfeaturelocation, q[Bio::MAGE::BioSequence::SeqFeatureLocation]);
isa_ok($seqfeaturelocation, q[Bio::MAGE::Extendable]);
# create a subclass
my $compoundmeasurement = Bio::MAGE::BioMaterial::CompoundMeasurement->new();
# testing subclass CompoundMeasurement
isa_ok($compoundmeasurement, q[Bio::MAGE::BioMaterial::CompoundMeasurement]);
isa_ok($compoundmeasurement, q[Bio::MAGE::Extendable]);
t/Feature.t view on Meta::CPAN
and defined $end->is_ref(),
and ($end->is_ref() == 0 or $end->is_ref() == 1),
and defined $end->class_name(),
and $end->class_name()),
'featureGroup->self() is a valid Bio::MAGE::Association::End'
);
# testing association featureLocation
my $featurelocation_assn;
{
# silence the abstract class warnings
local $SIG{__WARN__} = sub {'IGNORE'};
$featurelocation_assn = Bio::MAGE::DesignElement::FeatureLocation->new();
}
isa_ok($feature->getFeatureLocation, q[Bio::MAGE::DesignElement::FeatureLocation]);
is($feature->setFeatureLocation($featurelocation_assn), $featurelocation_assn,
'setFeatureLocation returns value');
ok($feature->getFeatureLocation() == $featurelocation_assn,
'getFeatureLocation fetches correct value');
# test setFeatureLocation throws exception with bad argument
eval {$feature->setFeatureLocation(1)};
ok($@, 'setFeatureLocation throws exception with bad argument');
# test getFeatureLocation throws exception with argument
eval {$feature->getFeatureLocation(1)};
ok($@, 'getFeatureLocation throws exception with argument');
t/FeatureLocation.t view on Meta::CPAN
use Bio::MAGE;
use Bio::MAGE::Association;
BEGIN { use_ok('Bio::MAGE::DesignElement::FeatureLocation') };
use Bio::MAGE::NameValueType;
# we test the new() method
my $featurelocation;
{
# silence the abstract class warnings
local $SIG{__WARN__} = sub {'IGNORE'};
$featurelocation = Bio::MAGE::DesignElement::FeatureLocation->new();
}
isa_ok($featurelocation, 'Bio::MAGE::DesignElement::FeatureLocation');
# test the package_name class method
is($featurelocation->package_name(), q[DesignElement],
'package');
# test the class_name class method
is($featurelocation->class_name(), q[Bio::MAGE::DesignElement::FeatureLocation],
'class_name');
# set the attribute values in the call to new()
{
# silence the abstract class warnings
local $SIG{__WARN__} = sub {'IGNORE'};
$featurelocation = Bio::MAGE::DesignElement::FeatureLocation->new(row => '1',
column => '2');
}
#
# testing attribute row
#
# test attribute values can be set in new()
is($featurelocation->getRow(), '1',
'row new');
# test getter/setter
$featurelocation->setRow('1');
is($featurelocation->getRow(), '1',
'row getter/setter');
# test getter throws exception with argument
eval {$featurelocation->getRow(1)};
ok($@, 'row getter throws exception with argument');
# test setter throws exception with no argument
eval {$featurelocation->setRow()};
ok($@, 'row setter throws exception with no argument');
# test setter throws exception with too many argument
eval {$featurelocation->setRow('1', '1')};
ok($@, 'row setter throws exception with too many argument');
# test setter accepts undef
eval {$featurelocation->setRow(undef)};
ok((!$@ and not defined $featurelocation->getRow()),
'row setter accepts undef');
#
# testing attribute column
#
# test attribute values can be set in new()
is($featurelocation->getColumn(), '2',
'column new');
# test getter/setter
$featurelocation->setColumn('2');
is($featurelocation->getColumn(), '2',
'column getter/setter');
# test getter throws exception with argument
eval {$featurelocation->getColumn(1)};
ok($@, 'column getter throws exception with argument');
# test setter throws exception with no argument
eval {$featurelocation->setColumn()};
ok($@, 'column setter throws exception with no argument');
# test setter throws exception with too many argument
eval {$featurelocation->setColumn('2', '2')};
ok($@, 'column setter throws exception with too many argument');
# test setter accepts undef
eval {$featurelocation->setColumn(undef)};
ok((!$@ and not defined $featurelocation->getColumn()),
'column setter accepts undef');
# retrieve the list of association meta-data
my %assns = Bio::MAGE::DesignElement::FeatureLocation->associations();
# set the association values in the call to new()
{
# silence the abstract class warnings
local $SIG{__WARN__} = sub {'IGNORE'};
$featurelocation = Bio::MAGE::DesignElement::FeatureLocation->new(propertySets => [Bio::MAGE::NameValueType->new()]);
}
my ($end, $assn);
# testing association propertySets
my $propertysets_assn;
{
# silence the abstract class warnings
local $SIG{__WARN__} = sub {'IGNORE'};
$propertysets_assn = Bio::MAGE::NameValueType->new();
}
ok((UNIVERSAL::isa($featurelocation->getPropertySets,'ARRAY')
and scalar @{$featurelocation->getPropertySets} == 1
and UNIVERSAL::isa($featurelocation->getPropertySets->[0], q[Bio::MAGE::NameValueType])),
'propertySets set in new()');
ok(eq_array($featurelocation->setPropertySets([$propertysets_assn]), [$propertysets_assn]),
'setPropertySets returns correct value');
ok((UNIVERSAL::isa($featurelocation->getPropertySets,'ARRAY')
and scalar @{$featurelocation->getPropertySets} == 1
and $featurelocation->getPropertySets->[0] == $propertysets_assn),
'getPropertySets fetches correct value');
is($featurelocation->addPropertySets($propertysets_assn), 2,
'addPropertySets returns number of items in list');
ok((UNIVERSAL::isa($featurelocation->getPropertySets,'ARRAY')
and scalar @{$featurelocation->getPropertySets} == 2
and $featurelocation->getPropertySets->[0] == $propertysets_assn
and $featurelocation->getPropertySets->[1] == $propertysets_assn),
'addPropertySets adds correct value');
# test setPropertySets throws exception with non-array argument
eval {$featurelocation->setPropertySets(1)};
ok($@, 'setPropertySets throws exception with non-array argument');
# test setPropertySets throws exception with bad argument array
eval {$featurelocation->setPropertySets([1])};
ok($@, 'setPropertySets throws exception with bad argument array');
# test addPropertySets throws exception with no arguments
eval {$featurelocation->addPropertySets()};
ok($@, 'addPropertySets throws exception with no arguments');
# test addPropertySets throws exception with bad argument
eval {$featurelocation->addPropertySets(1)};
ok($@, 'addPropertySets throws exception with bad array');
# test setPropertySets accepts empty array ref
eval {$featurelocation->setPropertySets([])};
ok((!$@ and defined $featurelocation->getPropertySets()
and UNIVERSAL::isa($featurelocation->getPropertySets, 'ARRAY')
and scalar @{$featurelocation->getPropertySets} == 0),
'setPropertySets accepts empty array ref');
# test getPropertySets throws exception with argument
eval {$featurelocation->getPropertySets(1)};
ok($@, 'getPropertySets throws exception with argument');
# test setPropertySets throws exception with no argument
eval {$featurelocation->setPropertySets()};
ok($@, 'setPropertySets throws exception with no argument');
# test setPropertySets throws exception with too many argument
eval {$featurelocation->setPropertySets(1,2)};
ok($@, 'setPropertySets throws exception with too many argument');
# test setPropertySets accepts undef
eval {$featurelocation->setPropertySets(undef)};
ok((!$@ and not defined $featurelocation->getPropertySets()),
'setPropertySets accepts undef');
# test the meta-data for the assoication
$assn = $assns{propertySets};
isa_ok($assn, 'Bio::MAGE::Association');
$end = $assn->other();
isa_ok($end, 'Bio::MAGE::Association::End');
ok((defined $end
and defined $end->documentation(),
and defined $end->cardinality(),
t/FeatureLocation.t view on Meta::CPAN
{
# silence the abstract class warnings
local $SIG{__WARN__} = sub {'IGNORE'};
# create a superclass
$extendable = Bio::MAGE::Extendable->new();
}
# testing superclass Extendable
isa_ok($extendable, q[Bio::MAGE::Extendable]);
isa_ok($featurelocation, q[Bio::MAGE::Extendable]);
t/SeqFeatureLocation.t view on Meta::CPAN
use Bio::MAGE::Association;
BEGIN { use_ok('Bio::MAGE::BioSequence::SeqFeatureLocation') };
use Bio::MAGE::BioSequence::SequencePosition;
use Bio::MAGE::NameValueType;
use Bio::MAGE::BioSequence::SeqFeatureLocation;
# we test the new() method
my $seqfeaturelocation;
{
# silence the abstract class warnings
local $SIG{__WARN__} = sub {'IGNORE'};
$seqfeaturelocation = Bio::MAGE::BioSequence::SeqFeatureLocation->new();
}
isa_ok($seqfeaturelocation, 'Bio::MAGE::BioSequence::SeqFeatureLocation');
# test the package_name class method
is($seqfeaturelocation->package_name(), q[BioSequence],
'package');
# test the class_name class method
is($seqfeaturelocation->class_name(), q[Bio::MAGE::BioSequence::SeqFeatureLocation],
'class_name');
# set the attribute values in the call to new()
{
# silence the abstract class warnings
local $SIG{__WARN__} = sub {'IGNORE'};
$seqfeaturelocation = Bio::MAGE::BioSequence::SeqFeatureLocation->new(strandType => '1');
}
#
# testing attribute strandType
#
# test attribute values can be set in new()
is($seqfeaturelocation->getStrandType(), '1',
'strandType new');
# test getter/setter
$seqfeaturelocation->setStrandType('1');
is($seqfeaturelocation->getStrandType(), '1',
'strandType getter/setter');
# test getter throws exception with argument
eval {$seqfeaturelocation->getStrandType(1)};
ok($@, 'strandType getter throws exception with argument');
# test setter throws exception with no argument
eval {$seqfeaturelocation->setStrandType()};
ok($@, 'strandType setter throws exception with no argument');
# test setter throws exception with too many argument
eval {$seqfeaturelocation->setStrandType('1', '1')};
ok($@, 'strandType setter throws exception with too many argument');
# test setter accepts undef
eval {$seqfeaturelocation->setStrandType(undef)};
ok((!$@ and not defined $seqfeaturelocation->getStrandType()),
'strandType setter accepts undef');
# retrieve the list of association meta-data
my %assns = Bio::MAGE::BioSequence::SeqFeatureLocation->associations();
# set the association values in the call to new()
{
# silence the abstract class warnings
local $SIG{__WARN__} = sub {'IGNORE'};
$seqfeaturelocation = Bio::MAGE::BioSequence::SeqFeatureLocation->new(coordinate => Bio::MAGE::BioSequence::SequencePosition->new(),
subregions => [Bio::MAGE::BioSequence::SeqFeatureLocation->new()],
propertySets => [Bio::MAGE::NameValueType->new()]);
}
my ($end, $assn);
# testing association coordinate
my $coordinate_assn;
{
# silence the abstract class warnings
local $SIG{__WARN__} = sub {'IGNORE'};
$coordinate_assn = Bio::MAGE::BioSequence::SequencePosition->new();
}
isa_ok($seqfeaturelocation->getCoordinate, q[Bio::MAGE::BioSequence::SequencePosition]);
is($seqfeaturelocation->setCoordinate($coordinate_assn), $coordinate_assn,
'setCoordinate returns value');
ok($seqfeaturelocation->getCoordinate() == $coordinate_assn,
'getCoordinate fetches correct value');
# test setCoordinate throws exception with bad argument
eval {$seqfeaturelocation->setCoordinate(1)};
ok($@, 'setCoordinate throws exception with bad argument');
# test getCoordinate throws exception with argument
eval {$seqfeaturelocation->getCoordinate(1)};
ok($@, 'getCoordinate throws exception with argument');
# test setCoordinate throws exception with no argument
eval {$seqfeaturelocation->setCoordinate()};
ok($@, 'setCoordinate throws exception with no argument');
# test setCoordinate throws exception with too many argument
eval {$seqfeaturelocation->setCoordinate(1,2)};
ok($@, 'setCoordinate throws exception with too many argument');
# test setCoordinate accepts undef
eval {$seqfeaturelocation->setCoordinate(undef)};
ok((!$@ and not defined $seqfeaturelocation->getCoordinate()),
'setCoordinate accepts undef');
# test the meta-data for the assoication
$assn = $assns{coordinate};
isa_ok($assn, 'Bio::MAGE::Association');
$end = $assn->other();
isa_ok($end, 'Bio::MAGE::Association::End');
ok((defined $end
and defined $end->documentation(),
and defined $end->cardinality(),
t/SeqFeatureLocation.t view on Meta::CPAN
# testing association subregions
my $subregions_assn;
{
# silence the abstract class warnings
local $SIG{__WARN__} = sub {'IGNORE'};
$subregions_assn = Bio::MAGE::BioSequence::SeqFeatureLocation->new();
}
ok((UNIVERSAL::isa($seqfeaturelocation->getSubregions,'ARRAY')
and scalar @{$seqfeaturelocation->getSubregions} == 1
and UNIVERSAL::isa($seqfeaturelocation->getSubregions->[0], q[Bio::MAGE::BioSequence::SeqFeatureLocation])),
'subregions set in new()');
ok(eq_array($seqfeaturelocation->setSubregions([$subregions_assn]), [$subregions_assn]),
'setSubregions returns correct value');
ok((UNIVERSAL::isa($seqfeaturelocation->getSubregions,'ARRAY')
and scalar @{$seqfeaturelocation->getSubregions} == 1
and $seqfeaturelocation->getSubregions->[0] == $subregions_assn),
'getSubregions fetches correct value');
is($seqfeaturelocation->addSubregions($subregions_assn), 2,
'addSubregions returns number of items in list');
ok((UNIVERSAL::isa($seqfeaturelocation->getSubregions,'ARRAY')
and scalar @{$seqfeaturelocation->getSubregions} == 2
and $seqfeaturelocation->getSubregions->[0] == $subregions_assn
and $seqfeaturelocation->getSubregions->[1] == $subregions_assn),
'addSubregions adds correct value');
# test setSubregions throws exception with non-array argument
eval {$seqfeaturelocation->setSubregions(1)};
ok($@, 'setSubregions throws exception with non-array argument');
# test setSubregions throws exception with bad argument array
eval {$seqfeaturelocation->setSubregions([1])};
ok($@, 'setSubregions throws exception with bad argument array');
# test addSubregions throws exception with no arguments
eval {$seqfeaturelocation->addSubregions()};
ok($@, 'addSubregions throws exception with no arguments');
# test addSubregions throws exception with bad argument
eval {$seqfeaturelocation->addSubregions(1)};
ok($@, 'addSubregions throws exception with bad array');
# test setSubregions accepts empty array ref
eval {$seqfeaturelocation->setSubregions([])};
ok((!$@ and defined $seqfeaturelocation->getSubregions()
and UNIVERSAL::isa($seqfeaturelocation->getSubregions, 'ARRAY')
and scalar @{$seqfeaturelocation->getSubregions} == 0),
'setSubregions accepts empty array ref');
# test getSubregions throws exception with argument
eval {$seqfeaturelocation->getSubregions(1)};
ok($@, 'getSubregions throws exception with argument');
# test setSubregions throws exception with no argument
eval {$seqfeaturelocation->setSubregions()};
ok($@, 'setSubregions throws exception with no argument');
# test setSubregions throws exception with too many argument
eval {$seqfeaturelocation->setSubregions(1,2)};
ok($@, 'setSubregions throws exception with too many argument');
# test setSubregions accepts undef
eval {$seqfeaturelocation->setSubregions(undef)};
ok((!$@ and not defined $seqfeaturelocation->getSubregions()),
'setSubregions accepts undef');
# test the meta-data for the assoication
$assn = $assns{subregions};
isa_ok($assn, 'Bio::MAGE::Association');
$end = $assn->other();
isa_ok($end, 'Bio::MAGE::Association::End');
ok((defined $end
and defined $end->documentation(),
and defined $end->cardinality(),
t/SeqFeatureLocation.t view on Meta::CPAN
# testing association propertySets
my $propertysets_assn;
{
# silence the abstract class warnings
local $SIG{__WARN__} = sub {'IGNORE'};
$propertysets_assn = Bio::MAGE::NameValueType->new();
}
ok((UNIVERSAL::isa($seqfeaturelocation->getPropertySets,'ARRAY')
and scalar @{$seqfeaturelocation->getPropertySets} == 1
and UNIVERSAL::isa($seqfeaturelocation->getPropertySets->[0], q[Bio::MAGE::NameValueType])),
'propertySets set in new()');
ok(eq_array($seqfeaturelocation->setPropertySets([$propertysets_assn]), [$propertysets_assn]),
'setPropertySets returns correct value');
ok((UNIVERSAL::isa($seqfeaturelocation->getPropertySets,'ARRAY')
and scalar @{$seqfeaturelocation->getPropertySets} == 1
and $seqfeaturelocation->getPropertySets->[0] == $propertysets_assn),
'getPropertySets fetches correct value');
is($seqfeaturelocation->addPropertySets($propertysets_assn), 2,
'addPropertySets returns number of items in list');
ok((UNIVERSAL::isa($seqfeaturelocation->getPropertySets,'ARRAY')
and scalar @{$seqfeaturelocation->getPropertySets} == 2
and $seqfeaturelocation->getPropertySets->[0] == $propertysets_assn
and $seqfeaturelocation->getPropertySets->[1] == $propertysets_assn),
'addPropertySets adds correct value');
# test setPropertySets throws exception with non-array argument
eval {$seqfeaturelocation->setPropertySets(1)};
ok($@, 'setPropertySets throws exception with non-array argument');
# test setPropertySets throws exception with bad argument array
eval {$seqfeaturelocation->setPropertySets([1])};
ok($@, 'setPropertySets throws exception with bad argument array');
# test addPropertySets throws exception with no arguments
eval {$seqfeaturelocation->addPropertySets()};
ok($@, 'addPropertySets throws exception with no arguments');
# test addPropertySets throws exception with bad argument
eval {$seqfeaturelocation->addPropertySets(1)};
ok($@, 'addPropertySets throws exception with bad array');
# test setPropertySets accepts empty array ref
eval {$seqfeaturelocation->setPropertySets([])};
ok((!$@ and defined $seqfeaturelocation->getPropertySets()
and UNIVERSAL::isa($seqfeaturelocation->getPropertySets, 'ARRAY')
and scalar @{$seqfeaturelocation->getPropertySets} == 0),
'setPropertySets accepts empty array ref');
# test getPropertySets throws exception with argument
eval {$seqfeaturelocation->getPropertySets(1)};
ok($@, 'getPropertySets throws exception with argument');
# test setPropertySets throws exception with no argument
eval {$seqfeaturelocation->setPropertySets()};
ok($@, 'setPropertySets throws exception with no argument');
# test setPropertySets throws exception with too many argument
eval {$seqfeaturelocation->setPropertySets(1,2)};
ok($@, 'setPropertySets throws exception with too many argument');
# test setPropertySets accepts undef
eval {$seqfeaturelocation->setPropertySets(undef)};
ok((!$@ and not defined $seqfeaturelocation->getPropertySets()),
'setPropertySets accepts undef');
# test the meta-data for the assoication
$assn = $assns{propertySets};
isa_ok($assn, 'Bio::MAGE::Association');
$end = $assn->other();
isa_ok($end, 'Bio::MAGE::Association::End');
ok((defined $end
and defined $end->documentation(),
and defined $end->cardinality(),
t/SeqFeatureLocation.t view on Meta::CPAN
{
# silence the abstract class warnings
local $SIG{__WARN__} = sub {'IGNORE'};
# create a superclass
$extendable = Bio::MAGE::Extendable->new();
}
# testing superclass Extendable
isa_ok($extendable, q[Bio::MAGE::Extendable]);
isa_ok($seqfeaturelocation, q[Bio::MAGE::Extendable]);