Grinde...lection(3pm)

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

πŸŽ€ NAME πŸŽ€

okay so bestie, welcome to Grinder::KmerCollection(3pm) β€” a User Contributed Perl Documentation situation, and it's giving a collection of kmers from sequences πŸ’– no cap.


✨ SYNOPSIS ✨

my $col = Grinder::KmerCollection->new( -k    => 10,
                                        -file => 'seqs.fa' );

🌸 DESCRIPTION 🌸

So basically this thing manages a collection of kmers that were found in various sequences. It literally stores the info about what sequence a kmer was found in and its starting position on that sequence. It's a whole little filing cabinet for kmers, and honestly? iconic. πŸ’…


πŸ¦‹ AUTHOR πŸ¦‹

Florent Angly <florent.angly@gmail.com> β€” thank you for your service, king/queen/monarch πŸ‘‘


πŸ‘‘ APPENDIX πŸ‘‘

The rest of this documentation (aka the main character section) details each of the object methods one by one. Heads up: internal methods are usually preceded with a _ β€” that underscore is the "do not perceive me" marker πŸ™ˆ


🧚 new

  • Title: new
  • Usage: my $col = Grinder::KmerCollection->new( -k => 10, -file => 'seqs.fa', -revcom => 1 );
  • Function: Build a new kmer collection ✨
  • Args:
    • -k β€” set the kmer length (default: 10 bp)
    • -revcom β€” count kmers before and after reverse-complementing sequences (default: 0)
    • -seqs β€” count kmers in the provided arrayref of sequences (which are Bio::Seq or Bio::SeqFeature objects)
    • -ids β€” if specified, index the sequences provided to -seq using the IDs in this arrayref instead of using the sequences' $seq->id() method
    • -file β€” count kmers in the provided file of sequences
    • -weights β€” if specified, assign the abundance of each sequence from the values in this arrayref
  • Returns: Grinder::KmerCollection object 🫢

πŸ“ k

  • Usage: $col->k;
  • Function: Get the length of the kmers
  • Args: None
  • Returns: Positive integer πŸ”’

πŸ’œ weights

  • Usage: $col->weights({'seq1' => 3, 'seq10' => 0.45});
  • Function: Get or set the weight of each sequence. Each sequence is given a weight of 1 by default.
  • Args: hashref where the keys are sequence IDs and the values are the weight of the corresponding (e.g. their relative abundance)
  • Returns: Grinder::KmerCollection object

🌈 collection_by_kmer

  • Usage: $col->collection_by_kmer;
  • Function: Get the collection of kmers, indexed by kmer
  • Args: None
  • Returns: A hashref of hashref of arrayref:
hash->{kmer}->{ID of sequences with this kmer}->[starts of kmer on sequence]

🌸 collection_by_seq

  • Usage: $col->collection_by_seq;
  • Function: Get the collection of kmers, indexed by sequence ID
  • Args: None
  • Returns: A hashref of hashref of arrayref:
hash->{ID of sequences with this kmer}->{kmer}->[starts of kmer on sequence]

πŸŽ€ add_file

  • Usage: $col->add_file('seqs.fa');
  • Function: Process the kmers in the given file of sequences.
  • Args: filename
  • Returns: Grinder::KmerCollection object

✨ add_seqs

  • Usage: $col->add_seqs([$seq1, $seq2]);
  • Function: Process the kmers in the given sequences.
  • Args:
    • arrayref of Bio::Seq or Bio::SeqFeature objects
    • arrayref of IDs to use for the indexing of the sequences
  • Returns: Grinder::KmerCollection object

πŸ”₯ filter_rare

  • Usage: $col->filter_rare( 2 );
  • Function: Remove kmers occurring at less than the (weighted) abundance specified
  • Args: integer
  • Returns: Grinder::KmerCollection object

πŸ’– filter_shared

  • Usage: $col->filter_shared( 2 );
  • Function: Remove kmers occurring in less than the number of sequences specified
  • Args: integer
  • Returns: Grinder::KmerCollection object

⭐ counts

  • Usage: $col->counts
  • Function: Calculate the total count of each kmer. Counts are affected by the weights given to the sequences.
  • Args:
    • restrict sequences to search to specified sequence ID (optional)
    • starting position from which counting should start (optional)
    • 0 to report counts (default), 1 to report frequencies (normalize to 1)
  • Returns:
    • arrayref of the different kmers
    • arrayref of the corresponding total counts

πŸ¦‹ sources

  • Usage: $col->sources()
  • Function: Return the sources of a kmer and their (weighted) abundance.
  • Args:
    • kmer to get the sources of
    • sources to exclude from the results (optional)
    • 0 to report counts (default), 1 to report frequencies (normalize to 1)
  • Returns:
    • arrayref of the different sources
    • arrayref of the corresponding total counts
If the kmer requested does not exist, the array will be empty. 😭

πŸ’… kmers

  • Usage: $col->kmers('seq1');
  • Function: This is the inverse of sources(). Return the kmers found in a sequence (given its ID) and their (weighted) abundance.
  • Args:
    • sequence ID to get the kmers of
    • 0 to report counts (default), 1 to report frequencies (normalize to 1)
  • Returns:
    • arrayref of sequence IDs
    • arrayref of the corresponding total counts
If the sequence ID requested does not exist, the arrays will be empty. 😭

🧚 positions

  • Usage: $col->positions()
  • Function: Return the positions of the given kmer on a given sequence. An error is reported if the kmer requested does not exist β€” like, it will straight up tell you, no hiding it πŸ’€
  • Args:
    • desired kmer
    • desired sequence with this kmer
  • Returns: Arrayref of the different positions. The arrays will be empty if the desired combination of kmer and sequence was not found.

okay bestie that's the whole page, you ate it, go forth and count your kmers 🫢🌸

perl v5.32.0 Β· 2020-12-03 Β· Grinde...lection(3pm) β€” and that's the footer, periodt. πŸ’–βœ¨

πŸ“¦ where this page comes from