line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# POD documentation - main docs before the code |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
GenOO::Transcript - Corresponds to a gene transcript |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# The class represents a transcript of a gene. |
10
|
|
|
|
|
|
|
# It extends the L<GenOO::GenomicRegion> class |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Instantiate |
13
|
|
|
|
|
|
|
my $transcript = GenOO::Transcript->new( |
14
|
|
|
|
|
|
|
name => undef, |
15
|
|
|
|
|
|
|
species => undef, |
16
|
|
|
|
|
|
|
strand => undef, #required |
17
|
|
|
|
|
|
|
chromosome => undef, #required |
18
|
|
|
|
|
|
|
start => undef, #required |
19
|
|
|
|
|
|
|
stop => undef, #required |
20
|
|
|
|
|
|
|
copy_number => undef, #defaults to 1 |
21
|
|
|
|
|
|
|
sequence => undef, |
22
|
|
|
|
|
|
|
splice_starts => undef, #required |
23
|
|
|
|
|
|
|
splice_stops => undef, #required |
24
|
|
|
|
|
|
|
id => undef, #required |
25
|
|
|
|
|
|
|
gene => undef, #GenOO::Gene |
26
|
|
|
|
|
|
|
utr5 => undef, #GenOO::Transcript::UTR5 |
27
|
|
|
|
|
|
|
cds => undef, #GenOO::Transcript::CDS |
28
|
|
|
|
|
|
|
utr3 => undef, #GenOO::Transcript::UTR3 |
29
|
|
|
|
|
|
|
biotype => undef, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 DESCRIPTION |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
The Transcript class describes a transcript of a gene. It can have a backreference |
35
|
|
|
|
|
|
|
to the gene in which it belongs. Protein coding transcripts have functional regions |
36
|
|
|
|
|
|
|
such as 5'UTR, CDS and 3'UTR. The transcript class extends the L<GenOO::GenomicRegion> |
37
|
|
|
|
|
|
|
and implements the L<GenOO::Spliceable> role. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 EXAMPLES |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Get the exons of the transcript |
42
|
|
|
|
|
|
|
$transcript->exons |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# Get the introns of the transcript |
45
|
|
|
|
|
|
|
$transcript->introns |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# Check if the transcript codes for a protein |
48
|
|
|
|
|
|
|
$transcript->is_coding # 0 / 1 |
49
|
|
|
|
|
|
|
$transcript->cds # undef / GenOO::Transcript::CDS |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=cut |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# Let the code begin... |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
package GenOO::Transcript; |
56
|
|
|
|
|
|
|
$GenOO::Transcript::VERSION = '1.4.6'; |
57
|
1
|
|
|
1
|
|
5
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
58
|
1
|
|
|
1
|
|
4618
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
59
|
|
|
|
|
|
|
|
60
|
1
|
|
|
1
|
|
420
|
use GenOO::Transcript::UTR5; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
61
|
1
|
|
|
1
|
|
559
|
use GenOO::Transcript::CDS; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
41
|
|
62
|
1
|
|
|
1
|
|
520
|
use GenOO::Transcript::UTR3; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
664
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
extends 'GenOO::GenomicRegion'; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
has 'id' => ( |
67
|
|
|
|
|
|
|
is => 'rw', |
68
|
|
|
|
|
|
|
required => 1 |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
has 'coding_start' => ( |
72
|
|
|
|
|
|
|
isa => 'Int', |
73
|
|
|
|
|
|
|
is => 'rw' |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
has 'coding_stop' => ( |
77
|
|
|
|
|
|
|
isa => 'Int', |
78
|
|
|
|
|
|
|
is => 'rw' |
79
|
|
|
|
|
|
|
); |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
has 'biotype' => ( |
82
|
|
|
|
|
|
|
isa => 'Str', |
83
|
|
|
|
|
|
|
is => 'rw', |
84
|
|
|
|
|
|
|
builder => '_find_biotype', |
85
|
|
|
|
|
|
|
lazy => 1, |
86
|
|
|
|
|
|
|
); |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
has 'gene' => ( |
89
|
|
|
|
|
|
|
isa => 'GenOO::Gene', |
90
|
|
|
|
|
|
|
is => 'rw', |
91
|
|
|
|
|
|
|
weak_ref => 1 |
92
|
|
|
|
|
|
|
); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
has 'utr5' => ( |
95
|
|
|
|
|
|
|
isa => 'Maybe[GenOO::Transcript::UTR5]', |
96
|
|
|
|
|
|
|
is => 'rw', |
97
|
|
|
|
|
|
|
builder => '_find_or_create_utr5', |
98
|
|
|
|
|
|
|
lazy => 1 |
99
|
|
|
|
|
|
|
); |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
has 'cds' => ( |
102
|
|
|
|
|
|
|
isa => 'Maybe[GenOO::Transcript::CDS]', |
103
|
|
|
|
|
|
|
is => 'rw', |
104
|
|
|
|
|
|
|
builder => '_find_or_create_cds', |
105
|
|
|
|
|
|
|
lazy => 1 |
106
|
|
|
|
|
|
|
); |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
has 'utr3' => ( |
109
|
|
|
|
|
|
|
isa => 'Maybe[GenOO::Transcript::UTR3]', |
110
|
|
|
|
|
|
|
is => 'rw', |
111
|
|
|
|
|
|
|
builder => '_find_or_create_utr3', |
112
|
|
|
|
|
|
|
lazy => 1 |
113
|
|
|
|
|
|
|
); |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
with 'GenOO::Spliceable'; |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
####################################################################### |
118
|
|
|
|
|
|
|
############################# Methods ############################# |
119
|
|
|
|
|
|
|
####################################################################### |
120
|
|
|
|
|
|
|
sub exons_split_by_function { |
121
|
1
|
|
|
1
|
0
|
649
|
my ($self) = @_; |
122
|
|
|
|
|
|
|
|
123
|
1
|
50
|
|
|
|
8
|
if ($self->is_coding) { |
124
|
1
|
|
|
|
|
2
|
my @exons; |
125
|
1
|
50
|
|
|
|
28
|
if (defined $self->utr5) { |
126
|
1
|
|
|
|
|
3
|
push @exons,@{$self->utr5->exons}; |
|
1
|
|
|
|
|
25
|
|
127
|
|
|
|
|
|
|
} |
128
|
1
|
50
|
|
|
|
24
|
if (defined $self->cds) { |
129
|
1
|
|
|
|
|
2
|
push @exons,@{$self->cds->exons}; |
|
1
|
|
|
|
|
24
|
|
130
|
|
|
|
|
|
|
} |
131
|
1
|
50
|
|
|
|
29
|
if (defined $self->utr3) { |
132
|
1
|
|
|
|
|
2
|
push @exons,@{$self->utr3->exons}; |
|
1
|
|
|
|
|
24
|
|
133
|
|
|
|
|
|
|
} |
134
|
1
|
|
|
|
|
7
|
return \@exons; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
else { |
137
|
0
|
|
|
|
|
0
|
return $self->exons; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
sub is_coding { |
142
|
12
|
|
|
12
|
0
|
581
|
my ($self) = @_; |
143
|
|
|
|
|
|
|
|
144
|
12
|
100
|
|
|
|
323
|
if ($self->biotype eq 'coding') { |
145
|
10
|
|
|
|
|
39
|
return 1; |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
else { |
148
|
2
|
|
|
|
|
29
|
return 0; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
####################################################################### |
153
|
|
|
|
|
|
|
######################### Private methods ########################## |
154
|
|
|
|
|
|
|
####################################################################### |
155
|
|
|
|
|
|
|
sub _find_or_create_utr5 { |
156
|
2
|
|
|
2
|
|
2
|
my ($self) = @_; |
157
|
|
|
|
|
|
|
|
158
|
2
|
50
|
33
|
|
|
51
|
if (defined $self->coding_start and defined $self->coding_stop) { |
159
|
2
|
50
|
|
|
|
53
|
my $utr5_start = ($self->strand == 1) ? $self->start : $self->coding_stop + 1; |
160
|
2
|
50
|
|
|
|
44
|
my $utr5_stop = ($self->strand == 1) ? $self->coding_start - 1 : $self->stop; |
161
|
|
|
|
|
|
|
|
162
|
2
|
50
|
|
|
|
5
|
return undef if $utr5_start > $utr5_stop; # there is no 5'UTR |
163
|
|
|
|
|
|
|
|
164
|
2
|
|
|
|
|
45
|
my ($splice_starts, $splice_stops) = _sanitize_splice_coords_within_limits( |
165
|
|
|
|
|
|
|
$self->splice_starts, |
166
|
|
|
|
|
|
|
$self->splice_stops, |
167
|
|
|
|
|
|
|
$utr5_start, |
168
|
|
|
|
|
|
|
$utr5_stop |
169
|
|
|
|
|
|
|
); |
170
|
|
|
|
|
|
|
|
171
|
2
|
|
|
|
|
52
|
return GenOO::Transcript::UTR5->new({ |
172
|
|
|
|
|
|
|
strand => $self->strand, |
173
|
|
|
|
|
|
|
chromosome => $self->chromosome, |
174
|
|
|
|
|
|
|
start => $utr5_start, |
175
|
|
|
|
|
|
|
stop => $utr5_stop, |
176
|
|
|
|
|
|
|
splice_starts => $splice_starts, |
177
|
|
|
|
|
|
|
splice_stops => $splice_stops, |
178
|
|
|
|
|
|
|
transcript => $self |
179
|
|
|
|
|
|
|
}); |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
|
182
|
0
|
|
|
|
|
0
|
return undef; |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
sub _find_or_create_cds { |
186
|
2
|
|
|
2
|
|
5
|
my ($self) = @_; |
187
|
|
|
|
|
|
|
|
188
|
2
|
50
|
33
|
|
|
52
|
if (defined $self->coding_start and defined $self->coding_stop) { |
189
|
2
|
|
|
|
|
48
|
my ($splice_starts, $splice_stops) = _sanitize_splice_coords_within_limits( |
190
|
|
|
|
|
|
|
$self->splice_starts, |
191
|
|
|
|
|
|
|
$self->splice_stops, |
192
|
|
|
|
|
|
|
$self->coding_start, |
193
|
|
|
|
|
|
|
$self->coding_stop |
194
|
|
|
|
|
|
|
); |
195
|
|
|
|
|
|
|
|
196
|
2
|
|
|
|
|
57
|
return GenOO::Transcript::CDS->new({ |
197
|
|
|
|
|
|
|
strand => $self->strand, |
198
|
|
|
|
|
|
|
chromosome => $self->chromosome, |
199
|
|
|
|
|
|
|
start => $self->coding_start, |
200
|
|
|
|
|
|
|
stop => $self->coding_stop, |
201
|
|
|
|
|
|
|
splice_starts => $splice_starts, |
202
|
|
|
|
|
|
|
splice_stops => $splice_stops, |
203
|
|
|
|
|
|
|
transcript => $self |
204
|
|
|
|
|
|
|
}); |
205
|
|
|
|
|
|
|
} |
206
|
|
|
|
|
|
|
|
207
|
0
|
|
|
|
|
0
|
return undef; |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
sub _find_or_create_utr3 { |
211
|
2
|
|
|
2
|
|
3
|
my ($self) = @_; |
212
|
|
|
|
|
|
|
|
213
|
2
|
50
|
33
|
|
|
50
|
if (defined $self->coding_start and defined $self->coding_stop) { |
214
|
2
|
50
|
|
|
|
50
|
my $utr3_start = ($self->strand == 1) ? $self->coding_stop + 1 : $self->start; |
215
|
2
|
50
|
|
|
|
44
|
my $utr3_stop = ($self->strand == 1) ? $self->stop : $self->coding_start - 1; |
216
|
|
|
|
|
|
|
|
217
|
2
|
50
|
|
|
|
6
|
return undef if $utr3_start > $utr3_stop; # there is no 3'UTR |
218
|
|
|
|
|
|
|
|
219
|
2
|
|
|
|
|
50
|
my ($splice_starts, $splice_stops) = _sanitize_splice_coords_within_limits( |
220
|
|
|
|
|
|
|
$self->splice_starts, |
221
|
|
|
|
|
|
|
$self->splice_stops, |
222
|
|
|
|
|
|
|
$utr3_start, |
223
|
|
|
|
|
|
|
$utr3_stop |
224
|
|
|
|
|
|
|
); |
225
|
|
|
|
|
|
|
|
226
|
2
|
|
|
|
|
51
|
return GenOO::Transcript::UTR3->new({ |
227
|
|
|
|
|
|
|
strand => $self->strand, |
228
|
|
|
|
|
|
|
chromosome => $self->chromosome, |
229
|
|
|
|
|
|
|
start => $utr3_start, |
230
|
|
|
|
|
|
|
stop => $utr3_stop, |
231
|
|
|
|
|
|
|
splice_starts => $splice_starts, |
232
|
|
|
|
|
|
|
splice_stops => $splice_stops, |
233
|
|
|
|
|
|
|
transcript => $self |
234
|
|
|
|
|
|
|
}); |
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
|
237
|
0
|
|
|
|
|
0
|
return undef; |
238
|
|
|
|
|
|
|
} |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
sub _find_biotype { |
241
|
2
|
|
|
2
|
|
3
|
my ($self) = @_; |
242
|
|
|
|
|
|
|
|
243
|
2
|
100
|
|
|
|
50
|
if (defined $self->coding_start) { |
244
|
1
|
|
|
|
|
23
|
return 'coding'; |
245
|
|
|
|
|
|
|
} |
246
|
|
|
|
|
|
|
} |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
1; |