Bio::EnsEMBL::Pipeline::DBSQL::Finished StateInfoContainer
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::EnsEMBL::Pipeline::DBSQL::Finished::StateinfoContainer
Package variables
No package variables defined.
Included modules
Bio::EnsEMBL::Pipeline::DBSQL::StateInfoContainer
Inherit
Bio::EnsEMBL::Pipeline::DBSQL::StateInfoContainer
Synopsis
my $dbobj = Bio::EnsEMBL::Pipeline::DBSQL::Finished::DBAdaptor->new(
-host => $dbhost,
-dbname => $dbname,
-user => $dbuser,
-pass => $dbpass,
-port => $dbport,
);
$sic = $dbobj->get_StateInfoContainer;
Description
Module which inherits from StateInfoContainer and overrides specific methods to implement the incremental
updating of the Blast analysis used in the Finished Pipeline.
Methods
fetch_analysis_by_input_idDescriptionCode
fetch_db_versionDescriptionCode
store_input_id_analysisDescriptionCode
Methods description
fetch_analysis_by_input_idcode    nextTop
Fetches all analyses on a specific input ID
which have been completed and don't need to be updated
Takes one string - input ID
and returns a ref to a list of Bio::EnsEMBL::Analysis.
fetch_db_versioncodeprevnextTop
Fetches the db version of a specific input ID and analysis
which have been completed.
Takes one string - input ID
and one analysis object - Bio::EnsEMBL::Analysis
and returns the db version as a string.
Throws an exception if the analysis object does not have a type.
store_input_id_analysiscodeprevnextTop
Stores an input ID, type, analysis and db version searched [optionally runtime info].
Takes an input ID (as string), Bio::EnsEMBL::Analysis object, is_dbversion_saved Boolean
and [optionally runtime_info as string].
Throws an exception if any of the inputs are invalid or if
the analysis object does not have a type.
called by: Job->run_module
Methods code
fetch_analysis_by_input_iddescriptionprevnextTop
sub fetch_analysis_by_input_id {
	my ( $self, $inputId ) = @_;

	my @result;
	my @row;

	my $anaAd = $self->db->get_AnalysisAdaptor();

	my $sth = $self->prepare(
		q{
SELECT analysis_id , db_version
FROM input_id_analysis
WHERE input_id = ? }
); $sth->execute($inputId); while ( my $row = $sth->fetchrow_arrayref ) { my $analysis = $anaAd->fetch_by_dbID( $row->[0] ); my $version = $row->[1]; next unless ($analysis); if ( !$version || $analysis->logic_name =~ /Halfwise/ || $analysis->db_version eq $version ) { #print "Analysis " . $analysis->logic_name . " V. $version\n";
push( @result, $analysis ); } else { #print "Analysis ". $analysis->logic_name." V. $version need to be updated to V. ". $analysis->db_version."\n";
} } return\@ result;
}
fetch_db_versiondescriptionprevnextTop
sub fetch_db_version {
	my ( $self, $inputId, $analysis) = @_;
	my $db_version = '';

	throw("[$analysis] is not a Bio::EnsEMBL::Pipeline::Analysis object")
	  unless $analysis->isa("Bio::EnsEMBL::Pipeline::Analysis");

	my $sth = $self->prepare(
	q  {
SELECT db_version
FROM input_id_analysis
WHERE input_id = ?
AND analysis_id = ? }
); $sth->execute($inputId,$analysis->dbID); while ( my $row = $sth->fetchrow_arrayref ) { $db_version = $row->[0]; } return $db_version;
}
store_input_id_analysisdescriptionprevnextTop
sub store_input_id_analysis {
	my ( $self, $inputId, $analysis, $host, $is_dbversion_saved, $run_time ) =
	  @_;
	throw("[$analysis] is not a Bio::EnsEMBL::Pipeline::Analysis object")
	  unless $analysis->isa("Bio::EnsEMBL::Pipeline::Analysis");

	throw("Invalid inputId [$inputId]")
	  unless $inputId;

	throw("No type defined in analysis obj")
	  unless defined( $analysis->input_id_type );

	if ( defined($run_time) ) {
		my $db_version = $is_dbversion_saved ? $analysis->db_version : 0;
		my $sth = $self->prepare(
			qq{
      		REPLACE INTO input_id_analysis
      		(input_id, input_id_type, analysis_id, created, runhost, db_version , result)
      		values (?, ?, ?, now(), ?, ? , ?)
      	}
		);
		$sth->execute( $inputId, $analysis->input_id_type, $analysis->dbID,
			$host, $db_version, $run_time );
	}
	else {
		my $db_version = $is_dbversion_saved ? $analysis->db_version : 0;
		my $sth = $self->prepare(
			qq{
      	REPLACE INTO input_id_analysis
      	(input_id, input_id_type, analysis_id, created, runhost, db_version)
      	values (?, ?, ?, now(), ?, ?)
      	}
		);
		$sth->execute( $inputId, $analysis->input_id_type, $analysis->dbID,
			$host, $db_version );
	}
}

1;
}
General documentation
FEEDBACKTop
AUTHOR - Mustapha LarbaouiTop
Mustapha Larbaoui <ml6@sanger.ac.uk>
CONTACTTop
Post general queries to anacode@sanger.ac.uk
APPENDIXTop
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _