[bug 2686]
[bioperl-live.git] / t / SeqWords.t
blob54a0ac2e588381ac16dfd0e1652f71e321b657a3
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id$
5 use strict;
7 BEGIN {
8     use lib 't/lib';
9     use BioperlTest;
10     
11     test_begin(-tests => 19);
12         
13         use_ok('Bio::PrimarySeq');
14         use_ok('Bio::Tools::SeqWords');
17 my ($seqobj, $count, $seqobj_stats, $wt);
19 $seqobj = Bio::PrimarySeq->new(-seq=>'ACTGTGGCGTCAACTGACTGGC',
20                                -alphabet=>'dna', -id=>'test');
21 ok $seqobj_stats  =  Bio::Tools::SeqWords->new(-seq=>$seqobj);
22 isa_ok $seqobj_stats, 'Bio::Tools::SeqWords';
24 $count = $seqobj_stats->count_words(4);
25 is $count->{'ACTG'}, 3;
26 is $count->{'TGGC'}, 1;
27 is $count->{'GTCA'}, 1;
29 $count = $seqobj_stats->count_overlap_words(4);
30 is $count->{'ACTG'}, 3;
31 is $count->{'TGGC'}, 2;
32 is $count->{'GTCA'}, 1;
33 is $count->{'GTGG'}, 1;
35 # now test a protein
36 $seqobj = Bio::PrimarySeq->new(-seq=>'MQSERGITIDISLWKFETSKYYVTIDISSLWKF',
37                                -alphabet=>'protein', -id=>'test');
38 ok $seqobj_stats  =  Bio::Tools::SeqWords->new('-seq' => $seqobj);
39 isa_ok $seqobj_stats, 'Bio::Tools::SeqWords';
41 $count = $seqobj_stats->count_words(4);
42 is $count->{'MQSE'}, 1;
43 is $count->{'LWKF'}, 1;
44 is $count->{'IDIS'}, 2;
46 $count = $seqobj_stats->count_overlap_words(4);
47 is $count->{'MQSE'}, 1;
48 is $count->{'LWKF'}, 2;
49 is $count->{'IDIS'}, 2;