# getOffsets: Generate Random or Uniformly Spaced Permutation Offsets In shiftR: Fast Enrichment Analysis via Circular Permutations

## Description

This functions generate offsets for permutation analysis with `shiftrPermBinary`. Random, uniformly spaced, and complete sets are available via `getOffsetsRandom`, `getOffsetsUniform`, and `getOffsetsAll` functions respectively.

The function `getNOffestsMax` calculates the maximum number of permutations (given the margin).

## Usage

 ```1 2 3 4 5``` ```getOffsetsRandom(n, npermute, margin = 0.05) getOffsetsUniform(n, npermute, margin = 0.05) getOffsetsAll(n, margin) getNOffsetsMax(n, margin) ```

## Arguments

 `n` Number of features in the permuted sets. `npermute` The number of offsets to be generated (number of permutations). `margin` Offsets by less than `margin*n` or more than `(1-margin)*n` are not generated.

## Value

Returns a set of permutation offsets for use in `shiftrPermBinary` function.
The set of offsets is

1. random for `getOffsetsRandom`,

2. uniformly spaced for `getOffsetsUniform`, or

3. all possible for `getOffsetsAll`.

The function `getNOffestsMax` returns the maximum number of permutations (given the margin).

## Author(s)

Andrey A Shabalin andrey.shabalin@gmail.com

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17``` ```### Number of features, permutations, and margin n = 100 npermute = 20 margin = 0.1 ### Maximum number of permutations # Should be 81 (from 10 to 90) getNOffsetsMax(n, margin) ### Random offsets getOffsetsRandom(n, npermute, margin) ### Uniformly spaced offsets getOffsetsUniform(n, npermute, margin) ### All possible offsets getOffsetsAll(n, margin) ```

shiftR documentation built on May 2, 2019, 3:41 a.m.