2
## Bioperl Test Harness Script for Modules
3
## $Id: SeqWords.t,v 1.1 2003/11/12 17:14:09 heikki Exp $
5
## SeqWords.t, based on SeqStats.t
6
# Derek Gatherer, 11th November 2003
10
# to handle systems with no installed Test module
11
# we include the t dir (where a copy of Test.pm is located)
13
eval { require Test; };
14
if( $@ ) { use lib 't'; }
20
use Bio::Tools::SeqWords;
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;
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;