pgVirtual-class {FindMyFriends} | R Documentation

## Base class for pangenomic data

### Description

This virtual class is the superclass of all other pangenome classes in FindMyFriends. It is an empty shell that is mainly used for dispatch and checking that the promises of subclasses are held.

### Usage

    ## S4 method for signature 'pgVirtual'
    length(x)

    ## S4 method for signature 'pgVirtual'
    show(object)

    ## S4 method for signature 'pgVirtual,integer,ANY,ANY'
    x[i]

    ## S4 method for signature 'pgVirtual,numeric,ANY,ANY'
    x[i]

    ## S4 method for signature 'pgVirtual,character,ANY,ANY'
    x[i]

    ## S4 method for signature 'pgVirtual,logical,ANY,ANY'
    x[i]

    ## S4 method for signature 'pgVirtual,ANY,ANY'
    x[[i]]

    as(object, Class='ExpressionSet')

    as(object, Class='matrix')

### Arguments

`x` | A pgVirtual subclass object
`object` | A pgVirtual subclass object
`i` | indices specifying genomes, either integer, numeric, character or logical, following the normal rules for indexing objects in R
`Class` | The class to coerce pgVirtual subclasses to. Outside of the FindMyFriends class tree only 'ExpressionSet' and 'matrix' is implemented.

### Details

Subclasses of pgVirtual must implement the following methods in order for them to plug into FindMyFriends algorithms:

seqToOrg(object)

  Returns the mapping from genes to organisms as an integer vector with position mapped to gene and integer mapped to organism.

seqToGeneGroup(object)

  As seqToOrg but mapped to gene group instead of organism. If gene groups are yet to be defined return an empty vector.

genes(object, split, subset)

  Return the underlying sequences. If split is missing return an XStringSet, otherwise return an XStringSetList. split can be either 'group', 'organism' or 'paralogue' and should group the sequences accordingly. Subset should behave as if it was added as '[]' to the results but allow you to avoid reading everything into memory if not needed.

geneNames(object)

  Return a character vector with the name of each gene.

geneNames<-(object, value)

  Set the name of each gene.

geneWidth(object)

  Return an integer vector with the length (in residues) of each gene.

removeGene(object, name, organism, group, ind)

  Should only be implemented for signature: c(yourClass, 'missing', 'missing', 'missing', 'integer') Remove the genes at the given indexes and return the object.

orgNames(object)

  Return a character vector of organism names.

orgNames<-(object, value)

  Set the name of the organisms.

groupNames(object)

  Return a character vector of gene group names.

groupNames<-(object, value)

  Set the name of gene groups.

orgInfo(object)

  Return a data.frame with metadata about each organim.

orgInfo<-(object, value)

  Set a data.frame to be metadata about each organism.

setOrgInfo(object, name, info, key)

  Set the metadata 'name', for the organisms corresponding to 'key' to 'info'

groupInfo(object)

  Return a data.frame with metadata about each gene group.

groupInfo<-(object, value)

  Set a data.frame to be metadata about each gene group.

setGroupInfo(object, name, info, key)

  Set the metadata 'name', for the gene groups corresponding to 'key' to 'info'

groupGenes(object, seqToGeneGroup)

  Sets the gene grouping of the pangenome. 'seqToGeneGroup' should correspond to the output of the seqToGeneGroup method (i.e. an integer vector with each element giving the group of the corresponding gene). This method must include a `callNextMethod(object)` as the last line.

mergePangenomes(pg1, pg2, geneGrouping, groupInfo)

  Merge pg2 into pg1 preserving the indexing in pg1 and appending and modifying the indexing of pg2. The geneGrouping argument is the new grouping of genes and groupInfo the new group info for the groups.

Additionally subclasses can override the following methods for performance gains. Otherwise they will be derived from the above methods.

length(object)

  Return the number of organisms in the object.

nOrganisms(object)

  As length.

nGenes(object)

  Return the number of genes in the object.

nGeneGroups(object)

  Return the number of gene groups

hasGeneGroups

  Returns TRUE if gene groups have been defined

pgMatrix

  Returns an integer matrix with organisms as columns and gene groups as rows and the corresponding number of genes in each element.

Developers are encourages to consult the implementation of FindMyFriends own classes when trying to implement new ones

### Value

Length returns an integer giving the number of organisms

### Methods (by generic)

- `length`: Length of a Pangenome, defined as the number of organisms it contain

- `show`: Basic information about the pangenome

- `[`: Create subsets of pangenomes based on index

- `[`: Create subsets of pangenomes based on index

- `[`: Create subsets of pangenomes based on organism name

- `[`: Create subsets of pangenomes based on logical vector

- `[[`: Extract sequences from a single organism

### Slots

`.settings`

  A list containing settings pertaining to the object

### See Also

Other Pangenome_classes: `pgFull-class`, `pgFullLoc-class`, `pgInMem-class`, `pgInMemLoc-class`, `pgLM-class`, `pgLMLoc-class`, `pgSlim-class`, `pgSlimLoc-class`, `pgVirtualLoc-class`

[Package FindMyFriends version 1.10.0 Index]