Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Chris Fields
committed
May 27, 2010
1 parent
09aa1b5
commit 6444b22
Showing
1 changed file
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!usr/bin/perl -w | ||
use strict; | ||
|
||
BEGIN | ||
{ | ||
use lib 't/lib'; | ||
|
||
# use BioperlTest; | ||
use Test::More tests=>41; | ||
|
||
#Check if module and all its methods can be loaded | ||
use_ok('Bio::Align::Graphics'); | ||
require_ok('Bio::Align::Graphics'); | ||
can_ok('Bio::Align::Graphics', qw(new draw height width aln_length aln_format no_sequences)); | ||
} | ||
|
||
#Get an alignment file | ||
my $file = Bio::Root::IO->catfile("t","data","pep-266.aln"); | ||
ok($file, 'input is defined'); | ||
|
||
#Create an AlignI object using AlignIO | ||
my $in=new Bio::AlignIO(-file=>$file, -format=>'clustalw'); | ||
ok(defined $in, 'AlignIO object is defined'); | ||
isa_ok($in, 'Bio::AlignIO'); | ||
|
||
#Read the alignment | ||
my $aln=$in->next_aln(); | ||
ok(defined $aln, 'alignment is there and defined'); | ||
|
||
#Create some domains for highlighting | ||
my @domain_start = ( 25, 50, 80 ); | ||
my @domain_end = ( 40 , 65 , 100 ); | ||
my @domain_color = ( 'red' , 'cyan' , 'green' ); | ||
ok(exists $domain_start[2], 'all starts are present'); | ||
ok(exists $domain_end[2],'all ends are present'); | ||
ok(exists $domain_color[2], 'all colors are present'); | ||
ok($domain_start[0]<=$domain_end[0],'first end is further than first start'); #Some | ||
ok($domain_start[1]<=$domain_end[1],'second end is further than second start'); #logical | ||
ok($domain_start[2]<=$domain_end[2],'third end is further than third start'); #tests | ||
|
||
#Create Labels for the domains | ||
my @dml = ("CARD", "Proline Rich", "Transmembrane"); | ||
my @dml_start = (25, 50, 80); | ||
my @dml_end = (40, 65, 100); | ||
my @dml_color = ("lightpink", "lightblue", "lightgreen"); | ||
ok(exists $dml[2], 'domain labels are present'); | ||
ok(exists $dml_start[2], 'domain starts are present'); | ||
ok(exists $dml_end[2], 'domain ends are present'); | ||
ok(exists $dml_color[2], 'domain colors are present'); | ||
|
||
#Some logical tests | ||
ok($dml_start[0]<=$dml_end[0],'label - first end is further than first start'); | ||
ok($dml_start[1]<=$dml_end[1],'label - second end is further than second start'); | ||
ok($dml_start[2]<=$dml_end[2],'label - third end is further than third start'); | ||
is($domain_start[0]=>$dml_start[0],'first label start is within domain range'); | ||
is($domain_start[1]=>$dml_start[1],'second label start is within domain range'); | ||
is($domain_start[2]=>$dml_start[2],'third label start is within domain range'); | ||
is($domain_end[0]=>$dml_end[0],'first label end is within domain range'); | ||
is($domain_end[1]=>$dml_end[1],'second label end is within domain range'); | ||
is($domain_end[2]=>$dml_end[2],'third label end is within domain range'); | ||
|
||
#Create individual labels | ||
my %labels = ( 145 => "Hep-c target"); | ||
ok(exists $labels{145}, 'individual labels work'); | ||
|
||
#my $output_file = test_output_file(); | ||
|
||
my $print_align = Bio::Align::Graphics->new( align => $aln, | ||
pad_bottom => 5, | ||
dm_start => \@domain_start, | ||
dm_end => \@domain_end, | ||
dm_color => \@domain_color, | ||
dm_labels => \@dml, | ||
dml_start => \@dml_start, | ||
dml_end => \@dml_end, | ||
dml_color => \@dml_color, | ||
labels => \%labels, | ||
out_format => "png", | ||
# output=>$output_file, | ||
wrap=>80); | ||
|
||
isa_ok($print_align, 'Bio::Align::Graphics'); | ||
ok( defined $print_align, 'new object is defined'); | ||
is($print_align->{pad_bottom}, 5, ' pad_bottom is right'); | ||
is($print_align->{pad_top}, 5, ' default pad_top is right'); | ||
is($print_align->{domain_start}, \@domain_start,' start point loaded'); | ||
is($print_align->{domain_end}, \@domain_end,' end point loaded'); | ||
is($print_align->{domain_color}, \@domain_color,' color of domain loaded'); | ||
is($print_align->{dm_labels}, \@dml, ' domain labels loaded'); | ||
is($print_align->{dm_label_start}, \@dml_start, ' label starts loaded'); | ||
is($print_align->{dm_label_end}, \@dml_end, ' label ends loaded'); | ||
is($print_align->{dm_label_color}, \@dml_color, ' label colors loaded'); | ||
is($print_align->{labels}, \%labels, ' labels loaded'); | ||
is($print_align->{out_format}, 'png', ' output file is png'); | ||
isnt($print_align->{wrapping}, 0, ' wrapping length is not zero'); | ||
|
||
exit; |