~ubuntu-branches/ubuntu/raring/bioperl/raring

« back to all changes in this revision

Viewing changes to Bio/SearchIO/psl.pm

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2008-03-18 14:44:57 UTC
  • mfrom: (4 hardy)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20080318144457-1jjoztrvqwf0gruk
* debian/control:
  - Removed MIA Matt Hope (dopey) from the Uploaders field.
    Thank you for your work, Matt. I hope you are doing well.
  - Downgraded some recommended package to the 'Suggests' priority,
    according to the following discussion on Upstream's mail list.
    http://bioperl.org/pipermail/bioperl-l/2008-March/027379.html
    (Closes: #448890)
* debian/copyright converted to machine-readable format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# $Id: psl.pm,v 1.5 2003/09/18 13:10:32 jason Exp $
 
1
# $Id: psl.pm,v 1.13.4.1 2006/10/02 23:10:26 sendu Exp $
2
2
#
3
3
# BioPerl module for Bio::SearchIO::psl
4
4
#
40
40
Bioperl modules. Send your comments and suggestions preferably to
41
41
the Bioperl mailing list.  Your participation is much appreciated.
42
42
 
43
 
  bioperl-l@bioperl.org              - General discussion
44
 
  http://bioperl.org/MailList.shtml  - About the mailing lists
 
43
  bioperl-l@bioperl.org                  - General discussion
 
44
  http://bioperl.org/wiki/Mailing_lists  - About the mailing lists
45
45
 
46
46
=head2 Reporting Bugs
47
47
 
48
48
Report bugs to the Bioperl bug tracking system to help us keep track
49
 
of the bugs and their resolution. Bug reports can be submitted via
50
 
email or the web:
 
49
of the bugs and their resolution. Bug reports can be submitted via the
 
50
web:
51
51
 
52
 
  http://bugzilla.bioperl.org/
 
52
  http://bugzilla.open-bio.org/
53
53
 
54
54
=head1 AUTHOR - Jason Stajich
55
55
 
56
56
Email jason-at-bioperl-dot-org
57
57
 
58
 
=head1 CONTRIBUTORS
59
 
 
60
 
Additional contributors names and emails here
61
 
 
62
58
=head1 APPENDIX
63
59
 
64
60
The rest of the documentation details each of the object methods.
71
67
 
72
68
 
73
69
package Bio::SearchIO::psl;
74
 
use vars qw(@ISA %MAPPING %MODEMAP $DEFAULT_WRITER_CLASS $DefaultProgramName);
 
70
use vars qw(%MAPPING %MODEMAP $DEFAULT_WRITER_CLASS $DefaultProgramName);
75
71
 
76
72
use strict;
77
 
use Bio::SearchIO;
78
73
use Bio::Search::HSP::HSPFactory;
79
74
use Bio::Search::Hit::HitFactory;
80
75
use Bio::Search::Result::ResultFactory;
129
124
             'PSLOutput_db-let'   => 'RESULT-database_letters',
130
125
             );
131
126
 
132
 
@ISA = qw(Bio::SearchIO );
 
127
use base qw(Bio::SearchIO);
133
128
 
134
129
=head2 new
135
130
 
168
163
 
169
164
sub next_result{
170
165
   my ($self) = @_;
171
 
   my ($lastquery,$lasthit) = undef;
172
 
   local ($_);
173
 
 
174
 
   #clear header if exists
175
 
   my $head = $self->_readline;
176
 
   if($head =~ /^psLayout/){
177
 
       for(1..4){$self->_readline}
178
 
   } else {
179
 
     $self->_pushback($head);
180
 
   }
 
166
   my ($lastquery,$lasthit);
 
167
   local $/ = "\n";
 
168
   local $_;
181
169
 
182
170
   while( defined ($_ = $self->_readline) ) {
183
 
       my ( $matches,$mismatches,$rep_matches,$n_count,
 
171
            #clear header if exists
 
172
            if(/^psLayout/){
 
173
                        #pass over header lines lines
 
174
                        while(!/^\d+\s+\d+\s+/) {
 
175
                                $_ = $self->_readline;
 
176
                        }
 
177
            } 
 
178
                my ( $matches,$mismatches,$rep_matches,$n_count,
184
179
            $q_num_insert,$q_base_insert,
185
180
            $t_num_insert, $t_base_insert, 
186
181
            $strand, $q_name, $q_length, $q_start,
249
244
           $self->element({'Name' => 'Hsp_query-from',
250
245
                           'Data' => $q_start + 1});
251
246
           $self->element({'Name' => 'Hsp_query-to',
252
 
                           'Data' => $q_end + 1});
 
247
                           'Data' => $q_end});
253
248
       } else { 
254
249
           $self->element({'Name' => 'Hsp_query-to',
255
250
                           'Data' => $q_start + 1});
256
251
           $self->element({'Name' => 'Hsp_query-from',
257
 
                           'Data' => $q_end + 1});
 
252
                           'Data' => $q_end});
258
253
       }
259
254
       my $hsplen = $q_base_insert + $t_base_insert + 
260
255
           abs( $t_end - $t_start) + abs( $q_end - $q_start);
261
256
       $self->element({'Name' => 'Hsp_hit-from',
262
257
                       'Data' => $t_start + 1 });
263
258
       $self->element({'Name' => 'Hsp_hit-to',
264
 
                       'Data' => $t_end + 1});
 
259
                       'Data' => $t_end});
265
260
       $self->element({'Name' => 'Hsp_align-len',
266
261
                       'Data' => $hsplen});
267
 
       my @blocksizes = split(/,/,$block_sizes); # block sizes
268
262
       # cleanup trailing commas in some output
269
263
       $block_sizes =~ s/\,$//;
270
264
       $q_starts    =~ s/\,$//;
271
265
       $t_starts    =~ s/\,$//;
 
266
       my @blocksizes = split(/,/,$block_sizes); # block sizes
272
267
       my @qstarts = split(/,/,$q_starts); # starting position of each block
273
268
                                           # in query
274
269
       my @tstarts = split(/,/,$t_starts); # starting position of each block