tests pass, find the right nodes more explicitly
[bioperl-run.git] / t / RepeatMasker.t
blob8e2a3ec0cb49db3536a655eda5b79fcdcf5b9210
1 # -*-Perl-*-
2 ## Bioperl Test Harness Script for Modules
3 # $Id$
5 use strict;
6 BEGIN {
7     eval { require Test; };
8     if( $@ ) {
9         use lib 't';
10     }
11     use Test;
12     use vars qw($NTESTS);
13     $NTESTS = 10;
14     plan tests => $NTESTS;
16 use Bio::Tools::Run::RepeatMasker;
17 use Bio::SeqIO;
18 use Env;
19 END {
20     for ( $Test::ntest..$NTESTS ) {
21         skip("RepeatMasker program not found. Skipping. (Be sure you have the phrap package )",1);
22     }
24 my $verbose = $ENV{'BIOPERLDEBUG'} ? 1 : 0;
25 my @params=("species" => "mammal","noint"=>1, 'qq' => 1, '-verbose' => $verbose);
26 my $fact = Bio::Tools::Run::RepeatMasker->new(@params);
27 $fact->quiet(1);
28 if( ! $fact->executable ) { 
29     warn("RepeatMasker program not found. Skipping tests $Test::ntest to $NTESTS.\n");
31     exit(0);
34 ok ($fact->species, 'mammal');
35 ok ($fact->noint,1);
36 my $inputfilename= Bio::Root::IO->catfile(qw(t data repeatmasker.fa));
38 my $in  = Bio::SeqIO->new(-file => $inputfilename , '-format' => 'fasta');
39 my $seq = $in->next_seq();
40 my @feats = $fact->mask($seq);
42 my $version = $fact->version;
44 ok ($feats[0]->feature1->primary_tag, "Simple_repeat");
45 ok ($feats[0]->feature1->source_tag, "RepeatMasker");
46 ok ($feats[0]->feature2->seq_id, "(TTAGGG)n");
48 if( $version =~ /open-(\S+)/) {
49     my $num = $1;
50     if( $num ge '3.1.0' ) {
51         ok ($feats[0]->feature1->start, 1337);
52         ok ($feats[0]->feature1->end, 1411);
53         ok ($feats[0]->feature1->strand, 1);
54         ok ($feats[1]->feature1->start, 1710);
55         ok ($feats[1]->feature1->end, 2052);
56     } elsif( $num ge  '3.0.8' ) {
57         ok ($feats[0]->feature1->start, 1337);
58         ok ($feats[0]->feature1->end, 1407);
59         ok ($feats[0]->feature1->strand, 1);
60         ok ($feats[1]->feature1->start, 1712);
61         ok ($feats[1]->feature1->end, 2225);    
62     } else {
63         skip("unknown RepeatMasker Version, cannot test",1) for ( 1..3);
64     }
65 } else {
66     ok ($feats[0]->feature1->start, 1337);
67     ok ($feats[0]->feature1->end, 1407);
68     ok ($feats[0]->feature1->strand, 1);