Supply TEMPLATE and SUFFIX for temporary query sequence files.
[bioperl-run.git] / t / Pal2Nal.t
blob88e692895a74ec532cee727af616df942dd9770d
1 # -*-Perl-*-
2 ## Bioperl Test Harness Script for Modules
4 use strict;
6 BEGIN {
7     use Bio::Root::Test;
8     test_begin(-tests => 9);
9     use_ok('Bio::Tools::Run::Alignment::Pal2Nal');
12 # setup input files etc
13 my $nucleotide_filename = test_input_file('pal2nal.nuc');
14 my $protein_alignfilename = test_input_file('pal2nal.aln');
15 my $mxlib = test_input_file('transfac.dat');
17 my $factory = Bio::Tools::Run::Alignment::Pal2Nal->new();
19 isa_ok($factory, 'Bio::Tools::Run::Alignment::Pal2Nal');
21 # test default factory values
22 is ($factory->program_dir, $ENV{'PAL2NALDIR'}, 'program_dir returned correct default');
23 is ($factory->program_name(), 'pal2nal.pl', 'Correct exe default name');
25 # test the program itself
26 SKIP: {
27         test_skip(-requires_executable => $factory,
28                   -tests => 5);
29     
30         # Run Pal2Nal with a protein alignment file and a multi-fasta nucleotide
31         # file
32         ok my $aln1 = $factory->run($protein_alignfilename, $nucleotide_filename);
33         
34         # or with Bioperl objects
35         use_ok('Bio::AlignIO');
36         use_ok('Bio::SeqIO');
37         my $ai = Bio::AlignIO->new(-file => $protein_alignfilename);
38         my $protein_bio_simplalign = $ai->next_aln;
39         my $si = Bio::SeqIO->new(-file => $nucleotide_filename, -format => 'fasta');
40         my $nucleotide_bio_seq1 = $si->next_seq;
41         my $nucleotide_bio_seq2 = $si->next_seq;
42         ok my $aln2 = $factory->run($protein_bio_simplalign,
43                                                                 [$nucleotide_bio_seq1, $nucleotide_bio_seq2]);
44         
45         is_deeply($aln1, $aln2);