# Create Batches of Null Permutations for a Crispr Screen

### Description

This is a wrapper function to partition batches of calls to `ct.RRAalpha()`

for multicore processing.
It is called internally as a single instance of the beta aggregation step in RRAa. Users should not interact with it directly.

### Usage

1 2 | ```
ct.RRAalphaBatch(p, g.key, alpha, result.environment, batch.size = 100,
permutation.seed = NULL)
``` |

### Arguments

`p` |
A single column matrix of rank statistics, with row.names indicating the gRNA labels. |

`g.key` |
data.frame with guide and gene names |

`alpha` |
The alpha cutoff parameter, corresponding to the P-value threshold or fold change proportion at which gRNAs should no longer be considered to be
differentially expressed. Alternatively, this can be provided as a logical vector of the same length as the number of rows in |

`result.environment` |
The target environment containing the quasi-global variables incremented during the permutations in the child functions. |

`batch.size` |
Number of iterations to deploy to each daughter process. |

`permutation.seed` |
numeric seed for permutation reproducibility. Default is |

### Value

An integer vector indicating the number of iterations in which each gene's score was better than those indicated in `result.environment$obs`

.

### Author(s)

Russell Bainer

### Examples

1 2 3 4 5 6 7 8 | ```
data('fit')
data('ann')
batch.size <- 50
env <- new.env()
env$obs <- ct.RRAalpha(fit$p.value, ann, alpha = 0.1, return.obj = 'none')
env$ngenes <- length(levels(ann$geneSymbol))
passed <- ct.RRAalphaBatch(fit$p.value, ann, alpha = 0.1, result.environment = env, batch.size = batch.size)
hist(passed/batch.size, main = 'Empirical P-value', xlab = 'P')
``` |