kmerSimilarity {FindMyFriends} | R Documentation

## Calculate a similarity matrix based on kmers

### Description

This method takes a pangenome and calculate a similarity matrix based on cosine similarity of kmer feature vectors in an all-vs-all fashion. The result can subsequently be used to group genes either using `graphGrouping` or homebrewed grouping scheme. In case of the latter `manualGrouping` should be used to add the grouping back to the pangenome.

### Usage

    kmerSimilarity(object, ...)

    ## S4 method for signature 'pgVirtual'
    kmerSimilarity(object, lowMem, kmerSize, lowerLimit,
      rescale, transform, pParam)

### Arguments

`object` | A pgVirtual subclass
`...` | parameters passed on.
`lowMem` | logical. Should low memory footprint be ensured over computation speed
`kmerSize` | The size of kmers to use for similarity calculations.
`lowerLimit` | The lower threshold for similarity below which it is set to 0
`rescale` | Should Similarities be normalised between lowerLimit and 1
`transform` | Transformation function to apply to similarities
`pParam` | An optional BiocParallelParam object that defines the workers used for parallelisation.

### Value

A matrix (sparse or normal) with cosine similarity for each gene pair

### Methods (by class)

- `pgVirtual`: Kmer based similarities for pgVirtual subclasses

### Examples

    testPG <- .loadPgExample()

    # Too heavy to include
    ## Not run:
    kmerSim <- kmerSimilarity(testPG, lowerLimit=0.75)

    ## End(Not run)

[Package FindMyFriends version 1.19.0 Index]