This file is indexed.

/usr/share/perl5/Bio/SeqIO/qual.pm is in libbio-perl-perl 1.6.924-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
#
# Copyright (c) 1997-9 bioperl, Chad Matsalla. All Rights Reserved.
#           This module is free software; you can redistribute it and/or
#           modify it under the same terms as Perl itself.
#
# Copyright Chad Matsalla
#
# You may distribute this module under the same terms as perl itself

# POD documentation - main docs before the code

=head1 NAME

Bio::SeqIO::qual - .qual file input/output stream

=head1 SYNOPSIS

Do not use this module directly.  Use it via the Bio::SeqIO class
(see L<Bio::SeqIO> for details).

  my $in_qual = Bio::SeqIO->new(-file    => $qualfile,
                                -format  => 'qual',
                                -width   => $width,
                                -verbose => $verbose);

=head1 DESCRIPTION

This object can transform .qual (similar to fasta) objects to and from
Bio::Seq::Quality objects. See L<Bio::Seq::Quality> for details.

Like the fasta module, it can take an argument '-width' to change the
number of values per line (defaults to 50).

=head1 FEEDBACK

=head2 Mailing Lists

User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to one
of the Bioperl mailing lists.  Your participation is much appreciated.

  bioperl-l@bioperl.org                  - General discussion
  http://bioperl.org/wiki/Mailing_lists  - About the mailing lists

=head2 Support 

Please direct usage questions or support issues to the mailing list:

I<bioperl-l@bioperl.org>

rather than to the module maintainer directly. Many experienced and 
reponsive experts will be able look at the problem and quickly 
address it. Please include a thorough description of the problem 
with code and data examples if at all possible.

=head2 Reporting Bugs

Report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution.  Bug reports can be submitted via the web:

  https://github.com/bioperl/bioperl-live/issues

=head1 AUTHOR Chad Matsalla

Chad Matsalla
bioinformatics@dieselwurks.com

=head1 CONTRIBUTORS

Jason Stajich, jason@bioperl.org

=head1 APPENDIX

The rest of the documentation details each of the object
methods. Internal methods are usually preceded with a _

=cut

# Let the code begin...

package Bio::SeqIO::qual;
use strict;
use Bio::Seq::SeqFactory;
use Dumpvalue;

my $dumper = Dumpvalue->new();

use base qw(Bio::SeqIO);

our $WIDTH = 25;

sub _initialize {
    my($self,@args) = @_;
    $self->SUPER::_initialize(@args);
    my ($width) = $self->_rearrange([qw(WIDTH)], @args);
    $width && $self->width($width);
    if( ! defined $self->sequence_factory ) {
        $self->sequence_factory(Bio::Seq::SeqFactory->new
                                (-verbose => $self->verbose(),
                                 -type => 'Bio::Seq::PrimaryQual'));
    }
}

=head2 next_seq()

 Title   : next_seq()
 Usage   : $scf = $stream->next_seq()
 Function: returns the next scf sequence in the stream
 Returns : Bio::Seq::PrimaryQual object
 Notes   : Get the next quality sequence from the stream.

=cut

sub next_seq {
    my ($self,@args) = @_;
    my ($qual,$seq);
    my $alphabet;
    local $/ = "\n>";

    return unless my $entry = $self->_readline;

    if ($entry eq '>') {	# very first one
        return unless $entry = $self->_readline;
    }

    # original: my ($top,$sequence) = $entry =~ /^(.+?)\n([^>]*)/s
    my ($top,$sequence) = $entry =~ /^(.+?)\n([^>]*)/s
        or $self->throw("Can't parse entry [$entry]");
    my ($id,$fulldesc) = $top =~ /^\s*(\S+)\s*(.*)/
        or $self->throw("Can't parse fasta header");
    $id =~ s/^>//;
    # create the seq object
    $sequence =~ s/\n+/ /g;
    return $self->sequence_factory->create
        (-qual        => $sequence,
         -id         => $id,
         -primary_id => $id,
         -display_id => $id,
         -desc       => $fulldesc
        );
}

=head2 _next_qual

 Title   : _next_qual
 Usage   : $seq = $stream->_next_qual() (but do not do
      	  that. Use $stream->next_seq() instead)
 Function: returns the next quality in the stream
 Returns : Bio::Seq::PrimaryQual object
 Args    : NONE
 Notes	: An internal method. Gets the next quality in
	        the stream.

=cut

sub _next_qual {
    my $qual = next_primary_qual( $_[0], 1 );
    return $qual;
}

=head2 next_primary_qual()

 Title   : next_primary_qual()
 Usage   : $seq = $stream->next_primary_qual()
 Function: returns the next sequence in the stream
 Returns : Bio::PrimaryQual object
 Args    : NONE

=cut

sub next_primary_qual {
    # print("CSM next_primary_qual!\n");
    my( $self, $as_next_qual ) = @_;
    my ($qual,$seq);
    local $/ = "\n>";

    return unless my $entry = $self->_readline;

    if ($entry eq '>') {        # very first one
        return unless $entry = $self->_readline;
    }

    my ($top,$sequence) = $entry =~ /^(.+?)\n([^>]*)/s
        or $self->throw("Can't parse entry [$entry]");
    my ($id,$fulldesc) = $top =~ /^\s*(\S+)\s*(.*)/
        or $self->throw("Can't parse fasta header");
    $id =~ s/^>//;
    # create the seq object
    $sequence =~ s/\n+/ /g;
    if ($as_next_qual) {
        $qual = Bio::Seq::PrimaryQual->new(-qual       => $sequence,
                                           -id         => $id,
                                           -primary_id => $id,
                                           -display_id => $id,
                                           -desc       => $fulldesc
                                          );
    }
    return $qual;
}


=head2 width

 Title   : width
 Usage   : $obj->width($newval)
 Function: Get/Set the number of values per line  for FASTA-like output
 Returns : value of width
 Args    : newvalue (optional)


=cut

sub width{
   my ($self,$value) = @_;
   if( defined $value) {
      $self->{'width'} = $value;
    }
    return $self->{'width'} || $WIDTH;
}


=head2 write_seq

 Title   : write_seq
 Usage   : $obj->write_seq( -source => $source,
                            -header  => "some information"
                            -oneline => 0);
 Function: Write out a list of quality values to a fasta-style file.
 Returns : Nothing.
 Args    : Requires a reference to a Bio::Seq::Quality object or a
           PrimaryQual object as the -source. Option 1: information
           for the header. Option 2: whether the quality score should
           be on a single line or not
 Notes   : If no -header is provided, $obj->id() will be used where
           $obj is a reference to either a Quality object or a
           PrimaryQual object. If $source->id() fails, "unknown" will
           be the header. If the Quality object has $source->length()
           of "DIFFERENT" (read the pod, luke), write_seq will use the
           length of the PrimaryQual object within the Quality object.

=cut

sub write_seq {
    my ($self,@args) = @_;
    my $width = $self->width;
    my ($source, $head, $oneline) = $self->_rearrange([qw(SOURCE HEADER ONELINE)], @args);
    if (!$source || ( !$source->isa('Bio::Seq::Quality') &&
                      !$source->isa('Bio::Seq::PrimaryQual')   )) {
        $self->throw("You must pass a Bio::Seq::Quality or a Bio::Seq::PrimaryQual".
                     " object to write_seq() as a parameter named \"source\"");
    }
    my $header = ($source->can("header") && $source->header) ?
        $source->header :
            ($source->can("id") && $source->id) ?
                $source->id :
                    "unknown";
    my @quals = $source->qual();
    # ::dumpValue(\@quals);
    my $desc = $source->desc if $source->can('desc');
    $desc ||= '';
    $self->_print (">$header $desc\n");
    my (@slice,$max,$length);
    $length = $source->length();
	
    if ( not(defined($oneline)) || $oneline == 0) {
        # $width quality values per line
	for (my $count = 1; $count<=$length; $count+= $width) {
            if ($count+$width > $length) {
                $max = $length;
            } else {
                $max = $count+$width-1;
            }
            my @slice = @{$source->subqual($count,$max)};
            $self->_print (join(' ',@slice), "\n");
	}
    } else {
        # quality values on a single line
        my @slice = @{$source->qual};
        $self->_print (join(' ',@slice), "\n");
    }

    $self->flush if $self->_flush_on_write && defined $self->_fh;
    return 1;
}


1;

__END__