NAME
Grinder::KmerCollection - A collection of kmers from sequences
SYNOPSIS
my $col = Grinder::KmerCollection->new( -k => 10,-file => 'seqs.fa' );
DESCRIPTION
Manage a collection of kmers found in various sequences. Store information about what sequence a kmer was found in and its starting position on the sequence.
AUTHOR
Florent Angly <[email protected]>
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
new
Title : newUsage : my $col = Grinder::KmerCollection->new( -k => 10, -file => 'seqs.fa', -revcom => 1 );Function: Build a new kmer collectionArgs : -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 (Bio::Seqor Bio::SeqFeature objects)-ids if specified, index the sequences provided to -seq using thethe 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 thevalues in this arrayrefReturns : Grinder::KmerCollection object
k
Usage : $col->k;Function: Get the length of the kmersArgs : NoneReturns : Positive integer
weights
Usage : $col->weights({'seq1' => 3, 'seq10' => 0.45});Function: Get or set the weight of each sequence. Each sequence is given aweight of 1 by default.Args : hashref where the keys are sequence IDs and the values are the weightof 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 kmerArgs : NoneReturns : 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 IDArgs : NoneReturns : 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 : filenameReturns : 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 sequencesReturns : Grinder::KmerCollection object
filter_rare
Usage : $col->filter_rare( 2 );Function: Remove kmers occurring at less than the (weighted) abundance specifiedArgs : integerReturns : Grinder::KmerCollection object
filter_shared
Usage : $col->filter_shared( 2 );Function: Remove kmers occurring in less than the number of sequences specifiedArgs : integerReturns : Grinder::KmerCollection object
counts
Usage : $col->countsFunction: Calculate the total count of each kmer. Counts are affected by theweights 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 countsIf 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 countsIf 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 erroris reported if the kmer requested does not existArgs : * desired kmer* desired sequence with this kmerReturns : Arrayref of the different positions. The arrays will be empty if thedesired combination of kmer and sequence was not found.