2 # BioPerl module for Bio::SeqIO::ztr
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Aaron Mackey <amackey@virginia.edu>
8 # Copyright Aaron Mackey
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
16 Bio::SeqIO::ztr - ztr trace sequence input/output stream
20 Do not use this module directly. Use it via the Bio::SeqIO class.
24 This object can transform Bio::Seq objects to and from ztr trace
31 User feedback is an integral part of the evolution of this and other
32 Bioperl modules. Send your comments and suggestions preferably to one
33 of the Bioperl mailing lists. Your participation is much appreciated.
35 bioperl-l@bioperl.org - General discussion
36 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
40 Please direct usage questions or support issues to the mailing list:
42 I<bioperl-l@bioperl.org>
44 rather than to the module maintainer directly. Many experienced and
45 reponsive experts will be able look at the problem and quickly
46 address it. Please include a thorough description of the problem
47 with code and data examples if at all possible.
51 Report bugs to the Bioperl bug tracking system to help us keep track
52 the bugs and their resolution.
53 Bug reports can be submitted via the web:
55 http://bugzilla.open-bio.org/
57 =head1 AUTHORS - Aaron Mackey
59 Email: amackey@virginia.edu
63 The rest of the documentation details each of the object
64 methods. Internal methods are usually preceded with a _
68 # Let the code begin...
70 package Bio
::SeqIO
::ztr
;
71 use vars
qw(@ISA $READ_AVAIL);
75 use Bio::Seq::SeqFactory;
77 push @ISA, qw( Bio::SeqIO );
80 eval { require Bio
::SeqIO
::staden
::read; };
84 push @ISA, "Bio::SeqIO::staden::read";
91 $self->SUPER::_initialize
(@args);
92 if( ! defined $self->sequence_factory ) {
93 $self->sequence_factory(Bio
::Seq
::SeqFactory
->new(-verbose
=> $self->verbose(), -type
=> 'Bio::Seq::Quality'));
96 my ($compression) = $self->_rearrange([qw
[COMPRESSION
]], @args);
97 $compression = 2 unless defined $compression;
98 $self->compression($compression);
100 unless ($READ_AVAIL) {
101 Bio
::Root
::Root
->throw( -class => 'Bio::Root::SystemException',
102 -text
=> "Bio::SeqIO::staden::read is not available; make sure the bioperl-ext package has been installed successfully!"
110 Usage : $seq = $stream->next_seq()
111 Function: returns the next sequence in the stream
112 Returns : Bio::Seq::Quality object
121 my ($seq, $id, $desc, $qual) = $self->read_trace($self->_fh, 'ztr');
123 # create the seq object
124 $seq = $self->sequence_factory->create(-seq
=> $seq,
137 Usage : $stream->write_seq(@seq)
138 Function: writes the $seq object into the stream
139 Returns : 1 for success and 0 for error
140 Args : Bio::Seq object
146 my ($self,@seq) = @_;
149 foreach my $seq (@seq) {
150 $self->write_trace($fh, $seq, 'ztr' . $self->compression);
153 $self->flush if $self->_flush_on_write && defined $self->_fh;
160 Usage : $stream->compression(3);
161 Function: determines the level of ZTR compression
162 Returns : the current (or newly set) value.
163 Args : 1, 2 or 3 - any other (defined) value will cause the compression
164 to be reset to the default of 2.
171 my ($self, $val) = @_;
174 if ($val =~ m/^1|2|3$/o) {
175 $self->{_compression
} = $val;
177 $self->{_compression
} = 2;
181 return $self->{_compression
};