File Coverage

blib/lib/Bio/Palantir/Refiner.pm
Criterion Covered Total %
statement 15 21 71.4
branch n/a
condition n/a
subroutine 5 6 83.3
pod n/a
total 20 27 74.0


line stmt bran cond sub pod time code
1             package Bio::Palantir::Refiner;
2             # ABSTRACT: front-end class for Bio::Palantir::Refiner module, wich handles the refinement of NRPS/PKS BGC annotations
3             $Bio::Palantir::Refiner::VERSION = '0.211420';
4 1     1   9 use Moose;
  1         2  
  1         8  
5 1     1   6869 use namespace::autoclean;
  1         4  
  1         8  
6              
7 1     1   101 use Data::UUID;
  1         2  
  1         71  
8              
9 1     1   6 use aliased 'Bio::Palantir::Parser';
  1         2  
  1         7  
10 1     1   213 use aliased 'Bio::Palantir::Refiner::ClusterPlus';
  1         3  
  1         4  
11             extends 'Bio::FastParsers::Base';
12              
13              
14             # ATTRIBUTES
15              
16              
17              
18             has 'module_delineation' => (
19             is => 'ro',
20             isa => 'Str',
21             default => 'substrate-selection',
22             );
23              
24              
25             has 'clusters' => (
26             traits => ['Array'],
27             is => 'ro',
28             isa => 'ArrayRef[Bio::Palantir::Refiner::ClusterPlus]',
29             init_arg => undef,
30             lazy => 1,
31             builder => '_build_clusters',
32             handles => {
33             count_clusters => 'count',
34             all_clusters => 'elements',
35             get_cluster => 'get',
36             next_cluster => 'shift',
37             },
38             );
39              
40             ## no critic (ProhibitUnusedPrivateSubroutines)
41              
42             sub _build_clusters {
43 0     0     my $self = shift;
44            
45 0           my $report = Parser->new( file => $self->file );
46 0           my $root = $report->root;
47              
48 0           my @cluster_plus;
49             push @cluster_plus, ClusterPlus->new(
50             _cluster => $_,
51             module_delineation => $self->module_delineation
52 0           ) for $root->all_clusters
53             ;
54              
55 0           return \@cluster_plus;
56              
57             }
58              
59             ## use critic
60              
61              
62             __PACKAGE__->meta->make_immutable;
63             1;
64              
65             __END__
66              
67             =pod
68              
69             =head1 NAME
70              
71             Bio::Palantir::Refiner - front-end class for Bio::Palantir::Refiner module, wich handles the refinement of NRPS/PKS BGC annotations
72              
73             =head1 VERSION
74              
75             version 0.211420
76              
77             =head1 DESCRIPTION
78              
79             This module implements classes and their methods for B<improving the antisMASH
80             annotation of NRPS/PKS BGCs>.
81              
82             The refined B<Biosynthetic Gene Cluster (BGC) information> is hierarchically
83             organized as follows:
84              
85             C<ClusterPlus.pm>: contains attributes and methods for the BGC B<Cluster> level,
86             including an array of GenePlus objects
87              
88             C<GenePlus.pm>: contains attributes and methods for the BGC B<Gene> level,
89             including an array of DomainPlus objects (if NRPS/PKS BGCs)
90              
91             C<ModulePlus.pm>: contains attributes and methods for the BGC B<Module> level
92             (generated by Palantir), including an array of DomainPlus objects (this class is
93             parallel to Genes, as module can be overlapping 2 genes)
94              
95             C<DomainPlus.pm>: contains attributes and methods for the BGC B<Domain> level
96              
97             =head1 ATTRIBUTES
98              
99             =head2 file
100              
101             Path to biosynML.xml or regions.js antiSMASH report file to be parsed.
102              
103             =head2 file
104              
105             Path to a biosynML.xml or regions.js file
106              
107             =head2 module_delineation
108              
109             Module delineation method: generates modules from condensation or selection domains.
110              
111             =head2 clusters
112              
113             ArrayRef of L<Bio::Palantir::Refiner::ClusterPlus>
114              
115             =head1 METHODS
116              
117             =head2 count_clusters
118              
119             Returns the number of Clusters of the Root.
120              
121             # $root is a Bio::Palantir::Refiner::RootPlus
122             my $count = $root->count_clusters;
123              
124             This method does not accept any arguments.
125              
126             =head2 all_clusters
127              
128             Returns all the Clusters of the Root (not an array reference).
129              
130             # $root is a Bio::Palantir::Refiner::RootPlus
131             my @clusters = $root->all_clusters;
132              
133             This method does not accept any arguments.
134              
135             =head2 get_cluster
136              
137             Returns one Cluster of the Root by its index. You can also use
138             negative index numbers, just as with Perl's core array handling. If the
139             specified Cluster does not exist, this method will return C<undef>.
140              
141             # $root is a Bio::Palantir::Refiner::RootPlus
142             my $cluster = $root->get_cluster($index);
143             croak "Cluster $index not found!" unless defined $cluster;
144              
145             This method accepts just one argument (and not an array slice).
146              
147             =head2 next_cluster
148              
149             Shifts the first Cluster of the array off and returns it, shortening the
150             array by 1 and moving everything down. If there are no more Clusters in
151             the array, returns C<undef>.
152              
153             # $root is a Bio::Palantir::Refiner::RootPlus
154             while (my $cluster = $root->next_cluster) {
155             # process $cluster
156             # ...
157             }
158              
159             This method does not accept any arguments.
160              
161             =head1 AUTHOR
162              
163             Loic MEUNIER <lmeunier@uliege.be>
164              
165             =head1 COPYRIGHT AND LICENSE
166              
167             This software is copyright (c) 2019 by University of Liege / Unit of Eukaryotic Phylogenomics / Loic MEUNIER and Denis BAURAIN.
168              
169             This is free software; you can redistribute it and/or modify it under
170             the same terms as the Perl 5 programming language system itself.
171              
172             =cut