Bio-EnsEMBL

 view release on metacpan or  search on metacpan

lib/Bio/EnsEMBL/DBSQL/AltAlleleGroupAdaptor.pm  view on Meta::CPAN


=head2 update

  Arg [1]    : AltAlleleGroup 
  Description: Removes the existing DB record of an AltAlleleGroup and stores 
               the altered version.
  Returntype : Integer - the return value of the store method, viz. whether the
               insert was successful.
=cut

sub update {
    my $self = shift;
    my $allele_group = shift;
    assert_ref($allele_group, 'Bio::EnsEMBL::AltAlleleGroup', 'allele_group');
    throw "Cannot update an AltAlleleGroup without a dbID. AltAlleleGroups should be fetched from the DB prior to updating them" if ! $allele_group->dbID();
    my $keep_group = 1;
    $self->remove($allele_group, $keep_group);
    return $self->store($allele_group);
}

=head2 remove

lib/Bio/EnsEMBL/DBSQL/AnalysisAdaptor.pm  view on Meta::CPAN

  Arg [1]    : Bio::EnsEMBL::Analysis $anal
  Example    : $adaptor->update($anal)
  Description: Updates this analysis in the database
  Returntype : int 1 if update is performed, undef if it is not
  Exceptions : throw if arg is not an analysis object
  Caller     : ?
  Status     : Stable

=cut

sub update {
  my $self = shift;
  my $a    = shift;

  if (!ref($a) || !$a->isa('Bio::EnsEMBL::Analysis')) {
    throw("Expected Bio::EnsEMBL::Analysis argument.");
  }

  if(!$a->is_stored($self->db())) {
    return;
  }

lib/Bio/EnsEMBL/DBSQL/BaseMetaContainer.pm  view on Meta::CPAN

               the value to update in the meta table
  Example    : $meta_container->update_key_value($key, $value);
  Description: update a value in the meta container, accessable by a key
  Returntype : none
  Exceptions : none
  Caller     : ?
  Status     : Stable

=cut

sub update_key_value {
  my ( $self, $key, $value ) = @_;

  my $sth;

  if ( !$self->_species_specific_key($key) ) {
    $sth =
      $self->prepare( 'UPDATE meta SET meta_value = ? '
        . 'WHERE meta_key = ?'
        . 'AND species_id IS NULL' );
  } else {

lib/Bio/EnsEMBL/DBSQL/BaseMetaContainer.pm  view on Meta::CPAN

        . 'SET meta_value = ? '
        . 'WHERE meta_key = ? '
        . 'AND species_id = ?' );
    $sth->bind_param( 3, $self->species_id(), SQL_INTEGER );
  }

  $sth->bind_param( 1, $value, SQL_VARCHAR );
  $sth->bind_param( 2, $key,   SQL_VARCHAR );
  $sth->execute();

} ## end sub update_key_value


=head2 delete_key

  Arg [1]    : string $key
               The key which should be removed from the database.
  Example    : $meta_container->delete_key('sequence.compression');
  Description: Removes all rows from the meta table which have a meta_key
               equal to $key.
  Returntype : none

lib/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm  view on Meta::CPAN

  Example    : $dbentry_adaptor->update($dbentry);
  Description: Updates the dbprimary_acc, display_label, version, description, info_type
               and info_text of a dbentry in the database.
  Returntype : None
  Exceptions : thrown if the $dbentry is not a Bio::EnsEMBL::DBEntry
  Caller     : general
  Status     : Stable

=cut

sub update {
  my ($self, $dbEntry) = @_;

  if (!defined $dbEntry || !ref $dbEntry || !$dbEntry->isa('Bio::EnsEMBL::DBEntry')) {
    throw("Must update a dbentry object, not a $dbEntry");
  }

  my $update_dbentry_sql = qq(
     UPDATE xref
        SET dbprimary_acc = ?,
            display_label = ?,

lib/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm  view on Meta::CPAN

  $sth->bind_param(3, ($dbEntry->version || q{0}),SQL_VARCHAR);
  $sth->bind_param(4, $dbEntry->description,SQL_VARCHAR);
  $sth->bind_param(5, $dbRef,SQL_INTEGER);
  $sth->bind_param(6, ($dbEntry->info_type || 'NONE'), SQL_VARCHAR);
  $sth->bind_param(7, ($dbEntry->info_text || ''), SQL_VARCHAR);

  $sth->bind_param(8, $dbEntry->dbID(), SQL_INTEGER);

  $sth->execute();

} ## end sub update
    
sub _store_object_xref_mapping {
    my $self = shift;
    my $ensembl_id = shift;
    my $dbEntry = shift;
    my $ensembl_type = shift;
    my $ignore_release = shift;
    
    my $dbc = $self->dbc();
    my $sql_helper = $dbc->sql_helper();

lib/Bio/EnsEMBL/DBSQL/DataFileAdaptor.pm  view on Meta::CPAN

  $self->dbc()->sql_helper()->execute_update(-SQL => $sql, -PARAMS => $params, -CALLBACK => sub {
    my ( $sth, $dbh ) = @_;
    $df->dbID($self->last_insert_id());
    return;
  });
  $df->adaptor($self);
  
  return $df->dbID();
}

sub update {
  my ($self, $df) = @_;
  
  assert_ref($df, 'Bio::EnsEMBL::DataFile', 'datafile');
  
  if (! $df->is_stored($self->db())) {
    $self->store($df);
    return;
  }
  
  my $sql = <<'SQL';

lib/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm  view on Meta::CPAN

  Example    : $gene_adaptor->update($gene);
  Description: Updates the type, analysis, display_xref, is_current and
               description of a gene in the database.
  Returntype : None
  Exceptions : thrown if the $gene is not a Bio::EnsEMBL::Gene
  Caller     : general
  Status     : Stable

=cut

sub update {
  my ($self, $gene) = @_;
  my $update = 0;

  if (!defined $gene || !ref $gene || !$gene->isa('Bio::EnsEMBL::Gene')) {
    throw("Must update a gene object, not a $gene");
  }

  # Get old canonical transcript id
  my $sth = $self->prepare("SELECT canonical_transcript_id FROM gene WHERE gene_id=?");
  $sth->execute($gene->dbID());

lib/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm  view on Meta::CPAN

  $sth->bind_param(8, $gene->version(), SQL_TINYINT);
  $sth->bind_param(9, $gene->dbID(), SQL_INTEGER);

  $sth->execute();

  if (defined($gene->canonical_transcript())) {
    my $transcript_adaptor = $self->db()->get_TranscriptAdaptor();
    $transcript_adaptor->update_canonical_attribute($gene->canonical_transcript()->dbID(), $old_canonical_transcript_id);
  }

} ## end sub update


=head2 update_coords

  Arg [1]    : Bio::EnsEMBL::Gene $gene
               The gene to update
  Example    : $gene_adaptor->update_coords($gene);
  Description: In the event of a transcript being removed, coordinates for the Gene
               need to be reset, but update() does not do this. update_coords 
               fills this niche
  Returntype : None
  Exceptions : thrown if the $gene is not supplied
  Caller     : general

=cut

sub update_coords {
  my ($self, $gene) = @_;
  throw('Must have a gene to update in order to update it') unless ($gene);
  $gene->recalculate_coordinates;
  my $update_sql = qq(
    UPDATE gene
       SET seq_region_start = ?,
           seq_region_end = ?
       WHERE gene_id = ?
    );
  my $sth = $self->prepare($update_sql);

lib/Bio/EnsEMBL/DBSQL/GenomeContainer.pm  view on Meta::CPAN

               If more than one value exists for the statistics, it will be distinguished by its attribute
  Example    : $genome_adaptor->update('coding_cnt', 20769);
  Description: Updates an existing genome statistic in the database
  Returntype : none
  Exceptions :
  Caller     : general
  Status     : Stable

=cut

sub update {
  my ($self, $statistic, $value, $attribute) = @_;

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

  my $update_genome_sql = q{
    UPDATE genome_statistics
       SET value = ?,
       timestamp = now()
  };

lib/Bio/EnsEMBL/DBSQL/IntronSupportingEvidenceAdaptor.pm  view on Meta::CPAN


  Arg[1]      : Bio::EnsEMBL::IntronSupportingEvidence Evidence to update
  Example     : $isea->update($ise);
  Description : Updates all attributes of an evidence object
  Returntype  : None
  Exceptions  : Thrown if the given object is not a IntronSupportingEvidence,
                if the object is not stored and for normal DB errors

=cut

sub update {
  my ($self, $sf) = @_;
  assert_ref($sf, 'Bio::EnsEMBL::IntronSupportingEvidence', 'intron_supporting_evidence');
  if (! $sf->is_stored($self->db())) {
    throw "Cannot update the supporting evidence if it has not already been stored in this database";
  }
  
  my $params = [
    [$sf->analysis()->dbID(), SQL_INTEGER],
    [$sf->slice()->get_seq_region_id(), SQL_INTEGER],
    [$sf->start(), SQL_INTEGER],

lib/Bio/EnsEMBL/DBSQL/MiscSetAdaptor.pm  view on Meta::CPAN

  Arg [1]    : Bio::EnsEMBL::MiscSet $miscset
  Example    : $adaptor->update($miscset)
  Description: Updates this misc_set in the database
  Returntype : int 1 if update is performed, undef if it is not
  Exceptions : throw if arg is not an misc_set object
  Caller     : ?
  Status     : Stable

=cut

sub update {
  my $self = shift;
  my $m    = shift;

  if (!ref($m) || !$m->isa('Bio::EnsEMBL::MiscSet')) {
    throw("Expected Bio::EnsEMBL::MiscSet argument.");
  }

  if(!$m->is_stored($self->db())) {
    return undef;
  }

lib/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm  view on Meta::CPAN

    }
  }
  
  
  $slice->adaptor($self);

  return $seq_region_id;
}


sub update {
  my $self = shift;
  my $slice = shift;

  #
  # Get all of the sanity checks out of the way before storing anything
  #

  if(!ref($slice) || !($slice->isa('Bio::EnsEMBL::Slice') or $slice->isa('Bio::EnsEMBL::LRGSlice'))) {
    throw('Slice argument is required');
  }

lib/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm  view on Meta::CPAN

  Exceptions : thrown if the $transcript is not a Bio::EnsEMBL::Transcript.
               warn if the method is called on a transcript that does not exist 
               in the database.
               Should warn if trying to update the number of attached exons, but
               this is a far more complex process and is not yet implemented.
  Caller     : general
  Status     : Stable

=cut

sub update {
  my ( $self, $transcript ) = @_;

  if (    !defined($transcript)
       || !ref($transcript)
       || !$transcript->isa('Bio::EnsEMBL::Transcript') )
  {
    throw("Must update a transcript object, not a $transcript");
  }

  my $update_transcript_sql = 

lib/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm  view on Meta::CPAN

  $sth->execute();

  # Check if transcript is canonical
  if ($transcript->is_canonical()) {
    my $gene = $transcript->get_Gene();
    my $gene_adaptor = $self->db()->get_GeneAdaptor();
    $gene->canonical_transcript($transcript);
    $gene_adaptor->update($gene);
  }

} ## end sub update


=head2 list_dbIDs

  Example    : @transcript_ids = @{ $t_adaptor->list_dbIDs };
  Description: Gets a list of internal ids for all transcripts in the db.
  Arg[1]     : <optional> int. not 0 for the ids to be sorted by the seq_region.  Returntype : Listref of Ints
  Exceptions : none
  Caller     : general
  Status     : Stable

lib/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm  view on Meta::CPAN

    push(@transcripts, $transcript) if $transcript;
  }

  return \@transcripts;
}

sub _final_clause {
	return ' ORDER BY t.transcript_id'
}

sub update_canonical_attribute {
  my ($self, $transcript_id, $old_transcript_id) = @_;

  # Get canonical attribute id
  my $db = $self->db();
  my $attr_adaptor = $db->get_AttributeAdaptor();
  my $canonical_attrib_id = @{$attr_adaptor->fetch_by_code('is_canonical')}[0];
  throw("No attrib_type_id found for 'is_canonical' attribute in attrib_type table.") if (!defined($canonical_attrib_id));

  # Check if new canonical transcript attribute exists
  my $sth = $self->prepare("SELECT value FROM transcript_attrib WHERE transcript_id=? AND attrib_type_id=?");

lib/Bio/EnsEMBL/IdMapping/ScoredMappingMatrix.pm  view on Meta::CPAN

                Actually delegates to add_Entry(), only there as an intuitively
                named wrapper.
  Return type : Float - the Entry's score
  Exceptions  : thrown on wrong or missing argument
  Caller      : general
  Status      : At Risk
              : under development

=cut

sub update_Entry {
  return $_[0]->add_Entry($_[1]);
}


#
# not needed in the current application, so not implemented
#
sub remove_Entry {
  warning('Method ScoredMappingMatrix->remove_Entry not implemented (yet).');
}

lib/Bio/EnsEMBL/Map/DBSQL/DitagAdaptor.pm  view on Meta::CPAN



=head2 update_ditag

  Arg [1]    : ditag to update
  Description: update an existing ditag with new values
  Returntype : true on success

=cut

sub update_ditag {
  my ($self, $ditag) = @_;

  my $sth = $self->prepare( "UPDATE ditag SET name=?, type=?, tag_count=?, sequence=? where ditag_id=?;" );
  my $result =$sth->execute(
                            $ditag->name,
                            $ditag->type,
                            $ditag->tag_count,
                            $ditag->sequence,
                            $ditag->dbID,
                           );

lib/Bio/EnsEMBL/Map/DBSQL/DitagFeatureAdaptor.pm  view on Meta::CPAN


=head2 update

  Arg [1]    : ditagFeature to update
  Description: update an existing ditagFeature with new values
  Returntype : 1 on success
  Status     : At Risk

=cut

sub update {
  my ($self, $ditagFeature) = @_;

  my $sth = $self->prepare( "UPDATE ditag_feature
                             SET ditag_id=?, seq_region_id=?, seq_region_start=?, seq_region_end=?,
                             seq_region_strand=?, analysis_id=?, hit_start=?, hit_end=?, hit_strand=?,
                             cigar_line=?, ditag_side=?, ditag_pair_id=?
                             where ditag_feature_id=?;" );

  $sth->bind_param(1, $ditagFeature->ditag_id, SQL_INTEGER);
  $sth->bind_param(1, $ditagFeature->seq_region_id, SQL_INTEGER);

lib/Bio/EnsEMBL/Utils/ConversionSupport.pm  view on Meta::CPAN

  Arg[3]      : attrib_type.value
  ARG[4]      : table to update (seq_region_attribute by default)
  Example     : $support->update_attribute(23,name,5);
  Description : uses MySQL to update an attribute table (seq_region_attrib by default)
  Return type : array_ref
  Caller      : general
  Status      : stable

=cut

sub update_attribute {
  my $self = shift;
  my $sr_id = shift;
  my $attrib_code  = shift;
  my $attrib_value = shift;
  my $table        = shift || 'seq_region_attrib';
  my $dbh = $self->get_dbconnection('loutre');
  my $attrib_id = $self->_get_attrib_id($attrib_code,$dbh);
  #update
  my $r = $dbh->do(
    qq(update $table



( run in 0.402 second using v1.01-cache-2.11-cpan-95122f20152 )