rarefaction: Diversity evaluation using rarefaction.
Description
Sequentially resample the given data with growing sample size the given data and compute mean number of unique clones.
For more details on the procedure see "Details".Usage
rarefaction(.data, .step = 30000, .quantile = c(0.025, 0.975),
.extrapolation = 2e+05, .col = "Barcode.count", .verbose = T)
Arguments
.data
Data frame or a list with data frames.
.quantile
Numeric vector of length 2 with quantiles for confidence intervals.
.extrapolation
If N > 0 than perform extrapolation of all samples to the size of the max one +N reads or barcodes.
.col
Column's name from which choose frequency of each clone.
.verbose
If T than print progress bar.
Value
- Data frame with first column for sizes, second columns for the first quantile,
third column for the mean, fourth columns for the second quantile, fifth columns
for the name of subject.
Details
This subroutine is designed for diversity evaluation of repertoires. On each step it computes a
mean unique clones from sample of fixed size using bootstrapping. Unique clones for each sample from bootstrap computed
as a number of non-zero elements in a vector from multinomial distribution with input vector of probabilities from the .col
column
using function rmultinom
with parameters n = .n, size = i * .step, prob = .data[, .col] (i is an index of current iteration)
and choosing for lower and upper bound quantile
bounds of the computed distribution of unique clones.Examples
Run this coderarefaction(immdata, .col = "Read.count")
Run the code above in your browser using DataLab