ensembl-hive  2.7.0
SeqRegionSynonym.pm
Go to the documentation of this file.
1 =head1 LICENSE
2 
3 See the NOTICE file distributed with this work for additional information
4 regarding copyright ownership.
5 
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
9 
10  http://www.apache.org/licenses/LICENSE-2.0
11 
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.
17 
18 =cut
19 
20 
21 =head1 CONTACT
22 
23  Please email comments or questions to the public Ensembl
24  developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.
25 
26  Questions may also be sent to the Ensembl help desk at
27  <http://www.ensembl.org/Help/Contact>.
28 
29 =cut
30 
31 =head1 NAME
32 
34 Object representing an alternatice name.
35 
36 =head1 SYNOPSIS
37 
38 =head1 DESCRIPTION
39 
40 This object holds information about alternative name to
41 Ensembl seq regions.
42 
43 =head1 METHODS
44 
45 =cut
46 
47 package Bio::EnsEMBL::SeqRegionSynonym;
48 
49 use strict;
50 use warnings;
51 no warnings qw(uninitialized);
52 
54 use Bio::Annotation::DBLink;
55 
56 use Bio::EnsEMBL::Utils::Argument qw(rearrange);
57 
58 our @ISA = qw(Bio::EnsEMBL::Storable);
59 
60 =head2 new
61 
62  Args [...] : list of named parameters
63  Example : my $srs = new Bio::EnsEMBL::SeqRegionSynonym(
64  -adaptor => $adaptor,
65  -synonym => $alt_name,
66  -external_db_id => 1234
67  -seq_region_id => 12);
68  Description: Creates a new SeqRegionSynonym object
70  Exceptions : none
71  Caller : Bio::EnsEMBL::SeqRegionSynonymAdaptor
72  Status : At Risk
73 =cut
74 
75 sub new {
76  my ($class, @args) = @_;
77 
78  my $self = bless {},$class;
79 
80  my ( $adaptor, $synonym, $ex_db, $seq_region_id, $dbid, $dbname, $db_display_name) =
81  rearrange ( ['ADAPTOR','SYNONYM','EXTERNAL_DB_ID','SEQ_REGION_ID','DBID', 'DBNAME', 'DB_DISPLAY_NAME'], @args );
82 
83  $self->adaptor($adaptor);
84 
85  if( defined $ex_db ) { $self->external_db_id( $ex_db ) } ;
86  if( defined $seq_region_id ) { $self->seq_region_id( $seq_region_id ) } ;
87  if (defined $dbid) { $self->{'dbID'} = $dbid} ;
88  if (defined $dbname) { $self->{'dbname'} = $dbname };
89  if (defined $db_display_name) { $self->{'db_display_name'} = $db_display_name };
90 
91  if( defined $synonym ) {
92  $self->name( $synonym ) ;
93  } else {
94  warn "No alternative name given\n";
95  return undef;
96  }
97 
98  return $self;
99 }
100 
101 sub name{
102  my $self = shift;
103  $self->{'name'} = shift if(@_);
104  return $self->{'name'};
105 }
106 
107 sub external_db_id{
108  my $self = shift;
109  $self->{'ex_db'} = shift if(@_);
110  return $self->{'ex_db'};
111 }
112 
113 sub seq_region_id{
114  my $self = shift;
115  $self->{'seq_region_id'} = shift if(@_);
116  return $self->{'seq_region_id'};
117 }
118 
119 sub dbname {
120  my $self = shift;
121  $self->{'dbname'} = shift if(@_);
122  return $self->{'dbname'};
123 }
124 
125 sub db_display_name {
126  my $self = shift;
127  $self->{'db_display_name'} = shift if(@_);
128  return $self->{'db_display_name'};
129 }
130 
131 sub summary_as_hash {
132  my $self = shift;
133  my %summary;
134  $summary{name} = $self->name;
135  $summary{dbname} = $self->dbname;
136 
137  return \%summary;
138 }
139 
140 1;
Bio::EnsEMBL::Storable
Definition: Storable.pm:23
Bio::EnsEMBL::SeqRegionSynonym
Definition: SeqRegionSynonym.pm:16
about
public about()
Bio::EnsEMBL::Utils::Argument
Definition: Argument.pm:34