Skip to content
Snippets Groups Projects
Commit 5c42e464 authored by Arne Stabenau's avatar Arne Stabenau
Browse files

aded attributes description and display_label

parent 5ef007e4
No related branches found
No related tags found
No related merge requests found
...@@ -31,7 +31,9 @@ Bio::EnsEMBL::Analysis.pm - Stores details of an analysis run ...@@ -31,7 +31,9 @@ Bio::EnsEMBL::Analysis.pm - Stores details of an analysis run
-module => $module, -module => $module,
-module_version => $module_version, -module_version => $module_version,
-parameters => $parameters, -parameters => $parameters,
-created => $created -created => $created,
-desccription => 'some warm words about this analysis'
-display_label => 'UNIprot alignment'
); );
=head1 DESCRIPTION =head1 DESCRIPTION
...@@ -91,7 +93,7 @@ sub new { ...@@ -91,7 +93,7 @@ sub new {
my ($id, $adaptor, $db, $db_version, $db_file, $program, $program_version, my ($id, $adaptor, $db, $db_version, $db_file, $program, $program_version,
$program_file, $gff_source, $gff_feature, $module, $module_version, $program_file, $gff_source, $gff_feature, $module, $module_version,
$parameters, $created, $logic_name ) = $parameters, $created, $logic_name, $description, $display_label ) =
rearrange([qw(ID rearrange([qw(ID
ADAPTOR ADAPTOR
...@@ -108,6 +110,8 @@ sub new { ...@@ -108,6 +110,8 @@ sub new {
PARAMETERS PARAMETERS
CREATED CREATED
LOGIC_NAME LOGIC_NAME
DESCRIPTION
DISPLAY_LABEL
)],@args); )],@args);
$self->dbID ($id); $self->dbID ($id);
...@@ -125,7 +129,8 @@ sub new { ...@@ -125,7 +129,8 @@ sub new {
$self->parameters ($parameters); $self->parameters ($parameters);
$self->created ($created); $self->created ($created);
$self->logic_name ( $logic_name ); $self->logic_name ( $logic_name );
$self->description( $description );
$self->display_label( $display_label );
return $self; # success - we hope! return $self; # success - we hope!
} }
...@@ -437,6 +442,49 @@ sub has_database{ ...@@ -437,6 +442,49 @@ sub has_database{
} }
=head2 description
Arg [1] : string $description
Example : none
Description: get/set for attribute description
Returntype : string
Exceptions : none
Caller : general
=cut
sub description {
my ($self,$arg) = @_;
if (defined($arg)) {
$self->{_description} = $arg;
}
return $self->{_description};
}
=head2 display_label
Arg [1] : string $display_label
Example : none
Description: get/set for attribute display_label
Returntype : string
Exceptions : none
Caller : general
=cut
sub display_label {
my ($self,$arg) = @_;
if (defined($arg)) {
$self->{_display_label} = $arg;
}
return $self->{_display_label};
}
=head2 compare =head2 compare
Arg 1 : Bio::EnsEMBL::Analysis $ana Arg 1 : Bio::EnsEMBL::Analysis $ana
......
...@@ -96,13 +96,15 @@ sub fetch_all { ...@@ -96,13 +96,15 @@ sub fetch_all {
$self->{_logic_name_cache} = {}; $self->{_logic_name_cache} = {};
my $sth = $self->prepare( q { my $sth = $self->prepare( q {
SELECT analysis_id, logic_name, SELECT analysis.analysis_id, logic_name,
program, program_version, program_file, program, program_version, program_file,
db, db_version, db_file, db, db_version, db_file,
module, module_version, module, module_version,
gff_source, gff_feature, gff_source, gff_feature,
created, parameters created, parameters, description, display_label
FROM analysis } ); FROM analysis
LEFT JOIN analysis_description
ON analysis.analysis_id = analysis_description.analysis_id } );
$sth->execute; $sth->execute;
while( $rowHashRef = $sth->fetchrow_hashref ) { while( $rowHashRef = $sth->fetchrow_hashref ) {
...@@ -209,14 +211,16 @@ sub fetch_by_dbID { ...@@ -209,14 +211,16 @@ sub fetch_by_dbID {
} }
my $query = q{ my $query = q{
SELECT analysis_id, logic_name, SELECT analysis.analysis_id, logic_name,
program, program_version, program_file, program, program_version, program_file,
db, db_version, db_file, db, db_version, db_file,
module, module_version, module, module_version,
gff_source, gff_feature, gff_source, gff_feature,
created, parameters created, parameters, description, display_label
FROM analysis FROM analysis
WHERE analysis_id = ? }; LEFT JOIN analysis_description
ON analysis.analysis_id = analysis_description.analysis_id
WHERE analysis.analysis_id = ? };
my $sth = $self->prepare($query); my $sth = $self->prepare($query);
$sth->execute( $id ); $sth->execute( $id );
...@@ -256,13 +260,15 @@ sub fetch_by_logic_name { ...@@ -256,13 +260,15 @@ sub fetch_by_logic_name {
} }
my $sth = $self->prepare( " my $sth = $self->prepare( "
SELECT analysis_id, logic_name, SELECT analysis.analysis_id, logic_name,
program, program_version, program_file, program, program_version, program_file,
db, db_version, db_file, db, db_version, db_file,
module, module_version, module, module_version,
gff_source, gff_feature, gff_source, gff_feature,
created, parameters created, parameters, description, display_label
FROM analysis FROM analysis
LEFT JOIN analysis_description
ON analysis.analysis_id = analysis_description.analysis_id
WHERE logic_name = ?" ); WHERE logic_name = ?" );
$sth->execute($logic_name); $sth->execute($logic_name);
...@@ -339,7 +345,9 @@ sub store { ...@@ -339,7 +345,9 @@ sub store {
module = ?, module = ?,
module_version = ?, module_version = ?,
gff_source = ?, gff_source = ?,
gff_feature = ? } ); gff_feature = ?
} );
$rows_inserted = $sth->execute $rows_inserted = $sth->execute
( $analysis->created, ( $analysis->created,
$analysis->logic_name, $analysis->logic_name,
...@@ -371,7 +379,8 @@ sub store { ...@@ -371,7 +379,8 @@ sub store {
module = ?, module = ?,
module_version = ?, module_version = ?,
gff_source = ?, gff_source = ?,
gff_feature = ? } ); gff_feature = ?
} );
$rows_inserted = $sth->execute $rows_inserted = $sth->execute
( $analysis->logic_name, ( $analysis->logic_name,
...@@ -385,7 +394,7 @@ sub store { ...@@ -385,7 +394,7 @@ sub store {
$analysis->module, $analysis->module,
$analysis->module_version, $analysis->module_version,
$analysis->gff_source, $analysis->gff_source,
$analysis->gff_feature $analysis->gff_feature,
); );
} }
...@@ -405,11 +414,22 @@ sub store { ...@@ -405,11 +414,22 @@ sub store {
$dbID = $new_analysis->dbID(); $dbID = $new_analysis->dbID();
$analysis->created($new_analysis->created()); $analysis->created($new_analysis->created());
$sth->finish();
} else { } else {
$dbID = $sth->{'mysql_insertid'}; $dbID = $sth->{'mysql_insertid'};
$sth->finish();
# store desccription and display_label so they are there
if( defined( $analysis->description() ) ||
defined( $analysis->display_label() )) {
$sth = $self->prepare( "INSERT IGNORE INTO TABLE analysis_description ".
"SET analysis_id = ?, display_label = ?, ".
" description = ? " );
$sth->execute( $dbID, $analysis->display_label(), $analysis->description() );
$sth->finish();
}
} }
$sth->finish();
$self->{_cache}->{$dbID} = $analysis; $self->{_cache}->{$dbID} = $analysis;
$self->{_logic_name_cache}{lc($analysis->logic_name)} = $analysis; $self->{_logic_name_cache}{lc($analysis->logic_name)} = $analysis;
...@@ -450,14 +470,14 @@ sub update { ...@@ -450,14 +470,14 @@ sub update {
"SET created = ?, logic_name = ?, db = ?, db_version = ?, db_file = ?, ". "SET created = ?, logic_name = ?, db = ?, db_version = ?, db_file = ?, ".
" program = ?, program_version = ?, program_file = ?, ". " program = ?, program_version = ?, program_file = ?, ".
" parameters = ?, module = ?, module_version = ?, ". " parameters = ?, module = ?, module_version = ?, ".
" gff_source = ?, gff_feature = ? " . " gff_source = ?, gff_feature = ?, description = ? " .
"WHERE analysis_id = ?"); "WHERE analysis_id = ?");
$sth->execute $sth->execute
($a->created, $a->logic_name, $a->db, $a->db_version, $a->db_file, ($a->created, $a->logic_name, $a->db, $a->db_version, $a->db_file,
$a->program, $a->program_version, $a->program_file, $a->program, $a->program_version, $a->program_file,
$a->parameters, $a->module, $a->module_version, $a->parameters, $a->module, $a->module_version,
$a->gff_source, $a->gff_feature, $a->gff_source, $a->gff_feature,$a->description,
$a->dbID); $a->dbID);
$sth->finish(); $sth->finish();
...@@ -586,7 +606,9 @@ sub _objFromHashref { ...@@ -586,7 +606,9 @@ sub _objFromHashref {
-module_version => $rowHash->{module_version}, -module_version => $rowHash->{module_version},
-parameters => $rowHash->{parameters}, -parameters => $rowHash->{parameters},
-created => $rowHash->{created}, -created => $rowHash->{created},
-logic_name => $rowHash->{logic_name} -logic_name => $rowHash->{logic_name},
-description => $rowHash->{description},
-display_label => $rowHash->{display_label}
); );
return $analysis; return $analysis;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment