5 eval { require Test; };
14 use vars qw($tmpfile);
16 END { unlink $tmpfile; }
18 $tmpfile = Bio::Root::IO->catfile("t","data","largefastatest.out");
19 my $seqio = new Bio::SeqIO('-format'=>'largefasta',
20 '-file' =>Bio::Root::IO->catfile("t","data","genomic-seq.fasta"));
21 ok defined $seqio, 1, 'cannot instantiate Bio::SeqIO::largefasta';
23 my $pseq = $seqio->next_seq();
24 $pseq->alphabet('dna');
25 $pseq->desc('this is my description');;
26 my $plength = $pseq->length();
27 my $last_3 = $pseq->subseq($plength-3,$plength);
29 ok defined $pseq, 1, 'could not call next_seq';
30 ok $plength > 0, 1, "could not call length, seq was empty";
31 ok length($pseq->subseq(100, 299)), 200, 'error in subseq';
32 ok $pseq->trunc(100,199)->length(), 100, 'error in trunc';
33 ok $pseq->alphabet(), 'dna', 'alphabet was ' . $pseq->alphabet();
34 ok $pseq->display_id(), 'HSBA536C5',"no display id";
35 ok $pseq->accession_number(), 'unknown', "no accession";
36 ok $pseq->desc, 'this is my description', 'no description';
38 ok open(OUT, ">$tmpfile"), 1,'could not open output file';
40 my $seqout = new Bio::SeqIO('-format' => 'largefasta',
42 ok defined $seqout, 1,'could not open seq with outputstream';
44 ok $seqout->write_seq($pseq), 1,'could not write seq';
47 my $seqin = new Bio::SeqIO('-format' => 'largefasta',
49 my $pseq2 = $seqin->next_seq;
50 ok ($plength, $pseq2->length(),
51 "written file was not same length as expected");
52 ok ($pseq->display_id(), $pseq2->display_id(),
53 "display ids were not identical as expected");
54 ok ($pseq->desc(), $pseq2->desc() ,
55 "description was not identical (" . $pseq->desc() .
56 "," . $pseq2->desc() . ")");