Bio::EnsEMBL::Funcgen Experiment
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::EnsEMBL::Funcgen::Experiment
Package variables
No package variables defined.
Included modules
Bio::EnsEMBL::Funcgen::Storable
Bio::EnsEMBL::Utils::Argument qw ( rearrange )
Bio::EnsEMBL::Utils::Exception qw ( throw warning )
Inherit
Bio::EnsEMBL::Funcgen::Storable
Synopsis
use Bio::EnsEMBL::Funcgen::Experiment;
my $array = Bio::EnsEMBL::Funcgen::Experiment->new(
-ADAPTOR => $self,
-NAME => $name,
-GROUP => $group,
-DATE => $date,
-PRIMARY_DESIGN_TYPE => $p_design_type,
-DESCRIPTION => $description,
);
my $db_adaptor = Bio::EnsEMBL::Funcgen::DBSQL::DBAdaptor->new(...);
my $exp_adaptor = $db_adaptor->get_ExperimentAdaptor();
my $exp = $exp_adaptor->fetch_by_name($exp_name)
Description
An Experiment object represents an experiment instance . The data
are stored in the experiment, egroup, target, design_type and
experimental_variable tables.
Methods
add_ExperimentalChipDescriptionCode
dateDescriptionCode
descriptionDescriptionCode
get_ExperimentalChip_by_unique_idDescriptionCode
get_ExperimentalChip_unique_idsDescriptionCode
get_ExperimentalChipsDescriptionCode
groupDescriptionCode
group_idDescriptionCode
mage_xmlDescriptionCode
mage_xml_idDescriptionCode
nameDescriptionCode
newDescriptionCode
primary_design_typeDescriptionCode
Methods description
add_ExperimentalChipcode    nextTop
  Example     : $exp_chip = $exp->add_ExperimentalChip($exp_chip)
Description : Adds and stores an ExperiemntalChip for this Experiment
Returntype : Bio::EnsEMBL::Funcgen::ExperimentalChip
Exceptions : Throws is not passed a valid stored Bio::EnsENBML::Funcgen::ExperimentalChip
Caller : General
Status : At risk
datecodeprevnextTop
  Arg [1]: optional - date, format yyyy-mm-dd
Example: $exp->date('2006-06-09');
Description: Getter/Setter for the date
Returntype : date string
Exceptions : None ? should throw/warn if format not correct
Caller : General
Status : Medium
descriptioncodeprevnextTop
  Arg [1]: string - the experiment description
Example: $exp->description("Human chromosome X TFBS identification");
Description: Getter/Setter for the experiment description
Returntype : string
Exceptions : None
Caller : General
Status : Stable
get_ExperimentalChip_by_unique_idcodeprevnextTop
  Example: $exp_chip = $exp->add_ExperimentalChip($exp_chip)
Description: Adds and stores an ExperiemntalChip for this Experiment
Returntype : Bio::EnsEMBL::Funcgen::ExperimentalChip
Exceptions : Throws if no uid supplied
Caller : General
Status : At risk
get_ExperimentalChip_unique_idscodeprevnextTop
  Example:     foreach my $uid(@{$self->experiment->get_ExperimentalChip_unique_ids()}){ ... }
Description: retrieves all ExperimentalChip unique_ids
Returntype : ListRef
Exceptions : None
Caller : General
Status : At risk
get_ExperimentalChipscodeprevnextTop
  Example: my $exp_chips = @{$exp->get_ExperimentalChips()}
Description: Retrieves all ExperiemntalChips
Returntype : Listref of ExperimentalChips
Exceptions : None
Caller : General
Status : At risk
groupcodeprevnextTop
  Arg [1]: optional - Bio::EnsEMBL::Funcgen::Group
Example: my $exp_group_name = $exp->group->name();
Description: Getter/Setter for the group
Returntype : Bio::EnsEMBL::Funcgen::Group
Exceptions : None
Caller : General
Status : At risk
group_idcodeprevnextTop
  Arg [1]: int - the group dbID corresponding to this experiment
Example: $exp->group_db_id('1');
Description: Getter/Setter for the group_db_id
Returntype : int
Exceptions : None
Caller : General
Status : Stable
mage_xmlcodeprevnextTop
  Arg [1]: string(optional) - MAGE XML
Example: my $xml = $exp->mage_xml();
Description: Getter/Setter for the mage_xml attribute
Returntype : string
Exceptions : None
Caller : General
Status : at risk
mage_xml_idcodeprevnextTop
  Arg [1]: int (optional) - mage_xml_id
Example: $exp->group_db_id('1');
Description: Getter/Setter for the mage_xml attribute
Returntype : string
Exceptions : None
Caller : General
Status : at risk
namecodeprevnextTop
  Arg [1]: string - the name of this experiment
Example: $exp->name('Experiment-1');
Description: Getter/Setter for the experiment name
Returntype : string
Exceptions : None
Caller : General
Status : Stable
newcodeprevnextTop
  Arg [-NAME]: string - the name of this experiment
Arg [-GROUP]: string - the name of the experimental group
Arg [-GROUP_ID]: int - the dbID of the experimental group
Arg [-DATE]: string - the date of the experiment (format?)
Arg [-PRIMARY_DESIGN_TYPE]: string - MGED term for the primary design of teh experiment e.g. binding_site_identification
Arg [-DESCRIPTION]: string - of the experiment
Example : my $array = Bio::EnsEMBL::Funcgen::Experiment->new( -NAME => $name, -GROUP => $group, -DATE => $date, -PRIMARY_DESIGN_TYPE => $p_design_type, -DESCRIPTION => $description, ); Description: Creates a new Bio::EnsEMBL::Funcgen::Experiment object. Returntype : Bio::EnsEMBL::Funcgen::Experiment Exceptions : None ? Should throw if mandatory params not set Caller : General Status : Medium Risk
primary_design_typecodeprevnextTop
  Arg [1]: string - MGED term for primary design type
Example: $exp->primary_design_type('binding_site_identification');
Description: Getter/Setter for the primary design type
Returntype : string
Exceptions : None ? should throw if not MGED term
Caller : General
Status : At risk
Methods code
add_ExperimentalChipdescriptionprevnextTop
sub add_ExperimentalChip {
  my ($self, $echip) = @_;
 

 throw("Must pass a valid stored Bio::EnsEMBL::Funcgen::ExperimentalChip object") 
    if(! $echip->isa("Bio::EnsEMBL::Funcgen::ExperimentalChip") || ! $echip->dbID());
 
  if(! exists $self->{'experimental_chips'}){
    $self->get_ExperimentalChips();
    $self->{'experimental_chips'}->{$echip->unique_id()} = $echip;
    #do this here without checking to avoid probelm of retrieving first stored chip
}elsif(exists $self->{'experimental_chips'}->{$echip->unique_id()}){ warn("You cannot add the same ExperimentalChip(".$echip->unique_id().")to an Experiment more than once, check your code"); }else{ $self->{'experimental_chips'}->{$echip->unique_id()} = $echip; } return;
}
datedescriptionprevnextTop
sub date {
  my $self = shift;
  
  if(@_){
    #Need to validate format here
$self->{'date'} = shift; } return $self->{'date'};
}
descriptiondescriptionprevnextTop
sub description {
  my $self = shift;
  $self->{'description'} = shift if(@_);
  return $self->{'description'};
}
get_ExperimentalChip_by_unique_iddescriptionprevnextTop
sub get_ExperimentalChip_by_unique_id {
  my ($self, $uid) = @_;
  
  my ($echip);

  throw("Must supply a ExperimentalChip unque_id") if(! defined $uid);
  
  $self->{'experimental_chips'} || $self->get_ExperimentalChips();

  if(exists $self->{'experimental_chips'}->{$uid}){
    $echip = $self->{'experimental_chips'}->{$uid};
  }
  #should we warn here if not exists?
return $echip;
}
get_ExperimentalChip_unique_idsdescriptionprevnextTop
sub get_ExperimentalChip_unique_ids {
  my $self = shift;
  
  $self->{'experimental_chips'} || $self->get_ExperimentalChips();

  return [keys %{ $self->{'experimental_chips'}}];
}



#should we add a methods to return just the 
#methods?
#lazy load design_types and exp_variables
#target? Is this a one to one?
1;
}
get_ExperimentalChipsdescriptionprevnextTop
sub get_ExperimentalChips {
  my ($self) = shift;
	
  #should this also store echips?
#Need to retrieve all from DB if not defined, then check whether already present and add and store if not
#what about immediate access to dbID
#should we separate and have add_ExperimentalChip?
if(! exists $self->{'experimental_chips'}){ $self->{'experimental_chips'} = {}; #need to warn about DBAdaptor here?
foreach my $echip(@{$self->adaptor->db->get_ExperimentalChipAdaptor->fetch_all_by_experiment_dbID($self->dbID())}){ $self->{'experimental_chips'}->{$echip->unique_id()} = $echip; } } #is this returning a list or a listref?
return [values %{$self->{'experimental_chips'}}];
}
groupdescriptionprevnextTop
sub group {
  my ($self) = shift;	

  if(@_){
    $self->{'group'} = shift;
  }elsif(! exists $self->{'group'}){
    #this should be group_adaptor->fetch_by_dbID($self->group_id());
throw("Not yet implemented group adaptor"); } return $self->{'group'};
}
group_iddescriptionprevnextTop
sub group_id {
	my ($self) = shift;	

	$self->{'group_id'} = shift if(@_);

	return $self->{'group_id'};
}
mage_xmldescriptionprevnextTop
sub mage_xml {
  my ($self) = shift;	

  $self->{'mage_xml'} = shift if(@_);
  
  #use fetch_attrs?
if(! exists $self->{'mage_xml'} && $self->mage_xml_id()){ $self->{'mage_xml'} = $self->adaptor->fetch_mage_xml_by_Experiment($self); } return (exists $self->{'mage_xml'}) ? $self->{'mage_xml'} : undef;
}
mage_xml_iddescriptionprevnextTop
sub mage_xml_id {
  my $self = shift;	

  $self->{'mage_xml_id'} = shift if @_;
  
  return $self->{'mage_xml_id'};
}
namedescriptionprevnextTop
sub name {
	my ($self) = shift;	

	$self->{'name'} = shift if(@_);

	return $self->{'name'};
}
newdescriptionprevnextTop
sub new {
	my $caller = shift;

	my $class = ref($caller) || $caller;

	my $self = $class->SUPER::new(@_);

	my ($name, $group_id, $group, $date, $p_dtype, $desc, $xml_id, $xml)
		= rearrange( ['NAME', 'GROUP_ID', 'GROUP', 'DATE', 'PRIMARY_DESIGN_TYPE', 'DESCRIPTION', 'MAGE_XML', 'MAGE_XML_ID'], @_ );
	
	$self->name($name)          if defined $name;
	$self->group_id($group_id)  if defined $group_id;
	$self->group($group)        if defined $group;
	$self->date($date)          if defined $date;
	$self->primary_design_type($p_dtype)    if defined $p_dtype;
	$self->description($desc)   if defined $desc;
	$self->mage_xml_id($xml_id) if defined $xml_id;
	$self->mage_xml($xml)       if defined $xml;


	#Need to add mandatory params check here!!
#name, group or group_id
return $self; } ### GENERIC ACCESSOR METHODS ###
}
primary_design_typedescriptionprevnextTop
sub primary_design_type {
  my ($self) = shift;
	
  if(@_){
    #warn "Need to validate design_types against MGED";
$self->{'primary_design_type'} = shift; } return $self->{'primary_design_type'}; } #These convenience methods are to provide a registry for the experimental chips of the experiment
}
General documentation
AUTHORTop
This module was created by Nathan Johnson.
This module is part of the Ensembl project: /
CONTACTTop
Post comments or questions to the Ensembl development list: ensembl-dev@ebi.ac.uk