~ubuntu-branches/ubuntu/precise/bioperl/precise

« back to all changes in this revision

Viewing changes to Bio/AlignIO/fasta.pm

  • Committer: Bazaar Package Importer
  • Author(s): Ilya Barygin
  • Date: 2010-01-27 22:48:22 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100127224822-ebot4qbrjxcv38au
Tags: 1.6.1-1ubuntu1
* Merge from Debian testing, remaining changes:
  - disable tests, they produce a FTBFS trying to access the network 
    during run.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# $Id: fasta.pm 11603 2007-07-31 15:32:43Z sendu $
 
1
# $Id: fasta.pm 16123 2009-09-17 12:57:27Z cjfields $
2
2
#
3
3
# BioPerl module for Bio::AlignIO::fasta
4
4
#
25
25
 
26
26
=head1 FEEDBACK
27
27
 
 
28
=head2 Support 
 
29
 
 
30
Please direct usage questions or support issues to the mailing list:
 
31
 
 
32
I<bioperl-l@bioperl.org>
 
33
 
 
34
rather than to the module maintainer directly. Many experienced and 
 
35
reponsive experts will be able look at the problem and quickly 
 
36
address it. Please include a thorough description of the problem 
 
37
with code and data examples if at all possible.
 
38
 
28
39
=head2 Reporting Bugs
29
40
 
30
41
Report bugs to the Bioperl bug tracking system to help us keep track
51
62
 
52
63
use base qw(Bio::AlignIO);
53
64
our $WIDTH = 60;
 
65
use Bio::LocatableSeq;
54
66
 
55
67
=head2 next_aln
56
68
 
130
142
                $start = 1;
131
143
                $end = $self->_get_len($seqchar);
132
144
        }
133
 
 
134
 
        #  If $end <= 0, we have either reached the end of
135
 
        #  file in <> or we have encountered some other error
136
 
        if ( $end <= 0 ) { 
137
 
                undef $aln; 
138
 
                return $aln;
139
 
        }
140
145
        
141
146
        # This logic now also reads empty lines at the 
142
147
        # end of the file. Skip this is seqchar and seqname is null
157
162
                $seq->seq( $seq->seq() . "-" x $diff);
158
163
            }
159
164
        }
160
 
        return $aln;
 
165
 
 
166
    # no sequences means empty alignment (possible EOF)
 
167
        return $aln if $aln->num_sequences;
161
168
}
162
169
 
163
170
=head2 write_aln
217
224
 
218
225
sub _get_len {
219
226
        my ($self,$seq) = @_;
220
 
        $seq =~ s/[^A-Z]//gi;
 
227
        my $chars = $Bio::LocatableSeq::RESIDUE_SYMBOLS;
 
228
        $seq =~ s{[^$chars]+}{}gi;
221
229
        return CORE::length($seq);
222
230
}
223
231