line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# BioPerl module for Bio::AlignIO::mase |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# based on the Bio::SeqIO::mase module |
5
|
|
|
|
|
|
|
# by Ewan Birney |
6
|
|
|
|
|
|
|
# and Lincoln Stein |
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 class. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 DESCRIPTION |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
This object can transform L 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 |
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
|
|
|
3
|
|
447
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
80
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
3
|
|
|
3
|
|
9
|
use base qw(Bio::AlignIO); |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
897
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 next_aln |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Title : next_aln |
75
|
|
|
|
|
|
|
Usage : $aln = $stream->next_aln() |
76
|
|
|
|
|
|
|
Function: returns the next alignment in the stream. |
77
|
|
|
|
|
|
|
Returns : L object |
78
|
|
|
|
|
|
|
Args : NONE |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub next_aln { |
83
|
3
|
|
|
3
|
1
|
9
|
my $self = shift; |
84
|
3
|
|
|
|
|
5
|
my $entry; |
85
|
|
|
|
|
|
|
my $name; |
86
|
0
|
|
|
|
|
0
|
my $start; |
87
|
0
|
|
|
|
|
0
|
my $end; |
88
|
0
|
|
|
|
|
0
|
my $seq; |
89
|
0
|
|
|
|
|
0
|
my $add; |
90
|
3
|
|
|
|
|
5
|
my $count = 0; |
91
|
3
|
|
|
|
|
3
|
my $seq_residues; |
92
|
|
|
|
|
|
|
|
93
|
3
|
|
|
|
|
22
|
my $aln = Bio::SimpleAlign->new(-source => 'mase'); |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
3
|
|
|
|
|
20
|
while( $entry = $self->_readline) { |
97
|
21
|
100
|
|
|
|
51
|
$entry =~ /^;/ && next; |
98
|
6
|
50
|
|
|
|
1413
|
if( $entry =~ /^(\S+)\/(\d+)-(\d+)/ ) { |
99
|
0
|
|
|
|
|
0
|
$name = $1; |
100
|
0
|
|
|
|
|
0
|
$start = $2; |
101
|
0
|
|
|
|
|
0
|
$end = $3; |
102
|
|
|
|
|
|
|
} else { |
103
|
6
|
|
|
|
|
17
|
$entry =~ s/\s//g; |
104
|
6
|
|
|
|
|
8
|
$name = $entry; |
105
|
6
|
|
|
|
|
243
|
$end = -1; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
6
|
|
|
|
|
12
|
$seq = ""; |
109
|
|
|
|
|
|
|
|
110
|
6
|
|
|
|
|
11
|
while( $entry = $self->_readline) { |
111
|
45
|
100
|
|
|
|
98
|
$entry =~ /^;/ && last; |
112
|
42
|
|
|
|
|
94
|
$entry =~ s/[^A-Za-z\.\-]//g; |
113
|
42
|
|
|
|
|
71
|
$seq .= $entry; |
114
|
|
|
|
|
|
|
} |
115
|
6
|
50
|
|
|
|
14
|
if( $end == -1) { |
116
|
6
|
|
|
|
|
5
|
$start = 1; |
117
|
|
|
|
|
|
|
|
118
|
6
|
|
|
|
|
7
|
$seq_residues = $seq; |
119
|
6
|
|
|
|
|
112
|
$seq_residues =~ s/\W//g; |
120
|
6
|
|
|
|
|
107
|
$end = length($seq_residues); |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
6
|
|
|
|
|
16
|
$add = Bio::LocatableSeq->new('-seq' => $seq, |
124
|
|
|
|
|
|
|
'-display_id' => $name, |
125
|
|
|
|
|
|
|
'-start' => $start, |
126
|
|
|
|
|
|
|
'-end' => $end, |
127
|
|
|
|
|
|
|
'-alphabet' => $self->alphabet, |
128
|
|
|
|
|
|
|
); |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
131
|
6
|
|
|
|
|
15
|
$aln->add_seq($add); |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
# If $end <= 0, we have either reached the end of |
135
|
|
|
|
|
|
|
# file in <> or we have encountered some other error |
136
|
|
|
|
|
|
|
# |
137
|
6
|
50
|
|
|
|
17
|
if ($end <= 0) { undef $aln;} |
|
0
|
|
|
|
|
0
|
|
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
3
|
50
|
|
|
|
35
|
return $aln if $aln->num_sequences; |
142
|
0
|
|
|
|
|
|
return; |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head2 write_aln |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Title : write_aln |
150
|
|
|
|
|
|
|
Usage : $stream->write_aln(@aln) |
151
|
|
|
|
|
|
|
Function: writes the $aln object into the stream in mase format ###Not yet implemented!### |
152
|
|
|
|
|
|
|
Returns : 1 for success and 0 for error |
153
|
|
|
|
|
|
|
Args : L object |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=cut |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
sub write_aln { |
159
|
0
|
|
|
0
|
1
|
|
my ($self,@aln) = @_; |
160
|
0
|
|
|
|
|
|
$self->throw_not_implemented(); |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
1; |