Bio::SeqIO raw
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvs
Summary
Bio::SeqIO::raw - raw sequence file input/output stream
Package variables
No package variables defined.
Included modules
Bio::Seq::SeqFactory
Inherit
Bio::SeqIO
Synopsis
Do not use this module directly. Use it via the Bio::SeqIO class.
Description
This object can transform Bio::Seq objects to and from raw flat
file databases.
Methods
_initialize
No description
Code
next_seqDescriptionCode
write_seqDescriptionCode
write_qualDescriptionCode
_separator
No description
Code
Methods description
next_seqcode    nextTop
 Title   : next_seq
Usage : $seq = $stream->next_seq()
Function: returns the next sequence in the stream
Returns : Bio::Seq object
Args :
write_seqcodeprevnextTop
 Title   : write_seq
Usage : $stream->write_seq($seq)
Function: writes the $seq object into the stream
Returns : 1 for success and 0 for error
Args : Array of Bio::PrimarySeqI objects
write_qualcodeprevnextTop
 Title   : write_qual
Usage : $stream->write_qual($seq)
Function: writes the $seq object into the stream
Returns : 1 for success and 0 for error
Args : Bio::Seq::Quality object
Methods code
_initializedescriptionprevnextTop
sub _initialize {
    my($self,@args) = @_;
    $self->SUPER::_initialize(@args);
    my ($variant) = $self->_rearrange([qw(VARIANT)], @args);
    $variant ||= 'multiple';
    $self->variant($variant);
    $self->{record_separator} = $variant eq 'single' ? undef : $/;
    if( ! defined $self->sequence_factory ) {
        $self->sequence_factory(Bio::Seq::SeqFactory->new
                    (-verbose => $self->verbose(),
                     -type => 'Bio::Seq'));
    }
    $self->variant;
}
next_seqdescriptionprevnextTop
sub next_seq {
    my ($self,@args) = @_;
    ## When its 1 sequence per line with no formatting at all,
## grabbing it should be easy :)
## adding an option to assume the file is one sequence
local $/ = $self->{record_separator}; my $nextline = $self->_readline(); return unless defined $nextline; my $sequence = uc($nextline); $sequence =~ s/\W//g; return unless $sequence; return $self->sequence_factory->create(-seq => $sequence) if $sequence;
}
write_seqdescriptionprevnextTop
sub write_seq {
    my ($self,@seq) = @_;
    foreach my $seq (@seq) {
        $self->throw("Must provide a valid Bio::PrimarySeqI object")
            unless defined $seq && ref($seq) && $seq->isa('Bio::PrimarySeqI');
        $self->_print($seq->seq, "\n") or return;
    }
    $self->flush if $self->_flush_on_write && defined $self->_fh;
    return 1;
}
write_qualdescriptionprevnextTop
sub write_qual {
    my ($self,@seq) = @_;
    my @qual = ();
    foreach (@seq) {
        unless ($_->isa("Bio::Seq::Quality")){
           warn("You cannot write raw qualities without supplying a Bio::Seq::".
                "Quality object! You passed a ".ref($_)."\n");
           next;
        }
        @qual = @{$_->qual};
        if(scalar(@qual) == 0) {
           $qual[0] = "\n";
        }
        $self->_print (join " ", @qual,"\n") or return;
    }
    return 1;
}
_separatordescriptionprevnextTop
sub _separator {
    shift->{record_separator};
}

1;
}
General documentation
FEEDBACKTop
Mailing ListsTop
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
Support Top
Please direct usage questions or support issues to the mailing list:
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.
Reporting BugsTop
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://redmine.open-bio.org/projects/bioperl/
AUTHORSTop
  Ewan Birney   <birney@ebi.ac.uk>
Lincoln Stein <lstein@cshl.org>
CONTRIBUTORSTop
  Jason Stajich <jason@bioperl.org<gt>
APPENDIXTop
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _
variantTop
 Title   : variant
Usage : $format = $obj->variant();
Function: Get and set method for the sequence variant. For raw sequence, this
indicates whether to treat the input as multiple sequences (the
default) or as a single sequence.
Current values accepted are: 'single' single sequence 'multiple' multiple sequences (default) Returns : string Args : new value, string