~ubuntu-branches/ubuntu/raring/bioperl/raring

« back to all changes in this revision

Viewing changes to Bio/Matrix/PSM/PsmHeaderI.pm

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2008-03-18 14:44:57 UTC
  • mfrom: (4 hardy)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20080318144457-1jjoztrvqwf0gruk
* debian/control:
  - Removed MIA Matt Hope (dopey) from the Uploaders field.
    Thank you for your work, Matt. I hope you are doing well.
  - Downgraded some recommended package to the 'Suggests' priority,
    according to the following discussion on Upstream's mail list.
    http://bioperl.org/pipermail/bioperl-l/2008-March/027379.html
    (Closes: #448890)
* debian/copyright converted to machine-readable format.

Show diffs side-by-side

added added

removed removed

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