fix hit count to go with database change, tests pass with BLAST+ 2.2.25+
[bioperl-run.git] / t / SeqBoot.t
blob599e114adaa4a4be237a1f87710e7854a2f0cbf3
1 # -*-Perl-*-
2 ## Bioperl Test Harness Script for Modules
3 ## $Id$
5 use strict;
6 use vars qw($DEBUG);
7 $DEBUG = test_debug();
9 BEGIN {
10     use Bio::Root::Test;
11     test_begin(-tests => 9);
12         use_ok('Bio::Tools::Run::Phylo::Phylip::SeqBoot');
13         use_ok('Bio::AlignIO');
15 my $verbose = $DEBUG;
16 my @params = ('-verbose'  => $verbose,
17               'idlength'  =>30,
18               'datatype'  =>'GENEFREQ',
19               'REPLICATES'=>50);
21 my $sb_factory = Bio::Tools::Run::Phylo::Phylip::SeqBoot->new(@params);
23 SKIP: {
24     test_skip(-requires_executable => $sb_factory,
25               -tests => 7);
26         isa_ok $sb_factory,'Bio::Tools::Run::Phylo::Phylip::SeqBoot';
27         
28         my $dt= 'SEQUENCE';
29         $sb_factory->datatype($dt);
30         
31         is $sb_factory->datatype, "SEQUENCE", "couldn't set datatype parameter";
32         
33         $sb_factory->replicates(2);
34         
35         is $sb_factory->replicates, 2, "coludn't set number of replicates";
36         
37         
38         my $bequiet = $verbose > 0 ? 0 : 1;
39         
40         $sb_factory->quiet($bequiet);  # Suppress protpars messages to terminal 
41         
42         my $inputfilename = test_input_file("protpars.phy");
43         
44         my $aln_ref = $sb_factory->run($inputfilename);
45         
46         is scalar(@{$aln_ref}), 2;
47         
48         my $aln = Bio::AlignIO->new(-file=>$inputfilename, -format=>"phylip")->next_aln;
49         
50         $aln_ref = $sb_factory->run($aln);
51         
52         is scalar(@{$aln_ref}), 2;
53         
54         # Test name preservation and restoration:
55         $inputfilename = test_input_file("longnames.aln");
56         $aln = Bio::AlignIO->new(-file=>$inputfilename, -format=>'clustalw')->next_aln;
57         my ($aln_safe, $ref_name) =$aln->set_displayname_safe();
58         $aln_ref = $sb_factory->run($aln_safe);
59         my $first=shift @{$aln_ref};
60         is $first->get_seq_by_pos(3)->id(), "S000000003", "ailed to  assign serial names";
61         my $aln_restored=$first->restore_displayname($ref_name);
62         is $aln_restored->get_seq_by_pos(3)->id(), "Smik_Contig1103.1", "fail to restore original names";