Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/EnsEMBL/SNP.pm @ 0:1f6dce3d34e0
Uploaded
author | mahtabm |
---|---|
date | Thu, 11 Apr 2013 02:01:53 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1f6dce3d34e0 |
---|---|
1 =head1 LICENSE | |
2 | |
3 Copyright (c) 1999-2012 The European Bioinformatics Institute and | |
4 Genome Research Limited. All rights reserved. | |
5 | |
6 This software is distributed under a modified Apache license. | |
7 For license details, please see | |
8 | |
9 http://www.ensembl.org/info/about/code_licence.html | |
10 | |
11 =head1 CONTACT | |
12 | |
13 Please email comments or questions to the public Ensembl | |
14 developers list at <dev@ensembl.org>. | |
15 | |
16 Questions may also be sent to the Ensembl help desk at | |
17 <helpdesk@ensembl.org>. | |
18 | |
19 =cut | |
20 | |
21 =head1 NAME | |
22 | |
23 Bio::EnsEMBL::SNP | |
24 | |
25 =head1 SYNOPSIS | |
26 | |
27 $snp = new Bio::EnsEMBL::SNP( | |
28 -start => 10, | |
29 -end => 10, | |
30 -strand => 1, | |
31 -source => 'The SNP Consortium', | |
32 -score => 99, # new meaning | |
33 -status => 'suspected', # new | |
34 -alleles => 't|c' # new | |
35 ); | |
36 | |
37 # add it to an annotated sequence | |
38 | |
39 $annseq->add_SeqFeature($feat); | |
40 | |
41 =head1 DESCRIPTION | |
42 | |
43 This class was written because the EnsEMBL::ExternalData::Variation | |
44 object is way too slow. There was simply too much chaining to bioperl | |
45 methods many, many layers deep. This object behaves like a Variation | |
46 but has a much faster constructor, and faster accessors for the relevant | |
47 methods needed by the web. | |
48 | |
49 =head1 METHODS | |
50 | |
51 =cut | |
52 | |
53 | |
54 package Bio::EnsEMBL::SNP; | |
55 use vars qw(@ISA); | |
56 use strict; | |
57 | |
58 | |
59 use Bio::EnsEMBL::ExternalData::Variation; | |
60 use Scalar::Util qw(weaken isweak); | |
61 | |
62 @ISA = qw( Bio::EnsEMBL::ExternalData::Variation ); | |
63 | |
64 | |
65 sub new_fast { | |
66 my $class = shift; | |
67 my $hashref = shift; | |
68 my $self = bless $hashref, $class; | |
69 weaken($self->{adaptor}) if ( ! isweak($self->{adaptor}) ); | |
70 return $self; | |
71 } | |
72 | |
73 sub dbID { | |
74 my $self = shift; | |
75 | |
76 if(@_) { | |
77 $self->{'dbID'} = shift; | |
78 } | |
79 | |
80 return $self->{'dbID'}; | |
81 } | |
82 | |
83 sub position { | |
84 my ($self, $arg) = @_; | |
85 | |
86 if(defined $arg) { | |
87 $self->{_gsf_start} = $arg; | |
88 $self->{_gsf_end} = $arg; | |
89 } | |
90 | |
91 return $self->{_gsf_start}; | |
92 } | |
93 | |
94 sub start { | |
95 my ($self, $arg) = @_; | |
96 | |
97 if(defined $arg) { | |
98 $self->{_gsf_start} = $arg; | |
99 } | |
100 | |
101 return $self->{_gsf_start}; | |
102 } | |
103 | |
104 sub end { | |
105 my ($self, $arg) = @_; | |
106 | |
107 if(defined $arg) { | |
108 $self->{_gsf_end} = $arg; | |
109 } | |
110 | |
111 return $self->{_gsf_end}; | |
112 } | |
113 | |
114 | |
115 sub source { | |
116 my ($self, $arg) = @_; | |
117 | |
118 if(defined $arg) { | |
119 $self->{_source} = $arg; | |
120 } | |
121 | |
122 return $self->{_source}; | |
123 } | |
124 | |
125 sub score { | |
126 my ($self, $arg) = @_; | |
127 | |
128 if(defined $arg) { | |
129 $self->{_gsf_score} = $arg; | |
130 } | |
131 | |
132 return $self->{_gsf_score}; | |
133 } | |
134 | |
135 | |
136 sub source_tag { | |
137 my ($self, $arg) = @_; | |
138 | |
139 if(defined $arg) { | |
140 $self->{_source_tag} = $arg; | |
141 } | |
142 | |
143 return $self->{_source_tag}; | |
144 } | |
145 | |
146 sub source_version { | |
147 my ($self, $arg) = @_; | |
148 | |
149 if(defined $arg) { | |
150 $self->{_source_version} = $arg; | |
151 } | |
152 | |
153 return $self->{_source_version}; | |
154 } | |
155 | |
156 | |
157 =head2 display_name | |
158 | |
159 Arg [1] : none | |
160 Example : print $snp->display_name(); | |
161 Description: This method returns a string that is considered to be | |
162 the 'display' identifier. For snps this is the | |
163 returns the same thing as the id method. | |
164 Returntype : string | |
165 Exceptions : none | |
166 Caller : web drawing code | |
167 | |
168 =cut | |
169 | |
170 sub display_name { | |
171 my $self = shift; | |
172 return $self->id(); | |
173 } | |
174 | |
175 | |
176 | |
177 1; |