New INSTALL.WIN doc (from wiki)
[bioperl-live.git] / t / SeqWords.t
blob7b54c1cb22d5760be46fbe72fc4d4171a8fc5dbf
1 # -*-Perl-*-
2 ## Bioperl Test Harness Script for Modules
3 ## $Id$
5 ## SeqWords.t, based on SeqStats.t
6 # Derek Gatherer, 11th November 2003
8 use strict;
9 BEGIN {
10     # to handle systems with no installed Test module
11     # we include the t dir (where a copy of Test.pm is located)
12     # as a fallback
13     eval { require Test; };
14     if( $@ ) { use lib 't'; }
15     use Test;
16     plan tests => 16;
19 use Bio::PrimarySeq;
20 use Bio::Tools::SeqWords;
21 use vars ('$DEBUG');
23 ok 1;
25 my ($seqobj, $count, $seqobj_stats, $wt);
27 $seqobj = Bio::PrimarySeq->new(-seq=>'ACTGTGGCGTCAACTGACTGGC',
28                                -alphabet=>'dna', -id=>'test');
29 $seqobj_stats  =  Bio::Tools::SeqWords->new(-seq=>$seqobj);
31 ok defined($seqobj_stats) && ref($seqobj_stats) &&
32     $seqobj_stats->isa('Bio::Tools::SeqWords');
34 $count = $seqobj_stats->count_words(4);
35 ok $count->{'ACTG'}, 3;
36 ok $count->{'TGGC'}, 1;
37 ok $count->{'GTCA'}, 1;
39 $count = $seqobj_stats->count_overlap_words(4);
40 ok $count->{'ACTG'}, 3;
41 ok $count->{'TGGC'}, 2;
42 ok $count->{'GTCA'}, 1;
43 ok $count->{'GTGG'}, 1;
45 # now test a protein
46 $seqobj = Bio::PrimarySeq->new(-seq=>'MQSERGITIDISLWKFETSKYYVTIDISSLWKF',
47                                -alphabet=>'protein', -id=>'test');
48 $seqobj_stats  =  Bio::Tools::SeqWords->new('-seq' => $seqobj);
49 ok defined($seqobj_stats) && ref($seqobj_stats) &&
50     $seqobj_stats->isa('Bio::Tools::SeqWords');
52 $count = $seqobj_stats->count_words(4);
53 ok $count->{'MQSE'}, 1;
54 ok $count->{'LWKF'}, 1;
55 ok $count->{'IDIS'}, 2;
57 $count = $seqobj_stats->count_overlap_words(4);
58 ok $count->{'MQSE'}, 1;
59 ok $count->{'LWKF'}, 2;
60 ok $count->{'IDIS'}, 2;