File: SeqEvolution.t

package info (click to toggle)
bioperl 1.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 40,768 kB
  • ctags: 12,005
  • sloc: perl: 174,299; xml: 13,923; sh: 1,941; lisp: 1,803; asm: 109; makefile: 53
file content (182 lines) | stat: -rw-r--r-- 6,288 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# -*-Perl-*- Test Harness script for Bioperl
# $Id: SeqEvolution.t 15112 2008-12-08 18:12:38Z sendu $

use strict;

BEGIN {
    use lib '.';
    use Bio::Root::Test;
    
    test_begin(-tests => 39);
	
    use_ok('Bio::SeqEvolution::Factory');
    use_ok('Bio::PrimarySeq');
}

#
# point mutations
#

ok my $evolve = Bio::SeqEvolution::Factory->new (-verbose => 1);
isa_ok $evolve, 'Bio::SeqEvolution::DNAPoint';

ok $evolve = Bio::SeqEvolution::DNAPoint->new (-verbose => 2);
isa_ok $evolve, 'Bio::SeqEvolution::DNAPoint';

ok $evolve = Bio::SeqEvolution::Factory->new (-verbose => 3,
                                             -type => 'Bio::SeqEvolution::DNAPoint');
isa_ok $evolve, 'Bio::SeqEvolution::DNAPoint';


my $seq = Bio::PrimarySeq->new(-id=>'test',
                              -seq=>'aaacccgggtta'
                             );

ok $evolve = Bio::SeqEvolution::Factory->new (-verbose => 0,
                                              -foo => 'bar',
                                              -rate => 5,
                                              -seq => $seq
                                             );

is $evolve->seq->id, 'test';
is $evolve->rate, 5,               'get rate()';
is $evolve->rate(2), 2,            'get and set rate()';


is $evolve->identity(80), 80, 'identity()';
is $evolve->identity(undef), undef, 'identity()';

is $evolve->pam, undef, 'pam()';
is $evolve->pam(80), 80, 'pam()';

is $evolve->mutation_count, undef, 'mutation_count()';
is $evolve->mutation_count(5), 5, , 'mutation_count()';



is $evolve->seq_type, 'Bio::PrimarySeq', 'seq_type()';
is $evolve->seq_type('Bio::Seq'), 'Bio::Seq', 'seq_type()';

ok my $newseq = $evolve->next_seq, 'next_seq()';

foreach ( $evolve->each_mutation('string')) {
    ok $_;
}
is $evolve->each_mutation, 5, 'each_mutation()';

ok $evolve = Bio::SeqEvolution::Factory->new (-verbose => 0,
                                              -rate => 5,
                                              -seq => $seq,
                                              -identity => 50     ###
                                             );
ok $newseq = $evolve->next_seq;
cmp_ok $evolve->get_alignment_identity, '<=', 50, "get_alignment_identity()";

ok $evolve = Bio::SeqEvolution::Factory->new (-verbose => 0,
                                              -rate => 5,
                                              -seq => $seq,
                                              -pam => 50     ###
                                             );
ok $newseq = $evolve->next_seq;
is $evolve->get_mutation_counter, 6, 'get_mutation_counter()';
$newseq = $evolve->next_seq;
is $evolve->get_sequence_counter, 2, 'get_sequence_counter()';
ok $evolve->reset_sequence_counter(), 'reset_sequence_counter()';
is $evolve->get_sequence_counter, 0, 'get_sequence_counter() == 0';

ok $evolve = Bio::SeqEvolution::Factory->new (-verbose => 0,
                                              -rate => 5,
                                              -seq => $seq,
                                              -pam => 50
                                             );

ok $newseq = $evolve->next_seq;
# ok $evolve->get_alignment_identity <= 50, "get_alignment_identity()";
isa_ok $evolve->get_alignmet, 'Bio::SimpleAlign';


#
#print "-----------------------------------------\n";
#print $evolve->{'_ori_locatableseq'}->seq, "\n";
#print $evolve->{'_mut_locatableseq'}->seq, "\n";
#print $evolve->{'_align'}->overall_percentage_identity, "\n";
#print $evolve->get_mutation_counter, "\n";
#print "-----------------------------------------\n";
#


#
# indels
#

#use Bio::SeqEvolution::DNAIndel;
#ok $evolve = Bio::SeqEvolution::DNAIndel->new (-verbose => 0,
#                                               -mutation_count => 3,
#                                               -rate => 1,
#                                               -seq => $seq
#                                             );
#
#
#
#ok $newseq = $evolve->next_seq;
#ok $evolve->get_mutation_counter, 3;
##print Dumper $evolve;
#
#foreach ( $evolve->each_mutation) {
##    print Dumper $_;
##    print $_->sysname, "\n";
#    ok $_->sysname;
#}
#
#
#ok $evolve = Bio::SeqEvolution::DNAIndel->new (-verbose => 0,
#                                               -duplication => 1,
##                                               -identity =>50,
#                                               -mutation_count => 3,
#                                               -rate => 1,
#                                               -seq => $seq
#                                             );
##$evolve->{'_mut_string'} = $evolve->{'_ori_string'};
#
##ok $newseq = $evolve->mutate(12);
#ok $newseq = $evolve->next_seq;
##print Dumper $evolve;
##print $evolve->{'_ori_locatableseq'}->seq, "\n";
##print $evolve->{'_mut_locatableseq'}->seq, "\n";
#
#print "-----------------------------------------\n";
#print $evolve->{'_ori_locatableseq'}->seq, "\n";
#print $evolve->{'_mut_locatableseq'}->seq, "\n";
#print $evolve->{'_align'}->overall_percentage_identity, "\n";
#print "-----------------------------------------\n";
#
#
##
## mixer, simulation
##
#
#
#ok my $evolve2 = Bio::SeqEvolution::Factory->new (-verbose => 0,
#                                                  -rate => 2,
#                                                  -seq => $seq,
#                                                  -set_mutated_seq => $newseq,
##                                                  -identity => 50
#                                                  -mutation_count => 1     ###
#                                             );
#ok $evolve2->seq_type('Bio::LocatableSeq');
#
#print "=-----------------------------------------\n";
#print $evolve2->{'_ori_locatableseq'}->seq, "\n";
#print $evolve2->{'_mut_locatableseq'}->seq, "\n";
#print $evolve2->{'_align'}->overall_percentage_identity, "\n";
#print "-----------------------------------------\n";
#
#ok $newseq = $evolve2->next_seq;
#
#
#print "-----------------------------------------\n";
#print $evolve2->{'_ori_locatableseq'}->seq, "\n";
#print $evolve2->{'_mut_locatableseq'}->seq, "\n";
#print $evolve2->{'_align'}->overall_percentage_identity, "\n";
#print "-----------------------------------------\n";
#