Bio::M...SM::IO(3pm)

πŸ“¦
version 1.7.8 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– Bio::M...SM::IO(3pm) β€” User Contributed Perl Documentation πŸ’–

okay bestie, gather round, because this one is Bio::Matrix::PSM::IO β€” the PSM parser, aka the lil module that reads your DNA position scoring matrices for you 🧬✨


✨ NAME ✨

Bio::Matrix::PSM::IO β€” PSM parser. that's it, that's the whole name. slay. πŸ’…


🌸 SYNOPSIS 🌸

use Bio::Matrix::PSM::IO;

my $psmIO= Bio::Matrix::PSM::IO->new(-file=>$file, -format=>'transfac');

my $release=$psmIO->release; #Using Bio::Matrix::PSM::PsmHeader methods

my $release=$psmIO->release;

while (my $psm=$psmIO->next_psm) {
 my %psm_header=$psm->header;
 my $ic=$psm_header{IC};
 my $sites=$psm_header{sites};
 my $width=$psm_header{width};
 my $score=$psm_header{e_val};
 my $IUPAC=$psm->IUPAC;
}

my $instances=$psm->instances;
foreach my $instance (@{$instances}) {
  my $id=$instance->primary_id;
}

πŸ¦‹ DESCRIPTION πŸ¦‹

bestie. this module lets you read DNA position scoring matrices and/or their respective sequence matches from a file. iconic behaviour honestly.

so there are two header methods, and they're giving main character energy in different ways:

  • one belongs to Bio::Matrix::PSM::IO::driver
  • the other belongs to Bio::Matrix::PSM::Psm

they hand you general info about the file (that's the driver one) and about the current PSM result (that's the Psm one). the Psm header method always returns the same thing, but lowkey some values in the hash might be empty depending on which file you're parsing. in that case you get undef β€” and no, no exceptions are thrown. it's not gonna yell at you, it's just gonna be quiet about it 🫢

heads up: the file header data (commentaries, version, input data, configuration, etc.) might be obtained through Bio::Matrix::PSM::PsmHeader methods. some methods are driver specific (meme, transfac, etc.): meme: weight mast: seq, instances

if you call one of those when you're parsing a different file type, you get undef. no cap. for example:

my $psmIO= Bio::Matrix::PSM::IO->new(file=>$file, format=>'transfac');
my %seq=$psmIO->seq;

…will return an empty hash πŸ’€ that's just how it is. to see all methods and how to use them, go to Bio::Matrix::PSM::PsmHeaderI.

see also Bio::Matrix::PSM::PsmI for details on using and manipulating the parsed data. obsessed with a good cross-reference, fr fr.

and listen β€” the only way to write PFM/PWM is through the masta module (something like fasta for DNA matrices). you can see an example by reading the Bio::Matrix::PSM::IO::masta documentation. go look, it's worth it 🌈


πŸ‘€ See also πŸ‘€

  • Bio::Matrix::PSM::PsmI
  • Bio::Matrix::PSM::PsmHeaderI
  • Bio::Matrix::PSM::IO::masta

πŸ“¬ FEEDBACK πŸ“¬

πŸ’Œ Mailing Lists

user feedback is an integral part of the evolution of this and other Bioperl modules. so send your comments and suggestions preferably to one of the Bioperl mailing lists. your participation is much appreciated, bestie, genuinely πŸ₯Ή

bioperl-l@bioperl.org                  - General discussion
http://bioperl.org/wiki/Mailing_lists  - About the mailing lists

🫢 Support

please direct usage questions or support issues to the mailing list:

bioperl-l@bioperl.org

rather than to the module maintainer directly. the reason? many experienced and responsive experts will be able look at the problem and quickly address it. group chat > DM, always. and please include a thorough description of the problem with code and data examples if at all possible πŸ’–

πŸ› Reporting Bugs

report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. bug reports can be submitted via the web:

https://github.com/bioperl/bioperl-live/issues


πŸ‘‘ AUTHOR - Stefan Kirov πŸ‘‘

Email: skirov@utk.edu


🧾 APPENDIX 🧾

new

  • Title: new
  • Usage:
my $psmIO =  Bio::Matrix::PSM::IO->new(-format=>'meme',
                                        -file=>$file);
  • Function: Associates a file with the appropriate parser
  • Throws: Throws if the file passed is in HTML format or if some criteria for the file format are not met. See Bio::Matrix::PSM::IO::meme and Bio::Matrix::PSM::IO::transfac for more details.
  • Example: (blank, bestie)
  • Returns: psm object, associated with a file with matrix file
  • Args: hash

fh

  • Title: fh
  • Usage: $obj->fh
  • Function: Get a filehandle type access to the matrix parser
  • Example:
$fh = $obj->fh;      # make a tied filehandle
$matrix = <$fh>;     # read a matrix object
  • Returns: filehandle tied to Bio::Matrix::PSM::IO class
  • Args: none

_load_format_module

  • Title: _load_format_module
  • Usage: INTERNAL Matrix::PSM::IO stuff
  • Function: Loads up (like use) a module at run time on demand

_guess_format

  • Title: _guess_format
  • Usage: $obj->_guess_format($filename)
  • Returns: guessed format of filename (lower case)
  • Args: filename

next_psm

  • Title: next_psm
  • Usage: my $psm=$psmIO->next_psm();
  • Function: Reads the next PSM from the input file, associated with this object
  • Throws: Throws if there are format violations in the input file (checking is not very strict with all drivers).
  • Example: (blank)
  • Returns: Bio::Matrix::PSM::Psm object
  • Args: none

_parseMatrix

  • Title: _parseMatrix
  • Usage: (blank)
  • Function: Parses the next site matrix information in the meme file
  • Throws: (blank)
  • Example: Internal stuff
  • Returns: hash as for constructing a SiteMatrix object (see SiteMatrixI)
  • Args: string

_parseInstance

  • Title: _parseInstance
  • Usage: (blank)
  • Function: Parses the next sites instances from the meme file
  • Throws: (blank)
  • Example: Internal stuff
  • Returns: Bio::Matrix::PSM::SiteMatrix object
  • Args: array references

_parse_coordinates

  • Title: _parse_coordinates
  • Usage: (blank)
  • Function: (blank)
  • Throws: (blank)
  • Example: Internal stuff
  • Returns: (blank)
  • Args: (blank)
  • Title: header
  • Usage: my %header=$psmIO->header;
  • Function: Returns the header for the PSM file, format specific
  • Throws: (blank)
  • Example: (blank)
  • Returns: Hash or a single string with driver specific information
  • Args: none

_make_matrix

  • Title: _make_matrix
  • Usage: (blank)
  • Function: makes a matrix from 4 array references (A C G T)
  • Throws: (blank)
  • Example: (blank)
  • Returns: SiteMatrix object
  • Args: array of references(A C G T)

and that's the whole page, bestie πŸ’œ this lil doc shipped as perl v5.32.1 on 2021-08-15, and yeah, that's the vibe check. go parse some matrices, you absolute icon πŸ‘‘βœ¨

πŸ“¦ where this page comes from