line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# BioPerl module for Bio::Seq::LargeSeq |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# Please direct questions and support issues to |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Cared for by Ewan Birney, Jason Stajich |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# Copyright Ewan Birney, Jason Stajich |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# You may distribute this module under the same terms as perl itself |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# POD documentation - main docs before the code |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Bio::Seq::LargeSeq - SeqI compliant object that stores sequence as |
17
|
|
|
|
|
|
|
files in /tmp |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# normal primary seq usage |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
This object stores a sequence as a series of files in a temporary |
26
|
|
|
|
|
|
|
directory. The aim is to allow someone the ability to store very large |
27
|
|
|
|
|
|
|
sequences (eg, E 100MBases) in a file system without running out |
28
|
|
|
|
|
|
|
of memory (eg, on a 64 MB real memory machine!). |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Of course, to actually make use of this functionality, the programs |
31
|
|
|
|
|
|
|
which use this object B not call $primary_seq-Eseq otherwise |
32
|
|
|
|
|
|
|
the entire sequence will come out into memory and probably paste your |
33
|
|
|
|
|
|
|
machine. However, calls $primary_seq-Esubseq(10,100) will cause |
34
|
|
|
|
|
|
|
only 90 characters to be brought into real memory. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 FEEDBACK |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 Mailing Lists |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
User feedback is an integral part of the evolution of this and other |
41
|
|
|
|
|
|
|
Bioperl modules. Send your comments and suggestions preferably to one |
42
|
|
|
|
|
|
|
of the Bioperl mailing lists. Your participation is much appreciated. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
bioperl-l@bioperl.org - General discussion |
45
|
|
|
|
|
|
|
http://bioperl.org/wiki/Mailing_lists - About the mailing lists |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 Support |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Please direct usage questions or support issues to the mailing list: |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
I |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
rather than to the module maintainer directly. Many experienced and |
54
|
|
|
|
|
|
|
reponsive experts will be able look at the problem and quickly |
55
|
|
|
|
|
|
|
address it. Please include a thorough description of the problem |
56
|
|
|
|
|
|
|
with code and data examples if at all possible. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 Reporting Bugs |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Report bugs to the Bioperl bug tracking system to help us keep track |
61
|
|
|
|
|
|
|
the bugs and their resolution. Bug reports can be submitted via the |
62
|
|
|
|
|
|
|
web: |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
https://github.com/bioperl/bioperl-live/issues |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 AUTHOR - Ewan Birney |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Email birney@ebi.ac.uk |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 APPENDIX |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
The rest of the documentation details each of the object |
73
|
|
|
|
|
|
|
methods. Internal methods are usually preceded with a _ |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# Let the code begin... |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
package Bio::Seq::LargeSeq; |
82
|
1
|
|
|
1
|
|
909
|
use vars qw($AUTOLOAD); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
83
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# Object preamble |
86
|
|
|
|
|
|
|
|
87
|
1
|
|
|
1
|
|
4
|
use Bio::Seq::LargePrimarySeq; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
18
|
|
88
|
|
|
|
|
|
|
|
89
|
1
|
|
|
1
|
|
4
|
use base qw(Bio::Seq Bio::Seq::LargeSeqI); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
334
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub new { |
93
|
8
|
|
|
8
|
1
|
27
|
my ($class, @args) = @_; |
94
|
8
|
|
|
|
|
27
|
my $self = $class->SUPER::new(@args); |
95
|
|
|
|
|
|
|
|
96
|
8
|
|
|
|
|
21
|
my ($pseq) = $self->_rearrange([qw(PRIMARYSEQ)], @args); |
97
|
|
|
|
|
|
|
|
98
|
8
|
100
|
|
|
|
18
|
if( ! defined $pseq ) { |
99
|
3
|
|
|
|
|
10
|
$pseq = Bio::Seq::LargePrimarySeq->new(@args); |
100
|
|
|
|
|
|
|
} |
101
|
8
|
|
|
|
|
22
|
$self->primary_seq($pseq); |
102
|
|
|
|
|
|
|
|
103
|
8
|
|
|
|
|
27
|
return $self; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head2 trunc |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Title : trunc |
110
|
|
|
|
|
|
|
Usage : $subseq = $myseq->trunc(10,100); |
111
|
|
|
|
|
|
|
Function: Provides a truncation of a sequence, |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Example : |
114
|
|
|
|
|
|
|
Returns : a fresh Bio::SeqI object |
115
|
|
|
|
|
|
|
Args : |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub trunc { |
120
|
4
|
|
|
4
|
1
|
50
|
my ($self, $s, $e) = @_; |
121
|
4
|
|
|
|
|
11
|
return new Bio::Seq::LargeSeq |
122
|
|
|
|
|
|
|
('-display_id' => $self->display_id, |
123
|
|
|
|
|
|
|
'-accession_number' => $self->accession_number, |
124
|
|
|
|
|
|
|
'-desc' => $self->desc, |
125
|
|
|
|
|
|
|
'-alphabet' => $self->alphabet, |
126
|
|
|
|
|
|
|
-primaryseq => $self->primary_seq->trunc($s,$e)); |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head2 Bio::Seq::LargePrimarySeq methods |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=cut |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 add_sequence_as_string |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Title : add_sequence_as_string |
136
|
|
|
|
|
|
|
Usage : $seq->add_sequence_as_string("CATGAT"); |
137
|
|
|
|
|
|
|
Function: Appends additional residues to an existing LargePrimarySeq object. |
138
|
|
|
|
|
|
|
This allows one to build up a large sequence without storing |
139
|
|
|
|
|
|
|
entire object in memory. |
140
|
|
|
|
|
|
|
Returns : Current length of sequence |
141
|
|
|
|
|
|
|
Args : string to append |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub add_sequence_as_string { |
146
|
0
|
|
|
0
|
1
|
|
my ($self,$str) = @_; |
147
|
0
|
|
|
|
|
|
return $self->primary_seq->add_sequence_as_string($str); |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
1; |