2 ## Bioperl Test Harness Script for Modules
7 eval { require Test; };
14 plan tests => $NTESTS;
16 use Bio::Tools::Run::Alignment::Sim4;
23 for ( $Test::ntest..$NTESTS ) {
24 skip("sim4 program not found. Skipping. (Be sure you have installed Sim4)",1);
31 my $cdna = Bio::Root::IO->catfile("t","data","sim4_cdna.fa");
32 my $genomic = Bio::Root::IO->catfile("t","data","sim4_genomic.fa");
33 my @params = (W=>15,K=>17,D=>10,N=>10,cdna_seq=>$cdna,genomic_seq=>$genomic);
34 my $factory = Bio::Tools::Run::Alignment::Sim4->new(@params);
36 unless (defined $factory->executable) {
37 warn("Sim4 program not found. Skipping tests $Test::ntest to $NTESTS.\n");
41 ok $factory->isa('Bio::Tools::Run::Alignment::Sim4');
43 $factory->quiet($bequiet); # Suppress clustal messages to terminal
45 #test by having inputs in constructor
46 my @exon_set = $factory->align;
48 my @exons = $exon_set[0]->sub_SeqFeature;
49 ok $exons[0]->start, 26;
50 ok $exons[0]->end, 268;
51 ok $exons[0]->strand, 1;
54 my $sio = Bio::SeqIO->new(-file=>$cdna,-format=>"fasta");
55 my $sio2 = Bio::SeqIO->new(-file=>$genomic,-format=>"fasta");
59 while(my $seq = $sio->next_seq){
63 while(my $seq = $sio2->next_seq){
64 push @genomic_seq,$seq;
67 @exon_set = $factory->align($cdna_seq[0],$genomic_seq[0]);
69 @exons = $exon_set[0]->sub_SeqFeature;
70 ok $exons[0]->start, 26;
71 ok $exons[0]->end, 268;
72 ok $exons[0]->strand, 1;
74 #test with cdna database as file
76 my $db = Bio::Root::IO->catfile("t","data","sim4_database.fa");
77 @params = (W=>15,K=>17,D=>10,N=>10,cdna_seq=>$db,genomic_seq=>$genomic);
78 $factory = Bio::Tools::Run::Alignment::Sim4->new(@params);
80 @exon_set = $factory->align();
81 @exons = $exon_set[0]->sub_SeqFeature;
82 ok $exons[0]->start, 26;
83 ok $exons[0]->end, 268;
84 ok $exons[0]->strand, 1;
86 @exons = $exon_set[1]->sub_SeqFeature;
87 ok $exons[0]->start, 26;
88 ok $exons[0]->end, 268;
89 ok $exons[0]->strand, 1;
92 #test with cdna database as object
94 $sio = Bio::SeqIO->new(-file=>$db,-format=>"fasta");
96 while(my $seq = $sio->next_seq){
100 $factory->align(\@cdna_seq,$genomic);
102 @exon_set = $factory->align();
103 @exons = $exon_set[0]->sub_SeqFeature;
104 ok $exons[0]->start, 26;
105 ok $exons[0]->end, 268;
106 ok $exons[0]->strand, 1;
108 @exons = $exon_set[1]->sub_SeqFeature;
109 ok $exons[0]->start, 26;
110 ok $exons[0]->end, 268;
111 ok $exons[0]->strand, 1;