Bio::T...:Codeml(3pm)

πŸ“¦
version 1.7.3 Β· 3 versions
, in debian bookworm, debian trixie

πŸ’– Bio::Tools::Phylo::PAML::Codeml β€” the vibe

okay bestie, so this is Bio::Tools::Phylo::PAML::Codeml(3pm), a Perl module from the Bioperl fam, and its whole personality is parsing the output from the PAML program codeml. That's it. That's the job. She reads, she doesn't run. πŸ’…

VERSION: version 1.7.3 β€” she's been out here, she's stable, she ate. ✨


✨ SYNOPSIS ✨

like, here's the whole groupchat of what she can do. read it, don't skip it, i worked hard:

#!/usr/bin/perl -Tw
use strict;

use Bio::Tools::Phylo::PAML::Codeml;

# need to specify the output file name (or a fh) (defaults to
# -file => "codeml.mlc"); also, optionally, the directory in which
# the other result files (rst, 2ML.dS, etc) may be found (defaults
# to "./")
my $parser = new Bio::Tools::Phylo::PAML::Codeml::Parser
  (-file => "./results/mlc", -dir => "./results/");

# get the first/next result; a Bio::[...]::Codeml::Result object
my $result = $parser->next_result();

# get the sequences used in the analysis; returns Bio::PrimarySeq
# objects (OTU = Operational Taxonomic Unit).
my @otus = $result->get_seqs();

# codon summary: codon usage of each sequence [ arrayref of {
# hashref of counts for each codon } for each sequence and the
# overall sum ], and positional nucleotide distribution [ arrayref
# of { hashref of frequencies for each nucleotide } for each
# sequence and overall frequencies ].

my ($codonusage, $ntdist) = $result->get_codon_summary();

# example manipulations of $codonusage and $ntdist:
printf "There were %d '%s' codons in the first seq (%s)\n",
  $codonusage->[0]->{AAA}, 'AAA', $otus[0]->id();
printf "There were %d '%s' codons used in all the sequences\n",
  $codonusage->[$#{$codonusage}]->{AAA}, 'AAA';
printf "Nucleotide '%c' was present %g of the time in seq %s\n",
  'A', $ntdist->[1]->{A}, $otus[1]->id();

# get Nei & Gojobori dN/dS matrix:
my $NGmatrix = $result->get_NGmatrix();

# get ML-estimated dN/dS matrix, if calculated; this corresponds to
# the runmode = -2, pairwise comparison usage of codeml
my $MLmatrix = $result->get_MLmatrix();

# These matrices are length(@otu) x length(@otu) "strict lower
# triangle" 2D-matrices, which means that the diagonal and
# everything above it is undefined.  Each of the defined cells is a
# hashref of estimates for "dN", "dS", "omega" (dN/dS ratio), "t",
# "S" and "N".  If a ML matrix, "lnL" will also be defined.  Any
# additional ML parameters estimated by the model will be in an
# array ref under "params"; it's up to the user to know which
# position corresponds to which parameter (since PAML doesn't label
# them, and we can't guess very well yet (a TODO I guess).

printf "The omega ratio for sequences %s vs %s was: %g\n",
  $otus[0]->id, $otus[1]->id, $MLmatrix->[0]->[1]->{omega};

# with a little work, these matrices could also be passed to
# Bio::Tools::Run::Phylip::Neighbor, or other similar tree-building
# method that accepts a matrix of "distances" (using the LOWTRI
# option):
my $distmat = [ map { [ map { $$_{omega} } @$_ ] } @$MLmatrix ];

# for runmode's other than -2, get tree topology with estimated
# branch lengths; returns a Bio::Tree::TreeI-based tree object with
# added PAML parameters at each node
my $tree = $result->get_tree();
for my $node ($tree->get_nodes()) {
   # inspect the tree: the "t" (time) parameter is available via
   # $node->branch_length(); all other branch-specific parameters
   # ("omega", "dN", etc.) are available via $node->param('omega');
}

# get any general model parameters: kappa (the
# transition/transversion ratio), NSsites model parameters ("p0",
# "p1", "w0", "w1", etc.), etc.
my $params = $result->get_model_params();
printf "M1 params: p0 = %g\tp1 = %g\n", $params->{p0}, $params->{p1};

# for NSsites models, obtain posterior probabilities for membership
# in each class for every position; probabilities correspond to
# classes w0, w1, ... etc.
my @probs = $result->get_posteriors();

# find, say, positively selected sites!
if ($params->{w2} > 1) {
  for (my $i = 0; $i < @probs ; $i++) {
    if ($probs[$i]->[2] > 0.5) {
       # assumes model M1: three w's, w0, w1 and w2 (positive selection)
       printf "position %d: (%g prob, %g omega, %g mean w)\n",
         $i, $probs[$i]->[2], $params->{w2}, $probs[$i]->[3];
    }
  }
} else { print "No positive selection found!\n"; }

🌸 DESCRIPTION 🌸

So like, this module is the one that parses the output from the PAML program codeml. That's the whole assignment. πŸ“

If you actually wanna run codeml, go talk to Bio::Tools::Run::Phylo::Phylo::PAML::Codeml β€” that one hits go. This one? She's just here to read the receipts afterwards. no cap. 🧾✨


πŸŽ€ METHODS πŸŽ€

new

  • Title: new
  • Usage: my $obj = new Bio::Tools::Phylo::PAML::Codeml();
  • Function: Builds a new Bio::Tools::Phylo::PAML::Codeml object β€” brand new baby, fresh out the box 🫢
  • Returns: Bio::Tools::Phylo::PAML::Codeml
  • Args: (nothing, bestie β€” she needs no input here)

get_trees

  • Title: get_trees
  • Usage: my @trees = $codemlparser->get_trees();
  • Function: Returns a list of trees (if any) are in the output file
  • Returns: List of Bio::Tree::TreeI objects 🌳🌳🌳
  • Args: none

get_statistics

  • Title: get_statistics
  • Usage: my $data = $codemlparser->get_statistics
  • Function: Retrieves the set of pairwise comparisons β€” the whole gossip table, everybody vs everybody πŸ‘€
  • Returns: Hash Reference keyed as 'seqname' -> 'seqname' -> 'datatype'
  • Args: none

πŸ’€ TODO πŸ’€

This module should also be able to handle "codemlsites" batch output... (it cannot yet. it's giving "we'll get to it". it's on the list. πŸ“‹)


πŸ¦‹ FEEDBACK πŸ¦‹

Mailing lists

User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated. (fr fr, they wanna hear from you πŸ’Œ)

bioperl-l@bioperl.org              - General discussion
http://bioperl.org/Support.html    - 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. Many experienced and reponsive experts will be able look at the problem and quickly address it. 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/bio-tools-phylo-paml/issues

πŸ‘‘ AUTHORS πŸ‘‘

Jason Stajich <jason@bioperl.org>

Aaron Mackey <amackey@virginia.edu>

two legends, honestly. main character energy from both of them. πŸ’…βœ¨


This software is copyright (c) by Jason Stajich <jason@bioperl.org>, and by Aaron Mackey <amackey@virginia.edu>.

This software is available under the same terms as the perl 5 programming language system itself.


and that's the whole page, bestie!! πŸŽ€ this was perl v5.34.0, dated 2022-10-14, and the manual you just read is Bio::...::Codeml(3pm). go parse some codeml output, you absolute icon. slay. πŸ’–πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from