1 # BioPerl module for Bio::SeqIO::abi
3 # Please direct questions and support issues to <bioperl-l@bioperl.org>
5 # Cared for by Aaron Mackey <amackey@virginia.edu>
7 # Copyright Aaron Mackey
9 # You may distribute this module under the same terms as perl itself
11 # POD documentation - main docs before the code
15 Bio::SeqIO::abi - abi trace sequence input/output stream
19 Do not use this module directly. Use it via the Bio::SeqIO class.
23 This object can transform Bio::Seq objects to and from abi trace
24 files. To optionally read the trace graph data (which can be used
25 to draw chromatographs, for instance), set the optional
26 '-get_trace_data' flag or the get_trace_data method to a value
33 User feedback is an integral part of the evolution of this and other
34 Bioperl modules. Send your comments and suggestions preferably to one
35 of the Bioperl mailing lists. Your participation is much appreciated.
37 bioperl-l@bioperl.org - General discussion
38 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
42 Please direct usage questions or support issues to the mailing list:
44 I<bioperl-l@bioperl.org>
46 rather than to the module maintainer directly. Many experienced and
47 reponsive experts will be able look at the problem and quickly
48 address it. Please include a thorough description of the problem
49 with code and data examples if at all possible.
53 Report bugs to the Bioperl bug tracking system to help us keep track
54 the bugs and their resolution.
55 Bug reports can be submitted via the web:
57 https://github.com/bioperl/bioperl-live/issues
59 =head1 AUTHORS - Aaron Mackey
61 Email: amackey@virginia.edu
65 The rest of the documentation details each of the object
66 methods. Internal methods are usually preceded with a _
70 # Let the code begin...
72 package Bio
::SeqIO
::abi
;
73 use vars
qw(@ISA $READ_AVAIL);
77 use Bio::Seq::SeqFactory;
79 push @ISA, qw( Bio::SeqIO );
82 eval { require Bio
::SeqIO
::staden
::read; };
86 push @ISA, "Bio::SeqIO::staden::read";
93 $self->SUPER::_initialize
(@args);
94 my ($get_trace) = $self->_rearrange([qw(get_trace_data)],@args);
95 $get_trace && $self->get_trace_data(1);
96 if( ! defined $self->sequence_factory ) {
97 $self->sequence_factory(Bio
::Seq
::SeqFactory
->new(-verbose
=> $self->verbose(), -type
=> 'Bio::Seq::Quality'));
99 unless ($READ_AVAIL) {
100 Bio
::Root
::Root
->throw( -class => 'Bio::Root::SystemException',
101 -text
=> "Bio::SeqIO::staden::read is not available; make sure the bioperl-ext package has been installed successfully!"
109 Usage : $seq = $stream->next_seq()
110 Function: returns the next sequence in the stream
111 Returns : Bio::Seq::Quality object
120 my ($seq, $id, $desc, $qual) = $self->read_trace($self->_fh, 'abi');
122 # create the seq object
123 my ($base_locs, $a_trace, $c_trace, $g_trace, $t_trace, $points, $max_height);
124 if ($self->get_trace_data) {
125 ($base_locs, $a_trace, $c_trace, $g_trace, $t_trace, $points, $max_height) = $self->read_trace_with_graph($self->_fh, 'abi');
130 # create the seq object
131 $seq = $self->sequence_factory->create(-seq
=> $seq,
137 -trace
=> join (" ", @
{$base_locs}),
138 -trace_data
=> { a_trace
=> $a_trace,
142 max_height
=> $max_height,
143 num_points
=> $points }
151 Usage : $stream->write_seq(@seq)
152 Function: writes the $seq object into the stream
153 Returns : 1 for success and 0 for error
154 Args : Bio::Seq object
160 my ($self,@seq) = @_;
163 foreach my $seq (@seq) {
164 $self->write_trace($fh, $seq, 'abi');
167 $self->flush if $self->_flush_on_write && defined $self->_fh;
171 =head2 get_trace_data
173 Title : get_trace_data
174 Usage : $stream->get_trace_data(1)
175 Function: set boolean flag to retrieve the trace data (possibly for
177 Returns : bool value, TRUE = retrieve trace data (default FALSE)
183 my ($self, $val) = @_;
184 $self->{_get_trace_data
} = $val ?
1 : 0 if (defined $val);
185 $self->{_get_trace_data
};