line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# POD documentation - main docs before the code |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
GenOO::TranscriptCollection::Factory::FromGeneCollection - Factory to create GenOO::TranscriptCollection object from a GeneCollection |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# Creates GenOO::TranscriptCollection object from a GeneCollection |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Preferably use it through the generic GenOO::TranscriptCollection::Factory |
12
|
|
|
|
|
|
|
my $factory = GenOO::TranscriptCollection::Factory->create('FromGeneCollection',{ |
13
|
|
|
|
|
|
|
gene_collection => $gene_collection |
14
|
|
|
|
|
|
|
}); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
An instance of this class is a concrete factory for the creation of a |
19
|
|
|
|
|
|
|
L<GenOO::TranscriptCollection> object from a GeneCollection. |
20
|
|
|
|
|
|
|
It offers the method "read_collection" (as the consumed role requires) which returns the actual |
21
|
|
|
|
|
|
|
L<GenOO::TranscriptCollection> object in the form of L<GenOO::RegionCollection::Type::DoubleHashArray>. |
22
|
|
|
|
|
|
|
The latter is the implementation of the L<GenOO::RegionCollection> class based on the complex |
23
|
|
|
|
|
|
|
data structure L<GenOO::Data::Structure::DoubleHashArray>. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 EXAMPLES |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Create a concrete factory |
28
|
|
|
|
|
|
|
my $factory_implementation = GenOO::TranscriptCollection::Factory->create('FromTranscriptCollection',{ |
29
|
|
|
|
|
|
|
gene_collection => $gene_collection |
30
|
|
|
|
|
|
|
}); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Return the actual GenOO::TranscriptCollection object |
33
|
|
|
|
|
|
|
my $collection = $factory_implementation->read_collection; |
34
|
|
|
|
|
|
|
print ref($collection) # GenOO::RegionCollection::Type::DoubleHashArray |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# Let the code begin... |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
package GenOO::TranscriptCollection::Factory::FromGeneCollection; |
41
|
|
|
|
|
|
|
$GenOO::TranscriptCollection::Factory::FromGeneCollection::VERSION = '1.5.1'; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
####################################################################### |
44
|
|
|
|
|
|
|
####################### Load External modules ##################### |
45
|
|
|
|
|
|
|
####################################################################### |
46
|
1
|
|
|
1
|
|
5310
|
use Modern::Perl; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
15
|
|
47
|
1
|
|
|
1
|
|
227
|
use autodie; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
14
|
|
48
|
1
|
|
|
1
|
|
5631
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
12
|
|
49
|
1
|
|
|
1
|
|
8450
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
11
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
####################################################################### |
53
|
|
|
|
|
|
|
####################### Load GenOO modules ##################### |
54
|
|
|
|
|
|
|
####################################################################### |
55
|
1
|
|
|
1
|
|
135
|
use GenOO::RegionCollection::Type::DoubleHashArray; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
284
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
####################################################################### |
59
|
|
|
|
|
|
|
####################### Interface attributes ###################### |
60
|
|
|
|
|
|
|
####################################################################### |
61
|
|
|
|
|
|
|
has 'gene_collection' => ( |
62
|
|
|
|
|
|
|
isa => 'GenOO::RegionCollection', |
63
|
|
|
|
|
|
|
is => 'ro', |
64
|
|
|
|
|
|
|
required => 1 |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
####################################################################### |
69
|
|
|
|
|
|
|
########################## Consumed Roles ######################### |
70
|
|
|
|
|
|
|
####################################################################### |
71
|
|
|
|
|
|
|
with 'GenOO::RegionCollection::Factory::Requires'; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
####################################################################### |
75
|
|
|
|
|
|
|
######################## Interface Methods ######################## |
76
|
|
|
|
|
|
|
####################################################################### |
77
|
|
|
|
|
|
|
sub read_collection { |
78
|
1
|
|
|
1
|
0
|
1359
|
my ($self) = @_; |
79
|
|
|
|
|
|
|
|
80
|
1
|
|
|
|
|
38
|
my $collection = GenOO::RegionCollection::Type::DoubleHashArray->new; |
81
|
1
|
|
|
|
|
37
|
my @all_transcripts = map {@{$_->transcripts}} $self->gene_collection->all_records; |
|
26
|
|
|
|
|
20
|
|
|
26
|
|
|
|
|
436
|
|
82
|
1
|
|
|
|
|
5
|
map {$collection->add_record($_)} @all_transcripts; |
|
58
|
|
|
|
|
98
|
|
83
|
|
|
|
|
|
|
|
84
|
1
|
|
|
|
|
14
|
return $collection; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |