2 # BioPerl module for Bio::SeqIO::abi
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::abi - abi 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 abi trace
25 files. To optionally read the trace graph data (which can be used
26 to draw chromatographs, for instance), set the optional
27 '-read_graph_data' flag or the read_graph_data method to a value
34 User feedback is an integral part of the evolution of this and other
35 Bioperl modules. Send your comments and suggestions preferably to one
36 of the Bioperl mailing lists. Your participation is much appreciated.
38 bioperl-l@bioperl.org - General discussion
39 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
43 Please direct usage questions or support issues to the mailing list:
45 L<bioperl-l@bioperl.org>
47 rather than to the module maintainer directly. Many experienced and
48 reponsive experts will be able look at the problem and quickly
49 address it. Please include a thorough description of the problem
50 with code and data examples if at all possible.
54 Report bugs to the Bioperl bug tracking system to help us keep track
55 the bugs and their resolution.
56 Bug reports can be submitted via the web:
58 http://bugzilla.open-bio.org/
60 =head1 AUTHORS - Aaron Mackey
62 Email: amackey@virginia.edu
66 The rest of the documentation details each of the object
67 methods. Internal methods are usually preceded with a _
71 # Let the code begin...
73 package Bio
::SeqIO
::abi
;
74 use vars
qw(@ISA $READ_AVAIL);
78 use Bio::Seq::SeqFactory;
80 push @ISA, qw( Bio::SeqIO );
83 eval { require Bio
::SeqIO
::staden
::read; };
87 push @ISA, "Bio::SeqIO::staden::read";
94 $self->SUPER::_initialize
(@args);
95 my ($get_trace) = $self->_rearrange([qw(get_trace_data)],@args);
96 $get_trace && $self->get_trace_data(1);
97 if( ! defined $self->sequence_factory ) {
98 $self->sequence_factory(Bio
::Seq
::SeqFactory
->new(-verbose
=> $self->verbose(), -type
=> 'Bio::Seq::Quality'));
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, 'abi');
123 # create the seq object
124 my ($base_locs, $a_trace, $c_trace, $g_trace, $t_trace, $points, $max_height);
125 if ($self->get_trace_data) {
126 ($base_locs, $a_trace, $c_trace, $g_trace, $t_trace, $points, $max_height) = $self->read_trace_with_graph($self->_fh, 'abi');
131 # create the seq object
132 $seq = $self->sequence_factory->create(-seq
=> $seq,
138 -trace
=> join (" ", @
{$base_locs}),
139 -trace_data
=> { a_trace
=> $a_trace,
143 max_height
=> $max_height,
144 num_points
=> $points }
152 Usage : $stream->write_seq(@seq)
153 Function: writes the $seq object into the stream
154 Returns : 1 for success and 0 for error
155 Args : Bio::Seq object
161 my ($self,@seq) = @_;
164 foreach my $seq (@seq) {
165 $self->write_trace($fh, $seq, 'abi');
168 $self->flush if $self->_flush_on_write && defined $self->_fh;
172 =head2 get_trace_data
174 Title : get_trace_data
175 Usage : $stream->get_trace_data(1)
176 Function: set boolean flag to retrieve the trace data (possibly for
178 Returns : bool value, TRUE = retrieve trace data (default FALSE)
184 my ($self, $val) = @_;
185 $self->{_get_trace_data
} = $val ?
1 : 0;
186 $self->{_get_trace_data
};