Bio/Matrix/PSM/PsmI.pm

filter: Statementstmt 63.6% 14 / 22 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 4 / 8 Podpod 100% 4 / 4 totaltotal 64.7% 22 / 34 CC 1 SCAR 4.1
CC
1
Cov
64%
new
2.0
instances
2.0
matrix
2.0
CRAP 1.5
« Bio/IdCollectionI.pm ↑ Summary Bio/DB/LocationI.pm »
1 #---------------------------------------------------------
2 #ISA SiteMatrix, HAS InstanceSite
3  
4 =head1 NAME
5  
6 Bio::Matrix::PSM::PsmI - abstract interface to handler of site matricies
7  
8 =head1 SYNOPSIS
9  
10 use Bio::Matrix::PSM::IO;
11  
12 # To get a Psm object from a file use the Psm parser:
13 my $psmIO = Bio::Matrix::PSM::IO->new(-format=>'meme', -file=>$file);
14  
15 # Now go through all entities in the file with next_psm, which
16 # returns a Psm object see Bio::Matrix::PSM::IO for detailed
17 # documentation (matrix predictions or matrix sequence matches or
18 # both):
19  
20 while (my $psm=$psmIO->next_psm) {
21 my %psm_header=$psm->header;
22 my $ic=$psm_header{IC};
23 my $sites=$psm_header{sites};
24 my $width=$psm_header{width};
25 my $score=$psm_header{e_val};
26 my $IUPAC=$psm->IUPAC;
27 my $instances=$psm->instances;
28 foreach my $instance (@{$instances}) {
29 my $id=$instance->primary_id;
30 #Do something with the id
31 }
32 }
33  
34 # or create from memmory:
35 my $psm= Bio::Matrix::PSM::Psm->new( -pA=>\@pA,-pC=>\@pC,-pG=>\@pG,-pT=>\@pT,
36 -id=>$id,
37 -instances=>$instances, -e_val=>$e_val,
38 -IC=>$ic, -width=>$width, -sites=>$sites)
39  
40 # where pA through pG are the respective frequencies of the matrix (see also
41 # Bio::Matrix::PSM::SiteMatrix), and everything else is self-explenatory,
42 # except for
43 #-instances (reference to an array of Bio::Matrix::PSM::InstanceSite objects)
44 # which is documented below.
45  
46 =head1 DESCRIPTION
47  
48 Supposed to handle a combination of site matrices and/or their
49 corresponding sequence matches (instances). This object inherits from
50 Bio::Matrix::PSM::SiteMatrix, so you can use the respective
51 methods. It may hold also an array of Bio::Matrix::PSM::InstanceSite
52 object, but you will have to retrieve these through
53 Bio::Matrix::PSM::Psm-E<gt>instances method (see below). To some extent
54 this is an expanded SiteMatrix object, holding data from analysis that
55 also deal with sequence matches of a particular matrix.
56  
57 =head2 DESIGN ISSUES
58  
59 This design is a bit of a compromise, so it might be a temporary
60 solution I am mixing PSM with PSM sequence matches Though they are
61 very closely related, I am not satisfied by the way this is
62 implemented here. Heikki suggested different objects when one has
63 something like meme But does this mean we have to write a different
64 objects for mast, meme, transfac, theiresias, etc.? To me the best
65 way is to return SiteMatrix object + arrray of InstanceSite objects
66 and then mast will return undef for SiteMatrix and transfac will
67 return undef for InstanceSite. Probably I cannot see some other design
68 issues that might arise from such approach, but it seems more
69 straightforward. Hilmar does not like this because it is an
70 exception from the general BioPerl rules Should I leave this as an
71 option? Also the header rightfully belongs the driver object, and
72 could be retrieved as hashes. I do not think it can be done any other
73 way, unless we want to create even one more object with very unclear
74 content.
75  
76 =head1 SEE ALSO
77  
78 L<Bio::Matrix::PSM::SiteMatrix>, L<Bio::Matrix::PSM::IO::meme>,
79 L<Bio::Matrix::PSM::IO::transfac>, L<Bio::Matrix::PSM::InstanceSite>
80  
81  
82 =head1 FEEDBACK
83  
84 =head2 Mailing Lists
85  
86 User feedback is an integral part of the evolution of this and other
87 Bioperl modules. Send your comments and suggestions preferably to one
88 of the Bioperl mailing lists. Your participation is much appreciated.
89  
90 bioperl-l@bioperl.org - General discussion
91 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
92  
93 =head2 Support
94  
95 Please direct usage questions or support issues to the mailing list:
96  
97 I<bioperl-l@bioperl.org>
98  
99 rather than to the module maintainer directly. Many experienced and
100 reponsive experts will be able look at the problem and quickly
101 address it. Please include a thorough description of the problem
102 with code and data examples if at all possible.
103  
104 =head2 Reporting Bugs
105  
106 Report bugs to the Bioperl bug tracking system to help us keep track
107 the bugs and their resolution. Bug reports can be submitted via the
108 web:
109  
110 https://github.com/bioperl/bioperl-live/issues
111  
112 =head1 AUTHOR - Stefan Kirov
113  
114 Email skirov@utk.edu
115  
116 =head1 DISCLAIMER
117  
118 This software is provided "as is" without warranty of any kind.
119  
120 =head1 APPENDIX
121  
122 =cut
123  
124  
125 # Let the code begin...
126 package Bio::Matrix::PSM::PsmI;
127 11 $Bio::Matrix::PSM::PsmI::VERSION = '1.7.8';
128 11 ▶use Bio::Matrix::PSM::SiteMatrix;
Subroutine BEGIN: called CC=1 SCAR=0.0
129 11 ▶use Bio::Matrix::PSM::InstanceSite;
Subroutine BEGIN: called CC=1 SCAR=0.0
130 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
131  
132 11 ▶use base qw(Bio::Matrix::PSM::SiteMatrixI);
Subroutine BEGIN: called CC=1 SCAR=0.0
133  
134 =head2 new
135  
136 Title : new
137 Usage : my $psm= Bio::Matrix::PSM::Psm->new( -pA=>\@pA,-pC=>\@pC,-pG=>\@pG,
138 -pT=>\@pT,-id=>$id,
139 -instances=>$instances,
140 -e_val=>$e_val,
141 -IC=>$ic, -width=>$width,
142 -sites=>$sites)
143 Function: Creates a new Bio::Matrix::PSM::Psm object
144 Throws :
145 Example :
146 Returns : Bio::Matrix::PSM::Psm object
147 Args : hash
148  
149  
150 =cut
151  
152 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
153 0 my $self = shift;
154 0 $self->throw_not_implemented();
155 }
156  
157  
158 =head2 instances
159  
160 Title : instances
161 Usage : my @instances=@{$psm->instances};
162 Function: Gets/sets the instances (Bio::Matrix::PSM::InstanceSite objects)
163 associated with the Psm object
164 Throws :
165 Example :
166 Returns : array reference (Bio::Matrix::PSM::InstanceSite objects)
167 Args : array reference (Bio::Matrix::PSM::InstanceSite objects)
168  
169 =cut
170  
171 0 ▶sub instances {
Subroutine instances: not called CC=1 SCAR=6.9
Pod documented
172 0 my $self = shift;
173 0 $self->throw_not_implemented();
174 }
175  
176  
177 =head2 matrix
178  
179 Title : matrix
180 Usage : my $matrix=$psm->matrix;
181 Function: Gets/sets the SiteMatrix related information
182 Throws :
183 Example :
184 Returns : Bio::Matrix::PSM::SiteMatrix objects
185 Args : Bio::Matrix::PSM::SiteMatrix objects
186  
187 =cut
188  
189 0 ▶sub matrix {
Subroutine matrix: not called CC=1 SCAR=6.9
Pod documented
190 0 my $self = shift;
191 0 $self->throw_not_implemented();
192 }
193  
194 =head2 header
195  
196 Title : header
197 Usage : my %header=$psm->header;
198 my $ic=$psm->header('IC');
199 Function: Gets the general information, common for most files, dealing
200 with PSM such as information content (IC), score (e-value,
201 etc.), number of sites (sites) and width. This list may
202 expand. The current list should be in
203 @Bio::Matrix::PSM::Psm::HEADER. Returns undef if an argument
204 is supplied that is not in @Bio::Matrix::PSM::meme::HEADER.
205 Throws :
206 Example :
207 Returns : hash or string
208 Args : string (IC, e_val...)
209  
210 =cut
211  
212 0 ▶sub header {
Subroutine header: not called CC=1 SCAR=6.9
Pod documented
213 0 my $self = shift;
214 0 $self->throw_not_implemented();
215 }
216  
217
218 11 1;
219  
« Bio/IdCollectionI.pm ↑ Summary Bio/DB/LocationI.pm »