Bio/AlignIO/mase.pm

filter: Statementstmt 84.0% 37 / 44 Branchbran 75.0% 12 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 100% 2 / 2 totaltotal 81.8% 54 / 66 CC 9 SCAR 20.1
CC
9
Cov
82%
next_aln
9.5
write_aln
2.0
BEGIN
1.0
CRAP 7.4
« Bio/AlignIO/psi.pm ↑ Summary Bio/SeqIO/ace.pm »
1 #
2 # BioPerl module for Bio::AlignIO::mase
3  
4 # based on the Bio::SeqIO::mase module
5 # by Ewan Birney <birney@ebi.ac.uk>
6 # and Lincoln Stein <lstein@cshl.org>
7 #
8 # and the SimpleAlign.pm module of Ewan Birney
9 #
10 # Copyright Peter Schattner
11 #
12 # You may distribute this module under the same terms as perl itself
13 # _history
14 # September 5, 2000
15 # POD documentation - main docs before the code
16  
17 =head1 NAME
18  
19 Bio::AlignIO::mase - mase sequence input/output stream
20  
21 =head1 SYNOPSIS
22  
23 Do not use this module directly. Use it via the L<Bio::AlignIO> class.
24  
25 =head1 DESCRIPTION
26  
27 This object can transform L<Bio::Align::AlignI> objects to and from mase flat
28 file databases.
29  
30 =head1 FEEDBACK
31  
32 =head2 Support
33  
34 Please direct usage questions or support issues to the mailing list:
35  
36 I<bioperl-l@bioperl.org>
37  
38 rather than to the module maintainer directly. Many experienced and
39 reponsive experts will be able look at the problem and quickly
40 address it. Please include a thorough description of the problem
41 with code and data examples if at all possible.
42  
43 =head2 Reporting Bugs
44  
45 Report bugs to the Bioperl bug tracking system to help us keep track
46 the bugs and their resolution. Bug reports can be submitted via the
47 web:
48  
49 https://github.com/bioperl/bioperl-live/issues
50  
51 =head1 AUTHORS - Peter Schattner
52  
53 Email: schattner@alum.mit.edu
54  
55  
56 =head1 APPENDIX
57  
58 The rest of the documentation details each of the object
59 methods. Internal methods are usually preceded with a _
60  
61 =cut
62  
63 # Let the code begin...
64  
65 package Bio::AlignIO::mase;
66 3 $Bio::AlignIO::mase::VERSION = '1.7.7';
67 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
68  
69  
70 3 ▶use base qw(Bio::AlignIO);
Subroutine BEGIN: called CC=1 SCAR=0.0
71  
72  
73 =head2 next_aln
74  
75 Title : next_aln
76 Usage : $aln = $stream->next_aln()
77 Function: returns the next alignment in the stream.
78 Returns : L<Bio::Align::AlignI> object
79 Args : NONE
80  
81 =cut
82  
83 sub next_aln {
84 13 ▶ my $self = shift;
Subroutine next_aln: called CC=9 SCAR=22.5
Pod documented
85 13 my $entry;
86 my $name;
87 13 my $start;
88 13 my $end;
89 13 my $seq;
90 13 my $add;
91 13 my $count = 0;
92 13 my $seq_residues;
93  
94 13 my $aln = Bio::SimpleAlign->new(-source => 'mase');
95  
96  
97 13 ▶ while( $entry = $self->_readline) {
Branch: 1 branch
BranchTrueFalseTotal
if ($entry = $self->_readline) 91 13 104
98 91 ▶ $entry =~ /^;/ && next;
Branch: 1 branch
BranchTrueFalseTotal
$entry =~ /^;/ and next 65 26 91
99 26 ▶ if( $entry =~ /^(\S+)\/(\d+)-(\d+)/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($entry =~ m[^(\S+)/(\d+)-(\d+)]) { } 0 26 26
100 0 $name = $1;
101 0 $start = $2;
102 0 $end = $3;
103 } else {
104 26 $entry =~ s/\s//g;
105 26 $name = $entry;
106 26 $end = -1;
107 }
108  
109 26 $seq = "";
110  
111 26 ▶ while( $entry = $self->_readline) {
Branch: 1 branch
BranchTrueFalseTotal
if ($entry = $self->_readline) 195 13 208
112 195 ▶ $entry =~ /^;/ && last;
Branch: 1 branch
BranchTrueFalseTotal
$entry =~ /^;/ and last 13 182 195
113 182 $entry =~ s/[^A-Za-z\.\-]//g;
114 182 $seq .= $entry;
115 }
116 26 ▶ if( $end == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($end == -1) 26 0 26
117 26 $start = 1;
118  
119 26 $seq_residues = $seq;
120 26 $seq_residues =~ s/\W//g;
121 26 $end = length($seq_residues);
122 }
123  
124 26 $add = Bio::LocatableSeq->new('-seq' => $seq,
125 '-display_id' => $name,
126 '-start' => $start,
127 '-end' => $end,
128 '-alphabet' => $self->alphabet,
129 );
130  
131  
132 26 $aln->add_seq($add);
133  
134  
135 # If $end <= 0, we have either reached the end of
136 # file in <> or we have encountered some other error
137 #
138 26 ▶ if ($end <= 0) { undef $aln;}
Branch: 1 branch
BranchTrueFalseTotal
if ($end <= 0) 0 26 26
139  
140 }
141  
142 13 ▶ return $aln if $aln->num_sequences;
Branch: 1 branch
BranchTrueFalseTotal
if $aln->num_sequences 13 0 13
143 0 return;
144 }
145  
146  
147  
148 =head2 write_aln
149  
150 Title : write_aln
151 Usage : $stream->write_aln(@aln)
152 Function: writes the $aln object into the stream in mase format ###Not yet implemented!###
153 Returns : 1 for success and 0 for error
154 Args : L<Bio::Align::AlignI> object
155  
156  
157 =cut
158  
159 sub write_aln {
160 0 ▶ my ($self,@aln) = @_;
Subroutine write_aln: not called CC=1 SCAR=6.9
Pod documented
161 0 $self->throw_not_implemented();
162 }
163  
164 3 1;
« Bio/AlignIO/psi.pm ↑ Summary Bio/SeqIO/ace.pm »