From: <sh...@us...> - 2002-07-23 16:18:03
|
Update of /cvsroot/miamexpress/scripts/magexpress/BioDataCube In directory usw-pr-cvs1:/tmp/cvs-serv3280/BioDataCube Added Files: ExperimentBioDataCube.pm Log Message: say Welcome to some other parts of MIAMExpress into MAGE ;) --- NEW FILE: ExperimentBioDataCube.pm --- #!/sw/arch/bin/perl -w #------------------------------------------------------------------------------ # European Molecular Biology Laboratory # Eoropean Bioinformatic Institute # Microarray Informatics #------------------------------------------------------------------------------ # ExperimentBioDataCube # # Path: ../scripts/magexpress/BioDataCube/ExperimentBioDataCube.pm # # Description: # This is ExperimentBioDataCube class which is inherited from # Bio::MAGE::BioDataCube class. # # Ver Author Date Comments #------------------------------------------------------------------------------ # 1.0 Mohammad Shoja 23/07/02 Create #------------------------------------------------------------------------------ package ExperimentBioDataCube; use strict; use Class::ObjectTemplate; use Bio::MAGE::BioAssayData::BioDataCube; use MX_const; use lib MX_INC_LIST; # For interaction with MIAMExpress database use MX_dbapi1; use MX_dbapi2; use MX_init; use MX_logging; use magexpress; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); require Exporter; @ISA = qw(Class::ObjectTemplate Bio::MAGE::BioAssayData::BioDataCube Exporter); # Items to export into callers namespace by default. Note: do not export # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. @EXPORT_OK = qw(); #------------------------------------------------------------------------------ # SetAllAssociations # # Argument consideration: # # Return value: # It returns appropriate error code or STATUS_OK. # # Ver Author Date Comments #------------------------------------------------------------------------------ # 1.0 Mohammad 22/04/02 Create #------------------------------------------------------------------------------ # Description: # Sets all associations of DerivedBioAssayDescription object, this method actually # call all other SetAssociation() methos which are listed below. #------------------------------------------------------------------------------ sub SetAllAssociations { my ($self, $subid) = @_; my $rc = STATUS_OK; $self->SetAllAssociations_self($subid); $self->SetAllAssocoations_ofAssociatedObjects($subid); return $rc; } #------------------------------------------------------------------------------ # SetAllAssociations_self # # Argument consideration: # # submission ID # (IN) # # Return value: # It returns appropriate error code or STATUS_OK. # # Ver Author Date Comments #------------------------------------------------------------------------------ # 1.0 Mohammad 17/04/02 Create #------------------------------------------------------------------------------ # Description: # Sets all associations of DerivedBioAssayDescription object, this method # actually call all other SetAssociation() methos which are listed below. #------------------------------------------------------------------------------ sub SetAllAssociations_self { my ($self, $subid) = @_; my $rc = STATUS_OK; return $rc; } #------------------------------------------------------------------------------ # SetAllAssocoations_ofAssociatedObjects # # Argument consideration: # # Return value: # It returns appropriate error code or STATUS_OK. # # Ver Author Date Comments #------------------------------------------------------------------------------ # 1.0 Mohammad 02/05/02 Create #------------------------------------------------------------------------------ # Description: # Sets all associations of all associated objects. #------------------------------------------------------------------------------ sub SetAllAssocoations_ofAssociatedObjects { my ($self, $subid) = @_; my $rc = STATUS_OK; # associations are handled as sub-elements of the current element # and we use the association meta-data to instruct how to represent # each association # # We use the IxHash module because the associations are ordered # in the same order the DTD expects to receive them, and IxHash # preserves insertion order tie my %assns_hash, 'Tie::IxHash', $self->associations(); foreach my $association (keys %assns_hash) { my $association_obj; { no strict 'refs'; my $getter_method = 'get'.ucfirst($association); $association_obj = $self->$getter_method(); } if (defined $association_obj) { my @association_objects; my $cardinality = $assns_hash{$association}->cardinality(); if (($cardinality eq CARD_1_TO_N) || ($cardinality eq CARD_0_TO_N)) { @association_objects = @$association_obj; } else { @association_objects = ($association_obj); } foreach $association_obj (@association_objects) { if (defined $association_obj) { $association_obj->SetAllAssociations($subid); } } } } return $rc; } #------------------------------------------------------------------------------ # LoadData # # Argument consideration: # # Return value: # It returns appropriate error code or STATUS_OK. # # Ver Author Date Comments #------------------------------------------------------------------------------ # 1.0 Mohammad 22/04/02 Create #------------------------------------------------------------------------------ # Description: # Load the data from MIAMExpress database into the ExperimentDescription object. # It returns appropriate error code or STATUS_OK #------------------------------------------------------------------------------ sub LoadData { my ($self, $subid) = @_; my $rc = STATUS_OK; $self->LoadData_self($subid); $self->LoadData_ofAssociatedObjects($subid); return $rc; } #------------------------------------------------------------------------------ # LoadData_self # # Argument consideration: # # Return value: # It returns appropriate error code or STATUS_OK. # # Ver Author Date Comments #------------------------------------------------------------------------------ # 1.0 Mohammad 23/07/02 Create #------------------------------------------------------------------------------ # Description: # Load data of self Object #------------------------------------------------------------------------------ sub LoadData_self { my ($self, $subid) = @_; my $rc = STATUS_OK; my $exprfnl = new SX_TEXPRFNL; $exprfnl->texprfnl_subid( $subid); $rc = MX_DB_GetExperimentFinalData( $subid, $exprfnl); if ($rc != STATUS_OK && $rc != REC_NOT_FOUND ) { MX_log_err("LoadData_self:",MX_ERR_GEN,__FILE__,__LINE__, "Error in getting experiment final data from database"); return $rc; } # Loading the data in object $self->setCube($exprfnl->texprfnl_datafile); return $rc; } #------------------------------------------------------------------------------ # LoadData_ofAssociatedObjects # # Argument consideration: # # Return value: # It returns appropriate error code or STATUS_OK. # # Ver Author Date Comments #------------------------------------------------------------------------------ # 1.0 Mohammad 26/04/02 Create #------------------------------------------------------------------------------ # Description: # Load data of all Associated Objects #------------------------------------------------------------------------------ sub LoadData_ofAssociatedObjects { my ($self , $subid) = @_; my $rc = STATUS_OK; # associations are handled as sub-elements of the current element # and we use the association meta-data to instruct how to represent # each association # # We use the IxHash module because the associations are ordered # in the same order the DTD expects to receive them, and IxHash # preserves insertion order tie my %assns_hash, 'Tie::IxHash', $self->associations(); foreach my $association (keys %assns_hash) { my $association_obj; { no strict 'refs'; $association_obj = $self->$association(); } if (defined $association_obj) { my @association_objects; my $cardinality = $assns_hash{$association}->cardinality(); if (($cardinality eq CARD_1_TO_N) || ($cardinality eq CARD_0_TO_N)) { @association_objects = @$association_obj; } else { @association_objects = ($association_obj); } foreach $association_obj (@association_objects) { if (defined $association_obj) { $association_obj->LoadData($subid); } } } } return $rc; } #------------------------------------------------------------------------------ # ReturnOwnRef # # Argument consideration: # # Return value: # It returns appropriate error code or STATUS_OK. # # Ver Author Date Comments #------------------------------------------------------------------------------ # 1.0 Mohammad 08/05/02 Create #------------------------------------------------------------------------------ # Description: # This method create a self object and return its reference #------------------------------------------------------------------------------ sub ReturnOwnRef { return ExperimentBioDataCube->new(); } # ObjectTemplate automagically creates a new() method for us # that method invokes $self->initialize() after first setting all # parameters specified in invocation sub initialize { my $self = shift; } 1; |