line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Bio::Perl; |
3
|
|
|
|
|
|
|
$Bio::Perl::VERSION = '1.7.4'; |
4
|
1
|
|
|
1
|
|
186223
|
use vars qw(@EXPORT @EXPORT_OK $DBOKAY); |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
55
|
|
5
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
6
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
53
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
558
|
use Bio::SeqIO; |
|
1
|
|
|
|
|
55893
|
|
|
1
|
|
|
|
|
37
|
|
9
|
1
|
|
|
1
|
|
652
|
use Bio::Seq; |
|
1
|
|
|
|
|
34909
|
|
|
1
|
|
|
|
|
42
|
|
10
|
1
|
|
|
1
|
|
439
|
use Bio::Root::Version '$VERSION'; |
|
1
|
|
|
|
|
196
|
|
|
1
|
|
|
|
|
6
|
|
11
|
|
|
|
|
|
|
BEGIN { |
12
|
1
|
|
|
1
|
|
263
|
eval { |
13
|
1
|
|
|
|
|
463
|
require Bio::DB::EMBL; |
14
|
1
|
|
|
|
|
59360
|
require Bio::DB::GenBank; |
15
|
0
|
|
|
|
|
0
|
require Bio::DB::SwissProt; |
16
|
0
|
|
|
|
|
0
|
require Bio::DB::RefSeq; |
17
|
0
|
|
|
|
|
0
|
require Bio::DB::GenPept; |
18
|
|
|
|
|
|
|
}; |
19
|
1
|
50
|
|
|
|
7
|
if( $@ ) { |
20
|
1
|
|
|
|
|
33
|
$DBOKAY = 0; |
21
|
|
|
|
|
|
|
} else { |
22
|
0
|
|
|
|
|
0
|
$DBOKAY = 1; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
1
|
|
6
|
use base qw(Exporter); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
2005
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
@EXPORT = qw(read_sequence read_all_sequences write_sequence |
29
|
|
|
|
|
|
|
new_sequence get_sequence translate translate_as_string |
30
|
|
|
|
|
|
|
reverse_complement revcom revcom_as_string |
31
|
|
|
|
|
|
|
reverse_complement_as_string blast_sequence write_blast); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
@EXPORT_OK = @EXPORT; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub read_sequence{ |
38
|
2
|
|
|
2
|
1
|
1197
|
my ($filename,$format) = @_; |
39
|
|
|
|
|
|
|
|
40
|
2
|
50
|
|
|
|
20
|
if( !defined $filename ) { |
41
|
0
|
|
|
|
|
0
|
confess "read_sequence($filename) - usage incorrect"; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
2
|
|
|
|
|
7
|
my $seqio; |
45
|
|
|
|
|
|
|
|
46
|
2
|
100
|
|
|
|
6
|
if( defined $format ) { |
47
|
1
|
|
|
|
|
5
|
$seqio = Bio::SeqIO->new( '-file' => $filename, '-format' => $format); |
48
|
|
|
|
|
|
|
} else { |
49
|
1
|
|
|
|
|
11
|
$seqio = Bio::SeqIO->new( '-file' => $filename); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
2
|
|
|
|
|
70131
|
my $seq = $seqio->next_seq(); |
53
|
|
|
|
|
|
|
|
54
|
2
|
|
|
|
|
45077
|
return $seq; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub read_all_sequences{ |
60
|
1
|
|
|
1
|
1
|
1089
|
my ($filename,$format) = @_; |
61
|
|
|
|
|
|
|
|
62
|
1
|
50
|
|
|
|
5
|
if( !defined $filename ) { |
63
|
0
|
|
|
|
|
0
|
confess "read_all_sequences($filename) - usage incorrect"; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
1
|
|
|
|
|
2
|
my $seqio; |
67
|
|
|
|
|
|
|
|
68
|
1
|
50
|
|
|
|
4
|
if( defined $format ) { |
69
|
1
|
|
|
|
|
6
|
$seqio = Bio::SeqIO->new( '-file' => $filename, '-format' => $format); |
70
|
|
|
|
|
|
|
} else { |
71
|
0
|
|
|
|
|
0
|
$seqio = Bio::SeqIO->new( '-file' => $filename); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
1
|
|
|
|
|
883
|
my @seq_array; |
75
|
|
|
|
|
|
|
|
76
|
1
|
|
|
|
|
5
|
while( my $seq = $seqio->next_seq() ) { |
77
|
2
|
|
|
|
|
949
|
push(@seq_array,$seq); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
1
|
|
|
|
|
33
|
return @seq_array; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub write_sequence{ |
86
|
1
|
|
|
1
|
1
|
2316
|
my ($filename,$format,@sequence_objects) = @_; |
87
|
|
|
|
|
|
|
|
88
|
1
|
50
|
|
|
|
6
|
if( scalar(@sequence_objects) == 0 ) { |
89
|
0
|
|
|
|
|
0
|
confess("write_sequence(filename,format,sequence_object)"); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
1
|
|
|
|
|
4
|
my $error = 0; |
93
|
1
|
|
|
|
|
2
|
my $seqname = "sequence1"; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# catch users who haven't passed us a filename we can open |
96
|
1
|
0
|
33
|
|
|
7
|
if( $filename !~ /^\>/ && $filename !~ /^|/ ) { |
97
|
0
|
|
|
|
|
0
|
$filename = ">".$filename; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
1
|
|
|
|
|
8
|
my $seqio = Bio::SeqIO->new('-file' => $filename, '-format' => $format); |
101
|
|
|
|
|
|
|
|
102
|
1
|
|
|
|
|
765
|
foreach my $seq ( @sequence_objects ) { |
103
|
1
|
|
|
|
|
2
|
my $seq_obj; |
104
|
|
|
|
|
|
|
|
105
|
1
|
50
|
|
|
|
4
|
if( !ref $seq ) { |
106
|
0
|
0
|
|
|
|
0
|
if( length $seq > 50 ) { |
107
|
|
|
|
|
|
|
# odds are this is a sequence as a string, and someone has not figured out |
108
|
|
|
|
|
|
|
# how to make objects. Warn him/her and then make a sequence object |
109
|
|
|
|
|
|
|
# from this |
110
|
0
|
0
|
|
|
|
0
|
if( $error == 0 ) { |
111
|
0
|
|
|
|
|
0
|
carp("WARNING: You have put in a long string into write_sequence.\n". |
112
|
|
|
|
|
|
|
"I suspect this means that this is the actual sequence\n". |
113
|
|
|
|
|
|
|
"In the future try the\n". |
114
|
|
|
|
|
|
|
" new_sequence method of this module to make a new sequence object.\n". |
115
|
|
|
|
|
|
|
"Doing this for you here\n"); |
116
|
0
|
|
|
|
|
0
|
$error = 1; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
0
|
$seq_obj = new_sequence($seq,$seqname); |
120
|
0
|
|
|
|
|
0
|
$seqname++; |
121
|
|
|
|
|
|
|
} else { |
122
|
0
|
|
|
|
|
0
|
confess("You have a non object [$seq] passed to write_sequence. It maybe that you". |
123
|
|
|
|
|
|
|
"want to use new_sequence to make this string into a sequence object?"); |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
} else { |
126
|
1
|
50
|
|
|
|
6
|
if( !$seq->isa("Bio::SeqI") ) { |
127
|
0
|
|
|
|
|
0
|
confess("object [$seq] is not a Bio::Seq object; can't write it out"); |
128
|
|
|
|
|
|
|
} |
129
|
1
|
|
|
|
|
2
|
$seq_obj = $seq; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
# finally... we get to write out the sequence! |
133
|
1
|
|
|
|
|
5
|
$seqio->write_seq($seq_obj); |
134
|
|
|
|
|
|
|
} |
135
|
1
|
|
|
|
|
10793
|
1; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
sub new_sequence{ |
140
|
1
|
|
|
1
|
1
|
505
|
my ($seq,$name,$accession) = @_; |
141
|
|
|
|
|
|
|
|
142
|
1
|
50
|
|
|
|
7
|
if( !defined $seq ) { |
143
|
0
|
|
|
|
|
0
|
confess("new_sequence(sequence_as_string) usage"); |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
1
|
|
50
|
|
|
4
|
$name ||= "no-name-for-sequence"; |
147
|
|
|
|
|
|
|
|
148
|
1
|
|
|
|
|
6
|
my $seq_object = Bio::Seq->new( -seq => $seq, -id => $name); |
149
|
|
|
|
|
|
|
|
150
|
1
|
50
|
|
|
|
265
|
$accession && $seq_object->accession_number($accession); |
151
|
|
|
|
|
|
|
|
152
|
1
|
|
|
|
|
47
|
return $seq_object; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
sub blast_sequence { |
157
|
1
|
|
|
1
|
1
|
1345
|
my ($seq,$verbose) = @_; |
158
|
|
|
|
|
|
|
|
159
|
1
|
50
|
|
|
|
5
|
if( !defined $verbose ) { |
160
|
0
|
|
|
|
|
0
|
$verbose = 1; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
1
|
50
|
|
|
|
39
|
if( !ref $seq ) { |
|
|
50
|
|
|
|
|
|
164
|
0
|
|
|
|
|
0
|
$seq = Bio::Seq->new( -seq => $seq, -id => 'blast-sequence-temp-id'); |
165
|
|
|
|
|
|
|
} elsif ( !$seq->isa('Bio::PrimarySeqI') ) { |
166
|
0
|
|
|
|
|
0
|
croak("[$seq] is an object, but not a Bio::Seq object, cannot be blasted"); |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
|
169
|
1
|
|
|
|
|
1376
|
require Bio::Tools::Run::RemoteBlast; |
170
|
|
|
|
|
|
|
|
171
|
1
|
50
|
|
|
|
18071
|
my $prog = ( $seq->alphabet eq 'protein' ) ? 'blastp' : 'blastn'; |
172
|
1
|
|
|
|
|
37
|
my $e_val= '1e-10'; |
173
|
|
|
|
|
|
|
|
174
|
1
|
|
|
|
|
4
|
my @params = ( '-prog' => $prog, |
175
|
|
|
|
|
|
|
'-expect' => $e_val, |
176
|
|
|
|
|
|
|
'-readmethod' => 'SearchIO' ); |
177
|
|
|
|
|
|
|
|
178
|
1
|
|
|
|
|
5
|
my $factory = Bio::Tools::Run::RemoteBlast->new(@params); |
179
|
|
|
|
|
|
|
|
180
|
1
|
|
|
|
|
1216
|
my $r = $factory->submit_blast($seq); |
181
|
1
|
50
|
|
|
|
1131947
|
if( $verbose ) { |
182
|
0
|
|
|
|
|
0
|
print STDERR "Submitted Blast for [".$seq->id."] "; |
183
|
|
|
|
|
|
|
} |
184
|
1
|
|
|
|
|
5000156
|
sleep 5; |
185
|
|
|
|
|
|
|
|
186
|
1
|
|
|
|
|
15
|
my $result; |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
LOOP : |
189
|
1
|
|
|
|
|
24
|
while( my @rids = $factory->each_rid) { |
190
|
2
|
|
|
|
|
72
|
foreach my $rid ( @rids ) { |
191
|
2
|
|
|
|
|
12
|
my $rc = $factory->retrieve_blast($rid); |
192
|
2
|
100
|
|
|
|
2131995
|
if( !ref($rc) ) { |
193
|
1
|
50
|
|
|
|
6
|
if( $rc < 0 ) { |
194
|
0
|
|
|
|
|
0
|
$factory->remove_rid($rid); |
195
|
|
|
|
|
|
|
} |
196
|
1
|
50
|
|
|
|
4
|
if( $verbose ) { |
197
|
0
|
|
|
|
|
0
|
print STDERR "."; |
198
|
|
|
|
|
|
|
} |
199
|
1
|
|
|
|
|
10000139
|
sleep 10; |
200
|
|
|
|
|
|
|
} else { |
201
|
1
|
|
|
|
|
6
|
$result = $rc->next_result(); |
202
|
1
|
|
|
|
|
7091
|
$factory->remove_rid($rid); |
203
|
1
|
|
|
|
|
22
|
last LOOP; |
204
|
|
|
|
|
|
|
} |
205
|
|
|
|
|
|
|
} |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
|
208
|
1
|
50
|
|
|
|
275
|
if( $verbose ) { |
209
|
0
|
|
|
|
|
0
|
print STDERR "\n"; |
210
|
|
|
|
|
|
|
} |
211
|
1
|
|
|
|
|
6
|
return $result; |
212
|
|
|
|
|
|
|
} |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
sub write_blast { |
216
|
0
|
|
|
0
|
1
|
0
|
my ($filename,$blast) = @_; |
217
|
|
|
|
|
|
|
|
218
|
0
|
0
|
0
|
|
|
0
|
if( $filename !~ /^\>/ && $filename !~ /^|/ ) { |
219
|
0
|
|
|
|
|
0
|
$filename = ">".$filename; |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
|
222
|
0
|
|
|
|
|
0
|
my $output = Bio::SearchIO->new( -output_format => 'blast', -file => $filename); |
223
|
|
|
|
|
|
|
|
224
|
0
|
|
|
|
|
0
|
$output->write_result($blast); |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
} |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
my $genbank_db = undef; |
230
|
|
|
|
|
|
|
my $genpept_db = undef; |
231
|
|
|
|
|
|
|
my $embl_db = undef; |
232
|
|
|
|
|
|
|
my $swiss_db = undef; |
233
|
|
|
|
|
|
|
my $refseq_db = undef; |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
sub get_sequence{ |
236
|
5
|
|
|
5
|
1
|
63929
|
my ($db_type,$identifier) = @_; |
237
|
5
|
50
|
|
|
|
16
|
if( ! $DBOKAY ) { |
238
|
5
|
|
|
|
|
71
|
confess ("Your system does not have one of LWP, HTTP::Request::Common, IO::String\n". |
239
|
|
|
|
|
|
|
"installed so the DB retrieval method is not available.\n". |
240
|
|
|
|
|
|
|
"Full error message is:\n $!\n"); |
241
|
0
|
|
|
|
|
0
|
return; |
242
|
|
|
|
|
|
|
} |
243
|
0
|
|
|
|
|
0
|
$db_type = lc($db_type); |
244
|
|
|
|
|
|
|
|
245
|
0
|
|
|
|
|
0
|
my $db; |
246
|
|
|
|
|
|
|
|
247
|
0
|
0
|
|
|
|
0
|
if( $db_type =~ /genbank/ ) { |
248
|
0
|
0
|
|
|
|
0
|
if( !defined $genbank_db ) { |
249
|
0
|
|
|
|
|
0
|
$genbank_db = Bio::DB::GenBank->new(); |
250
|
|
|
|
|
|
|
} |
251
|
0
|
|
|
|
|
0
|
$db = $genbank_db; |
252
|
|
|
|
|
|
|
} |
253
|
0
|
0
|
|
|
|
0
|
if( $db_type =~ /genpept/ ) { |
254
|
0
|
0
|
|
|
|
0
|
if( !defined $genpept_db ) { |
255
|
0
|
|
|
|
|
0
|
$genpept_db = Bio::DB::GenPept->new(); |
256
|
|
|
|
|
|
|
} |
257
|
0
|
|
|
|
|
0
|
$db = $genpept_db; |
258
|
|
|
|
|
|
|
} |
259
|
|
|
|
|
|
|
|
260
|
0
|
0
|
|
|
|
0
|
if( $db_type =~ /swiss/ ) { |
261
|
0
|
0
|
|
|
|
0
|
if( !defined $swiss_db ) { |
262
|
0
|
|
|
|
|
0
|
$swiss_db = Bio::DB::SwissProt->new(); |
263
|
|
|
|
|
|
|
} |
264
|
0
|
|
|
|
|
0
|
$db = $swiss_db; |
265
|
|
|
|
|
|
|
} |
266
|
|
|
|
|
|
|
|
267
|
0
|
0
|
|
|
|
0
|
if( $db_type =~ /embl/ ) { |
268
|
0
|
0
|
|
|
|
0
|
if( !defined $embl_db ) { |
269
|
0
|
|
|
|
|
0
|
$embl_db = Bio::DB::EMBL->new(); |
270
|
|
|
|
|
|
|
} |
271
|
0
|
|
|
|
|
0
|
$db = $embl_db; |
272
|
|
|
|
|
|
|
} |
273
|
|
|
|
|
|
|
|
274
|
0
|
0
|
0
|
|
|
0
|
if( $db_type =~ /refseq/ or ($db_type !~ /swiss/ and |
|
|
|
0
|
|
|
|
|
275
|
|
|
|
|
|
|
$identifier =~ /^\s*N\S+_/)) { |
276
|
0
|
0
|
|
|
|
0
|
if( !defined $refseq_db ) { |
277
|
0
|
|
|
|
|
0
|
$refseq_db = Bio::DB::RefSeq->new(); |
278
|
|
|
|
|
|
|
} |
279
|
0
|
|
|
|
|
0
|
$db = $refseq_db; |
280
|
|
|
|
|
|
|
} |
281
|
|
|
|
|
|
|
|
282
|
0
|
|
|
|
|
0
|
my $seq; |
283
|
|
|
|
|
|
|
|
284
|
0
|
0
|
|
|
|
0
|
if( $identifier =~ /^\w+\d+$/ ) { |
285
|
0
|
|
|
|
|
0
|
$seq = $db->get_Seq_by_acc($identifier); |
286
|
|
|
|
|
|
|
} else { |
287
|
0
|
|
|
|
|
0
|
$seq = $db->get_Seq_by_id($identifier); |
288
|
|
|
|
|
|
|
} |
289
|
|
|
|
|
|
|
|
290
|
0
|
|
|
|
|
0
|
return $seq; |
291
|
|
|
|
|
|
|
} |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
sub translate { |
296
|
4
|
|
|
4
|
1
|
3309
|
my ($scalar) = shift; |
297
|
|
|
|
|
|
|
|
298
|
4
|
|
|
|
|
8
|
my $obj; |
299
|
4
|
100
|
|
|
|
12
|
if( ref $scalar ) { |
300
|
2
|
50
|
|
|
|
11
|
if( !$scalar->isa("Bio::PrimarySeqI") ) { |
301
|
0
|
|
|
|
|
0
|
confess("Expecting a sequence object not a $scalar"); |
302
|
|
|
|
|
|
|
} else { |
303
|
2
|
|
|
|
|
5
|
$obj= $scalar; |
304
|
|
|
|
|
|
|
} |
305
|
|
|
|
|
|
|
} else { |
306
|
|
|
|
|
|
|
# check this looks vaguely like DNA |
307
|
2
|
|
|
|
|
5
|
my $n = ( $scalar =~ tr/ATGCNatgcn/ATGCNatgcn/ ); |
308
|
2
|
50
|
|
|
|
12
|
if( $n < length($scalar) * 0.85 ) { |
309
|
0
|
|
|
|
|
0
|
confess("Sequence [$scalar] is less than 85% ATGCN, which doesn't look very DNA to me"); |
310
|
|
|
|
|
|
|
} |
311
|
2
|
|
|
|
|
10
|
$obj = Bio::PrimarySeq->new(-id => 'internalbioperlseq',-seq => $scalar); |
312
|
|
|
|
|
|
|
} |
313
|
4
|
|
|
|
|
388
|
return $obj->translate(); |
314
|
|
|
|
|
|
|
} |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
sub translate_as_string { |
319
|
2
|
|
|
2
|
1
|
2041
|
my ($scalar) = shift; |
320
|
2
|
|
|
|
|
6
|
my $obj = Bio::Perl::translate($scalar); |
321
|
2
|
|
|
|
|
747
|
return $obj->seq; |
322
|
|
|
|
|
|
|
} |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
sub reverse_complement { |
327
|
0
|
|
|
0
|
1
|
|
my ($scalar) = shift; |
328
|
|
|
|
|
|
|
|
329
|
0
|
|
|
|
|
|
my $obj; |
330
|
|
|
|
|
|
|
|
331
|
0
|
0
|
|
|
|
|
if( ref $scalar ) { |
332
|
0
|
0
|
|
|
|
|
if( !$scalar->isa("Bio::PrimarySeqI") ) { |
333
|
0
|
|
|
|
|
|
confess("Expecting a sequence object not a $scalar"); |
334
|
|
|
|
|
|
|
} else { |
335
|
0
|
|
|
|
|
|
$obj= $scalar; |
336
|
|
|
|
|
|
|
} |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
} else { |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
# check this looks vaguely like DNA |
341
|
0
|
|
|
|
|
|
my $n = ( $scalar =~ tr/ATGCNatgcn/ATGCNatgcn/ ); |
342
|
|
|
|
|
|
|
|
343
|
0
|
0
|
|
|
|
|
if( $n < length($scalar) * 0.85 ) { |
344
|
0
|
|
|
|
|
|
confess("Sequence [$scalar] is less than 85% ATGCN, which doesn't look very DNA to me"); |
345
|
|
|
|
|
|
|
} |
346
|
|
|
|
|
|
|
|
347
|
0
|
|
|
|
|
|
$obj = Bio::PrimarySeq->new(-id => 'internalbioperlseq',-seq => $scalar); |
348
|
|
|
|
|
|
|
} |
349
|
|
|
|
|
|
|
|
350
|
0
|
|
|
|
|
|
return $obj->revcom(); |
351
|
|
|
|
|
|
|
} |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
sub revcom { |
355
|
0
|
|
|
0
|
1
|
|
return &Bio::Perl::reverse_complement(@_); |
356
|
|
|
|
|
|
|
} |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
sub reverse_complement_as_string { |
361
|
0
|
|
|
0
|
1
|
|
my ($scalar) = shift; |
362
|
0
|
|
|
|
|
|
my $obj = &Bio::Perl::reverse_complement($scalar); |
363
|
0
|
|
|
|
|
|
return $obj->seq; |
364
|
|
|
|
|
|
|
} |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
sub revcom_as_string { |
369
|
0
|
|
|
0
|
1
|
|
my ($scalar) = shift; |
370
|
0
|
|
|
|
|
|
my $obj = &Bio::Perl::reverse_complement($scalar); |
371
|
0
|
|
|
|
|
|
return $obj->seq; |
372
|
|
|
|
|
|
|
} |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
1; |
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
# ABSTRACT: Functional access to BioPerl for people who don't know objects |
379
|
|
|
|
|
|
|
# AUTHOR: Ewan Birney |
380
|
|
|
|
|
|
|
# OWNER: many people (see the individual modules for their copyright holders) |
381
|
|
|
|
|
|
|
# LICENSE: Perl_5 |
382
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
__END__ |