line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::Roary::SequenceLengths; |
2
|
|
|
|
|
|
|
$Bio::Roary::SequenceLengths::VERSION = '3.11.0'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Take in a fasta file and create a hash with the length of each sequence |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
531713
|
use Moose; |
|
2
|
|
|
|
|
381199
|
|
|
2
|
|
|
|
|
12
|
|
7
|
2
|
|
|
2
|
|
12705
|
use Bio::SeqIO; |
|
2
|
|
|
|
|
101955
|
|
|
2
|
|
|
|
|
60
|
|
8
|
2
|
|
|
2
|
|
503
|
use Bio::Roary::Exceptions; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
261
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has 'fasta_file' => ( is => 'ro', isa => 'Str', required => 1 ); |
11
|
|
|
|
|
|
|
has 'sequence_lengths' => ( is => 'ro', isa => 'HashRef', lazy => 1, builder => '_build_sequence_lengths' ); |
12
|
|
|
|
|
|
|
has '_input_seqio' => ( is => 'ro', isa => 'Bio::SeqIO', lazy => 1, builder => '_build__input_seqio' ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _build__input_seqio { |
15
|
1
|
|
|
1
|
|
4
|
my ($self) = @_; |
16
|
1
|
|
|
|
|
36
|
return Bio::SeqIO->new( -file => $self->fasta_file, -format => 'Fasta' ); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _build_sequence_lengths { |
20
|
1
|
|
|
1
|
|
3
|
my ($self) = @_; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
3
|
my %sequence_lengths; |
23
|
1
|
|
|
|
|
36
|
while ( my $input_seq = $self->_input_seqio->next_seq() ) { |
24
|
6
|
|
|
|
|
854
|
$sequence_lengths{ $input_seq->display_id } = $input_seq->length(); |
25
|
|
|
|
|
|
|
} |
26
|
1
|
|
|
|
|
43
|
return \%sequence_lengths; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
2
|
|
|
2
|
|
11
|
no Moose; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
15
|
|
30
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=pod |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=encoding UTF-8 |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 NAME |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Bio::Roary::SequenceLengths - Take in a fasta file and create a hash with the length of each sequence |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 VERSION |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
version 3.11.0 |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 SYNOPSIS |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Add labels to the groups |
51
|
|
|
|
|
|
|
use Bio::Roary::SequenceLengths; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my $obj = Bio::Roary::SequenceLengths->new( |
54
|
|
|
|
|
|
|
fasta_file => 'abc.fa', |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
$obj->sequence_lengths; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 AUTHOR |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Andrew J. Page <ap13@sanger.ac.uk> |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This is free software, licensed under: |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |