t/AlignIO/AlignIO.t: fix number of tests in plan (fixup c523e6bed866)
[bioperl-live.git] / Bio / Matrix / PSM / PsmHeaderI.pm
blob1d258c5acaf3e0101723939b7cdcdf8acf9e7187
1 #---------------------------------------------------------
3 =head1 NAME
5 Bio::Matrix::PSM::PsmHeaderI - handles the header data from a PSM file
7 =head1 SYNOPSIS
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');
13 #Get some general data about the file you are parsing:
14 my $release=$psmIO->release;
15 my $version=$psmIO->version;
17 print "This analysis was performed using MAST version $version, release $release\n";
19 #Now let's see what are the consensus sequences of the motifs fed as an input:
20 my %seq=$psmIO->seq;
22 #let's cycle through all consensus sequences now:
24 foreach my $id ($psmIO->hid) {
25 print "Motif $id is \t",$seq{$id},"\n";
28 #Finally look at the stuff we do not parse:
29 my @inputfile=grep(/datafile/i,$psmIO->unstructured);
31 =head1 DESCRIPTION
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.
43 =head1 FEEDBACK
45 =head2 Mailing Lists
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.
52 bioperl-l@bioperl.org - General discussion
53 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
55 =head2 Support
57 Please direct usage questions or support issues to the mailing list:
59 I<bioperl-l@bioperl.org>
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.
66 =head2 Reporting Bugs
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:
72 https://github.com/bioperl/bioperl-live/issues
74 =head1 AUTHOR - Stefan Kirov
76 Email skirov@utk.edu
78 =head1 APPENDIX
80 =cut
83 # Let the code begin...
84 package Bio::Matrix::PSM::PsmHeaderI;
85 use Bio::Matrix::PSM::InstanceSite;
86 use Bio::Matrix::PSM::Psm;
87 use Bio::Matrix::PSM::IO;
88 use strict;
89 use base qw(Bio::Matrix::PSM::PsmI);
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);
102 =head2 new
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
115 =cut
117 =head2 seq
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 :
131 =cut
133 sub seq {
134 my $self = shift;
135 $self->throw_not_implemented();
139 =head2 hid
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 :
150 =cut
152 sub hid {
153 my $self = shift;
154 $self->throw_not_implemented();
157 =head2 length
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 :
169 =cut
171 sub length {
172 my $self = shift;
173 $self->throw_not_implemented();
176 =head2 instances
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 :
188 =cut
190 sub instances {
191 my $self = shift;
192 $self->throw_not_implemented();
195 =head2 weights
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 :
207 =cut
209 sub weights {
210 my $self = shift;
211 $self->throw_not_implemented();
215 =head2 unstuctured
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 :
227 =cut
229 sub unstructured {
230 my $self = shift;
231 $self->throw_not_implemented();
234 =head2 version
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 :
245 =cut
247 sub version {
248 my $self = shift;
249 $self->throw_not_implemented();
252 =head2 revision
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 :
263 =cut
265 sub revision {
266 my $self = shift;
267 $self->throw_not_implemented();
270 =head2 _check
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
281 =cut
283 sub _check {
284 my $self = shift;
285 $self->throw_not_implemented();