t/*: remove "use lib '.'" and t/lib/Error.pm
[bioperl-live.git] / t / SeqIO / largefasta.t
blob8ea77f51051d3c4afbccb22758c2e31b3e9b62e4
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id$
4 use strict;
6 BEGIN { 
7     use Bio::Root::Test;
8     
9     test_begin(-tests => 16);
11     use_ok('Bio::SeqIO::largefasta');
14 my $tmpfile = test_output_file();
16 my $seqio = Bio::SeqIO->new('-format' => 'largefasta',
17                             '-file'   => test_input_file('genomic-seq.fasta'),
18                             );
19 isa_ok($seqio, 'Bio::SeqIO');
21 my $pseq = $seqio->next_seq();
22 $pseq->alphabet('dna');
23 $pseq->desc('this is my description');;
24 my $plength = $pseq->length();
25 my $last_3 = $pseq->subseq($plength-3,$plength);
27 is defined $pseq, 1;
28 is $plength > 0, 1;
29 is length($pseq->subseq(100, 299)), 200; 
30 is $pseq->trunc(100,199)->length(), 100; 
31 is $pseq->alphabet(), 'dna';
32 is $pseq->display_id(), 'HSBA536C5';
33 is $pseq->accession_number(), 'unknown';
34 is $pseq->desc, 'this is my description';
36 is open(OUT, '>', $tmpfile), 1;
38 my $seqout = Bio::SeqIO->new('-format' => 'largefasta',
39                              '-fh'     => \*OUT );
40 is defined $seqout, 1;
42 is $seqout->write_seq($pseq), 1;
43 $seqout->close();
44 close(OUT);
45 my $seqin = Bio::SeqIO->new('-format' => 'largefasta',
46                             '-file'   => $tmpfile);
47 my $pseq2 = $seqin->next_seq;
48 is ($plength, $pseq2->length());
49 is ($pseq->display_id(), $pseq2->display_id());
50 is ($pseq->desc(), $pseq2->desc());