Grinde...lection(3pm)
π 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 areBio::SeqorBio::SeqFeatureobjects)-idsβ if specified, index the sequences provided to-sequsing 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::KmerCollectionobject π«Ά
π 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::KmerCollectionobject
π 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::KmerCollectionobject
β¨ add_seqs
- Usage:
$col->add_seqs([$seq1, $seq2]); - Function: Process the kmers in the given sequences.
- Args:
- arrayref of
Bio::SeqorBio::SeqFeatureobjects - arrayref of IDs to use for the indexing of the sequences
- arrayref of
- Returns:
Grinder::KmerCollectionobject
π₯ filter_rare
- Usage:
$col->filter_rare( 2 ); - Function: Remove kmers occurring at less than the (weighted) abundance specified
- Args: integer
- Returns:
Grinder::KmerCollectionobject
π filter_shared
- Usage:
$col->filter_shared( 2 ); - Function: Remove kmers occurring in less than the number of sequences specified
- Args: integer
- Returns:
Grinder::KmerCollectionobject
β 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)
0to report counts (default),1to 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)
0to report counts (default),1to 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
0to report counts (default),1to 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
- debian bookworm: grinder 0.5.4-6 Β· GPL-3.0-or-later
- debian trixie: grinder 0.5.4-6 Β· GPL-3.0-or-later
- ubuntu jammy: grinder 0.5.4-6 Β· GPL-3.0-or-later
- ubuntu noble: grinder 0.5.4-6 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms