line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# POD documentation - main docs before the code |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
GenOO::Data::File::FASTA::Record - Object representing a record of a fasta file |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# Object representing a record of a fasta file |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# To initialize |
12
|
|
|
|
|
|
|
my $record = GenOO::Data::File::FASTA::Record->new({ |
13
|
|
|
|
|
|
|
HEADER => undef, |
14
|
|
|
|
|
|
|
SEQUENCE => undef, |
15
|
|
|
|
|
|
|
}); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
This object represents a record of a fasta file and offers methods for accessing the different attributes. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 EXAMPLES |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $sequence = $record->sequence(); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Let the code begin... |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
package GenOO::Data::File::FASTA::Record; |
31
|
|
|
|
|
|
|
$GenOO::Data::File::FASTA::Record::VERSION = '1.5.1'; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
####################################################################### |
34
|
|
|
|
|
|
|
####################### Load External modules ##################### |
35
|
|
|
|
|
|
|
####################################################################### |
36
|
1
|
|
|
1
|
|
5
|
use Modern::Perl; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
37
|
1
|
|
|
1
|
|
86
|
use autodie; |
|
1
|
|
|
|
|
4143
|
|
|
1
|
|
|
|
|
7
|
|
38
|
1
|
|
|
1
|
|
2801
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
39
|
1
|
|
|
1
|
|
4335
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
####################################################################### |
43
|
|
|
|
|
|
|
####################### Interface attributes ###################### |
44
|
|
|
|
|
|
|
####################################################################### |
45
|
|
|
|
|
|
|
has 'header' => ( |
46
|
|
|
|
|
|
|
isa => 'Str', |
47
|
|
|
|
|
|
|
is => 'ro', |
48
|
|
|
|
|
|
|
required => 1 |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
has 'sequence' => ( |
52
|
|
|
|
|
|
|
isa => 'Str', |
53
|
|
|
|
|
|
|
is => 'ro', |
54
|
|
|
|
|
|
|
required => 1 |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
####################################################################### |
59
|
|
|
|
|
|
|
############################## BUILD ############################## |
60
|
|
|
|
|
|
|
####################################################################### |
61
|
|
|
|
|
|
|
around BUILDARGS => sub { |
62
|
|
|
|
|
|
|
my ($orig, $class) = @_; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
my $argv_hash_ref = $class->$orig(@_); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
if (exists $argv_hash_ref->{header}) { |
67
|
|
|
|
|
|
|
my $header = $argv_hash_ref->{header}; |
68
|
|
|
|
|
|
|
$header =~ s/^>//; |
69
|
|
|
|
|
|
|
$argv_hash_ref->{header} = $header |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
return $argv_hash_ref; |
73
|
|
|
|
|
|
|
}; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
####################################################################### |
77
|
|
|
|
|
|
|
######################## Interface Methods ######################## |
78
|
|
|
|
|
|
|
####################################################################### |
79
|
|
|
|
|
|
|
sub length { |
80
|
2
|
|
|
2
|
0
|
791
|
my ($self) = @_; |
81
|
2
|
|
|
|
|
73
|
return length($self->sequence); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub to_string { |
85
|
2
|
|
|
2
|
0
|
887
|
my ($self) = @_; |
86
|
|
|
|
|
|
|
|
87
|
2
|
|
|
|
|
60
|
return join("\n",( |
88
|
|
|
|
|
|
|
'>'.$self->header, |
89
|
|
|
|
|
|
|
$self->sequence, |
90
|
|
|
|
|
|
|
)); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
####################################################################### |
94
|
|
|
|
|
|
|
############################ Finalize ############################# |
95
|
|
|
|
|
|
|
####################################################################### |
96
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
1; |