Updating Mauricio's email
[bioperl-run.git] / t / Vista.t
blobf1057f91e7e9263f500bfbdbb3df7f5fff5037b3
1 # -*-Perl-*-
2 ## Bioperl Test Harness Script for Modules
4 use strict;
5 BEGIN {
6     use Bio::Root::Test;
7     test_begin(-tests => 7);
9     use_ok('Bio::Tools::Run::Vista');
10     use_ok('Bio::AlignIO');
13 SKIP: {
14     #Java and java version check
15     my $v;
16     if (-d "java") {
17         skip("Skipping because no java present to run vista", 5);
18     }
20     open(PIPE,"java -version 2>&1 |");
21     while (<PIPE>) {
22         if (/Java\sVersion\:\s(\d+\.\d+)/) {
23             $v = $1;
24             last;
25         }
26         elsif (/java version\s.(\d+\.\d+)/) {
27             $v = $1;
28             last;
29         }
30         elsif (/java version\s\"(\d\.\d)"/) {
31             $v = $1;
32             last;
33         }
34     }
35     if ($v < 1.2) {
36         skip("Skipping due to old java version", 5);
37     }
39     open (PIPE ,'java Vista 2>&1 |');
40     while(<PIPE>){
41         if (   /NoClassDefFoundError/
42             # For JRE 1.7.0_25 - Win7 - Spanish, the message is:
43             # "Error: no se ha encontrado o cargado la clase principal Vista"
44             or /^Error\:/
45             ){
46             diag('Vista.jar is not in your class path: '.$_);
47             skip("Vista.jar is not in your class path",5);
48         }
49     }
50     my $inputfilename= test_input_file("vista.cls");
51     my $gff_file = test_input_file("vista.gff");
52     my $aio = Bio::AlignIO->new(-file   => $inputfilename,
53                                 -format => 'clustalw');
54     my $aln = $aio->next_aln;
56     my $out= test_output_file();
57     my $vis = Bio::Tools::Run::Vista->new('outfile'           => $out,
58                                           'title'             => "My Vista Plot",
59                                           'annotation'        => $gff_file,
60                                           'annotation_format' => 'GFF',
61                                           'min_perc_id'       => 75,
62                                           'min_length'        => 100,
63                                           'plotmin'           => 50,
64                                           'tickdist'          => 2000,
65                                           'window'            => 40,
66                                           'numwindows'        => 4,
67                                           'start'             => 50,
68                                           'end'               => 1500,
69                                           'tickdist'          => 100,
70                                           'bases'             => 1000,
71                                           'color'             => {'EXON'=>'45 25 54','CNS'=>'0 0 100'},
72                                           'quiet'             =>1);
73     isa_ok $vis,'Bio::Tools::Run::Vista';
74     is $vis->plotmin, 50;
75     is $vis->annotation, $gff_file;
77     $vis->run($aln,1);
78     ok -e $out;
79     $vis->run($aln,'mouse');
80     ok -e $out;