Learn R Programming

negenes (version 1.0-12)

sim.mutants: Simulate data for a random transposon mutagenesis experiment

Description

Simulate data for a random transposon mutagenesis experiment.

Usage

sim.mutants(n.sites, essential, n.sites2 = NULL, n.mutants)

Arguments

n.sites

A vector specifying the number of transposon insertion sites in each gene. All elements must by strictly positive.

essential

A vector containing 1's (indicating that the corresponding gene is essential) and 0's (indicating that the corresponding gene is not essential). Must be the same length as n.sites.

n.sites2

A vector specfying the number of transposon insertion sites shared by adjacent genes. The ith element is the number of insertion sites shared by genes i and i+1. The last element is for sites shared by genes N and 1. If missing, these are assumed to be all 0.

n.mutants

Number of mutants to simulate.

Value

If n.sites2 is missing or contains all 0's, a vector is returned containing the number of mutants observed for each gene.

If n.sites2 is not missing and has some positive entries, a matrix with two columns is returned. The first column contains the number of mutants observed for each gene alone; the second column contains the number of mutants observed shared by adjacent genes.

References

Blades, N. J. and Broman, K. W. (2002) Estimating the number of essential genes in a genome by random transposon mutagenesis. Technical Report MS02-20, Department of Biostatistics, Johns Hopkins University, Baltimore, MD. https://www.biostat.wisc.edu/~kbroman/publications/ms0220.pdf

See Also

negenes::negenes(), negenes::Mtb80()

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
data(Mtb80)

# simulate 44% of genes to be essential
essential <- rep(0,nrow(Mtb80))
essential[sample(1:nrow(Mtb80),ceiling(nrow(Mtb80)*0.44))] <- 1

# simulate 759 mutants
counts <- sim.mutants(Mtb80[,1], essential, Mtb80[,2], 759)

# run the Gibbs sampler
output <- negenes(Mtb80[,1], counts[,1], Mtb80[,2], counts[,2])
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab