Supply TEMPLATE and SUFFIX for temporary query sequence files.
[bioperl-run.git] / t / Raxml.t
blob61e4d8f1b99aaa85ba39493cb39abea25b33aca2
1 # This is -*-Perl-*- code
2 ## Bioperl Test Harness Script for Modules
3 # Before `./Build install' is performed this script should be runnable with
4 # `./Build test --test_files test.t'. After `./Build install' it should work as `perl test.t'
6 use strict;
8 BEGIN {
9     use Bio::Root::Test;
10     test_begin(
11         -tests => 11,
12     );
13     use_ok('Bio::Root::IO');
14     use_ok('Bio::Tools::Run::Phylo::Raxml');
15     use_ok('Bio::AlignIO');
18 END { unlink glob "RAxML_*.*"; }
20 ok(my $raxml = Bio::Tools::Run::Phylo::Raxml->new(-p => 100, -quiet => 1, -d => 1), "Make the object");
21 isa_ok( $raxml, 'Bio::Tools::Run::Phylo::Raxml');
23 SKIP: {
24     test_skip(
25         -requires_executable => $raxml,
26         -tests               => 6
27     );
29     # The input could be an alignment file in phylip format
30     my $alignfile = test_input_file("testaln.phylip");
31     my $tree = $raxml->run($alignfile);
32     ok( defined($tree), "Tree is defined" );
34         # The working directory could be different, i.e. -w set
35         $raxml->w($raxml->tempdir);
36         $tree = $raxml->run($alignfile);
37     ok( defined($tree), "Tree is defined" );
38         my $out = $raxml->w . '/RAxML_bestTree.' . $raxml->outfile_name;
39         ok( -e $out, "File containing best tree exists in tempdir" );
41     # The input could be a SimpleAlign object
42     my $alignio = Bio::AlignIO->new(
43         -format => 'phylip',
44         -file   => test_input_file('testaln.phylip')
45     );
46     my $alnobj = $alignio->next_aln;
48     $raxml = Bio::Tools::Run::Phylo::Raxml->new(-p => 100, -quiet => 1, -d => 1);
49     $tree = $raxml->run($alnobj);
50     ok( defined($tree), "Tree is defined" );
51     my @nodes = $tree->get_nodes;
52     is($#nodes,5, "Number of nodes is correct");
54     # Input is protein sequence alignment
55     $alignio = Bio::AlignIO->new(
56         -format => 'msf',
57         -file   => test_input_file('cysprot.msf')
58     );
59     $alnobj = $alignio->next_aln;
61     $raxml = Bio::Tools::Run::Phylo::Raxml->new(-quiet => 1, -p => 100);
62     my $ptree = $raxml->run($alnobj);
63     ok( defined($ptree), "Tree is defined" );