line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package BioX::CLPM::Fragments; |
2
|
1
|
|
|
1
|
|
1299
|
use base qw(BioX::CLPM::Base); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
79
|
|
3
|
|
|
|
|
|
|
use BioX::CLPM::Fragments::Simple; |
4
|
|
|
|
|
|
|
use Class::Std; |
5
|
|
|
|
|
|
|
use Class::Std::Utils; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use warnings; |
8
|
|
|
|
|
|
|
use strict; |
9
|
|
|
|
|
|
|
use Carp; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use version; our $VERSION = qv('0.0.1'); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
{ |
14
|
|
|
|
|
|
|
my %sequence_id_of :ATTR( :get :set :default<''> :init_arg ); |
15
|
|
|
|
|
|
|
my %list_of :ATTR( :get :set :default<[]> :init_arg ); |
16
|
|
|
|
|
|
|
my %index_of :ATTR( :get :set :default<'1'> :init_arg ); |
17
|
|
|
|
|
|
|
my %type_of :ATTR( :get :set :default<''> :init_arg ); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub BUILD { |
20
|
|
|
|
|
|
|
my ($self, $ident, $arg_ref) = @_; |
21
|
|
|
|
|
|
|
return; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub START { |
25
|
|
|
|
|
|
|
my ($self, $ident, $arg_ref) = @_; |
26
|
|
|
|
|
|
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub list { my ( $self ) = @_; return @{ $self->get_list() }; } |
30
|
|
|
|
|
|
|
sub next_index { my ( $self ) = @_; my $index = $self->get_index(); $self->set_index( $index + 1 ); return $index; } |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub add { |
33
|
|
|
|
|
|
|
my ( $self, $arg_ref ) = @_; |
34
|
|
|
|
|
|
|
my @fragments = $self->list(); |
35
|
|
|
|
|
|
|
my $fragment; |
36
|
|
|
|
|
|
|
if ( $self->get_type() eq 'simple' ) { |
37
|
|
|
|
|
|
|
my $sequence = defined $arg_ref->{sequence} ? $arg_ref->{sequence} : ''; |
38
|
|
|
|
|
|
|
my $mass = defined $arg_ref->{mass} ? $arg_ref->{mass} : ''; |
39
|
|
|
|
|
|
|
my $fragment_id = defined $arg_ref->{fragment_id} ? $arg_ref->{fragment_id} : $self->next_index(); |
40
|
|
|
|
|
|
|
$fragment = BioX::CLPM::Fragments::Simple->new({ |
41
|
|
|
|
|
|
|
sequence => $sequence, |
42
|
|
|
|
|
|
|
mass => $mass, |
43
|
|
|
|
|
|
|
fragment_id => $fragment_id, |
44
|
|
|
|
|
|
|
sequence_id => $self->get_sequence_id() }); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
elsif ( $self->get_type() eq 'linked' ) { |
47
|
|
|
|
|
|
|
my $fragment_id_1 = defined $arg_ref->{fragment_id_1} ? $arg_ref->{fragment_id_1} : ''; |
48
|
|
|
|
|
|
|
my $fragment_id_2 = defined $arg_ref->{fragment_id_2} ? $arg_ref->{fragment_id_2} : ''; |
49
|
|
|
|
|
|
|
my $mass = defined $arg_ref->{mass} ? $arg_ref->{mass} : ''; |
50
|
|
|
|
|
|
|
my $mods = defined $arg_ref->{mods} ? $arg_ref->{mods} : ''; |
51
|
|
|
|
|
|
|
$fragment = BioX::CLPM::Fragments::Linked->new({ |
52
|
|
|
|
|
|
|
fragment_id_1 => $fragment_id_1, |
53
|
|
|
|
|
|
|
fragment_id_2 => $fragment_id_2, |
54
|
|
|
|
|
|
|
mass => $mass, |
55
|
|
|
|
|
|
|
mods => $mods }); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
push( @fragments, $fragment ); |
58
|
|
|
|
|
|
|
$self->set_list( \@fragments ); |
59
|
|
|
|
|
|
|
return; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
65
|
|
|
|
|
|
|
__END__ |