1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id: SeqWords.t 11525 2007-06-27 10:16:38Z sendu $
9 test_begin(-tests => 22);
12 use_ok('Bio::Tools::SeqWords');
15 my ($seqobj, $count, $seqobj_stats, $wt);
17 my $str = Bio::SeqIO->new(-file=> test_input_file('multifa.seq'), '-format' => 'Fasta');
18 $seqobj= $str->next_seq();
19 ok defined $seqobj, 'new Bio::Root::IO object';
21 my $words = Bio::Tools::SeqWords->new('-seq' => $seqobj);
22 my $hash = $words->count_words(6);
23 ok (defined $words, 'new Bio::Tools::SeqWords object');
24 ok (defined $hash, 'count_words');
26 $seqobj = Bio::PrimarySeq->new(-seq=>'ACTGTGGCGTCAACTGACTGGC',
27 -alphabet=>'dna', -id=>'test');
28 ok $seqobj_stats = Bio::Tools::SeqWords->new(-seq=>$seqobj);
29 isa_ok $seqobj_stats, 'Bio::Tools::SeqWords';
31 $count = $seqobj_stats->count_words(4);
32 is $count->{'ACTG'}, 3;
33 is $count->{'TGGC'}, 1;
34 is $count->{'GTCA'}, 1;
36 $count = $seqobj_stats->count_overlap_words(4);
37 is $count->{'ACTG'}, 3;
38 is $count->{'TGGC'}, 2;
39 is $count->{'GTCA'}, 1;
40 is $count->{'GTGG'}, 1;
43 $seqobj = Bio::PrimarySeq->new(-seq=>'MQSERGITIDISLWKFETSKYYVTIDISSLWKF',
44 -alphabet=>'protein', -id=>'test');
45 ok $seqobj_stats = Bio::Tools::SeqWords->new('-seq' => $seqobj);
46 isa_ok $seqobj_stats, 'Bio::Tools::SeqWords';
48 $count = $seqobj_stats->count_words(4);
49 is $count->{'MQSE'}, 1;
50 is $count->{'LWKF'}, 1;
51 is $count->{'IDIS'}, 2;
53 $count = $seqobj_stats->count_overlap_words(4);
54 is $count->{'MQSE'}, 1;
55 is $count->{'LWKF'}, 2;
56 is $count->{'IDIS'}, 2;