| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
############################################################################### |
|
2
|
|
|
|
|
|
|
# # |
|
3
|
|
|
|
|
|
|
# Copyright © 2012-2013 -- IRB/INSERM # |
|
4
|
|
|
|
|
|
|
# (Institut de Recherche en Biothérapie / # |
|
5
|
|
|
|
|
|
|
# Institut National de la Santé et de la # |
|
6
|
|
|
|
|
|
|
# Recherche Médicale) # |
|
7
|
|
|
|
|
|
|
# # |
|
8
|
|
|
|
|
|
|
# Auteurs/Authors: Jerôme AUDOUX # |
|
9
|
|
|
|
|
|
|
# Nicolas PHILIPPE # |
|
10
|
|
|
|
|
|
|
# # |
|
11
|
|
|
|
|
|
|
# ------------------------------------------------------------------------- # |
|
12
|
|
|
|
|
|
|
# # |
|
13
|
|
|
|
|
|
|
# Ce fichier fait partie de la suite CracTools qui contient plusieurs pipeline# |
|
14
|
|
|
|
|
|
|
# intégrés permettant de traiter les évênements biologiques présents dans du # |
|
15
|
|
|
|
|
|
|
# RNA-Seq. Les CracTools travaillent à partir d'un fichier SAM de CRAC et d'un# |
|
16
|
|
|
|
|
|
|
# fichier d'annotation au format GFF3. # |
|
17
|
|
|
|
|
|
|
# # |
|
18
|
|
|
|
|
|
|
# Ce logiciel est régi par la licence CeCILL soumise au droit français et # |
|
19
|
|
|
|
|
|
|
# respectant les principes de diffusion des logiciels libres. Vous pouvez # |
|
20
|
|
|
|
|
|
|
# utiliser, modifier et/ou redistribuer ce programme sous les conditions de # |
|
21
|
|
|
|
|
|
|
# la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA sur # |
|
22
|
|
|
|
|
|
|
# le site "http://www.cecill.info". # |
|
23
|
|
|
|
|
|
|
# # |
|
24
|
|
|
|
|
|
|
# En contrepartie de l'accessibilité au code source et des droits de copie, # |
|
25
|
|
|
|
|
|
|
# de modification et de redistribution accordés par cette licence, il n'est # |
|
26
|
|
|
|
|
|
|
# offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons, # |
|
27
|
|
|
|
|
|
|
# seule une responsabilité restreinte pèse sur l'auteur du programme, le # |
|
28
|
|
|
|
|
|
|
# titulaire des droits patrimoniaux et les concédants successifs. # |
|
29
|
|
|
|
|
|
|
# # |
|
30
|
|
|
|
|
|
|
# À cet égard l'attention de l'utilisateur est attirée sur les risques # |
|
31
|
|
|
|
|
|
|
# associés au chargement, à l'utilisation, à la modification et/ou au # |
|
32
|
|
|
|
|
|
|
# développement et à la reproduction du logiciel par l'utilisateur étant # |
|
33
|
|
|
|
|
|
|
# donné sa spécificité de logiciel libre, qui peut le rendre complexe à # |
|
34
|
|
|
|
|
|
|
# manipuler et qui le réserve donc à des développeurs et des professionnels # |
|
35
|
|
|
|
|
|
|
# avertis possédant des connaissances informatiques approfondies. Les # |
|
36
|
|
|
|
|
|
|
# utilisateurs sont donc invités à charger et tester l'adéquation du # |
|
37
|
|
|
|
|
|
|
# logiciel à leurs besoins dans des conditions permettant d'assurer la # |
|
38
|
|
|
|
|
|
|
# sécurité de leurs systêmes et ou de leurs données et, plus généralement, # |
|
39
|
|
|
|
|
|
|
# à l'utiliser et l'exploiter dans les mêmes conditions de sécurité. # |
|
40
|
|
|
|
|
|
|
# # |
|
41
|
|
|
|
|
|
|
# Le fait que vous puissiez accéder à cet en-tête signifie que vous avez # |
|
42
|
|
|
|
|
|
|
# pris connaissance de la licence CeCILL, et que vous en avez accepté les # |
|
43
|
|
|
|
|
|
|
# termes. # |
|
44
|
|
|
|
|
|
|
# # |
|
45
|
|
|
|
|
|
|
# ------------------------------------------------------------------------- # |
|
46
|
|
|
|
|
|
|
# # |
|
47
|
|
|
|
|
|
|
# This file is part of the CracTools which provide several integrated # |
|
48
|
|
|
|
|
|
|
# pipeline to analyze biological events present in RNA-Seq data. CracTools # |
|
49
|
|
|
|
|
|
|
# work on a SAM file generated by CRAC and an annotation file in GFF3 format.# |
|
50
|
|
|
|
|
|
|
# # |
|
51
|
|
|
|
|
|
|
# This software is governed by the CeCILL license under French law and # |
|
52
|
|
|
|
|
|
|
# abiding by the rules of distribution of free software. You can use, # |
|
53
|
|
|
|
|
|
|
# modify and/ or redistribute the software under the terms of the CeCILL # |
|
54
|
|
|
|
|
|
|
# license as circulated by CEA, CNRS and INRIA at the following URL # |
|
55
|
|
|
|
|
|
|
# "http://www.cecill.info". # |
|
56
|
|
|
|
|
|
|
# # |
|
57
|
|
|
|
|
|
|
# As a counterpart to the access to the source code and rights to copy, # |
|
58
|
|
|
|
|
|
|
# modify and redistribute granted by the license, users are provided only # |
|
59
|
|
|
|
|
|
|
# with a limited warranty and the software's author, the holder of the # |
|
60
|
|
|
|
|
|
|
# economic rights, and the successive licensors have only limited # |
|
61
|
|
|
|
|
|
|
# liability. # |
|
62
|
|
|
|
|
|
|
# # |
|
63
|
|
|
|
|
|
|
# In this respect, the user's attention is drawn to the risks associated # |
|
64
|
|
|
|
|
|
|
# with loading, using, modifying and/or developing or reproducing the # |
|
65
|
|
|
|
|
|
|
# software by the user in light of its specific status of free software, # |
|
66
|
|
|
|
|
|
|
# that may mean that it is complicated to manipulate, and that also # |
|
67
|
|
|
|
|
|
|
# therefore means that it is reserved for developers and experienced # |
|
68
|
|
|
|
|
|
|
# professionals having in-depth computer knowledge. Users are therefore # |
|
69
|
|
|
|
|
|
|
# encouraged to load and test the software's suitability as regards their # |
|
70
|
|
|
|
|
|
|
# requirements in conditions enabling the security of their systems and/or # |
|
71
|
|
|
|
|
|
|
# data to be ensured and, more generally, to use and operate it in the same # |
|
72
|
|
|
|
|
|
|
# conditions as regards security. # |
|
73
|
|
|
|
|
|
|
# # |
|
74
|
|
|
|
|
|
|
# The fact that you are presently reading this means that you have had # |
|
75
|
|
|
|
|
|
|
# knowledge of the CeCILL license and that you accept its terms. # |
|
76
|
|
|
|
|
|
|
# # |
|
77
|
|
|
|
|
|
|
############################################################################### |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 NAME |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
CracTools::GFF::Annotation - Parse GFF lines. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Usage: |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
use CracTools::GFF::Query; |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# Creating the reader |
|
90
|
|
|
|
|
|
|
my $gffQuery = CracTools::GFF::Query->new('annotations.gff'); |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
my @annotations = $gffQuery->fetchByLocation('1',298345,'+'); |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
foreach my $gff_line (@annotations) { |
|
95
|
|
|
|
|
|
|
my $annotation = CracTools::GFF::Annotation->new($gff_line); |
|
96
|
|
|
|
|
|
|
print "Gene_id : ",$annotation->attribute('gene_id'),"\n"; |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
CracTools::GFF::Annotataion is an object to parse and access GFF line's fields. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
package CracTools::GFF::Annotation; |
|
106
|
|
|
|
|
|
|
|
|
107
|
2
|
|
|
2
|
|
71734
|
use Carp; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
8428
|
|
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 METHODS |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head2 new |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Arg [1] : String - $line |
|
114
|
|
|
|
|
|
|
GFF line |
|
115
|
|
|
|
|
|
|
Arg [2] : String - $format (optional) - default 'gff2' |
|
116
|
|
|
|
|
|
|
GFF format (gff2 or gff3) |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Example : my $annotation = CracTools::GFF::Annotation->new($gff_line); |
|
119
|
|
|
|
|
|
|
Description : Create a new CracTools::GFF::Annotation object |
|
120
|
|
|
|
|
|
|
If a gff line is passed in argument, the line will be parsed |
|
121
|
|
|
|
|
|
|
and loaded. |
|
122
|
|
|
|
|
|
|
ReturnType : CracTools::GFF::Query |
|
123
|
|
|
|
|
|
|
Exceptions : none |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=cut |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub new { |
|
128
|
22
|
|
|
22
|
1
|
50
|
my $class = shift; |
|
129
|
22
|
|
|
|
|
44
|
my $line = shift; |
|
130
|
22
|
|
|
|
|
27
|
my $format = shift; |
|
131
|
22
|
100
|
|
|
|
53
|
if(!defined $format) { |
|
132
|
1
|
|
|
|
|
3
|
$format = 'gff2'; |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
|
|
135
|
22
|
|
|
|
|
109
|
my $self = bless {format => $format}, $class; |
|
136
|
|
|
|
|
|
|
|
|
137
|
22
|
50
|
|
|
|
60
|
if(defined $line) { |
|
138
|
22
|
|
|
|
|
52
|
$self->_init($line); |
|
139
|
|
|
|
|
|
|
} |
|
140
|
|
|
|
|
|
|
|
|
141
|
22
|
|
|
|
|
157
|
return $self; |
|
142
|
|
|
|
|
|
|
} |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub _init { |
|
145
|
22
|
|
|
22
|
|
73
|
my ($self,$line) = @_; |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
# Split the line with TABS |
|
148
|
22
|
|
|
|
|
133
|
my ($chr,$source,$feature,$start,$end,$score,$strand,$phase,$attributes) = split("\t",$line); |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
# Get the strand if 1/-1 format |
|
151
|
22
|
|
|
|
|
57
|
$strand = convertStrand($strand); |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
# Loading the 8 first columns |
|
154
|
22
|
|
|
|
|
61
|
$self->{chr} = $chr; |
|
155
|
22
|
|
|
|
|
39
|
$self->{source} = $source; |
|
156
|
22
|
|
|
|
|
39
|
$self->{feature} = $feature; |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
# Conversion to 0-based coordinate system |
|
159
|
22
|
|
|
|
|
53
|
$self->{start} = $start-1; |
|
160
|
22
|
|
|
|
|
42
|
$self->{end} = $end-1; |
|
161
|
|
|
|
|
|
|
|
|
162
|
22
|
|
|
|
|
43
|
$self->{score} = $score; |
|
163
|
22
|
|
|
|
|
64
|
$self->{strand} = $strand; |
|
164
|
22
|
|
|
|
|
42
|
$self->{phase} = $phase; |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
# Loading attributes |
|
167
|
22
|
|
|
|
|
284
|
my @attributes_tab = split(";",$attributes); |
|
168
|
22
|
|
|
|
|
45
|
foreach my $attr (@attributes_tab) { |
|
169
|
60
|
|
|
|
|
98
|
my ($k,$v); |
|
170
|
60
|
100
|
|
|
|
366
|
if($self->{format} =~ /gff3/i) { |
|
171
|
58
|
|
|
|
|
784
|
($k,$v) = $attr =~ /(\S+)=(.*)/; |
|
172
|
|
|
|
|
|
|
} else { |
|
173
|
2
|
|
|
|
|
18
|
($k,$v) = $attr =~ /(\S+)\s+"(.*)"/; |
|
174
|
|
|
|
|
|
|
} |
|
175
|
60
|
50
|
33
|
|
|
567
|
if(defined $k && defined $v) { |
|
176
|
60
|
|
|
|
|
242
|
$self->{attributes}{$k} = $v; |
|
177
|
|
|
|
|
|
|
} #else { |
|
178
|
|
|
|
|
|
|
# carp("Error parsing attribute $attr"); |
|
179
|
|
|
|
|
|
|
#} |
|
180
|
|
|
|
|
|
|
} |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
} |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head1 GETTERS AND SETTERS |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head2 chr |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Description : Getter/setter for attribute chr |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=cut |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
sub chr { |
|
193
|
1
|
|
|
1
|
1
|
8
|
my $self = shift; |
|
194
|
1
|
|
|
|
|
3
|
my $chr = shift; |
|
195
|
1
|
50
|
|
|
|
5
|
if(defined $chr) { |
|
196
|
0
|
|
|
|
|
0
|
$self->{chr} = $chr; |
|
197
|
|
|
|
|
|
|
} |
|
198
|
1
|
|
|
|
|
9
|
return $self->{chr}; |
|
199
|
|
|
|
|
|
|
} |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head2 source |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
Description : Getter/setter for attribute source |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=cut |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
sub source { |
|
208
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
|
209
|
1
|
|
|
|
|
2
|
my $source = shift; |
|
210
|
1
|
50
|
|
|
|
5
|
if(defined $source) { |
|
211
|
0
|
|
|
|
|
0
|
$self->{source} = $source; |
|
212
|
|
|
|
|
|
|
} |
|
213
|
1
|
|
|
|
|
8
|
return $self->{source}; |
|
214
|
|
|
|
|
|
|
} |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=head2 feature |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
Description : Getter/setter for attribute feature |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=cut |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
sub feature { |
|
223
|
21
|
|
|
21
|
1
|
28
|
my $self = shift; |
|
224
|
21
|
|
|
|
|
24
|
my $feature = shift; |
|
225
|
21
|
50
|
|
|
|
59
|
if(defined $feature) { |
|
226
|
0
|
|
|
|
|
0
|
$self->{feature} = $feature; |
|
227
|
|
|
|
|
|
|
} |
|
228
|
21
|
|
|
|
|
412
|
return $self->{feature}; |
|
229
|
|
|
|
|
|
|
} |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=head2 start |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
Description : Getter/setter for attribute start |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=cut |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
sub start { |
|
238
|
2
|
|
|
2
|
1
|
119
|
my $self = shift; |
|
239
|
2
|
|
|
|
|
6
|
my $start = shift; |
|
240
|
2
|
50
|
|
|
|
10
|
if(defined $start) { |
|
241
|
0
|
|
|
|
|
0
|
$self->{start} = $start; |
|
242
|
|
|
|
|
|
|
} |
|
243
|
2
|
|
|
|
|
19
|
return $self->{start}; |
|
244
|
|
|
|
|
|
|
} |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=head2 end |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
Description : Getter/setter for attribute end |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=cut |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
sub end { |
|
253
|
2
|
|
|
2
|
1
|
7
|
my $self = shift; |
|
254
|
2
|
|
|
|
|
5
|
my $end = shift; |
|
255
|
2
|
50
|
|
|
|
11
|
if(defined $end) { |
|
256
|
0
|
|
|
|
|
0
|
$self->{end} = $end; |
|
257
|
|
|
|
|
|
|
} |
|
258
|
2
|
|
|
|
|
16
|
return $self->{end}; |
|
259
|
|
|
|
|
|
|
} |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=head2 score |
|
262
|
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
Description : Getter/setter for attribute score |
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=cut |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
sub score { |
|
268
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
|
269
|
1
|
|
|
|
|
2
|
my $score = shift; |
|
270
|
1
|
50
|
|
|
|
4
|
if(defined $score) { |
|
271
|
0
|
|
|
|
|
0
|
$self->{score} = $score; |
|
272
|
|
|
|
|
|
|
} |
|
273
|
1
|
|
|
|
|
7
|
return $self->{score}; |
|
274
|
|
|
|
|
|
|
} |
|
275
|
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=head2 strand |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
Description : Getter/setter for attribute strand ('+','-' convention) |
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=cut |
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
sub strand { |
|
283
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
|
284
|
1
|
|
|
|
|
2
|
my $strand = shift; |
|
285
|
1
|
50
|
|
|
|
5
|
if(defined $strand) { |
|
286
|
0
|
|
|
|
|
0
|
$self->{strand} = $strand; |
|
287
|
|
|
|
|
|
|
} |
|
288
|
1
|
|
|
|
|
5
|
return $self->{strand}; |
|
289
|
|
|
|
|
|
|
} |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=head2 gffStrand |
|
292
|
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
Description : Return strand using "1","-1" convention. |
|
294
|
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=cut |
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
sub gffStrand { |
|
298
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
299
|
0
|
|
|
|
|
0
|
return convertStrand($self->{strand}); |
|
300
|
|
|
|
|
|
|
} |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
=head2 phase |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
Description : Getter/setter for attribute phase |
|
305
|
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
=cut |
|
307
|
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
sub phase { |
|
309
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
|
310
|
1
|
|
|
|
|
2
|
my $phase = shift; |
|
311
|
1
|
50
|
|
|
|
5
|
if(defined $phase) { |
|
312
|
0
|
|
|
|
|
0
|
$self->{phase} = $phase; |
|
313
|
|
|
|
|
|
|
} |
|
314
|
1
|
|
|
|
|
7
|
return $self->{phase}; |
|
315
|
|
|
|
|
|
|
} |
|
316
|
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
=head2 parents |
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
Description : Getter for attribute parents. |
|
320
|
|
|
|
|
|
|
ReturnType : Array of strings with parents ID |
|
321
|
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
=cut |
|
323
|
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
sub parents { |
|
325
|
120
|
|
|
120
|
1
|
151
|
my $self = shift; |
|
326
|
120
|
100
|
|
|
|
237
|
if(defined $self->attribute('Parent')) { |
|
327
|
72
|
|
|
|
|
141
|
return split(',',$self->attribute('Parent')); |
|
328
|
|
|
|
|
|
|
} else { |
|
329
|
48
|
|
|
|
|
117
|
return (); |
|
330
|
|
|
|
|
|
|
} |
|
331
|
|
|
|
|
|
|
} |
|
332
|
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
=head2 attribute |
|
334
|
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
Description : Getter/setter for attribute attribute |
|
336
|
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
=cut |
|
338
|
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
sub attribute { |
|
340
|
237
|
|
|
237
|
1
|
1123
|
my $self = shift; |
|
341
|
237
|
|
|
|
|
270
|
my $key = shift; |
|
342
|
237
|
|
|
|
|
251
|
my $value = shift; |
|
343
|
237
|
100
|
|
|
|
655
|
if(defined $value) { |
|
|
|
50
|
|
|
|
|
|
|
344
|
1
|
|
|
|
|
78
|
return $self->{attributes}{$key} = $value; |
|
345
|
|
|
|
|
|
|
} elsif(defined $key) { |
|
346
|
236
|
|
|
|
|
2915
|
return $self->{attributes}{$key}; |
|
347
|
|
|
|
|
|
|
} else { |
|
348
|
0
|
|
|
|
|
0
|
return undef; |
|
349
|
|
|
|
|
|
|
#croak ("Missing attribute key to retreive attribute value"); |
|
350
|
|
|
|
|
|
|
} |
|
351
|
|
|
|
|
|
|
} |
|
352
|
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
=head1 STATIC METHODS |
|
354
|
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
=head2 convertStrand |
|
356
|
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
Arg [1] : Character - strand using '+' and '-' signs |
|
358
|
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
Description : Retrun the strand using the (1,-1) convention |
|
360
|
|
|
|
|
|
|
instead of the ('+','-') convention of GFF files. |
|
361
|
|
|
|
|
|
|
=cut |
|
362
|
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
sub convertStrand($) { |
|
364
|
22
|
|
|
22
|
1
|
34
|
my $strand = shift; |
|
365
|
22
|
|
|
|
|
309
|
my %conversion_hash = ( '+' => 1, '-' => -1, 1 => '+', -1 => '-'); |
|
366
|
22
|
|
|
|
|
65
|
return $conversion_hash{$strand}; |
|
367
|
|
|
|
|
|
|
} |
|
368
|
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
1; |