BioMart::Configuration
AttributeList
Toolbar
Summary
BioMart::Configuration::AttributeList
Package variables
No package variables defined.
Included modules
Inherit
Synopsis
Stores an array of attribute objects, in order.
Description
Stores an array of attribute objects. Used to handle the behaviour of
exportables in the system. When linking two Datasets together, the
BioMart::QueryRunner object will add the BioMart::AttributeList object
exported from the Exporting Dataset to the Query targeted to the
Exporting Dataset.
Methods
Methods description
Usage : minimal: my $alist = BioMart::AttributeList->new();
with name and dataSetName
my $alist = BioMart::AttributeList->new(
'name' => $name,
'dataSetName' => $subName
);
To be used as a Link Exportable (note orderby_string is
optional):
my $alist = BioMart::AttributeList->new(
'name' => $name,
'dataSetName' => $subName,
'linkName' => $linkName,
'attribute_string' => $attribute_string,
'orderby_string' => $orderby_string
);
Description: creates a new AttributeList object capable of storing an
array of Attribute objects
Returntype : BioMart::Configuration::AttributeList
Exceptions : none
Caller : caller |
Usage : $alist->addAttribute($att); Description: adds a BioMart::Attribute object to the AttributeList, maintaining the order of addition. Returntype : none Exceptions : none Caller : caller |
Usage : $alist->addSortByAttribute($att); Description: adds a BioMart::Attribute object to the AttributeList sortBy list, maintaining the order of addition. Returntype : none Exceptions : none Caller : caller |
Usage : my $attributeString = $alist->attributeString; $alist->attributeString($newAttString); Description : get/set the attributeString of this BioMart::AttributeList object. Returntype : scalar $attributeString Exceptions : none Caller : caller |
Usage : no arguments Description: returns 1 if this AttributeList is the default, otherwise 0 Returntype : 0,1 Exceptions : none Caller : caller |
Usage : my $atts = $alist->getAllAttributes; Description : get all Attributes added to this AttributeList. Primarily used by BioMart::ResultTable to support getFieldByName and getIndexByName, but may also be used by DatasetI objects which override or ignore the default toSQL method. Returntype : array_ref of BioMart::Attribute objects Exceptions : none Caller : BioMart::ResultTable, and BioMart::DatasetI implementatiions. |
Usage : my $linkName = $alist->linkName; $alist->linkName($newLinkName); Description : get/set the linkName of this BioMart::AttributeList object. Returntype : scalar $linkName Exceptions : none Caller : caller |
Usage : my $linkVersion = $alist->linkVersion; $alist->linkVersion($newLinkVersion); Description : get/set the linkVersion of this BioMart::AttributeList object. Returntype : scalar $linkVersion Exceptions : none Caller : caller |
Usage : my $orderByString = $alist->orderByString; $alist->orderByString($newOrderByString); Description : get/set the orderByString of this BioMart::AttributeList object. Returntype : scalar $orderByString (a comma separated list of BioMart::Configuration::Attribute names) Exceptions : none Caller : caller |
Usage : $alist->setDefault; Description: sets this AttributeList as the default Returntype : none Exceptions : none Caller : caller |
Usage : my $sql = $alist->toOrderBySQL; Description: returns a SQL stub for all the attributes stored in the AttributeList sortBy list. Returntype : string Exceptions : none Caller : caller |
Usage : my $sql = $alist->toSQL; Description: returns a SQL stub for all the attributes stored in the AttributeList Returntype : string Exceptions : none Caller : caller |
Usage : $exp->type(); Description : get/set for the exportable type object. Returntype : string Exceptions : none Caller : caller |
Usage : $alist->unSetDefault; Description: this BioMart::AttributeList will no longer be the default. Returntype : none Exceptions : none Caller : caller |
Methods code
sub _hashCode
{ my $self = shift;
my $digest = Digest::MD5->new;
$digest->add($self->name) if ($self->name);
$digest->add($self->linkName) if ($self->linkName);
$digest->add($self->dataSetName) if ($self->dataSetName);
my $atts = $self->get('attributes');
foreach my $att (@{$atts}) {
$digest->add($att->hashCode);
}
$digest->add($self->defaultList);
return $digest->hexdigest;
}
1; } |
sub _new
{
my ($self, @param) = @_;
$self->SUPER::_new(@param);
$self->addParams(TITLES, @param);
$self->attr('attributes', []);
$self->attr('orderby_attributes', []);
$self->attr('default', 0); } |
sub addAttribute
{ my ($self, $attribute) = @_;
my $attributes = $self->get('attributes');
push @{$attributes}, $attribute;
$self->set('attributes', $attributes); } |
sub addOrderByAttribute
{ my ($self, $attribute) = @_;
my $attributes = $self->get('orderby_attributes');
push @{$attributes}, $attribute;
$self->set('orderby_attributes', $attributes); } |
sub attributeString
{ my ($self, $name) = @_;
if ($name) {
$self->setParam(ATTRIBUTESTRING, $name);
}
return $self->getParam(ATTRIBUTESTRING); } |
sub defaultList
{ my $self = shift;
return $self->get('default'); } |
sub getAllAttributes
{ my $self = shift;
return $self->get('attributes'); } |
sub getAttributeByName
{ my ($self,$name) = @_;
my $attribute;
my $attributes = $self->get('attributes');
foreach (@$attributes){
if ($_->name eq $name){
$attribute = $_;
last;
}
}
return $attribute; } |
sub linkName
{ my ($self, $name) = @_;
if ($name) {
$self->setParam(LINKNAME, $name);
}
return $self->getParam(LINKNAME); } |
sub linkVersion
{ my ($self, $name) = @_;
if ($name) {
$self->setParam(LINKVERSION, $name);
}
return $self->getParam(LINKVERSION); } |
sub orderByString
{ my ($self, $name) = @_;
if ($name) {
$self->setParam(ORDERBYSTRING, $name);
}
return $self->getParam(ORDERBYSTRING); } |
sub setDefault
{ my $self = shift;
$self->set('default',1); } |
sub toOrderBySQL
{ my $self = shift;
my $sql;
my $attributes = $self->get('orderby_attributes');
foreach my $attribute (@$attributes){
$sql .= ' '.$attribute->toSQL().',';
}
chop $sql;
return $sql; } |
sub toSQL
{ my $self = shift;
my $sql;
my $attributes = $self->get('attributes');
foreach my $attribute (@$attributes){
$sql .= ' '.$attribute->toSQL().',';
}
chop $sql;
return $sql; } |
sub type
{ my ($self, $name) = @_;
if ($name) {
$self->setParam(TYPE, $name);
}
return $self->getParam(TYPE); } |
sub unSetDefault
{ my $self = shift;
$self->set('default',0); } |
General documentation
AUTHOR - Arek Kasprzyk, Syed Haider, Richard Holland, Darin London, Damian Smedley | Top |