Bio-EnsEMBL

 view release on metacpan or  search on metacpan

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

    $rp_st->bind_param(7, $rnaproduct->version(),   SQL_INTEGER);
  }
  $rp_st->bind_param(  8, $rnaproduct->type_code(), SQL_VARCHAR);
  $rp_st->execute();
  $rp_st->finish();

  # Retrieve the newly assigned dbID
  my $rp_dbID = $self->last_insert_id('rnaproduct_id', undef, 'rnaproduct');

  # Store attributes
  $rnaproduct->synchronise_attributes();
  my $attr_adaptor = $db->get_AttributeAdaptor();
  $attr_adaptor->store_on_RNAProduct($rp_dbID,
                                     $rnaproduct->get_all_Attributes());

  # Store xrefs
  my $dbe_adaptor = $db->get_DBEntryAdaptor();
  for my $dbe (@{ $rnaproduct->get_all_DBEntries() }) {
    $dbe_adaptor->store($dbe, $rp_dbID, 'RNAProduct', 1);
  }

lib/Bio/EnsEMBL/RNAProduct.pm  view on Meta::CPAN

  $summary{'rnaproduct_id'} = $id;
  $summary{'genomic_start'} = $self->genomic_start;
  $summary{'genomic_end'} = $self->genomic_end;
  $summary{'length'} = $self->length;
  my $transcript = $self->transcript;
  $summary{'Parent'} = $transcript->display_id;
  return \%summary;
}


=head2 synchronise_attributes

  Example       : $rnaproduct->synchronise_attributes();
  Description   : Some RNAProduct attributes, e.g. stem-loop arm in case
                  of MicroRNA, use a local cache of their value for
                  convenience. Unless the corresponding setters update both
                  the cache value and the attribute (which would defeat
                  the convenience thing), we have to make sure the former
                  get propagated to the latter before storing the object
                  in the database:
                   - if no corresponding attribute exists, create one;
                   - if there is one, update its value.
                  Class-specific maps of attributes to synchronise are
                  provided by
                  RNAProductTypeMapper::class_attribute_cache_map() .
  Returntype    : none
  Exceptions    : throws if the object contains multiple attributes with the
                  given code and the choice which one to update is
                  ambiguous.
  Caller        : RNAProductAdaptor
  Status        : At Risk (In Development)

=cut

sub synchronise_attributes {
  my ($self) = @_;

  my $attribute_cache_map = Bio::EnsEMBL::Utils::RNAProductTypeMapper::mapper()
    ->class_attribute_cache_map(ref($self));

  while (my ($cache_key, $attr_code) = each %{$attribute_cache_map}) {
    my $existing_attributes = $self->get_all_Attributes($attr_code);
    my $n_existing_attrs = scalar @{$existing_attributes};
    if ($n_existing_attrs > 0) {
      # At the moment we do not support multiple occurrences of target

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

}


=head2 class_attribute_cache_map

  Arg [1]    : string $class_name - fully qualified RNA-product class name
  Example    : my $attr_cache_map
                 = $mapper->class_attribute_cache_map( 'Bio::EnsEMBL::MicroRNA' );
  Description: For the given name of a class representing a mature RNA
               product, returns the map indicating which local members variables
               should be synchronised with which Attributes.
  Returntype : hashref
  Exceptions : throw if the class does not represent known RNA-product type
  Caller     : internal
  Status     : Stable

=cut

sub class_attribute_cache_map {
  my ( $self, $class_name ) = @_;



( run in 0.317 second using v1.01-cache-2.11-cpan-0d8aa00de5b )