hanabi {CAGEr} | R Documentation

## Calcultate richness in preparation for plotting

### Description

Rarefy data at multiple sample sizes using the `vegan` package and return a ‘hanabi’ object that can be passed to plot functions.

The computation can be long, so the steps of rarefaction and plotting are kept separate.

### Usage

    hanabi(x, n = 20, step = 0.75, from = NULL, useMulticore = FALSE,
      nrCores = NULL)

    ## S4 method for signature 'Rle'
    hanabi(x, n = 20, step = 0.75, from = NULL,
      useMulticore = FALSE, nrCores = NULL)

    ## S4 method for signature 'numeric'
    hanabi(x, n = 20, step = 0.75, from = NULL,
      useMulticore = FALSE, nrCores = NULL)

    ## S4 method for signature 'integer'
    hanabi(x, n = 20, step = 0.75, from = NULL,
      useMulticore = FALSE, nrCores = NULL)

    ## S4 method for signature 'GRanges'
    hanabi(x, n = 20, step = 0.75, from = NULL,
      useMulticore = FALSE, nrCores = NULL)

    ## S4 method for signature 'List'
    hanabi(x, n = 20, step = 0.75, from = NULL,
      useMulticore = FALSE, nrCores = NULL)

    ## S4 method for signature 'list'
    hanabi(x, n = 20, step = 0.75, from = NULL,
      useMulticore = FALSE, nrCores = NULL)

    ## S4 method for signature 'matrix'
    hanabi(x, n = 20, step = 0.75, from = NULL,
      useMulticore = FALSE, nrCores = NULL)

### Arguments

`x` | An object contained expression counts on which richness scores can be calculated. For example an expression table in `DataFrame` or `data.frame` format where columns are samples and rows are featuressuch as genes, TSS, etc, or a vector of counts (tag counts, molecule counts, ...), or `GRanges` or `GRangesList` objects, etc.
`n` | The maximum number of rarefactions per sample.
`step` | Subsample sizes are calculated by taking the largest sample and multiplying it by the step "n" times.
`from` | Add one sample size (typically "0") in order to extend the plot on the left-hand side.
`useMulticore` | Logical, should multicore be used. `useMulticore = TRUE` has no effect on non-Unix-like platforms. At the moment, it also has only effects on lists and list-derived classes (data frames but not matrices).
`nrCores` | Number of cores to use when `useMulticore = TRUE` (set to `NULL` to use all detected cores).

### Details

This function does not take directly CAGEr objects as input, because hanabi plots can be made from CTSS, clustered or gene-level data, therefore it is not possible to guess which one to use.

### Value

A list-based object of class "hanabi".

### Author(s)

Charles Plessy

### See Also

`vegan::rarecurve`.

Other CAGEr richness functions: `hanabiPlot`, `plot.hanabi`

### Examples

    h <- hanabi(CTSStagCountDF(exampleCAGEexp))
    h
    plot(h)
    hanabi(CTSStagCountGR(exampleCAGEexp, 2))

[Package CAGEr version 1.32.1 Index]