Supply TEMPLATE and SUFFIX for temporary query sequence files.
[bioperl-run.git] / t / FastTree.t
blob98283c9895d406c0c8b29123147460be09ff3e57
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 => 9,
12     );
13     use_ok('Bio::Root::IO');
14     use_ok('Bio::Tools::Run::Phylo::FastTree');
15     use_ok('Bio::AlignIO');
18 ok (my $ft = Bio::Tools::Run::Phylo::FastTree->new( -quiet => 1 ),"Make the object");
20 SKIP: {
21     test_skip(
22         -requires_executable => $ft,
23         -tests               => 5
24     );
26     # The input could be a SimpleAlign object
27     my $alignio = Bio::AlignIO->new(
28         -format => 'fasta',
29         -file   => test_input_file('219877.cdna.fasta')
30     );
31     my $alnobj = $alignio->next_aln;
33     my $tree = $ft->run($alnobj);
34     ok( defined($tree), "Tree is defined" );
35     my @nodes = $tree->get_nodes;
36     is($#nodes,3,"Number of nodes is correct");
38     # The input could be an alignment file (fasta or phylip interleaved)
39     my $alignfile = test_input_file("sample_dataset_1_aligned.fa");
40     my $fastft = Bio::Tools::Run::Phylo::FastTree->new( -quiet => 1, -fastest => 1 );
41     $tree = $fastft->run($alignfile);
42     ok( defined($tree), "Tree is defined" );
44     my $slowft = Bio::Tools::Run::Phylo::FastTree->new(
45         -quiet   => 1,
46         -mlacc   => 2,
47         -slownni => 1,
48         -spr     => 4
49     );
50     $tree = $slowft->run($alignfile);
51     ok( defined($tree), "Tree is defined" );
53     # Input is protein sequence alignment
54     $alignio = Bio::AlignIO->new(
55         -format => 'msf',
56         -file   => test_input_file('cysprot.msf')
57     );
58     $alnobj = $alignio->next_aln;
60     my $ptree = $ft->run($alnobj);
61     ok( defined($tree), "Tree is defined" );