File Coverage

Bio/Matrix/PSM/PsmHeaderI.pm
Criterion Covered Total %
statement 15 33 45.4
branch n/a
condition n/a
subroutine 5 14 35.7
pod 7 8 87.5
total 27 55 49.0


line stmt bran cond sub pod time code
1             #---------------------------------------------------------
2              
3             =head1 NAME
4              
5             Bio::Matrix::PSM::PsmHeaderI - handles the header data from a PSM file
6              
7             =head1 SYNOPSIS
8              
9             use Bio::Matrix::PSM::IO;
10             #Obtain an Bio::Matrix::PSM::IO object:
11             my $psmIO= Bio::Matrix::PSM::IO->new(-file=>$file, -format=>'mast');
12              
13             #Get some general data about the file you are parsing:
14             my $release=$psmIO->release;
15             my $version=$psmIO->version;
16              
17             print "This analysis was performed using MAST version $version, release $release\n";
18              
19             #Now let's see what are the consensus sequences of the motifs fed as an input:
20             my %seq=$psmIO->seq;
21              
22             #let's cycle through all consensus sequences now:
23              
24             foreach my $id ($psmIO->hid) {
25             print "Motif $id is \t",$seq{$id},"\n";
26             }
27              
28             #Finally look at the stuff we do not parse:
29             my @inputfile=grep(/datafile/i,$psmIO->unstructured);
30              
31             =head1 DESCRIPTION
32              
33             Generally you should not use this object directly, you can access the
34             information through a PSM driver (See Bio::Matrix::PSM::IO). It is
35             handling the header data from a PSM file which may be very
36             different. This means that some of the methods will return undef
37             naturally, because this information is not present in the file which
38             is parsed. Some important data might be left over in the unstructured
39             part, and you might have to parse it yourself. I will try to
40             'structure' this header more in the near future.
41              
42              
43             =head1 FEEDBACK
44              
45             =head2 Mailing Lists
46              
47             User feedback is an integral part of the evolution of this
48             and other Bioperl modules. Send your comments and suggestions preferably
49             to one of the Bioperl mailing lists.
50             Your participation is much appreciated.
51              
52             bioperl-l@bioperl.org - General discussion
53             http://bioperl.org/wiki/Mailing_lists - About the mailing lists
54              
55             =head2 Support
56              
57             Please direct usage questions or support issues to the mailing list:
58              
59             I
60              
61             rather than to the module maintainer directly. Many experienced and
62             reponsive experts will be able look at the problem and quickly
63             address it. Please include a thorough description of the problem
64             with code and data examples if at all possible.
65              
66             =head2 Reporting Bugs
67              
68             Report bugs to the Bioperl bug tracking system to help us keep track
69             the bugs and their resolution. Bug reports can be submitted via the
70             web:
71              
72             https://github.com/bioperl/bioperl-live/issues
73              
74             =head1 AUTHOR - Stefan Kirov
75              
76             Email skirov@utk.edu
77              
78             =head1 APPENDIX
79              
80             =cut
81              
82              
83             # Let the code begin...
84             package Bio::Matrix::PSM::PsmHeaderI;
85 3     3   14 use Bio::Matrix::PSM::InstanceSite;
  3         5  
  3         64  
86 3     3   10 use Bio::Matrix::PSM::Psm;
  3         4  
  3         39  
87 3     3   9 use Bio::Matrix::PSM::IO;
  3         2  
  3         62  
88 3     3   9 use strict;
  3         3  
  3         62  
89 3     3   9 use base qw(Bio::Matrix::PSM::PsmI);
  3         3  
  3         854  
90              
91             #Accessor methods, based on the driver
92             @Bio::Matrix::PSM::PsmHeader::MASTHEADER=qw(html version release
93             seq hid length instances
94             unstructured);
95             @Bio::Matrix::PSM::PsmHeader::MEMEHEADER=qw(html version release hid
96             weight length unstructured);
97             @Bio::Matrix::PSM::PsmHeader::TRANSFACHEADER=qw(unstructured version release);
98             @Bio::Matrix::PSM::PsmHeader::ALLHEADER=qw(header release type version html
99             release weight length hid
100             seq instances unstructured);
101              
102             =head2 new
103              
104             Title : new
105             Usage : my $header= Bio::Matrix::PSM::PsmHeader->new
106             ( -seq=>\%seq, -mid=>\%mid, -width=>\%width,
107             -instances=>\%instances, -header=>\@header, -type=>'mast');
108             Function: Creates a new Bio::Matrix::PSM::PsmHeader object
109             Throws :
110             Example :
111             Returns : Bio::Matrix::PSM::PsmHeaderI object
112             Args : hash
113              
114              
115             =cut
116              
117             =head2 seq
118              
119             Title : seq
120             Usage : my %seq= $header->seq();
121             Function: Returns the sequence data as a hash, indexed by a
122             sequence ID (motif id or accession number)
123             In case the input data is a motif it would return the
124             consenus seq for each of them (mast).
125             Throws :
126             Example :
127             Returns : hash
128             Args :
129              
130              
131             =cut
132              
133             sub seq {
134 0     0 1   my $self = shift;
135 0           $self->throw_not_implemented();
136             }
137              
138              
139             =head2 hid
140              
141             Title : hid
142             Usage : my @ids= $header->hid();
143             Function: Returns array with the motif/instance ids
144             Throws :
145             Example :
146             Returns : array
147             Args :
148              
149              
150             =cut
151              
152             sub hid {
153 0     0 1   my $self = shift;
154 0           $self->throw_not_implemented();
155             }
156              
157             =head2 length
158              
159             Title : length
160             Usage : my %length= $header->length();
161             Function: Returns the length of the input sequence or motifs as a hash, indexed
162             by a sequence ID (motif id or accession number)
163             Throws :
164             Example :
165             Returns : hash
166             Args :
167              
168              
169             =cut
170              
171             sub length {
172 0     0 1   my $self = shift;
173 0           $self->throw_not_implemented();
174             }
175              
176             =head2 instances
177              
178             Title : instances
179             Usage : my %instances= $header->length();
180             Function: Returns the instance, used as a hash, indexed
181             by a sequence ID (motif id or accession number)
182             Throws :
183             Example :
184             Returns : hash of Bio::Matrix::PSM::InstanceSite objects
185             Args :
186              
187              
188             =cut
189              
190             sub instances {
191 0     0 1   my $self = shift;
192 0           $self->throw_not_implemented();
193             }
194              
195             =head2 weights
196              
197             Title : weights
198             Usage : my %weights= $header->weights();
199             Function: Returns the weights of the input sequence as a hash, indexed
200             by a sequence ID
201             Throws :
202             Example :
203             Returns : hash
204             Args :
205              
206              
207             =cut
208              
209             sub weights {
210 0     0 1   my $self = shift;
211 0           $self->throw_not_implemented();
212             }
213              
214              
215             =head2 unstuctured
216              
217             Title : unstuctured
218             Usage : my @unstructured= $header->unstuctured();
219             Function: Returns the unstructured data in the header as an array, one line per
220             array element, all control symbols are removed with \W
221             Throws :
222             Example :
223             Returns : array
224             Args :
225              
226              
227             =cut
228              
229             sub unstructured {
230 0     0 0   my $self = shift;
231 0           $self->throw_not_implemented();
232             }
233              
234             =head2 version
235              
236             Title : version
237             Usage : my $version= $header->version;
238             Function: Returns the version of the file being parsed if such exists
239             Throws :
240             Example :
241             Returns : string
242             Args :
243              
244              
245             =cut
246              
247             sub version {
248 0     0 1   my $self = shift;
249 0           $self->throw_not_implemented();
250             }
251              
252             =head2 revision
253              
254             Title : revision
255             Usage : my $revision= $header->revision;
256             Function: Returns the revision of the file being parsed if such exists
257             Throws :
258             Example :
259             Returns : string
260             Args :
261              
262              
263             =cut
264              
265             sub revision {
266 0     0 1   my $self = shift;
267 0           $self->throw_not_implemented();
268             }
269              
270             =head2 _check
271              
272             Title : _check
273             Usage : if ($self->_check('weights') { #do something} else {return 0;}
274             Function: Checks if the method called is aplicable to the file format
275             Throws :
276             Example :
277             Returns : boolean
278             Args : string
279              
280              
281             =cut
282              
283             sub _check {
284 0     0     my $self = shift;
285 0           $self->throw_not_implemented();
286             }
287              
288             1;