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

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

πŸ’– Bio::T...qWords(3pm) β€” the vibe πŸ’–

okay bestie, gather round 🫢 you're looking at the manual page for Bio::T...qWords(3pm), which lives under User Contributed Perl Documentation. yes the name is truncated in the header, no that's not a typo, the real module is Bio::Tools::SeqWords and she is everything. let's get into it πŸ’…


✨ NAME ✨

Bio::Tools::SeqWords β€” an object that holds n-mer statistics for a sequence 🧬


✨ SYNOPSIS ✨

# Create the SeqWords object, e.g.:

my $inputstream = Bio::SeqIO->new(-file => "seqfile",
                                       -format => 'Fasta');
my $seqobj = $inputstream->next_seq();
my $seq_word = Bio::Tools::SeqWords->new(-seq => $seqobj);

# Or:
my $seqobj = Bio::PrimarySeq->new(-seq => "agggtttccc",
                                  -alphabet => 'dna',
                                  -id => 'test');
my $seq_word  =  Bio::Tools::SeqWords->new(-seq => $seqobj);

# obtain a hash of word counts, eg:
my $hash_ref = $seq_stats->count_words($word_length);

# display hash table, eg:
my %hash = %$hash_ref;
foreach my $key(sort keys %hash)
{
  print "\n$key\t$hash{$key}";
}

# Or:

my $hash_ref =
   Bio::Tools::SeqWords->count_words($seqobj,$word_length);

✨ DESCRIPTION ✨

so Bio::Tools::SeqWords is a featherweight little object that counts how many times n-mer words show up in a single sequence. literally no cap, she's small but she works πŸ”₯

the whole idea is that you'd use her to build scripts where n-mer word tables are the raw material for your statistical calculations β€” think hexamer frequency for working out coding potential, or finding periodicity in repetitive DNA. if you want triplet frequency specifically, that's already handled by Bio::Tools::SeqStats (author: Peter Schattner) πŸ‘‘

and yeah she does protein too, a few possible applications there β€” like hypothesised amino acid 7-mers in heat shock proteins, or proteins with multiple simple motifs. sometimes those protein periodicities pop off the most when you truncate the amino acid alphabet, e.g. the Shulman alphabet. and because there are quite a few of these shortened alphabets floating around, this module doesn't specify any particular one. it's giving "you pick, bestie" 🌸

see the Synopsis above for the object creation code, iykyk.

🧠 Rationale 🧠

the whole plan: take a sequence object and build an object whose job is holding n-mer word statistics about that sequence. the sequence can be nucleic acid or protein, she's flexible like that πŸ’…

in count_words() the words get counted in a non-overlapping manner β€” think codon-table style, but with any word length you want.

in count_overlap_words() the words get counted in an overlapping manner. different vibe, different numbers.

for counts on the opposite strand (DNA/RNA), you should do a reverse complement method and then repeat the count. that's the move 🧬


✨ FEEDBACK ✨

πŸ’Œ Mailing Lists πŸ’Œ

user feedback is an integral part of the evolution of this and other Bioperl modules β€” fr fr, they actually want to hear from you. send your comments and suggestions preferably to one of the Bioperl mailing lists. your participation is much appreciated 🫢

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. there are many experienced and reponsive experts who'll be able to look at the problem and quickly address it. and please include a thorough description of the problem with code and data examples if at all possible β€” the more detail the better, bestie πŸ™

πŸ› Reporting Bugs πŸ›

report bugs to the Bioperl bug tracking system so we can keep track of the bugs and their resolutions. bug reports can be submitted via the web:

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

✨ AUTHOR ✨

Derek Gatherer, in the loosest sense of the word 'author' 😭

the general shape of the module is lifted directly from the SeqStat module of Peter Schattner. the central subroutine that counts the words is adapted from original code provided by Dave Shivak, in response to a query on the bioperl mailing list. at least 2 other people provided alternative means (equally good but not used in the end) of performing the same calculation. thanks to all for your assistance πŸ’–


✨ CONTRIBUTORS ✨

Jason Stajich, jason-at-bioperl.org 🫢


✨ APPENDIX ✨

the rest of the documentation details each of the object methods. internal methods are usually preceded with a _

🌟 count_words 🌟

  • Title: count_words
  • Usage:
$word_count = $seq_stats->count_words($word_length)
    or
$word_count = $seq_stats->Bio::Tools::SeqWords->($seqobj,$word_length);
  • Function: counts non-overlapping words within a string, any alphabet is used πŸ”€
  • Example: a sequence ACCGTCCGT, counted at word length 4, will give the hash {ACCG => 1, TCCG => 1}
  • Returns: reference to a hash in which keys are words (any length) of the alphabet used and values are number of occurrences of the word in the sequence.
  • Args: word length as scalar and, reference to sequence object if required
throws an exception word length is not a positive integer or if word length is longer than the sequence. so like, be normal about your word length bestie πŸ’€

🌟 count_overlap_words 🌟

  • Title: count_overlap_words
  • Usage: $word_count = $word_obj->count_overlap_words($word_length);
  • Function: counts overlapping words within a string, any alphabet is used πŸ”€
  • Example: a sequence ACCAACCA, counted at word length 4, will give the hash {ACCA=>2, CCAA=>1, CAAC=>1, AACC=>1}
  • Returns: reference to a hash in which keys are words (any length) of the alphabet used and values are number of occurrences of the word in the sequence.
  • Args: word length as scalar
throws an exception if word length is not a positive integer or if word length is longer than the sequence. same energy as before, watch your word length πŸ’…

and that's the whole page, bestie πŸŽ€ this one shipped as perl v5.32.1 back on 2021-08-15 β€” go forth and count your n-mers, she's iconic for it πŸ‘‘βœ¨πŸ¦‹

πŸ“¦ where this page comes from