Bio/Seq/TraceI.pm

filter: Statementstmt 37.8% 14 / 37 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 40.0% 4 / 10 Podpod 100% 6 / 6 totaltotal 38.1% 24 / 63 CC 6 SCAR 14.8
CC
6
Cov
30%
trace
6.0
subtrace
6.0
traceat
6.0
CRAP 4.4
« Bio/Tools/MZEF.pm ↑ Summary Bio/Annotation/Relation.pm »
1 # BioPerl module for Bio::Seq::TraceI
2 #
3 # Please direct questions and support issues to <bioperl-l@bioperl.org>
4 #
5 # Cared for by Chad Matsalla <bioinformatics@dieselwurks.com
6 #
7 # Copyright Chad Matsalla
8 #
9 # You may distribute this module under the same terms as perl itself
10  
11 # POD documentation - main docs before the code
12  
13 =head1 NAME
14  
15 Bio::Seq::TraceI - Interface definition for a Bio::Seq::Trace
16  
17 =head1 SYNOPSIS
18  
19 # get a Bio::Seq::Qual compliant object somehow
20 $st = &get_object_somehow();
21  
22 # to test this is a seq object
23 $st->isa("Bio::Seq::TraceI")
24 || $obj->throw("$obj does not implement the Bio::Seq::TraceI interface");
25  
26 # set the trace for T to be @trace_points
27 my $arrayref = $st->trace("T",\@trace_points);
28 # get the trace points for "C"
29 my $arrayref = $st->trace("C");
30 # get a subtrace for "G" from 10 to 100
31 $arrayref = $st->subtrace("G",10,100);
32 # what is the trace value for "A" at position 355?
33 my $trace_calue = $st->traceat("A",355);
34 # create a false trace for "A" with $accuracy
35 $arrayref = $st->false_trace("A",Bio::Seq::Quality, $accuracy);
36 # does this trace have entries for each base?
37 $bool = $st->is_complete();
38 # how many entries are there in this trace?
39 $length = $st->length();
40  
41  
42  
43 =head1 DESCRIPTION
44  
45 This object defines an abstract interface to basic trace information. This
46 information may have come from an ABI- or scf- formatted file or may have been
47 made up.
48  
49 =head1 FEEDBACK
50  
51 =head2 Mailing Lists
52  
53 User feedback is an integral part of the evolution of this and other
54 Bioperl modules. Send your comments and suggestions preferably to one
55 of the Bioperl mailing lists. Your participation is much appreciated.
56  
57 bioperl-l@bioperl.org - General discussion
58 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
59  
60 =head2 Support
61  
62 Please direct usage questions or support issues to the mailing list:
63  
64 I<bioperl-l@bioperl.org>
65  
66 rather than to the module maintainer directly. Many experienced and
67 reponsive experts will be able look at the problem and quickly
68 address it. Please include a thorough description of the problem
69 with code and data examples if at all possible.
70  
71 =head2 Reporting Bugs
72  
73 Report bugs to the Bioperl bug tracking system to help us keep track
74 the bugs and their resolution. Bug reports can be submitted via the
75 web:
76  
77 https://github.com/bioperl/bioperl-live/issues
78  
79 =head1 AUTHOR - Chad Matsalla
80  
81 Email bioinformatics@dieselwurks.com
82  
83 =head1 APPENDIX
84  
85 The rest of the documentation details each of the object methods.
86 Internal methods are usually preceded with a _
87  
88 =cut
89  
90  
91 # Let the code begin...
92  
93  
94 package Bio::Seq::TraceI;
95 4 $Bio::Seq::TraceI::VERSION = '1.7.8';
96 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
97 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
98 4 ▶use Dumpvalue;
Subroutine BEGIN: called CC=1 SCAR=0.0
99 4 ▶use Bio::Root::RootI;
Subroutine BEGIN: called CC=1 SCAR=0.0
100  
101 =head1 Implementation Specific Functions
102  
103 These functions are the ones that a specific implementation must
104 define.
105  
106 =head2 trace($base,\@new_values)
107  
108 Title : trace($base,\@new_values)
109 Usage : @trace_Values = @{$obj->trace($base,\@new_values)};
110 Function: Returns the trace values as a reference to an array containing the
111 trace values. The individual elements of the trace array are not validated
112 and can be any numeric value.
113 Returns : A reference to an array.
114 Status :
115 Arguments: $base : which color channel would you like the trace values for?
116 - $base must be one of "A","T","G","C"
117 \@new_values : a reference to an array of values containing trace
118 data for this base
119  
120 =cut
121  
122 0 ▶sub trace {
Subroutine trace: not called CC=2 SCAR=17.9
Pod documented
123 0 my ($self) = @_;
124 0 ▶ if( $self->can('throw') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->can('throw')) { } 0 0 0
125 0 $self->throw("Bio::Seq::TraceI definition of trace - implementing class did not provide this method");
126 } else {
127 0 confess("Bio::Seq::TraceI definition of trace - implementing class did not provide this method");
128 }
129 }
130  
131 =head2 subtrace($base,$start,$end)
132  
133 Title : subtrace($base,$start,$end)
134 Usage : @subset_of_traces = @{$obj->subtrace("A",10,40)};
135 Function: returns the trace values from $start to $end, where the
136 first value is 1 and the number is inclusive, ie 1-2 are the first
137 two trace values of this base. Start cannot be larger than end but can
138 be equal.
139 Returns : A reference to an array.
140 Args : $base: "A","T","G" or "C"
141 $start: a start position
142 $end : an end position
143  
144 =cut
145  
146 0 ▶sub subtrace {
Subroutine subtrace: not called CC=2 SCAR=17.9
Pod documented
147 0 my ($self) = @_;
148  
149 0 ▶ if( $self->can('throw') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->can('throw')) { } 0 0 0
150 0 $self->throw("Bio::Seq::TraceI definition of subtrace - implementing class did not provide this method");
151 } else {
152 0 confess("Bio::Seq::TraceI definition of subtrace - implementing class did not provide this method");
153 }
154  
155 }
156  
157 =head2 can_call_new()
158  
159 Title : can_call_new()
160 Usage : if( $obj->can_call_new ) {
161 $newobj = $obj->new( %param );
162 }
163 Function: can_call_new returns 1 or 0 depending on whether an
164 implementation allows new constructor to be called. If a new
165 constructor is allowed, then it should take the followed hashed
166 constructor list.
167 $myobject->new( -qual => $quality_as_string,
168 -display_id => $id,
169 -accession_number => $accession,
170 );
171 Example :
172 Returns : 1 or 0
173 Args :
174  
175  
176 =cut
177  
178 0 ▶sub can_call_new{
Subroutine can_call_new: not called CC=1 SCAR=6.9
Pod documented
179 0 my ($self,@args) = @_;
180 # we default to 0 here
181 0 return 0;
182 }
183  
184 =head2 traceat($channel,$position)
185  
186 Title : qualat($channel,$position)
187 Usage : $trace = $obj->traceat(500);
188 Function: Return the trace value at the given location, where the
189 first value is 1 and the number is inclusive, ie 1-2 are the first
190 two bases of the sequence. Start cannot be larger than end but can
191 be equal.
192 Returns : A scalar.
193 Args : A base and a position.
194  
195 =cut
196  
197 0 ▶sub traceat {
Subroutine traceat: not called CC=2 SCAR=17.9
Pod documented
198 0 my ($self,$value) = @_;
199 0 ▶ if( $self->can('warn') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->can('warn')) { } 0 0 0
200 0 $self->warn("Bio::Seq::TraceI definition of traceat - implementing class did not provide this method");
201 } else {
202 0 warn("Bio::Seq::TraceI definition of traceat - implementing class did not provide this method");
203 }
204 0 return '';
205 }
206  
207 =head2 length()
208  
209 Title : length()
210 Usage : $length = $obj->length("A");
211 Function: Return the length of the array holding the trace values for the "A"
212 channel. A check should be done to make sure that this Trace object
213 is_complete() before doing this to prevent hazardous results.
214 Returns : A scalar (the number of elements in the quality array).
215 Args : If used, get the traces from that channel. Default to "A"
216  
217 =cut
218  
219 0 ▶sub length {
Subroutine length: not called CC=2 SCAR=17.9
Pod documented
220 0 my ($self)= @_;
221 0 ▶ if( $self->can('throw') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->can('throw')) { } 0 0 0
222 0 $self->throw("Bio::Seq::TraceI definition of length - implementing class did not provide this method");
223 } else {
224 0 confess("Bio::Seq::TraceI definition of length - implementing class did not provide this method");
225 }
226 }
227  
228 =head2 trace_indices($new_indices)
229  
230 Title : trace_indices($new_indices)
231 Usage : $indices = $obj->trace_indices($new_indices);
232 Function: Return the trace iindex points for this object.
233 Returns : A scalar
234 Args : If used, the trace indices will be set to the provided value.
235  
236 =cut
237  
238 0 ▶sub trace_indices {
Subroutine trace_indices: not called CC=2 SCAR=17.9
Pod documented
239 0 my ($self)= @_;
240 0 ▶ if( $self->can('throw') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->can('throw')) { } 0 0 0
241 0 $self->throw("Bio::Seq::TraceI definition of trace_indices - implementing class did not provide this method");
242 } else {
243 0 confess("Bio::Seq::TraceI definition of trace_indices - implementing class did not provide this method");
244 }
245 }
246  
247  
248  
249  
250 4 1;
« Bio/Tools/MZEF.pm ↑ Summary Bio/Annotation/Relation.pm »