Supply TEMPLATE and SUFFIX for temporary query sequence files.
[bioperl-run.git] / t / Meme.t
blob3576073171258a6bf5bcb224fe51f2c4a5e4ec5b
1 # -*-Perl-*-
2 ## Bioperl Test Harness Script for Modules
4 use strict;
6 BEGIN {
7     use Bio::Root::Test;
8     test_begin(-tests => 25);
9     use_ok('Bio::Tools::Run::Meme');
12 # setup input files
13 my $seq1_file = test_input_file('fasta.fa');
14 my $seq2_file = test_input_file('lagan_dna.fa');
15 my $seq3_file = test_input_file('new_dna.fa');
17 # object setup and testing
18 my $factory = Bio::Tools::Run::Meme->new(-verbose => -1,
19                                          -quiet => 1,
20                                          -mod => 'oops',
21                                          -dna => 1);
23 isa_ok($factory, 'Bio::Tools::Run::Meme');
24 ok $factory->can('nmotifs'), 'has a created method not in args';
25 is $factory->mod, 'oops', 'mod param was set';
26 ok $factory->dna, 'dna switch was set';
28 is ($factory->program_dir, $ENV{'MEME_BIN'}, 'program_dir returned correct default');
29 is ($factory->program_name(), 'meme', 'Correct exe default name');
31 # test the program itself
32 SKIP: {
33     test_skip(-tests => 18,
34               -requires_executable => $factory);
35     
36     use_ok('Bio::SeqIO');
37     my $si = Bio::SeqIO->new(-file => $seq1_file, -format => 'fasta');
38     ok my $seq1 = $si->next_seq;
39     $si = Bio::SeqIO->new(-file => $seq2_file, -format => 'fasta');
40     ok my $seq2 = $si->next_seq;
41     $si = Bio::SeqIO->new(-file => $seq3_file, -format => 'fasta');
42     ok my $seq3 = $si->next_seq;
43     
44     # get an alignio given seq objects
45     ok my $alignio = $factory->run($seq1, $seq2, $seq3);
46     my $aligns = 0;
47     while (my $align = $alignio->next_aln) {
48         $aligns++;
49         
50         is $align->score, '1.3e+002';
51         is $align->length, 20;
52         
53         my @expected = (['sequence_10', 738], ['Scaffold_2042.1', 787], ['SINFRUT00000067802', 941]);
54         
55         my $seqs = 0;
56         foreach my $seq ($align->each_seq) {
57             $seqs++;
58             
59             my @answers = @{shift @expected};
60             is $seq->id, shift @answers;
61             is $seq->start, shift @answers;
62             is $seq->strand, 1;
63         }
64         is $seqs, 3;
65     }
66     is $aligns, 1;
67     
68     # get a Bio::Map::Prediction
69     # ...