Bio::EnsEMBL::Pipeline::DBSQL CompressedDnaAlignFeatureAdaptor
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::EnsEMBL::Pipeline::DBSQL::CompressedDnaAlignFeatureAdaptor - Adaptor for compressed DnaAlignFeatures
Package variables
No package variables defined.
Included modules
Bio::EnsEMBL::DBSQL::BaseAlignFeatureAdaptor
Bio::EnsEMBL::DBSQL::DnaAlignFeatureAdaptor
Bio::EnsEMBL::DnaDnaAlignFeature
Bio::EnsEMBL::Utils::Exception qw ( throw warning )
Inherit
Bio::EnsEMBL::DBSQL::DnaAlignFeatureAdaptor
Synopsis
    $cdafa = Bio::EnsEMBL::Pipeline::DBSQL::CompressedDnaAlignFeatureAdaptor->new
(
$db_adaptor
);
@features = @{$cdafa->fetch_by_Slice($slice)}; $cdafa->store(@features);
Description
This is an adaptor responsible for the retrieval and storage of
CompressedDnaDnaAlignFeatures from the database. This adaptor inherits most of its
functionality from the DnaAlignFeatureAdaptor and BaseFeatureAdaptor
superclasses. It just overrides the store method to allow a the features to be
compressed
Methods
new
No description
Code
store
No description
Code
Methods description
None available.
Methods code
newdescriptionprevnextTop
sub new {
  my ( $class, @args ) = @_;
  my $self = $class->SUPER::new(@args);
  return $self;
}
storedescriptionprevnextTop
sub store {
  my ($self, @feats) = @_;

  throw("Must call store with features") if( scalar(@feats) == 0 );

  my @tabs = $self->_tables;
  my ($tablename) = @{$tabs[0]};

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

  my $sth = $self->prepare
    (
     "UPDATE IGNORE $tablename set evalue = evalue+1 
      WHERE seq_region_id = ? 
      AND seq_region_start = ?
      AND seq_region_end  = ?
      AND seq_region_strand = ?
      AND analysis_id = ?");
  
 FEATURE: foreach my $feat ( @feats ) {
    if( !ref $feat || !$feat->isa("Bio::EnsEMBL::DnaDnaAlignFeature") ) {
      throw("feature must be a Bio::EnsEMBL::DnaDnaAlignFeature,"
            . " not a [".ref($feat)."].");
    }

    if($feat->is_stored($db)) {
      warning("DnaDnaAlignFeature [".$feat->dbID."] is already stored" .
              " in this database.");
      next FEATURE;
    }

    my $hstart = $feat->hstart();
    my $hend   = $feat->hend();
    my $hstrand = $feat->hstrand();
    $self->_check_start_end_strand($hstart,$hend, $hstrand);

    my $cigar_string = $feat->cigar_string();
    if(!$cigar_string) {
      $cigar_string = $feat->length() . 'M';
      warning("DnaDnaAlignFeature does not define a cigar_string.\n" .
              "Assuming ungapped block with cigar_line=$cigar_string .");
    }

    my $hseqname = $feat->hseqname();
    if(!$hseqname) {
      throw("DnaDnaAlignFeature must define an hseqname.");
    }

    if(!defined($feat->analysis)) {
      throw("An analysis must be attached to the features to be stored.");
    }

    #store the analysis if it has not been stored yet
if(!$feat->analysis->is_stored($db)) { $analysis_adaptor->store($feat->analysis()); } my $original = $feat; my $seq_region_id; ($feat, $seq_region_id) = $self->_pre_store($feat); $sth->bind_param(1,$seq_region_id,SQL_INTEGER); $sth->bind_param(2,$feat->start,SQL_INTEGER); $sth->bind_param(3,$feat->end,SQL_INTEGER); $sth->bind_param(4,$feat->strand,SQL_TINYINT); $sth->bind_param(5,$feat->analysis->dbID,SQL_INTEGER); my $result = $sth->execute(); # print " $result \n";
if ($result eq "0E0"){ $self->SUPER::store($original); return; } $original->dbID($sth->{'mysql_insertid'}); $original->adaptor($self); } $sth->finish(); } 1;
}
General documentation
CONTACTTop
Post questions to the EnsEMBL development list <ensembl-dev@ebi.ac.uk>