1 #---------------------------------------------------------
5 Bio::Matrix::PSM::PsmHeaderI - handles the header data from a PSM file
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:
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);
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.
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
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.
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
72 https://github.com/bioperl/bioperl-live/issues
74 =head1 AUTHOR - Stefan Kirov
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
;
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
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);
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
111 Returns : Bio::Matrix::PSM::PsmHeaderI object
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).
135 $self->throw_not_implemented();
142 Usage : my @ids= $header->hid();
143 Function: Returns array with the motif/instance ids
154 $self->throw_not_implemented();
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)
173 $self->throw_not_implemented();
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)
184 Returns : hash of Bio::Matrix::PSM::InstanceSite objects
192 $self->throw_not_implemented();
198 Usage : my %weights= $header->weights();
199 Function: Returns the weights of the input sequence as a hash, indexed
211 $self->throw_not_implemented();
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
231 $self->throw_not_implemented();
237 Usage : my $version= $header->version;
238 Function: Returns the version of the file being parsed if such exists
249 $self->throw_not_implemented();
255 Usage : my $revision= $header->revision;
256 Function: Returns the revision of the file being parsed if such exists
267 $self->throw_not_implemented();
273 Usage : if ($self->_check('weights') { #do something} else {return 0;}
274 Function: Checks if the method called is aplicable to the file format
285 $self->throw_not_implemented();