| 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<bioperl-l@bioperl.org> | ||
| 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 | 8 | $Bio::Matrix::PSM::PsmHeaderI::VERSION = '1.7.8'; | |
| 86 | 8 | ▶ | use Bio::Matrix::PSM::InstanceSite; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 87 | 8 | ▶ | use Bio::Matrix::PSM::Psm; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 88 | 8 | ▶ | use Bio::Matrix::PSM::IO; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 89 | 8 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 90 | 8 | ▶ | use base qw(Bio::Matrix::PSM::PsmI); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 91 | |||
| 92 | #Accessor methods, based on the driver | ||
| 93 | 8 | @Bio::Matrix::PSM::PsmHeader::MASTHEADER=qw(html version release | |
| 94 | seq hid length instances | ||
| 95 | unstructured); | ||
| 96 | 8 | @Bio::Matrix::PSM::PsmHeader::MEMEHEADER=qw(html version release hid | |
| 97 | weight length unstructured); | ||
| 98 | 8 | @Bio::Matrix::PSM::PsmHeader::TRANSFACHEADER=qw(unstructured version release); | |
| 99 | 8 | @Bio::Matrix::PSM::PsmHeader::ALLHEADER=qw(header release type version html | |
| 100 | release weight length hid | ||
| 101 | seq instances unstructured); | ||
| 102 | |||
| 103 | =head2 new | ||
| 104 | |||
| 105 | Title : new | ||
| 106 | Usage : my $header= Bio::Matrix::PSM::PsmHeader->new | ||
| 107 | ( -seq=>\%seq, -mid=>\%mid, -width=>\%width, | ||
| 108 | -instances=>\%instances, -header=>\@header, -type=>'mast'); | ||
| 109 | Function: Creates a new Bio::Matrix::PSM::PsmHeader object | ||
| 110 | Throws : | ||
| 111 | Example : | ||
| 112 | Returns : Bio::Matrix::PSM::PsmHeaderI object | ||
| 113 | Args : hash | ||
| 114 | |||
| 115 | |||
| 116 | =cut | ||
| 117 | |||
| 118 | =head2 seq | ||
| 119 | |||
| 120 | Title : seq | ||
| 121 | Usage : my %seq= $header->seq(); | ||
| 122 | Function: Returns the sequence data as a hash, indexed by a | ||
| 123 | sequence ID (motif id or accession number) | ||
| 124 | In case the input data is a motif it would return the | ||
| 125 | consenus seq for each of them (mast). | ||
| 126 | Throws : | ||
| 127 | Example : | ||
| 128 | Returns : hash | ||
| 129 | Args : | ||
| 130 | |||
| 131 | |||
| 132 | =cut | ||
| 133 | |||
| 134 | 0 | ▶ | sub seq { |
|
Subroutine
seq: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 135 | 0 | my $self = shift; | |
| 136 | 0 | $self->throw_not_implemented(); | |
| 137 | } | ||
| 138 | |||
| 139 | |||
| 140 | =head2 hid | ||
| 141 | |||
| 142 | Title : hid | ||
| 143 | Usage : my @ids= $header->hid(); | ||
| 144 | Function: Returns array with the motif/instance ids | ||
| 145 | Throws : | ||
| 146 | Example : | ||
| 147 | Returns : array | ||
| 148 | Args : | ||
| 149 | |||
| 150 | |||
| 151 | =cut | ||
| 152 | |||
| 153 | 0 | ▶ | sub hid { |
|
Subroutine
hid: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 154 | 0 | my $self = shift; | |
| 155 | 0 | $self->throw_not_implemented(); | |
| 156 | } | ||
| 157 | |||
| 158 | =head2 length | ||
| 159 | |||
| 160 | Title : length | ||
| 161 | Usage : my %length= $header->length(); | ||
| 162 | Function: Returns the length of the input sequence or motifs as a hash, indexed | ||
| 163 | by a sequence ID (motif id or accession number) | ||
| 164 | Throws : | ||
| 165 | Example : | ||
| 166 | Returns : hash | ||
| 167 | Args : | ||
| 168 | |||
| 169 | |||
| 170 | =cut | ||
| 171 | |||
| 172 | 0 | ▶ | sub length { |
|
Subroutine
length: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 173 | 0 | my $self = shift; | |
| 174 | 0 | $self->throw_not_implemented(); | |
| 175 | } | ||
| 176 | |||
| 177 | =head2 instances | ||
| 178 | |||
| 179 | Title : instances | ||
| 180 | Usage : my %instances= $header->length(); | ||
| 181 | Function: Returns the instance, used as a hash, indexed | ||
| 182 | by a sequence ID (motif id or accession number) | ||
| 183 | Throws : | ||
| 184 | Example : | ||
| 185 | Returns : hash of Bio::Matrix::PSM::InstanceSite objects | ||
| 186 | Args : | ||
| 187 | |||
| 188 | |||
| 189 | =cut | ||
| 190 | |||
| 191 | 0 | ▶ | sub instances { |
|
Subroutine
instances: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 192 | 0 | my $self = shift; | |
| 193 | 0 | $self->throw_not_implemented(); | |
| 194 | } | ||
| 195 | |||
| 196 | =head2 weights | ||
| 197 | |||
| 198 | Title : weights | ||
| 199 | Usage : my %weights= $header->weights(); | ||
| 200 | Function: Returns the weights of the input sequence as a hash, indexed | ||
| 201 | by a sequence ID | ||
| 202 | Throws : | ||
| 203 | Example : | ||
| 204 | Returns : hash | ||
| 205 | Args : | ||
| 206 | |||
| 207 | |||
| 208 | =cut | ||
| 209 | |||
| 210 | 0 | ▶ | sub weights { |
|
Subroutine
weights: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 211 | 0 | my $self = shift; | |
| 212 | 0 | $self->throw_not_implemented(); | |
| 213 | } | ||
| 214 | |||
| 215 | |||
| 216 | =head2 unstuctured | ||
| 217 | |||
| 218 | Title : unstuctured | ||
| 219 | Usage : my @unstructured= $header->unstuctured(); | ||
| 220 | Function: Returns the unstructured data in the header as an array, one line per | ||
| 221 | array element, all control symbols are removed with \W | ||
| 222 | Throws : | ||
| 223 | Example : | ||
| 224 | Returns : array | ||
| 225 | Args : | ||
| 226 | |||
| 227 | |||
| 228 | =cut | ||
| 229 | |||
| 230 | 0 | ▶ | sub unstructured { |
|
Subroutine
unstructured: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 231 | 0 | my $self = shift; | |
| 232 | 0 | $self->throw_not_implemented(); | |
| 233 | } | ||
| 234 | |||
| 235 | =head2 version | ||
| 236 | |||
| 237 | Title : version | ||
| 238 | Usage : my $version= $header->version; | ||
| 239 | Function: Returns the version of the file being parsed if such exists | ||
| 240 | Throws : | ||
| 241 | Example : | ||
| 242 | Returns : string | ||
| 243 | Args : | ||
| 244 | |||
| 245 | |||
| 246 | =cut | ||
| 247 | |||
| 248 | 0 | ▶ | sub version { |
|
Subroutine
version: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 249 | 0 | my $self = shift; | |
| 250 | 0 | $self->throw_not_implemented(); | |
| 251 | } | ||
| 252 | |||
| 253 | =head2 revision | ||
| 254 | |||
| 255 | Title : revision | ||
| 256 | Usage : my $revision= $header->revision; | ||
| 257 | Function: Returns the revision of the file being parsed if such exists | ||
| 258 | Throws : | ||
| 259 | Example : | ||
| 260 | Returns : string | ||
| 261 | Args : | ||
| 262 | |||
| 263 | |||
| 264 | =cut | ||
| 265 | |||
| 266 | 0 | ▶ | sub revision { |
|
Subroutine
revision: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 267 | 0 | my $self = shift; | |
| 268 | 0 | $self->throw_not_implemented(); | |
| 269 | } | ||
| 270 | |||
| 271 | =head2 _check | ||
| 272 | |||
| 273 | Title : _check | ||
| 274 | Usage : if ($self->_check('weights') { #do something} else {return 0;} | ||
| 275 | Function: Checks if the method called is aplicable to the file format | ||
| 276 | Throws : | ||
| 277 | Example : | ||
| 278 | Returns : boolean | ||
| 279 | Args : string | ||
| 280 | |||
| 281 | |||
| 282 | =cut | ||
| 283 | |||
| 284 | 0 | ▶ | sub _check { |
|
Subroutine
_check: not called CC=1 SCAR=6.9
| |||
| 285 | 0 | my $self = shift; | |
| 286 | 0 | $self->throw_not_implemented(); | |
| 287 | } | ||
| 288 | |||
| 289 | 8 | 1; | |