1 # This is -*-Perl-*- code
2 ## Bioperl Test Harness Script for Modules
10 test_begin(-tests => 10,
11 -requires_module =>'IO::String');
13 use_ok('Bio::Tools::Run::Phylo::Hyphy::SLAC');
14 use_ok('Bio::Tools::Run::Phylo::Hyphy::FEL');
15 use_ok('Bio::Tools::Run::Phylo::Hyphy::REL');
16 use_ok('Bio::Tools::Run::Phylo::Hyphy::Modeltest');
17 use_ok('Bio::Tools::Run::Phylo::Hyphy::BatchFile');
22 my $rel = Bio::Tools::Run::Phylo::Hyphy::REL->new();
24 test_skip(-requires_executable => $rel,
27 my $alignio = Bio::AlignIO->new(-format => 'fasta',
28 -file => 't/data/hyphy1.fasta');
30 my $treeio = Bio::TreeIO->new(-format => 'newick',
31 -file => 't/data/hyphy1.tree');
33 my $aln = $alignio->next_aln;
34 my $tree = $treeio->next_tree;
35 my $debug = test_debug();
38 $rel->alignment($aln);
40 ($rc,$results) = $rel->run();
41 if (($rc == 0) && ($debug == 1)){
42 warn("ERROR in REL module $rc:" . $rel->error_string() . "\n");
44 ok ($rc != 0, "REL module");
46 my $fel = Bio::Tools::Run::Phylo::Hyphy::FEL->new();
47 $fel->alignment($aln);
49 ($rc,$results) = $fel->run();
50 if (($rc == 0) && ($debug == 1)){
51 warn("ERROR in FEL module $rc:" . $fel->error_string() . "\n");
53 ok (defined($results->{'LRT'}), "FEL module");
55 my $modeltest = Bio::Tools::Run::Phylo::Hyphy::Modeltest->new();
56 $modeltest->alignment($aln);
57 $modeltest->tree($tree);
58 ($rc,$results) = $modeltest->run();
59 if (($rc == 0) && ($debug == 1)){
60 warn("ERROR in Modeltest module $rc:" . $modeltest->error_string() . "\n");
62 ok (defined($results->{'AIC'}), "Modeltest module");
64 my $bf_exec = Bio::Tools::Run::Phylo::Hyphy::BatchFile->new(
65 -params => {'bf' => "ModelTest.bf",
66 'order' => [$aln, $tree, '4', 'AIC Test', ""]}
68 $bf_exec->alignment($aln);
69 $bf_exec->tree($tree);
70 my ($tfh, $t) = $bf_exec->io->tempfile;
71 $bf_exec->set_parameter(5, $t);
73 ($rc,$results) = $bf_exec->run();
74 if (($rc == 0) && ($debug == 1)){
75 warn("ERROR in Batchfile module $rc:" . $bf_exec->error_string() . "\n");
77 ok ($rc != 0, "Batchfile module");
79 my $slac = Bio::Tools::Run::Phylo::Hyphy::SLAC->new();
80 $slac->alignment($aln);
82 ($rc,$results) = $slac->run();
83 if (($rc == 0) && ($debug == 1)){
84 warn("ERROR in SLAC module $rc:" . $slac->error_string() . "\n");
86 ok (defined($results->{'Observed NS Changes'}), "SLAC module");