line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::Tools::DNAGen; |
2
|
1
|
|
|
1
|
|
13189
|
use 5.006; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
31
|
|
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use XSLoader; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
8
|
|
|
|
|
|
|
XSLoader::load 'Bio::Tools::DNAGen'; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use Exporter; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
66
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
12
|
|
|
|
|
|
|
our @EXPORT = qw(calc_gcratio calc_mt); |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
5
|
use List::Util qw(shuffle); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
686
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Standalone Functions |
17
|
1
|
|
|
1
|
1
|
35
|
sub calc_gcratio { gcratio($_[0]) } |
18
|
1
|
|
|
1
|
1
|
13
|
sub calc_mt { mt($_[0]) } |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub subseq { |
21
|
7750
|
|
|
7750
|
0
|
17932
|
map{substr($_, length($_)-1)}grep{!is_selfcplm($_)}map{substr($_[0],1).$_} shuffle qw/a c g t/; |
|
30984
|
|
|
|
|
54628
|
|
|
31000
|
|
|
|
|
70797
|
|
|
31000
|
|
|
|
|
56334
|
|
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub new { |
26
|
1
|
|
|
1
|
1
|
924
|
my $pkg = shift; |
27
|
1
|
50
|
|
|
|
8
|
my $arg = ref($_[0]) ? $_[0] : {@_}; |
28
|
1
|
|
50
|
|
|
18
|
bless { |
|
|
|
33
|
|
|
|
|
|
|
|
50
|
|
|
|
|
29
|
|
|
|
|
|
|
gcratio => $arg->{gcratio}, |
30
|
|
|
|
|
|
|
mt => $arg->{mt}, |
31
|
|
|
|
|
|
|
limit => $arg->{limit} || 1, |
32
|
|
|
|
|
|
|
prefix => $arg->{prefix} || join(q//, subseq), |
33
|
|
|
|
|
|
|
len => $arg->{len} || 10, |
34
|
|
|
|
|
|
|
_result => '', |
35
|
|
|
|
|
|
|
_seqcnt => 0, |
36
|
|
|
|
|
|
|
}, $pkg; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
50
|
1
|
1
|
9
|
sub set_limit { $_[0]->{limit} = $_[1] || 1 } |
40
|
2
|
|
50
|
2
|
1
|
24
|
sub set_gcratio { $_[0]->{gcratio} = (ref($_[1]) ? $_[1] : [@_[1..$#_]]) || undef } |
41
|
1
|
|
50
|
1
|
1
|
11
|
sub set_mt { $_[0]->{mt} = (ref($_[1]) ? $_[1] : [@_[1..$#_]]) || undef } |
42
|
2
|
|
33
|
2
|
1
|
24
|
sub set_prefix { $_[0]->{prefix} = $_[1] || join (q//, subseq) } |
43
|
2
|
|
50
|
2
|
1
|
14
|
sub set_len { $_[0]->{len} = $_[1] || 10 } |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub genseq($) { |
47
|
5
|
|
|
5
|
1
|
19
|
$_[0]->{_seqcnt} = 0; |
48
|
5
|
|
|
|
|
15
|
$_[0]->{_result} = undef; |
49
|
5
|
50
|
|
|
|
21
|
die "Prefix's length is greater than sequence's length\n" if length($_[0]->{prefix}) > $_[0]->{len}; |
50
|
5
|
|
|
|
|
22
|
_genseq($_[0], $_[0]->{prefix}); |
51
|
5
|
|
|
|
|
28
|
grep{$_}split /\n/, $_[0]->{_result}; |
|
6
|
|
|
|
|
62
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
1
|
|
876
|
use subs qw/_genseq/; |
|
1
|
|
|
|
|
18
|
|
|
1
|
|
|
|
|
5
|
|
55
|
|
|
|
|
|
|
sub _genseq { |
56
|
17721
|
|
|
17721
|
|
22236
|
my $prefix = $_[1]; |
57
|
17721
|
100
|
|
|
|
55789
|
return if length $prefix == $_[0]->{len}; |
58
|
4525
|
100
|
|
|
|
11732
|
if(length $prefix == $_[0]->{len}-1){ |
59
|
3316
|
|
|
|
|
5608
|
for ( |
60
|
|
|
|
|
|
|
grep { |
61
|
20
|
100
|
66
|
|
|
82
|
if(defined $_[0]->{mt} && ref($_[0]->{mt})){ |
62
|
12
|
50
|
|
|
|
15
|
if(@{$_[0]->{mt}} >= 2){ |
|
12
|
|
|
|
|
27
|
|
63
|
0
|
0
|
|
|
|
0
|
mt($_) >= $_[0]->{mt}->[0] && mt($_) <= $_[0]->{mt}->[1]; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
else{ |
66
|
12
|
|
|
|
|
43
|
mt($_) == $_[0]->{mt}->[0]; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
else{ |
70
|
8
|
|
|
|
|
17
|
$_; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
grep { |
74
|
13264
|
50
|
33
|
|
|
67267
|
if(defined $_[0]->{gcratio} && ref($_[0]->{gcratio})){ |
|
13264
|
|
|
|
|
20673
|
|
75
|
13264
|
50
|
|
|
|
14989
|
if(@{$_[0]->{gcratio}} >= 2){ |
|
13264
|
|
|
|
|
30855
|
|
76
|
0
|
0
|
|
|
|
0
|
gcratio($_) >= $_[0]->{gcratio}->[0] && gcratio($_) <= $_[0]->{gcratio}->[1]; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
else{ |
79
|
13264
|
|
|
|
|
53055
|
gcratio($_) == $_[0]->{gcratio}->[0]; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
else{ |
83
|
0
|
|
|
|
|
0
|
gcratio($_); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
map{$prefix.$_} subseq $prefix){ |
87
|
|
|
|
|
|
|
|
88
|
15
|
100
|
|
|
|
47
|
if(++$_[0]->{_seqcnt} <= $_[0]->{limit}){ |
89
|
6
|
|
|
|
|
17
|
$_[0]->{_result} .= $_."\n"; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
else{ |
92
|
9
|
|
|
|
|
33
|
return; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
} |
96
|
4516
|
100
|
|
|
|
13708
|
return if $_[0]->{_seqcnt} > $_[0]->{limit}; |
97
|
4433
|
|
|
|
|
10414
|
map { _genseq($_[0], $prefix.$_) } subseq($prefix); |
|
17716
|
|
|
|
|
44705
|
|
98
|
4433
|
|
|
|
|
8835
|
return; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; |
102
|
|
|
|
|
|
|
__END__ |