Updating Mauricio's email
[bioperl-run.git] / t / MCS.t
blobdedb4aa4bd4f43307a0d143e364918c9b6cb8fa3
1 use strict;
3 BEGIN {
4     use Bio::Root::Test;
6     test_begin(-tests => 24,
7                -requires_modules => [qw(Config::Any)]);
9     use_ok('Bio::Location::Atomic');
12 # setup input files etc
13 my $alignfilename = test_input_file('gumby', 'hmrd.mfa');
14 ok (-e $alignfilename, 'Found input alignment file');
16 SKIP: {
17     test_skip(-requires_module => 'Bio::FeatureIO',
18               -tests => 22);
19     use_ok('Bio::Tools::Run::MCS');
20     use_ok('Bio::SeqFeature::Annotated');
21     my $factory = Bio::Tools::Run::MCS->new(-verbose => -1,
22                                             -quiet => 1);
23     isa_ok($factory, 'Bio::Tools::Run::MCS');
24     ok $factory->can('neutral'), 'has a created method not in args supplied to new';
25     is $factory->quiet, 1, 'quiet was set';
26     
27     # test default factory values
28     is ($factory->program_dir, $ENV{'MCSDIR'}, 'program_dir returned correct default');
29     is ($factory->program_name(), 'align2binomial.pl', 'Correct exe default name');
30     
31     # test the program itself
32     SKIP: {
33         test_skip(-requires_executable => $factory,
34                   -tests => 15);
35     
36         my $alignio = Bio::AlignIO->new(-file => $alignfilename);
37         my $align = $alignio->next_aln;
38     
39         my @cds_feats;
40         foreach my $data ([47367820, 47367830], [47367850, 47367860], [47367870, 47367880]) {
41             my $cds_feat = Bio::SeqFeature::Annotated->new(
42                     -seq_id       => 'Homo_sapiens',
43                     -start        => $data->[0],
44                     -end          => $data->[1],
45                     -frame        => 0,
46                     -strand       => 1,
47                     -primary      => 'CDS',
48                     -type         => 'CDS',
49                     -source       => 'UCSC');
50             push(@cds_feats, $cds_feat);
51         }
52         my $location = Bio::Location::Atomic->new(-start => 47367748, -end => 47427851, -strand => 1, -seq_id => 'chr1');
53     
54         # run the program
55         my @feats = $factory->run($align, $location, \@cds_feats);
56     
57         # spot-test the results
58         my @spot_results = ($feats[0], $feats[1], $feats[2]);
59         foreach my $expected ([47373765, 47373846, 1000],
60                               [47373848, 47373883, 1000],
61                               [47377883, 47377908, 1000]) {
62             my $feat = shift(@spot_results);
63             isa_ok $feat, 'Bio::SeqFeature::Annotated';
64             is $feat->source->value, 'MCS', 'correct source';
65             is $feat->start, shift(@{$expected}), 'feature start correct';
66             is $feat->end, shift(@{$expected}), 'feature end correct';
67             is $feat->score, shift(@{$expected}), 'feature score correct';
68         }
69     }