BioMart::Configuration VirtualSchema
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
BioMart::Configuration::VirtualSchema
Package variables
No package variables defined.
Inherit
BioMart::Root
Synopsis
Represents the virtualSchema defined in the martRegistry XML
Description
All BioMart::Configuration::Location implementing objects are contained
within a BioMart::Configuration::VirtualSchema objects in the
BioMart::Registry. At the very least if no virtualSchema is defined in the
registry configuration a single "default" virtualSchema is generated to
contain all Locations and Dataset. Datasets contained in different
virtualSchemas cannot be used in the same BioMart::Query.
Methods
_new
No description
Code
addLocationDescriptionCode
defaultDescriptionCode
displayNameDescriptionCode
getAllLocationsDescriptionCode
getAllMartsDescriptionCode
getDatasetByNameDescriptionCode
getMartByName
No description
Code
nameDescriptionCode
removeLocationDescriptionCode
visibleDescriptionCode
Methods description
addLocationcode    nextTop
  Usage      : usage
Description: Description
Returntype :
Exceptions : none
Caller : caller
defaultcodeprevnextTop
  Usage      : my $default = $virtualSchema->default(); 
$virtualSchemaDefault->default($newname);
Description: sets/gets the default flag of the VirtualSchema
Returntype : string name
Exceptions : none
Caller : caller
displayNamecodeprevnextTop
  Usage      : my $displayName = $virtualSchema->displayName(); 
$virtualSchemaDisplayName->displayName($newdisplayName);
Description: sets/gets the displayName of the VirtualSchema
Returntype : string displayName
Exceptions : none
Caller : caller
getAllLocationscodeprevnextTop
  Usage      : usage
Description: [deprecated] to be replaced with getAllMarts
Returntype :
Exceptions : none
Caller : caller
getAllMartscodeprevnextTop
  Usage      : getAllMarts(martusers-required, visible as 1-optional)
Description: Replaced the old getAllLocations call
Returntype :
Exceptions : none
Caller : caller
getDatasetByNamecodeprevnextTop
  Usage      : usage
Description: Description
Returntype :
Exceptions : none
Caller : caller
namecodeprevnextTop
  Usage      : my $name = $virtualSchema->name(); 
$virtualSchemaName->name($newname);
Description: sets/gets the name of the VirtualSchema
Returntype : string name
Exceptions : none
Caller : caller
removeLocationcodeprevnextTop
  Usage      : usage
Description: Description
Returntype :
Exceptions : none
Caller : caller
visiblecodeprevnextTop
  Usage      : my $visible = $virtualSchema->visible(); 
$virtualSchema->visible($newname);
Description: sets/gets the visible flag of the VirtualSchema
Returntype : string name
Exceptions : none
Caller : caller
Methods code
_newdescriptionprevnextTop
sub _new {
  my ($self, @param) = @_;
  $self->SUPER::_new(@param);

  $self->addParams(TITLES, @param);
  $self->attr('default', 0);
  $self->attr('locations', []);
  $self->attr('visible',1);
}
addLocationdescriptionprevnextTop
sub addLocation {
  my ($self, $location) = @_;
  my $locations = $self->get('locations');
  push @{$locations}, $location;
}
defaultdescriptionprevnextTop
sub default {
  my ($self, $newName) = @_;

  if ($newName) {
    $self->set('default', $newName);
  }
  return $self->get('default');
}
displayNamedescriptionprevnextTop
sub displayName {
  my ($self, $newDisplayName) = @_;

  if ($newDisplayName) {
    $self->setParam(DISPLAYNAME, $newDisplayName);
  }
  return $self->getParam(DISPLAYNAME);
}
getAllLocationsdescriptionprevnextTop
sub getAllLocations {
  my $self = shift;
  return $self->get('locations');
}
getAllMartsdescriptionprevnextTop
sub getAllMarts {
  	my ($self, $visible) = @_;

	if(!$visible)
	{
		return  $self->get('locations');
	}
	if ($visible == 1)
	{
		my $allMarts = $self->get('locations');
		my $Marts;
		foreach my $mart(@$allMarts)
  		{				
			if($visible eq $mart->visible()) 
			{
  				push @{$Marts}, $mart;  			
  			}
  		}
  		return $Marts;  
	}
}
getDatasetByNamedescriptionprevnextTop
sub getDatasetByName {
  my ($self,$datasetName) = @_;
  my $retDataset;
  LOC:foreach my $location(@{$self->getAllLocations}){
      foreach my $dataset(@{$location->getAllDatasets}){
	  if ($dataset->name eq $datasetName){
	      $retDataset = $dataset;
	      last LOC;
	  }
      }
  }
  return $retDataset;
}



1;
}
getMartByNamedescriptionprevnextTop
sub getMartByName {
  	my ($self, $name) = @_;

		my $allMarts = $self->get('locations');
		my $Marts;
		foreach my $mart(@$allMarts)
  		{				
			if($name eq $mart->name()) 
			{
				return $mart;
  			}
  		}
  		return undef;
}
namedescriptionprevnextTop
sub name {
  my ($self, $newName) = @_;

  if ($newName) {
    $self->setParam(NAME, $newName);
  }
  return $self->getParam(NAME);
}
removeLocationdescriptionprevnextTop
sub removeLocation {
  my ($self,$location) = @_;
  my $locations = $self->getAllLocations;
  my $i = 0;
  foreach my $loc (@$locations){
      if ($loc->name eq $location->name){
	  splice @$locations,$i,1;
	  last;
      }
      $i++;
  }
}
visibledescriptionprevnextTop
sub visible {
  my ($self, $newName) = @_;

  if (defined($newName)) {
    $self->set('visible', $newName);
  }
  return $self->get('visible');
}
General documentation
AUTHOR - 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