Skip to content

Commit

Permalink
added wiggle test
Browse files Browse the repository at this point in the history
  • Loading branch information
lstein committed Mar 25, 2010
1 parent dc49745 commit 3654a94
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions t/Wiggle.t
@@ -0,0 +1,44 @@
#-*-Perl-*-

# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.t'

use strict;
use ExtUtils::MakeMaker;
use File::Temp qw(tempfile);
use FindBin '$Bin';
use constant TEST_COUNT => 10;

use lib "$Bin/../lib","$Bin/../blib/lib","$Bin/../blib/arch";
use Test::More tests => TEST_COUNT;

use File::Temp 'tempdir';
use Bio::Graphics::Wiggle::Loader;

my $source = "$Bin/data/wig_data.wig";
my $tmpdir = tempdir(CLEANUP=>1);

my $loader = Bio::Graphics::Wiggle::Loader->new($tmpdir,'mywibfile');
ok($loader);
my $fh = IO::File->new($source);
ok($loader->load($fh));
my $gff3 = $loader->featurefile('gff3');
undef $loader; # force a flush

ok($gff3);
my ($wibfile) = $gff3 =~ m!wigfile=(.+\.wib)!;
ok($wibfile);
ok($wibfile =~ /mywibfile/);

my $wig = Bio::Graphics::Wiggle->new($wibfile);
ok($wig);
is($wig->seqid,'I');
ok(abs($wig->values(87=>87)->[0]-0.22) < 0.01);
ok(abs($wig->values(173=>173)->[0]-0.52) < 0.01);
my $h = $wig->values(101=>200);
is(@$h,100);

exit 0;



0 comments on commit 3654a94

Please sign in to comment.