2 ## Bioperl Test Harness Script for Modules
10 test_begin(-tests => 19);
11 use_ok('Bio::Tools::Run::Phylo::LVB');
12 use_ok('Bio::AlignIO');
15 my $tree_factory = Bio::Tools::Run::Phylo::LVB->new();
16 isa_ok $tree_factory, 'Bio::Tools::Run::Phylo::LVB';
19 test_skip(-requires_executable => $tree_factory,
22 my $default_format = "interleaved";
23 my $format = $tree_factory->format;
24 is $format, $default_format, "default is wrong for format parameter";
25 $format = "sequential";
26 $tree_factory->format($format);
27 my $new_format = $tree_factory->format();
28 is $new_format, $format, "couldn't set format parameter";
29 $format = "interleaved";
30 $tree_factory->format($format);
31 $new_format = $tree_factory->format();
32 is $new_format, $format, "couldn't reset format parameter";
34 my $default_gaps = "unknown";
35 my $gaps = $tree_factory->gaps;
36 is $gaps, $default_gaps, "default is wrong for gaps parameter";
38 $tree_factory->gaps($gaps);
39 my $new_gaps = $tree_factory->gaps();
40 is $new_gaps, $gaps, "couldn't set gaps parameter";
42 $tree_factory->gaps($gaps);
43 $new_gaps = $tree_factory->gaps();
44 is $new_gaps, $gaps, "couldn't reset gaps parameter";
46 my $default_seed = "";
47 my $seed = $tree_factory->seed;
48 is $seed, $default_seed, "default is wrong for seed parameter";
50 $tree_factory->seed($seed);
51 my $new_seed = $tree_factory->seed();
52 is $new_seed, $seed, "couldn't set seed parameter";
54 my $default_duration = "slow";
55 my $duration = $tree_factory->duration;
56 is $duration, $default_duration, "default is wrong for duration parameter";
58 $tree_factory->duration($duration);
59 my $new_duration = $tree_factory->duration();
60 is $new_duration, $duration, "couldn't set duration parameter";
62 $tree_factory->duration($duration);
63 $new_duration = $tree_factory->duration();
64 is $new_duration, $duration, "couldn't reset duration parameter";
66 my $default_bootstraps = 0;
67 my $bootstraps = $tree_factory->bootstraps;
68 is $bootstraps, $default_bootstraps, "default is wrong for bootstraps parameter";
69 $bootstraps = "10000";
70 $tree_factory->bootstraps($bootstraps);
71 my $new_bootstraps = $tree_factory->bootstraps();
72 is $new_bootstraps, $bootstraps, "couldn't set bootstraps parameter";
74 $tree_factory->bootstraps($bootstraps);
75 $new_bootstraps = $tree_factory->bootstraps();
76 $new_bootstraps = $tree_factory->bootstraps();
77 is $new_bootstraps, $bootstraps, "couldn't reset seed parameter";
80 $tree_factory->quiet($bequiet); # Suppress LVB messages to terminal
85 $tree_factory->format("sequential");
86 my $inputfilename = test_input_file("lvb_sequential.phy");
87 @trees = $tree_factory->create_tree($inputfilename);
88 is scalar(@trees), 3, "create_tree failed to create array of trees from file";
91 $inputfilename = test_input_file("lvb.fa");
92 my $align_in = Bio::AlignIO->new(-file => $inputfilename, -format => "fasta");
93 my $align_obj = $align_in->next_aln;
94 @trees = $tree_factory->run($align_obj);
95 is scalar(@trees), 3, "run failed to create array of trees from object";
97 $tree_factory->gaps("fifthstate");
98 @trees = $tree_factory->run($align_obj);
99 is scalar(@trees), 1, "run failed to create tree with fifthstate on";
101 $tree_factory->bootstraps(7);
102 @trees = $tree_factory->run($align_obj);
103 my $enough_trees = "no";
104 $enough_trees = "yes" if scalar(@trees) >= 7;
105 is $enough_trees, "yes", "run failed to create enough bootstrap trees";