| 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.2'; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
####################################################################### |
|
44
|
|
|
|
|
|
|
####################### Load External modules ##################### |
|
45
|
|
|
|
|
|
|
####################################################################### |
|
46
|
1
|
|
|
1
|
|
7834
|
use Modern::Perl; |
|
|
1
|
|
|
|
|
9
|
|
|
|
1
|
|
|
|
|
38
|
|
|
47
|
1
|
|
|
1
|
|
413
|
use autodie; |
|
|
1
|
|
|
|
|
12
|
|
|
|
1
|
|
|
|
|
35
|
|
|
48
|
1
|
|
|
1
|
|
6819
|
use Moose; |
|
|
1
|
|
|
|
|
12
|
|
|
|
1
|
|
|
|
|
39
|
|
|
49
|
1
|
|
|
1
|
|
11394
|
use namespace::autoclean; |
|
|
1
|
|
|
|
|
11
|
|
|
|
1
|
|
|
|
|
36
|
|
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
####################################################################### |
|
53
|
|
|
|
|
|
|
####################### Load GenOO modules ##################### |
|
54
|
|
|
|
|
|
|
####################################################################### |
|
55
|
1
|
|
|
1
|
|
211
|
use GenOO::RegionCollection::Type::DoubleHashArray; |
|
|
1
|
|
|
|
|
8
|
|
|
|
1
|
|
|
|
|
313
|
|
|
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
|
2590
|
my ($self) = @_; |
|
79
|
|
|
|
|
|
|
|
|
80
|
1
|
|
|
|
|
62
|
my $collection = GenOO::RegionCollection::Type::DoubleHashArray->new; |
|
81
|
1
|
|
|
|
|
63
|
my @all_transcripts = map {@{$_->transcripts}} $self->gene_collection->all_records; |
|
|
26
|
|
|
|
|
50
|
|
|
|
26
|
|
|
|
|
573
|
|
|
82
|
1
|
|
|
|
|
12
|
map {$collection->add_record($_)} @all_transcripts; |
|
|
58
|
|
|
|
|
158
|
|
|
83
|
|
|
|
|
|
|
|
|
84
|
1
|
|
|
|
|
17
|
return $collection; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |