tests pass, find the right nodes more explicitly
[bioperl-run.git] / t / FootPrinter.t
blob3d37ee9acb5592a7fcc60b035844b5b8b9f292ff
1 # -*-Perl-*-
2 ## Bioperl Test Harness Script for Modules
5 use strict;
6 BEGIN {
7     eval { require Test; };
8     if( $@ ) {
9         use lib 't';
10     }
11     use Test;
12     use vars qw($NTESTS);
13     $NTESTS = 18;
14     plan tests => $NTESTS;
16 use Bio::Tools::Run::FootPrinter;
17 use Bio::SeqIO;
19 END {
20     for ( $Test::ntest..$NTESTS ) {
21         skip("FootPrinter program not found. Skipping.",1);
22     }
24 my $treefile =Bio::Root::IO->catfile("t", "data", "tree_of_life");
26 my @params = (
27                'size'=>10,
28               'sequence_type'=>'upstream',
29               'subregion_size'=>30,
30               'position_change_cost'=>5,
31               'triplet_filtering'=>1,
32               'pair_filtering'=>1,
33               'post_filtering'=>1,
34               'inversion_cost'=>1,
35               'tree'   =>$treefile,
36               'details'=>0,
37               'verbose'=>0);
39 my $fact = Bio::Tools::Run::FootPrinter->new(@params);
41 if( ! $fact->executable ) { 
42     warn("FootPrinter program not found. Skipping tests $Test::ntest to $NTESTS.\n");
44     exit(0);
47 ok $fact->size, 10;
48 ok $fact->sequence_type, 'upstream';
49 ok $fact->subregion_size, 30;
50 ok $fact->position_change_cost, 5;
51 ok $fact->triplet_filtering,1;
52 ok $fact->pair_filtering,1;
53 ok $fact->post_filtering,1;
54 ok $fact->inversion_cost,1;
55 ok $fact->tree, $treefile;
57 my $input= Bio::Root::IO->catfile("t","data","FootPrinter.seq.fa");
59 my $in  = Bio::SeqIO->new(-file => "$input" , '-format' => 'fasta');
60 my @seq;
61 while (my $seq = $in->next_seq){
62   push @seq, $seq;
64 my @fp= $fact->run(@seq);
65 ok $#fp, 5;
67 my $first = shift @fp;
69 my @motifs = $first->sub_SeqFeature;
70 ok $#motifs, 1;
71 ok $motifs[0]->seq_id,'TETRAODON';
72 ok $motifs[0]->seq->seq, 'tacaggatgca';
73 ok $motifs[0]->start, 352;
74 ok $motifs[0]->end, 362;
75 ok $motifs[1]->seq->seq, 'ccatatttgga';
76 ok $motifs[1]->start, 363;
77 ok $motifs[1]->end, 373;