BioMart::Configuration AttributeList
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
BioMart::Configuration::AttributeList
Package variables
No package variables defined.
Included modules
Digest::MD5
Inherit
BioMart::Configuration::Attribute
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
_hashCode
No description
Code
_newDescriptionCode
addAttributeDescriptionCode
addOrderByAttributeDescriptionCode
attributeStringDescriptionCode
defaultListDescriptionCode
getAllAttributesDescriptionCode
getAttributeByName
No description
Code
linkNameDescriptionCode
linkVersionDescriptionCode
orderByStringDescriptionCode
setDefaultDescriptionCode
toOrderBySQLDescriptionCode
toSQLDescriptionCode
typeDescriptionCode
unSetDefaultDescriptionCode
Methods description
_newcode    nextTop
  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
addAttributecodeprevnextTop
  Usage      : $alist->addAttribute($att);
Description: adds a BioMart::Attribute object to the AttributeList,
maintaining the order of addition.
Returntype : none
Exceptions : none
Caller : caller
addOrderByAttributecodeprevnextTop
  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
attributeStringcodeprevnextTop
  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
defaultListcodeprevnextTop
  Usage      : no arguments
Description: returns 1 if this AttributeList is the default, otherwise 0
Returntype : 0,1
Exceptions : none
Caller : caller
getAllAttributescodeprevnextTop
  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.
linkNamecodeprevnextTop
  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
linkVersioncodeprevnextTop
  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
orderByStringcodeprevnextTop
  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
setDefaultcodeprevnextTop
  Usage      : $alist->setDefault;
Description: sets this AttributeList as the default
Returntype : none
Exceptions : none
Caller : caller
toOrderBySQLcodeprevnextTop
  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
toSQLcodeprevnextTop
  Usage      : my $sql = $alist->toSQL;
Description: returns a SQL stub for all the attributes stored in the
AttributeList
Returntype : string
Exceptions : none
Caller : caller
typecodeprevnextTop
  Usage        :  $exp->type();

Description : get/set for the exportable type
object.
Returntype : string
Exceptions : none
Caller : caller
unSetDefaultcodeprevnextTop
  Usage      : $alist->unSetDefault;
Description: this BioMart::AttributeList will no longer be the default.
Returntype : none
Exceptions : none
Caller : caller
Methods code
_hashCodedescriptionprevnextTop
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;
}
_newdescriptionprevnextTop
sub _new {
  my ($self, @param) = @_;
  $self->SUPER::_new(@param);
  $self->addParams(TITLES, @param);
  $self->attr('attributes', []);
  $self->attr('orderby_attributes', []);
  $self->attr('default', 0);
}
addAttributedescriptionprevnextTop
sub addAttribute {
  my ($self, $attribute) = @_;

  my $attributes = $self->get('attributes');
  push @{$attributes}, $attribute;
  $self->set('attributes', $attributes);
}
addOrderByAttributedescriptionprevnextTop
sub addOrderByAttribute {
  my ($self, $attribute) = @_;

  my $attributes = $self->get('orderby_attributes');
  push @{$attributes}, $attribute;
  $self->set('orderby_attributes', $attributes);
}
attributeStringdescriptionprevnextTop
sub attributeString {
  my ($self, $name) = @_;
  if ($name) {
    $self->setParam(ATTRIBUTESTRING, $name);
  }
  return $self->getParam(ATTRIBUTESTRING);
}
defaultListdescriptionprevnextTop
sub defaultList {
  my $self = shift;
  return $self->get('default');
}
getAllAttributesdescriptionprevnextTop
sub getAllAttributes {
  my $self = shift;
  return $self->get('attributes');
}
getAttributeByNamedescriptionprevnextTop
sub getAttributeByName {
  my ($self,$name) = @_;
  my $attribute;
  my $attributes = $self->get('attributes');
  foreach (@$attributes){
      if ($_->name eq $name){
	  $attribute = $_;
	  last;
      }
  }
  return $attribute;
}
linkNamedescriptionprevnextTop
sub linkName {
  my ($self, $name) = @_;
  if ($name) {
    $self->setParam(LINKNAME, $name);
  }
  return $self->getParam(LINKNAME);
}
linkVersiondescriptionprevnextTop
sub linkVersion {
  my ($self, $name) = @_;
  if ($name) {
    $self->setParam(LINKVERSION, $name);
  }
  return $self->getParam(LINKVERSION);
}
orderByStringdescriptionprevnextTop
sub orderByString {
  my ($self, $name) = @_;
  if ($name) {
    $self->setParam(ORDERBYSTRING, $name);
  }
  return $self->getParam(ORDERBYSTRING);
}
setDefaultdescriptionprevnextTop
sub setDefault {
  my $self = shift;
  $self->set('default',1);
}
toOrderBySQLdescriptionprevnextTop
sub toOrderBySQL {
  # gets each attribute, inserts ',' in between
my $self = shift; my $sql; my $attributes = $self->get('orderby_attributes'); foreach my $attribute (@$attributes){ $sql .= ' '.$attribute->toSQL().','; } chop $sql; return $sql;
}
toSQLdescriptionprevnextTop
sub toSQL {
  # gets each attribute, inserts ',' in between
my $self = shift; my $sql; my $attributes = $self->get('attributes'); foreach my $attribute (@$attributes){ $sql .= ' '.$attribute->toSQL().','; } chop $sql; return $sql;
}
typedescriptionprevnextTop
sub type {
  my ($self, $name) = @_;
  if ($name) {
    $self->setParam(TYPE, $name);
  }
  return $self->getParam(TYPE);
}
unSetDefaultdescriptionprevnextTop
sub unSetDefault {
  my $self = shift;
  $self->set('default',0);
}
General documentation
AUTHOR - Arek Kasprzyk, Syed Haider, Richard Holland, Darin London, Damian SmedleyTop
CONTACTTop
This module is part of the BioMart project http://www.biomart.org
Questions can be posted to the mart-dev mailing list: mart-dev@ebi.ac.uk