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.
23 Please email comments or questions to the
public Ensembl
24 developers list at <http:
26 Questions may also be sent to the Ensembl help desk at
37 # fetch a gene from the db and create a lightweight gene object from it
38 my $gene = $gene_adaptor->fetch_by_stable_id(
'ENSG000345437');
40 $gene->dbID, $gene->stable_id,
41 $gene->version, $gene->created_date,
42 $gene->modified_date, $gene->start,
43 $gene->end, $gene->strand,
44 $gene->slice->seq_region_name, $gene->biotype,
45 $gene->analysis->logic_name,
50 This is a lightweight gene
object for the stable Id mapping. See the
68 package Bio::EnsEMBL::IdMapping::TinyGene;
70 # internal data structure (array indices):
84 no warnings
'uninitialized';
94 Arg[1] : (optional) Int - the gene
's start coordinate
95 Description : Getter/setter for the gene's start coordinate.
106 $self->[5] = shift if (@_);
113 Arg[1] : (optional) Int - the gene
's end coordinate
114 Description : Getter/setter for the gene's end coordinate.
125 $self->[6] = shift if (@_);
132 Arg[1] : (optional) Int - the gene
's strand
133 Description : Getter/setter for the gene's strand.
144 $self->[7] = shift if (@_);
149 =head2 seq_region_name
151 Arg[1] : (optional) String - seq_region name
152 Description : Getter/setter
for the seq_region name of the slice the gene is
162 sub seq_region_name {
164 $self->[8] = shift if (@_);
171 Arg[1] : (optional) String - the gene
's biotype
172 Description : Getter/setter for the gene's biotype.
183 $self->[9] = shift if (@_);
191 Arg[1] : (optional) String - the gene
's analysis' logic_name
192 Description : Getter/setter
for the gene
's analysis' logic_name.
203 $self->[10] = shift if (@_);
209 =head2 add_Transcript
213 Example : $tiny_gene->add_Transcript($tiny_transcript);
216 Exceptions : thrown on wrong or missing argument
227 unless ($tr && $tr->isa(
'Bio::EnsEMBL::IdMapping::TinyTranscript')) {
228 throw(
'Need a Bio::EnsEMBL::IdMapping::TinyTranscript.');
231 push @{ $self->[11] }, $tr;
235 =head2 get_all_Transcripts
237 Example :
foreach my $tr (@{ $tiny_gene->get_all_Transcripts }) {
238 # do something with transcript
240 Description : Returns all transcripts attached to that gene.
249 sub get_all_Transcripts {
250 return $_[0]->[11] || [];
256 Description : Returns the gene length (distance between start and end).
267 return ($self->end - $self->start + 1);