Commit 0c2c5dc5 authored by Jessica Severin's avatar Jessica Severin
Browse files

added analysis_data table and adaptor.

Estentially a mini filesystem so that data that would normally be stored in
NFS files and referenced via a path, can now be stored in the database and
referenced via a dbID. Data is a LONGTEXT.
Can be used to store configuration data, paramater strings,
BLOSSUM matrix data, uuencode of binary data .....
parent 23b30141
# Perl module for Bio::EnsEMBL::Hive::DBSQL::AnalysisDataAdaptor
#
# Date of creation: 22.03.2004
# Original Creator : Jessica Severin <jessica@ebi.ac.uk>
#
# Copyright EMBL-EBI 2004
#
# You may distribute this module under the same terms as perl itself
# POD documentation - main docs before the code
=head1 NAME
Bio::EnsEMBL::Hive::DBSQL::AnalysisDataAdaptor
=head1 SYNOPSIS
$dataDBA = $db_adaptor->get_AnalysisDataAdaptor;
=head1 DESCRIPTION
analysis_data table holds LONGTEXT data for use by the analysis system.
This data is general purpose and it's up to each analysis to
determine how to use it.
This Adaptor module is used to access/store this data.
=head1 CONTACT
Contact Jessica Severin on implemetation/design detail: jessica@ebi.ac.uk
Contact Ewan Birney on EnsEMBL in general: birney@sanger.ac.uk
=head1 APPENDIX
The rest of the documentation details each of the object methods.
Internal methods are preceded with a _
=cut
# Let the code begin...
package Bio::EnsEMBL::Compara::DBSQL::AnalysisDataAdaptor;
use strict;
use Bio::EnsEMBL::DBSQL::BaseAdaptor;
use Bio::EnsEMBL::Utils::Argument qw(rearrange);
use Bio::EnsEMBL::Utils::Exception qw(throw warning);
our @ISA = qw(Bio::EnsEMBL::DBSQL::BaseAdaptor);
sub fetch_by_dbID {
my ($self, $data_id) = @_;
my $sql = "SELECT data FROM analysis_datae WHERE analysis_data_id = ?";
my $sth = $self->prepare($sql);
$sth->execute($sequence_id);
my ($sequence) = $sth->fetchrow_array();
$sth->finish();
return $sequence;
}
#
# STORE METHODS
#
################
sub store {
my ($self, $data) = @_;
my $data_id;
return 0 unless($data);
my $sth = $self->prepare("SELECT analysis_data_id FROM analysis_data WHERE data = ?");
$sth->execute($data);
($seqID) = $sth->fetchrow_array();
$sth->finish;
if($data_id) {
# print("sequence already stored as id $seqID\n");
return $data_id;
}
my $sth2 = $self->prepare("INSERT INTO analysis_data (data) VALUES (?)");
$sth2->execute($data);
$data_id = $sth2->{'mysql_insertid'};
$sth2->finish;
return $data_id;
}
1;
......@@ -190,6 +190,28 @@ CREATE TABLE analysis_job_file (
);
------------------------------------------------------------------------------------
--
-- Table structure for table 'analysis_data'
--
-- overview:
-- Table which holds LONGTEXT data for use by the analysis system.
-- This data is general purpose and it's up to each analysis to
-- determine how to use it
--
-- semantics:
-- analysis_data_id - primary id
-- data - text blob which holds the data
CREATE TABLE analysis_data (
analysis_data_id int(10) NOT NULL auto_increment,
data longtext,
PRIMARY KEY (analysis_data_id),
KEY data (data(7))
);
------------------------------------------------------------------------------------
--
-- Table structure for table 'analysis_stats'
......@@ -220,4 +242,3 @@ CREATE TABLE analysis_stats (
UNIQUE KEY (analysis_id)
);
Markdown is supported
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