my
$error
;
$DEBUG
=
$ENV
{
'BIOPERLDEBUG'
};
BEGIN {
if
( $@ ) {
}
$TESTCOUNT
= 15;
plan
tests
=>
$TESTCOUNT
;
$error
= 0;
if
( $@ ) {
print
STDERR
"XML::Parser::PerlSAX not loaded. This means game test cannot be executed. Skipping\n"
;
foreach
(
$Test::ntest
..
$TESTCOUNT
) {
skip(
'XML::Parser::PerlSAX installed'
,1);
}
$error
= 1;
}
if
(
$error
== 0 ) {
if
( $@ ) {
print
STDERR
"tinyseq.pm not loaded. This means tinyseq test cannot be executed. Skipping\n"
;
foreach
(
$Test::ntest
..
$TESTCOUNT
) {
skip(
'tinyseq.pm not loaded because XML::Writer not loaded'
,1);
}
$error
= 1;
}
}
}
if
(
$error
== 1 ) {
exit
(0);
}
my
$file
= File::Spec->catfile(
qw(t data NM_002253.tseq)
);
my
$outfile
=
'tinyseqout.xml'
;
my
$instream
= Bio::SeqIO->new(
-file
=>
$file
,
-format
=>
'tinyseq'
);
my
$outstream
= Bio::SeqIO->new(
-file
=>
">$outfile"
,
-format
=>
'tinyseq'
);
my
$seq
=
$instream
->next_seq;
ok(
defined
$seq
);
ok(
defined
$seq
->seq);
ok(
$seq
->
length
, 5830);
ok(
$seq
->accession_number,
'NM_002253'
);
ok(
$seq
->species);
ok(
$seq
->species->binomial,
'Homo sapiens'
);
ok(
$seq
->species->ncbi_taxid, 9606);
$outstream
->write_seq(
$seq
);
undef
$outstream
;
ok(-e
$outfile
);
my
$reread
= Bio::SeqIO->new(
-file
=>
$outfile
,
-format
=>
'tinyseq'
);
my
$seq2
=
$reread
->next_seq;
ok(
$seq2
);
ok(
$seq2
->seq);
ok(
$seq2
->
length
, 5830);
ok(
$seq2
->accession_number,
'NM_002253'
);
ok(
$seq2
->species);
ok(
$seq2
->species->binomial,
'Homo sapiens'
);
ok(
$seq2
->species->ncbi_taxid, 9606);
unlink
$outfile
;