topCounts {baySeq} | R Documentation

## Get the top counts corresponding to some group from a 'countData' object

### Description

Takes posterior likelihoods and returns the counts with highest (or lowest) likelihood of association with a given group.

### Usage

    topCounts(cD, group, ordering, decreasing = TRUE, number = 10, likelihood, FDR,
    FWER, normaliseData = FALSE, posteriors)

### Arguments

`cD` | `countData` object, containing posterior likelihoods for each group (unless ‘posteriors’ is specified; see below).
`group` | Which group should we give the counts for? See Details.
`ordering` | If specified, restricts the analysis to a particlar ordering on the group.
`decreasing` | Ordering on posterior likelihoods.
`number` | How many results should be returned?
`likelihood` | If given, ignores ‘number’ and returns all results above a certain likelihood (and FDR, and FWER, if given).
`FDR` | If given, ignores ‘number’ and returns all results with an FDR lower than this threshold (and likelihood, and FWER, if given).
`FWER` | If given, ignores ‘number’ and returns all results with an FWER lower than this threshold (and likelihood, and FDR, if given).
`normaliseData` | Should the displayed counts be normalised? See details. Defaults to FALSE.
`posteriors` | If given, a vector of log-posterior likelihoods to use instead of those in the ‘@posteriors’ slot of the ‘cD’ object.

### Details

The argument 'group' can be specified either as a number, giving the index of an element in the `cD@groups` list, or as a character string identifying an element by name. Partial matching is allowed. If group = NULL, then the function looks at the posterior likelihoods that the data have no true differential expression (if calculated).

If a `countData` object is given, the returned dataframe will contain either the raw counts for that object, or (if 'normaliseData = TRUE' the counts normalised by library size.

### Value

A dataframe of the top counts associated with some model (group), described by annotation drawn from the '@annotation' slot of the 'cD' object and the raw data from the '@data' slot, together with the posterior likelihoods and false discovery rates.

### Author(s)

Thomas J. Hardcastle

### See Also

`countData`

### Examples

    # We load in a `countData' object containing the estimated posterior
    # likelihoods of expression (see `getLikelihoods').

    data(CDPost)

    # Report the top ten rows of data that have highest likelihood of belonging to
    # group 2 of the data (i.e., differentially expressed)

    topCounts(CDPost, group = "DE", number = 10)

    # equivalently...
    topCounts(CDPost, group = 2, number = 10)

    # Report the top ten rows of data that have highest likelihood of belonging to
    # group 2 of the data (i.e., differentially expressed), with group 1
    # being overexpressed compared to group 2.

    topCounts(CDPost, group = "DE", ordering = "1>2", number = 10)

[Package baySeq version 2.24.0 Index]