BioPerl
view release on metacpan or search on metacpan
Bio/SeqIO/strider.pm view on Meta::CPAN
# BioPerl module for Bio::SeqIO::strider
#
# Please direct questions and support issues to <bioperl-l@bioperl.org>
#
# Cared for by Malcolm Cook <mec@stowers-institute.org>
#
# You may distribute this module under the same terms as perl itself
#
# _history
# April 7th, 2005 Malcolm Cook authored
# POD documentation - main docs before the code
=head1 NAME
Bio::SeqIO::strider - DNA strider sequence input/output stream
=head1 SYNOPSIS
Do not use this module directly. Use it via the Bio::SeqIO class.
=head1 DESCRIPTION
This object can transform Bio::Seq objects to and from strider
'binary' format, as documented in the strider manual, in which the
first 112 bytes are a header, following by the sequence, followed by a
sequence description.
Note: it does NOT assign any sequence identifier, since they are not
contained in the byte stream of the file; the Strider application
simply displays the name of the file on disk as the name of the
sequence. The caller should set the id, probably based on the name of
the file (after possibly cleaning up whitespace, which ought not to be
used as the id in most applications).
Note: the strider 'comment' is mapped to the BioPerl 'description'
(since there is no other text field, and description maps to defline
text).
=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 AUTHORS - Malcolm Cook
Email: mec@stowers-institute.org
=head1 CONTRIBUTORS
Modelled after Bio::SeqIO::fasta by Ewan Birney E<lt>birney@ebi.ac.ukE<gt> and
Lincoln Stein E<lt>lstein@cshl.orgE<gt>
=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::strider;
use strict;
use warnings;
use Bio::Seq::SeqFactory;
use Convert::Binary::C;
use base qw(Bio::SeqIO);
my $c = Convert::Binary::C->new (
ByteOrder => 'BigEndian',
Alignment => 2
);
my $headerdef;
{local ($/);
# See this file's __DATA__ section for the c structure definitions
# for strider binary header data. Here we slurp it all into $headerdef.
$headerdef = <DATA>};
$c->parse($headerdef);
my $size_F_HEADER = 112;
die "expected strider header structure size of $size_F_HEADER" unless $size_F_HEADER eq $c->sizeof('F_HEADER');
my %alphabet2type = (
# map between BioPerl alphabet and strider
# sequence type code.
# From Strider Documentation: the sequence type:
# 1, 2, 3 and 4 for DNA, DNA Degenerate, RNA and
# Protein sequence files, respectively.
# TODO: determine 'DNA Degenerate' based on
# sequence alphabet?
dna => 1,
rna => 3,
protein => 4,
);
( run in 1.014 second using v1.01-cache-2.11-cpan-437f7b0c052 )