3 See the NOTICE file distributed with
this work
for additional information
4 regarding copyright ownership.
6 Licensed under the Apache License, Version 2.0 (the
"License");
7 you may not use
this file except in compliance with the License.
8 You may obtain a copy of the License at
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an
"AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License
for the specific language governing permissions and
16 limitations under the License.
24 Please email comments or questions to the
public Ensembl
25 developers list at <http:
27 Questions may also be sent to the Ensembl help desk at
38 my $operon_transcript =
43 $operon->add_OperonTranscript($operon_transcript);
47 A representation of a polycistronic
transcript from an operon within the Ensembl system. An operon is a collection of one or more polycistronic transcripts, which contain one or more genes.
53 package Bio::EnsEMBL::OperonTranscript;
73 int - 1,-1 tehe strand the operon
transcript is on
77 string - the stable identifier of
this operon
transcript
79 int - the version of the stable identifier of
this operon
transcript
81 string - the date the operon
transcript was created
83 string - the date the operon
transcript was last modified
86 Description: Creates a
new operon
transcript object
97 my $class = ref($caller) || $caller;
98 my $self = $class->SUPER::new(@_);
99 my ( $stable_id, $version, $created_date, $modified_date, $display_label ) =
100 rearrange( [
'STABLE_ID',
'VERSION',
101 'CREATED_DATE',
'MODIFIED_DATE',
'DISPLAY_LABEL' ],
104 $self->stable_id($stable_id);
105 $self->version($version);
106 $self->{
'created_date'} = $created_date;
107 $self->{
'modified_date'} = $modified_date;
108 $self->display_label($display_label);
114 Arg [1] : (optional) String - created date to set (as a UNIX time
int)
115 Example : $gene->created_date(
'1141948800');
116 Description: Getter/setter
for attribute created_date
126 $self->{
'created_date'} = shift
if ( @_ );
127 return $self->{
'created_date'};
133 Arg [1] : (optional) String - modified date to set (as a UNIX time
int)
134 Example : $gene->modified_date(
'1141948800');
135 Description: Getter/setter
for attribute modified_date
145 $self->{
'modified_date'} = shift
if ( @_ );
146 return $self->{
'modified_date'};
152 Arg [1] : (optional) String - the name/label to set
153 Example : $operon->name(
'accBCD');
154 Description: Getter/setter
for attribute name.
155 Returntype : String or undef
164 $self->{
'display_label'} = shift
if (@_);
165 return $self->{
'display_label'};
170 Arg [1] : (optional) String - the stable ID to set
171 Example : $operon->stable_id(
"accR2A");
172 Description: Getter/setter
for stable
id for this operon
transcript.
182 $self->{
'stable_id'} = shift
if (@_);
183 return $self->{
'stable_id'};
188 Arg [1] : (optional) Int - the stable ID version to set
189 Example : $operon->version(1);
190 Description: Getter/setter
for stable
id version
for this operon
transcript.
199 $self->{
'version'} = shift
if(@_);
200 return $self->{
'version'};
203 =head2 stable_id_version
205 Arg [1] : (optional) String - the stable ID with version to set
206 Example : $operon->stable_id(
"accR2A.3");
207 Description: Getter/setter
for stable
id with version.
215 sub stable_id_version {
217 if(my $stable_id = shift) {
218 # See if there's an embedded period, assume that's a
219 # version, might not work for some species but you
220 # should use ->stable_id() and version() if you're worried
222 my $vindex = rindex($stable_id,
'.');
223 # Set the stable_id and version pair depending on if
224 # we found a version delimiter in the stable_id
225 ($self->{stable_id}, $self->{version}) = ($vindex > 0 ?
226 (substr($stable_id,0,$vindex), substr($stable_id,$vindex+1)) :
229 return $self->{stable_id} . ($self->{version} ?
".$self->{version}" :
'');
234 Example : $operon = $ot->operon();
235 Description: getter
for the operon to which
this transcript belongs
244 if ( !exists $self->{
'operon'} ) {
245 if ( defined $self->adaptor() ) {
246 my $ta = $self->
adaptor()->
db()->get_OperonAdaptor();
247 my $operon = $ta->fetch_by_operon_transcript($self);
248 $self->{
'operon'} = $operon;
251 return $self->{
'operon'};
256 Example : $genes = $ot->get_all_Genes();
257 Description: get all the genes that are attached to
this operon
transcript
266 if(! defined $self->{_gene_array}) {
267 if(defined $self->dbID() && defined $self->adaptor()) {
268 my $ta = $self->
adaptor()->
db()->get_OperonTranscriptAdaptor();
269 my $transcripts = $ta->fetch_genes_by_operon_transcript($self);
270 $self->{_gene_array} = $transcripts;
273 $self->{_gene_array} = [];
276 return $self->{_gene_array};
281 Example : $operon->add_gene($gene);
282 Description: Attach a gene to
this polycistronic
transcript
289 my ($self,$gene) = @_;
290 assert_ref($gene,
'Bio::EnsEMBL::Gene');
291 push @{$self->get_all_Genes()},$gene;
298 The dbEntry to be added
299 Example : my $dbe = Bio::EnsEMBL::DBEntery->
new(...);
300 $operon->add_DBEntry($dbe);
301 Description: Associates a DBEntry with
this operon. Note that adding DBEntries
302 will prevent future lazy-loading of DBEntries
for this operon
303 (see get_all_DBEntries).
305 Exceptions : thrown on incorrect argument type
315 unless($dbe && ref($dbe) && $dbe->isa(
'Bio::EnsEMBL::DBEntry')) {
316 throw(
'Expected DBEntry argument');
319 $self->{
'dbentries'} ||= [];
320 push @{$self->{
'dbentries'}}, $dbe;
324 =head2 get_all_Attributes
326 Arg [1] : (optional) String $attrib_code
327 The code of the attribute type to retrieve values
for
328 Example : my ($author) = @{ $ot->get_all_Attributes(
'author') };
329 my @ot_attributes = @{ $ot->get_all_Attributes };
330 Description: Gets a list of Attributes of
this operon
transcript.
331 Optionally just get Attributes
for given code.
333 Exceptions : warning
if gene does not have attached adaptor and attempts lazy
340 sub get_all_Attributes {
342 my $attrib_code = shift;
344 if ( !exists $self->{
'attributes'} ) {
345 if ( !$self->adaptor() ) {
349 my $attribute_adaptor = $self->adaptor->db->get_AttributeAdaptor();
350 $self->{
'attributes'} = $attribute_adaptor->fetch_all_by_OperonTranscript($self);
353 if ( defined $attrib_code ) {
355 grep { uc( $_->code() ) eq uc($attrib_code) }
356 @{ $self->{
'attributes'} };
359 return $self->{
'attributes'};
363 =head2 get_all_DBEntries
365 Arg [1] : (optional) String, external database name
367 Arg [2] : (optional) String, external_db type
369 Example : @dbentries = @{ $gene->get_all_DBEntries() };
371 Description: Retrieves DBEntries (xrefs)
for this operon
transcript. This does
372 *not* include DBEntries that are associated with the
373 transcripts and corresponding translations of
this
374 gene (see get_all_DBLinks()).
376 This method will attempt to lazy-load DBEntries
377 from a database
if an adaptor is available and no
378 DBEntries are present on the gene (i.e. they have not
379 already been added or loaded).
383 Caller : get_all_DBLinks, OperontTranscriptAdaptor::store
388 sub get_all_DBEntries {
389 my ( $self, $db_name_exp, $ex_db_type ) = @_;
391 my $cache_name =
'dbentries';
393 if ( defined($db_name_exp) ) {
394 $cache_name .= $db_name_exp;
397 if ( defined($ex_db_type) ) {
398 $cache_name .= $ex_db_type;
401 # if not cached, retrieve all of the xrefs for this gene
402 if ( !defined( $self->{$cache_name} ) && defined( $self->adaptor() ) ) {
403 $self->{$cache_name} =
404 $self->
adaptor()->
db()->get_DBEntryAdaptor()
405 ->fetch_all_by_Operon( $self->operon(), $db_name_exp, $ex_db_type );
408 $self->{$cache_name} ||= [];
410 return $self->{$cache_name};