Bio-Procedural
view release on metacpan or search on metacpan
examples/bioperl.pl view on Meta::CPAN
waitenter
# now the sequences are output in
# fasta format
# to change to embl format:
^+outformat embl
^,
waitenter
# we can also fetch _all_ seqs from
# a file; for this example we will
# use t/data/swiss.dat, which is in
# swiss format. usually bioperl can guess
# the file format from the file extension
# but this isn't possible here, so we
# must help by setting the input format:
^+format swiss
# now lets get all the sequences, like this:
^<*t/data/swiss.dat
waitenter
# typing <* is equivalent to
# using the read_seqs() function,
# like this:
lib/Bio/Perl.pm view on Meta::CPAN
Bio::Perl - Functional access to BioPerl for people who don't know objects
=head1 VERSION
version 1.7.4
=head1 SYNOPSIS
use Bio::Perl;
# will guess file format from extension
$seq_object = read_sequence($filename);
# forces genbank format
$seq_object = read_sequence($filename,'genbank');
# reads an array of sequences
@seq_object_array = read_all_sequences($filename,'fasta');
# sequences are Bio::Seq objects, so the following methods work
# for more info see Bio::Seq, or do 'perldoc Bio/Seq.pm'
lib/Bio/Perl.pm view on Meta::CPAN
=head2 read_sequence
Title : read_sequence
Usage : $seq = read_sequence('sequences.fa')
$seq = read_sequence($filename,'genbank');
# pipes are fine
$seq = read_sequence("my_fetching_program $id |",'fasta');
Function: Reads the top sequence from the file. If no format is given, it will
try to guess the format from the filename. If a format is given, it
forces that format. The filename can be any valid perl open() string
- in particular, you can put in pipes
Returns : A Bio::Seq object. A quick synopsis:
$seq_object->display_id - name of the sequence
$seq_object->seq - sequence as a string
Args : Two strings, first the filename - any Perl open() string is ok
Second string is the format, which is optional
test_begin(-tests => 31,
-requires_module => 'IO::String');
use_ok('Bio::Perl');
}
# Bio::Perl isn't OO so we don't see Bio::Perl->new() here
my ($seq_object,$filename,$blast_report,@seq_object_array);
# will guess file format from extension
$filename = test_input_file('cysprot1.fa');
ok ($seq_object = read_sequence($filename));
isa_ok $seq_object, 'Bio::SeqI';
# forces genbank format
$filename = test_input_file('AF165282.gb');
ok ($seq_object = read_sequence($filename,'genbank'));
isa_ok $seq_object, 'Bio::SeqI';
# reads an array of sequences
( run in 1.553 second using v1.01-cache-2.11-cpan-748bfb374f4 )