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

« back to all changes in this revision

Viewing changes to Bio/Matrix/PSM/PsmHeader.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
 
# $Id: PsmHeader.pm,v 1.4 2003/11/14 11:24:31 heikki Exp $
 
1
# $Id: PsmHeader.pm,v 1.11.4.1 2006/10/02 23:10:22 sendu Exp $
2
2
 
3
3
=head1 NAME
4
4
 
22
22
Bioperl modules. Send your comments and suggestions preferably to one
23
23
of the Bioperl mailing lists.  Your participation is much appreciated.
24
24
 
25
 
  bioperl-l@bioperl.org                 - General discussion
26
 
  http://bio.perl.org/MailList.html     - About the mailing lists
 
25
  bioperl-l@bioperl.org                  - General discussion
 
26
  http://bioperl.org/wiki/Mailing_lists  - About the mailing lists
27
27
 
28
28
=head2 Reporting Bugs
29
29
 
31
31
the bugs and their resolution. Bug reports can be submitted via the
32
32
web:
33
33
 
34
 
  http://bugzilla.bioperl.org/
 
34
  http://bugzilla.open-bio.org/
35
35
 
36
36
=head1 AUTHOR - Stefan Kirov
37
37
 
46
46
package Bio::Matrix::PSM::PsmHeader;
47
47
 
48
48
use Bio::Matrix::PSM::InstanceSite;
49
 
use Bio::Matrix::PSM::Psm;
50
 
use Bio::Matrix::PSM::IO;
51
 
use Bio::Root::Root;
52
 
use Bio::Matrix::PSM::PsmHeaderI;
 
49
 
53
50
use strict;
54
 
use vars qw(@ISA);
55
 
@ISA=qw( Bio::Root::Root Bio::Matrix::PSM::PsmHeaderI);
 
51
use base qw(Bio::Root::Root Bio::Matrix::PSM::PsmHeaderI);
56
52
 
57
53
#These define what structures within the
58
54
@Bio::Matrix::PSM::PsmHeader::MASTHEADER=qw(html version release seq hid 
59
55
                                            length instances unstructured);
60
56
@Bio::Matrix::PSM::PsmHeader::MEMEHEADER=qw(html version release hid weight length unstructured);
61
57
@Bio::Matrix::PSM::PsmHeader::TRANSFACHEADER=qw(unstructured version release);
 
58
@Bio::Matrix::PSM::PsmHeader::PSIBLASTHEADER=qw(seq width ic);
62
59
@Bio::Matrix::PSM::PsmHeader::ALLHEADER=qw(header release type version html 
63
60
                                           release weight length id 
64
61
                                           seq instances unstructured);
148
145
 
149
146
sub hid {
150
147
    my $self = shift;
151
 
    return undef unless ($self->_check('hid'));
 
148
    return unless ($self->_check('hid'));
152
149
    my @header=@{$self->{hid}};
153
150
    return @header;
154
151
}
169
166
 
170
167
sub length {
171
168
     my $self = shift;
172
 
     return undef unless ($self->_check('length'));
 
169
     return unless ($self->_check('length'));
173
170
    return $self->{length};
174
171
}
175
172
 
188
185
 
189
186
sub instances {
190
187
      my $self = shift;
191
 
     return undef unless ($self->_check('instances'));
192
 
    return %{$self->{instances}};
 
188
      return unless ($self->_check('instances'));
 
189
      return %{$self->{instances}};
193
190
}
194
191
 
195
192
=head2 weight
271
268
=head2 _check
272
269
 
273
270
 Title   : _check
274
 
 Usage   : if ($self->_check('weights') { #do something} else {return undef;}
 
271
 Usage   : if ($self->_check('weights') { #do something} else {return 0;}
275
272
 Function: Checks if the method called is aplicable to the file format
276
273
 Throws  :
277
274
 Example :
284
281
sub _check {
285
282
    my ($self,$method) = @_;
286
283
    my $type= $self->{'_type'};
287
 
  TYPE: {
288
 
      if ($type eq 'meme') { return undef unless (grep(/$method/,@Bio::Matrix::PSM::PsmHeader::MEMEHEADER)); last TYPE; }
289
 
      if ($type eq 'mast') { return undef unless (grep(/$method/,@Bio::Matrix::PSM::PsmHeader::MASTHEADER)); last TYPE; }
290
 
      if ($type eq 'transfac') { return undef unless (grep(/$method/,@Bio::Matrix::PSM::PsmHeader::TRANSFACHEADER)); last TYPE; }
291
 
  }
 
284
    if ($type eq 'meme') { 
 
285
        return 0 unless (grep(/$method/,
 
286
                                  @Bio::Matrix::PSM::PsmHeader::MEMEHEADER)); 
 
287
    } elsif ($type eq 'mast') { 
 
288
        return 0 unless (grep(/$method/,
 
289
                                  @Bio::Matrix::PSM::PsmHeader::MASTHEADER));
 
290
    } elsif ($type eq 'transfac') { 
 
291
        return 0 unless (grep(/$method/,
 
292
                                  @Bio::Matrix::PSM::PsmHeader::TRANSFACHEADER)); 
 
293
    } elsif ($type eq 'psiblast') { 
 
294
        return 0 unless (grep(/$method/,
 
295
                                  @Bio::Matrix::PSM::PsmHeader::PSIBLASTHEADER)); 
 
296
    }
292
297
    return 1;
293
298
}
294
299