File Coverage

blib/lib/Bio/RNA/Treekin/MultiRecord.pm
Criterion Covered Total %
statement 20 20 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod n/a
total 27 27 100.0


line stmt bran cond sub pod time code
1             # Bio/RNA/Treekin/MultiRecord.pm
2             package Bio::RNA::Treekin::MultiRecord;
3             our $VERSION = '0.04';
4              
5 4     4   95 use 5.006;
  4         16  
6 4     4   24 use strict;
  4         8  
  4         99  
7 4     4   21 use warnings;
  4         10  
  4         128  
8              
9 4     4   23 use Moose;
  4         7  
  4         30  
10 4     4   28955 use MooseX::StrictConstructor;
  4         9  
  4         31  
11 4     4   13577 use namespace::autoclean;
  4         10  
  4         57  
12              
13 4     4   352 use autodie qw(:all);
  4         9  
  4         33  
14              
15             extends 'IO::File::RecordStream';
16              
17             has '+_record_factory' => ( # + means overwrite inherited attribute
18             is => 'ro',
19             init_arg => undef,
20             default => sub { return sub { Bio::RNA::Treekin::Record->new(@_); } },
21             );
22              
23             has '+match_separator' => ( # + means overwrite inherited attribute
24             is => 'ro',
25             init_arg => undef,
26             default => sub {
27             qr{ ^ & $ }x # match a line consisting of single '&'
28             },
29             );
30              
31             __PACKAGE__->meta->make_immutable;
32              
33             1; # End of Bio::RNA::Treekin::MultiRecord
34              
35              
36             __END__
37              
38              
39             =pod
40              
41             =encoding UTF-8
42              
43             =head1 NAME
44              
45             Bio::RNA::Treekin::MultiRecord - Stream records from a multi-record I<Treekin>
46             file.
47              
48             =head1 SYNOPSIS
49              
50             use Bio::RNA::Treekin;
51              
52             # Open the multi-record Treekin file.
53             my $record_stream = Bio::RNA::Treekin::MultiRecord->new(
54             'multi_treekin.out');
55              
56             # Iterate over the individual records.
57             while (defined (my $record = $record_stream->next)) {
58             ... # do something with the Treekin record
59             }
60              
61             =head1 DESCRIPTION
62              
63             This class provides a stream to read individual records from multi-record
64             I<Treekin> files as generated by the RNA folding simulation tool I<BarMap>.
65              
66             =head1 METHODS
67              
68             This class extends L<IO::File::RecordStream> and offers the same methods.
69             Below, only the differences are described.
70              
71             =head2 Bio::RNA::Treekin::MultiRecord->new($treekin_file)
72              
73             =head2 Bio::RNA::Treekin::MultiRecord->new($treekin_handle)
74              
75             Constructs a new record stream for a multi-I<Treekin> file, i. e. an output
76             file as generated by the I<BarMap> scripts, which were developed by the
77             Theoretical Biochemistry Group (TBI) of the University of Vienna. These files
78             look like a concatenation of multiple regular I<Treekin> files, where the
79             individual file contents are separated by a line consisting only of "&" (a
80             syntax borrowed from the I<Grace> visualization software).
81              
82             Both a path to the file or a handle can be passed to the constructor.
83              
84             =head2 $record_stream->next
85              
86             Return the next I<Treekin> record from the multi-record I<Treekin> file,
87             represented as an object of class L<Bio::RNA::Treekin::Record>.
88              
89              
90             =head1 AUTHOR
91              
92             Felix Kuehnl, C<< <felix@bioinf.uni-leipzig.de> >>
93              
94              
95             =head1 BUGS
96              
97             Please report any bugs or feature requests by raising an issue at
98             L<https://github.com/xileF1337/Bio-RNA-Treekin/issues>.
99              
100             You can also do so by mailing to C<bug-bio-rna-treekin at rt.cpan.org>,
101             or through the web interface at
102             L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Bio-RNA-Treekin>. I will be
103             notified, and then you'll automatically be notified of progress on your bug as
104             I make changes.
105              
106              
107             =head1 SUPPORT
108              
109             You can find documentation for this module with the perldoc command.
110              
111             perldoc Bio::RNA::Treekin
112              
113              
114             You can also look for information at:
115              
116             =over 4
117              
118             =item * Github: the official repository
119              
120             L<https://github.com/xileF1337/Bio-RNA-Treekin>
121              
122             =item * RT: CPAN's request tracker (report bugs here)
123              
124             L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Bio-RNA-Treekin>
125              
126             =item * AnnoCPAN: Annotated CPAN documentation
127              
128             L<http://annocpan.org/dist/Bio-RNA-Treekin>
129              
130             =item * CPAN Ratings
131              
132             L<https://cpanratings.perl.org/d/Bio-RNA-Treekin>
133              
134             =item * Search CPAN
135              
136             L<https://metacpan.org/release/Bio-RNA-Treekin>
137              
138             =back
139              
140              
141             =head1 LICENSE AND COPYRIGHT
142              
143             Copyright 2019-2021 Felix Kuehnl.
144              
145             This program is free software: you can redistribute it and/or modify
146             it under the terms of the GNU General Public License as published by
147             the Free Software Foundation, either version 3 of the License, or
148             (at your option) any later version.
149              
150             This program is distributed in the hope that it will be useful,
151             but WITHOUT ANY WARRANTY; without even the implied warranty of
152             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
153             GNU General Public License for more details.
154              
155             You should have received a copy of the GNU General Public License
156             along with this program. If not, see L<http://www.gnu.org/licenses/>.
157              
158              
159             =cut
160              
161             # End of Bio/RNA/Treekin/MultiRecord.pm