sub _objFromHashref
{ my $self = shift;
my $rowHash = shift;
my $analysis = Bio::EnsEMBL::Pipeline::Analysis->new
(
-id => $rowHash->{analysis_id},
-adaptor => $self,
-db => $rowHash->{db},
-db_file => $rowHash->{db_file},
-db_version => $rowHash->{db_version},
-program => $rowHash->{program},
-program_version => $rowHash->{program_version},
-program_file => $rowHash->{program_file},
-gff_source => $rowHash->{gff_source},
-gff_feature => $rowHash->{gff_feature},
-module => $rowHash->{module},
-module_version => $rowHash->{module_version},
-parameters => $rowHash->{parameters},
-created => $rowHash->{created},
-logic_name => $rowHash->{logic_name},
);
my $type = $self->fetch_analysis_input_id_type($analysis);
$analysis->input_id_type($type);
return $analysis; } |
sub store
{
my $self = shift;
my $analysis = shift;
if( !$analysis || !($analysis->isa('Bio::EnsEMBL::Pipeline::Analysis'))) {
throw("called store on Pipeline::AnalysisAdaptor with a [$analysis]");
}
$analysis->dbID && $analysis->adaptor && ( $analysis->adaptor() == $self ) &&
return $analysis->dbID;
my $dbID;
if( $dbID = $self->exists( $analysis )) {
$analysis->adaptor( $self );
$analysis->dbID( $dbID );
return $dbID;
}
if( !$analysis->logic_name ) {
throw("Must have a logic name on the analysis object");
}
if (!$analysis->input_id_type) {
throw("Must have an input_id_type");
}
if($analysis->created ) {
my $sth = $self->prepare( q{ INSERT IGNORE INTO analysis SET created = ?, logic_name = ?, db = ?, db_version = ?, db_file = ?, program = ?, program_version = ?, program_file = ?, parameters = ?, module = ?, module_version = ?, gff_source = ?, gff_feature = ? } );
$sth->execute
( $analysis->created,
$analysis->logic_name,
$analysis->db,
$analysis->db_version,
$analysis->db_file,
$analysis->program,
$analysis->program_version,
$analysis->program_file,
$analysis->parameters,
$analysis->module,
$analysis->module_version,
$analysis->gff_source,
$analysis->gff_feature
);
$dbID = $sth->{'mysql_insertid'};
} else {
my $sth = $self->prepare( q{
INSERT IGNORE INTO analysis SET created = now(), logic_name = ?, db = ?, db_version = ?, db_file = ?, program = ?, program_version = ?, program_file = ?, parameters = ?, module = ?, module_version = ?, gff_source = ?, gff_feature = ? } );
$sth->execute
( $analysis->logic_name,
$analysis->db,
$analysis->db_version,
$analysis->db_file,
$analysis->program,
$analysis->program_version,
$analysis->program_file,
$analysis->parameters,
$analysis->module,
$analysis->module_version,
$analysis->gff_source,
$analysis->gff_feature
);
$dbID = $sth->{'mysql_insertid'};
if( $dbID ) {
$sth = $self->prepare( q{ SELECT created FROM analysis WHERE analysis_id = ? } );
$sth->execute( $dbID );
$analysis->created( ($sth->fetchrow_array)[0] );
}
}
$self->{_cache}->{$dbID} = $analysis;
$self->{_logic_name_cache}{lc($analysis->logic_name)} = $analysis;
$analysis->adaptor( $self );
$analysis->dbID( $dbID );
if($analysis->input_id_type){
my $sql = 'insert into input_id_type_analysis(input_id_type, analysis_id) values(?, ?)';
my $sth = $self->prepare($sql);
$sth->execute($analysis->input_id_type, $analysis->dbID);
}
return $dbID; } |
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _